98 int offset_y,
int offset_x,
105 #define OFFSET(x) offsetof(WaveformContext, x)
106 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
318 else if (rgb && depth == 8 && ncomp > 2)
320 else if (rgb && depth == 9 && ncomp > 2)
322 else if (rgb && depth == 10 && ncomp > 2)
324 else if (rgb && depth == 12 && ncomp > 2)
326 else if (depth == 8 && ncomp > 2)
328 else if (depth == 9 && ncomp > 2)
330 else if (depth == 10 && ncomp > 2)
332 else if (depth == 12 && ncomp > 2)
344 const int dst_linesize = out->
linesize[component] / 2;
345 const int bg = s->
bg_color[component] * (s->
max / 256);
346 const int limit = s->
max - 1;
355 for (x = offset; x < offset + dst_w; x++) {
356 for (y = start; y <
end; y++) {
357 dst = (uint16_t *)out->
data[component] + y * dst_linesize + x;
363 for (y = end - 1; y >=
start; y--) {
364 dst = (uint16_t *)out->
data[component] + y * dst_linesize + x;
372 for (y = offset; y < offset + dst_h; y++) {
373 dst = (uint16_t *)out->
data[component] + y * dst_linesize;
374 for (x = start; x <
end; x++) {
380 for (x = end - 1; x >=
start; x--) {
392 const int dst_linesize = out->
linesize[component];
402 for (x = offset; x < offset + dst_w; x++) {
403 for (y = start; y <
end; y++) {
404 dst = out->
data[component] + y * dst_linesize + x;
410 for (y = end - 1; y >=
start; y--) {
411 dst = out->
data[component] + y * dst_linesize + x;
419 for (y = offset; y < offset + dst_h; y++) {
420 dst = out->
data[component] + y * dst_linesize;
421 for (x = start; x <
end; x++) {
427 for (x = end - 1; x >=
start; x--) {
439 const int dst_linesize = out->
linesize[component] / 2;
440 const int bg = s->
bg_color[component] * (s->
max / 256);
441 const int limit = s->
max - 1;
452 for (x = offset; x < offset + dst_w; x++) {
453 for (y = start; y < end && y < emin[x -
offset]; y++) {
454 dst = (uint16_t *)out->
data[component] + y * dst_linesize + x;
460 for (y = end - 1; y >= start && y >= emax[x -
offset]; y--) {
461 dst = (uint16_t *)out->
data[component] + y * dst_linesize + x;
472 for (x = offset; x < offset + dst_w; x++) {
473 dst = (uint16_t *)out->
data[component] + emin[x - offset] * dst_linesize + x;
475 dst = (uint16_t *)out->
data[component] + emax[x -
offset] * dst_linesize + x;
479 for (y = offset; y < offset + dst_h; y++) {
480 dst = (uint16_t *)out->
data[component] + y * dst_linesize;
481 for (x = start; x < end && x < emin[y -
offset]; x++) {
487 for (x = end - 1; x >= start && x >= emax[y -
offset]; x--) {
498 for (y = offset; y < offset + dst_h; y++) {
499 dst = (uint16_t *)out->
data[component] + y * dst_linesize + emin[y - offset];
501 dst = (uint16_t *)out->
data[component] + y * dst_linesize + emax[y -
offset];
509 const int dst_linesize = out->
linesize[component];
510 const int bg = s->
bg_color[component];
521 for (x = offset; x < offset + dst_w; x++) {
522 for (y = start; y < end && y < emin[x -
offset]; y++) {
523 dst = out->
data[component] + y * dst_linesize + x;
529 for (y = end - 1; y >= start && y >= emax[x -
offset]; y--) {
530 dst = out->
data[component] + y * dst_linesize + x;
541 for (x = offset; x < offset + dst_w; x++) {
542 dst = out->
data[component] + emin[x -
offset] * dst_linesize + x;
544 dst = out->
data[component] + emax[x -
offset] * dst_linesize + x;
548 for (y = offset; y < offset + dst_h; y++) {
549 dst = out->
data[component] + y * dst_linesize;
550 for (x = start; x < end && x < emin[y -
offset]; x++) {
556 for (x = end - 1; x >= start && x >= emax[y -
offset]; x--) {
567 for (y = offset; y < offset + dst_h; y++) {
568 dst = out->
data[component] + y * dst_linesize + emin[y -
offset];
570 dst = out->
data[component] + y * dst_linesize + emax[y -
offset];
617 int offset_y,
int offset_x,
625 const int dst_signed_linesize = dst_linesize * (mirror == 1 ? -1 : 1);
626 const int limit = s->
max - 1;
630 const uint16_t *src_data = (
const uint16_t *)in->
data[plane];
631 uint16_t *dst_data = (uint16_t *)out->
data[
plane] + offset_y * dst_linesize + offset_x;
632 uint16_t *
const dst_bottom_line = dst_data + dst_linesize * (s->
size - 1);
633 uint16_t *
const dst_line = (mirror ? dst_bottom_line : dst_data);
634 const int step = column ? 1 << shift_w : 1 <<
shift_h;
638 if (!column && mirror)
641 for (y = 0; y < src_h; y++) {
642 const uint16_t *src_data_end = src_data + src_w;
643 uint16_t *dst = dst_line;
645 for (p = src_data; p < src_data_end; p++) {
647 int i = 0, v =
FFMIN(*p, limit);
651 target = dst++ + dst_signed_linesize * v;
652 update16(target, max, intensity, limit);
653 }
while (++i < step);
655 uint16_t *row = dst_data;
658 target = row - v - 1;
661 update16(target, max, intensity, limit);
663 }
while (++i < step);
666 src_data += src_linesize;
667 dst_data += dst_linesize * step;
670 envelope16(s, out, plane, plane, column ? offset_x : offset_y);
673 #define LOWPASS16_FUNC(name, column, mirror) \
674 static void lowpass16_##name(WaveformContext *s, \
675 AVFrame *in, AVFrame *out, \
676 int component, int intensity, \
677 int offset_y, int offset_x, \
678 int unused1, int unused2) \
680 lowpass16(s, in, out, component, intensity, \
681 offset_y, offset_x, column, mirror); \
692 int offset_y,
int offset_x,
695 const int plane = s->desc->comp[component].plane;
696 const int shift_w = s->shift_w[component];
697 const int shift_h = s->shift_h[component];
698 const int src_linesize = in->linesize[
plane];
699 const int dst_linesize = out->linesize[
plane];
700 const int dst_signed_linesize = dst_linesize * (mirror == 1 ? -1 : 1);
705 uint8_t *dst_data = out->data[
plane] + offset_y * dst_linesize + offset_x;
706 uint8_t *
const dst_bottom_line = dst_data + dst_linesize * (s->size - 1);
707 uint8_t *
const dst_line = (mirror ? dst_bottom_line : dst_data);
708 const int step = column ? 1 << shift_w : 1 <<
shift_h;
712 if (!column && mirror)
715 for (y = 0; y < src_h; y++) {
716 const uint8_t *src_data_end = src_data + src_w;
719 for (p = src_data; p < src_data_end; p++) {
722 target = dst + dst_signed_linesize * *p;
724 update(target, max, intensity);
728 target = row - *p - 1;
731 update(target, max, intensity);
735 src_data += src_linesize;
736 dst_data += dst_linesize * step;
739 if (column && step > 1) {
740 const int dst_w = s->display ==
PARADE ? out->width / s->acomp : out->width;
741 const int dst_h = 256;
745 dst = out->data[
plane] + offset_y * dst_linesize + offset_x;
746 for (y = 0; y < dst_h; y++) {
747 for (x = 0; x < dst_w; x+=step) {
748 for (z = 1; z < step; z++) {
754 }
else if (step > 1) {
755 const int dst_h = s->display ==
PARADE ? out->height / s->acomp : out->height;
756 const int dst_w = 256;
760 dst = out->data[
plane] + offset_y * dst_linesize + offset_x;
761 for (y = 0; y < dst_h; y+=step) {
762 for (z = 1; z < step; z++)
763 memcpy(dst + dst_linesize * z, dst, dst_w);
764 dst += dst_linesize * step;
768 envelope(s, out, plane, plane, column ? offset_x : offset_y);
771 #define LOWPASS_FUNC(name, column, mirror) \
772 static void lowpass_##name(WaveformContext *s, \
773 AVFrame *in, AVFrame *out, \
774 int component, int intensity, \
775 int offset_y, int offset_x, \
776 int unused1, int unused2) \
778 lowpass(s, in, out, component, intensity, \
779 offset_y, offset_x, column, mirror); \
790 int offset_y,
int offset_x,
793 const int plane = s->desc->comp[component].plane;
794 const int c0_linesize = in->linesize[ plane + 0 ] / 2;
795 const int c1_linesize = in->linesize[(plane + 1) % s->ncomp] / 2;
796 const int c2_linesize = in->linesize[(plane + 2) % s->ncomp] / 2;
797 const int c0_shift_w = s->shift_w[ component + 0 ];
798 const int c1_shift_w = s->shift_w[(component + 1) % s->ncomp];
799 const int c2_shift_w = s->shift_w[(component + 2) % s->ncomp];
800 const int c0_shift_h = s->shift_h[ component + 0 ];
801 const int c1_shift_h = s->shift_h[(component + 1) % s->ncomp];
802 const int c2_shift_h = s->shift_h[(component + 2) % s->ncomp];
803 const int d0_linesize = out->linesize[ plane + 0 ] / 2;
804 const int d1_linesize = out->linesize[(plane + 1) % s->ncomp] / 2;
805 const int limit = s->max - 1;
806 const int max = limit - intensity;
807 const int mid = s->max / 2;
808 const int src_h = in->height;
809 const int src_w = in->width;
813 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1);
814 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1);
816 for (x = 0; x < src_w; x++) {
817 const uint16_t *c0_data = (uint16_t *)in->data[plane + 0];
818 const uint16_t *c1_data = (uint16_t *)in->data[(plane + 1) % s->ncomp];
819 const uint16_t *c2_data = (uint16_t *)in->data[(plane + 2) % s->ncomp];
820 uint16_t *d0_data = (uint16_t *)(out->data[
plane]) + offset_y * d0_linesize + offset_x;
821 uint16_t *d1_data = (uint16_t *)(out->data[(plane + 1) % s->ncomp]) + offset_y * d1_linesize + offset_x;
822 uint16_t *
const d0_bottom_line = d0_data + d0_linesize * (s->size - 1);
823 uint16_t *
const d0 = (mirror ? d0_bottom_line : d0_data);
824 uint16_t *
const d1_bottom_line = d1_data + d1_linesize * (s->size - 1);
825 uint16_t *
const d1 = (mirror ? d1_bottom_line : d1_data);
827 for (y = 0; y < src_h; y++) {
828 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit) + s->max;
829 const int c1 =
FFMIN(
FFABS(c1_data[x >> c1_shift_w] - mid) +
FFABS(c2_data[x >> c2_shift_w] - mid), limit);
832 target = d0 + x + d0_signed_linesize * c0;
834 target = d1 + x + d1_signed_linesize * (c0 -
c1);
836 target = d1 + x + d1_signed_linesize * (c0 +
c1);
839 if (!c0_shift_h || (y & c0_shift_h))
840 c0_data += c0_linesize;
841 if (!c1_shift_h || (y & c1_shift_h))
842 c1_data += c1_linesize;
843 if (!c2_shift_h || (y & c2_shift_h))
844 c2_data += c2_linesize;
845 d0_data += d0_linesize;
846 d1_data += d1_linesize;
850 const uint16_t *c0_data = (uint16_t *)in->data[plane];
851 const uint16_t *c1_data = (uint16_t *)in->data[(plane + 1) % s->ncomp];
852 const uint16_t *c2_data = (uint16_t *)in->data[(plane + 2) % s->ncomp];
853 uint16_t *d0_data = (uint16_t *)(out->data[
plane]) + offset_y * d0_linesize + offset_x;
854 uint16_t *d1_data = (uint16_t *)(out->data[(plane + 1) % s->ncomp]) + offset_y * d1_linesize + offset_x;
857 d0_data += s->size - 1;
858 d1_data += s->size - 1;
861 for (y = 0; y < src_h; y++) {
862 for (x = 0; x < src_w; x++) {
863 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit) + s->max;
864 const int c1 =
FFMIN(
FFABS(c1_data[x >> c1_shift_w] - mid) +
FFABS(c2_data[x >> c2_shift_w] - mid), limit);
868 target = d0_data - c0;
870 target = d1_data - (c0 -
c1);
872 target = d1_data - (c0 +
c1);
875 target = d0_data + c0;
877 target = d1_data + (c0 -
c1);
879 target = d1_data + (c0 +
c1);
884 if (!c0_shift_h || (y & c0_shift_h))
885 c0_data += c0_linesize;
886 if (!c1_shift_h || (y & c1_shift_h))
887 c1_data += c1_linesize;
888 if (!c2_shift_h || (y & c2_shift_h))
889 c2_data += c2_linesize;
890 d0_data += d0_linesize;
891 d1_data += d1_linesize;
895 envelope16(s, out, plane, plane, column ? offset_x : offset_y);
896 envelope16(s, out, plane, (plane + 1) % s->ncomp, column ? offset_x : offset_y);
902 int offset_y,
int offset_x,
906 const int c0_linesize = in->
linesize[ plane + 0 ];
907 const int c1_linesize = in->
linesize[(plane + 1) % s->
ncomp];
908 const int c2_linesize = in->
linesize[(plane + 2) % s->
ncomp];
909 const int c0_shift_w = s->
shift_w[ component + 0 ];
910 const int c1_shift_w = s->
shift_w[(component + 1) % s->
ncomp];
911 const int c2_shift_w = s->
shift_w[(component + 2) % s->
ncomp];
912 const int c0_shift_h = s->
shift_h[ component + 0 ];
913 const int c1_shift_h = s->
shift_h[(component + 1) % s->
ncomp];
914 const int c2_shift_h = s->
shift_h[(component + 2) % s->
ncomp];
915 const int d0_linesize = out->
linesize[ plane + 0 ];
916 const int d1_linesize = out->
linesize[(plane + 1) % s->
ncomp];
917 const int max = 255 - intensity;
918 const int src_h = in->
height;
919 const int src_w = in->
width;
923 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1);
924 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1);
926 for (x = 0; x < src_w; x++) {
931 uint8_t *d1_data = out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
932 uint8_t *
const d0_bottom_line = d0_data + d0_linesize * (s->
size - 1);
933 uint8_t *
const d0 = (mirror ? d0_bottom_line : d0_data);
934 uint8_t *
const d1_bottom_line = d1_data + d1_linesize * (s->
size - 1);
935 uint8_t *
const d1 = (mirror ? d1_bottom_line : d1_data);
937 for (y = 0; y < src_h; y++) {
938 const int c0 = c0_data[x >> c0_shift_w] + 256;
939 const int c1 =
FFABS(c1_data[x >> c1_shift_w] - 128) +
FFABS(c2_data[x >> c2_shift_w] - 128);
942 target = d0 + x + d0_signed_linesize * c0;
944 target = d1 + x + d1_signed_linesize * (c0 -
c1);
946 target = d1 + x + d1_signed_linesize * (c0 +
c1);
949 if (!c0_shift_h || (y & c0_shift_h))
950 c0_data += c0_linesize;
951 if (!c1_shift_h || (y & c1_shift_h))
952 c1_data += c1_linesize;
953 if (!c2_shift_h || (y & c2_shift_h))
954 c2_data += c2_linesize;
955 d0_data += d0_linesize;
956 d1_data += d1_linesize;
964 uint8_t *d1_data = out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
967 d0_data += s->
size - 1;
968 d1_data += s->
size - 1;
971 for (y = 0; y < src_h; y++) {
972 for (x = 0; x < src_w; x++) {
973 int c0 = c0_data[x >> c0_shift_w] + 256;
974 const int c1 =
FFABS(c1_data[x >> c1_shift_w] - 128) +
FFABS(c2_data[x >> c2_shift_w] - 128);
978 target = d0_data - c0;
980 target = d1_data - (c0 -
c1);
982 target = d1_data - (c0 +
c1);
985 target = d0_data + c0;
987 target = d1_data + (c0 -
c1);
989 target = d1_data + (c0 +
c1);
994 if (!c0_shift_h || (y & c0_shift_h))
995 c0_data += c0_linesize;
996 if (!c1_shift_h || (y & c1_shift_h))
997 c1_data += c1_linesize;
998 if (!c2_shift_h || (y & c2_shift_h))
999 c2_data += c2_linesize;
1000 d0_data += d0_linesize;
1001 d1_data += d1_linesize;
1005 envelope(s, out, plane, plane, column ? offset_x : offset_y);
1006 envelope(s, out, plane, (plane + 1) % s->
ncomp, column ? offset_x : offset_y);
1012 int offset_y,
int offset_x,
1016 const int c0_linesize = in->
linesize[ plane + 0 ] / 2;
1017 const int c1_linesize = in->
linesize[(plane + 1) % s->
ncomp] / 2;
1018 const int c2_linesize = in->
linesize[(plane + 2) % s->
ncomp] / 2;
1019 const int c0_shift_w = s->
shift_w[ component + 0 ];
1020 const int c1_shift_w = s->
shift_w[(component + 1) % s->
ncomp];
1021 const int c2_shift_w = s->
shift_w[(component + 2) % s->
ncomp];
1022 const int c0_shift_h = s->
shift_h[ component + 0 ];
1023 const int c1_shift_h = s->
shift_h[(component + 1) % s->
ncomp];
1024 const int c2_shift_h = s->
shift_h[(component + 2) % s->
ncomp];
1025 const int d0_linesize = out->
linesize[ plane + 0 ] / 2;
1026 const int d1_linesize = out->
linesize[(plane + 1) % s->
ncomp] / 2;
1027 const int d2_linesize = out->
linesize[(plane + 2) % s->
ncomp] / 2;
1028 const int limit = s->
max - 1;
1030 const int mid = s->
max / 2;
1031 const int src_h = in->
height;
1032 const int src_w = in->
width;
1036 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1);
1037 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1);
1038 const int d2_signed_linesize = d2_linesize * (mirror == 1 ? -1 : 1);
1040 for (x = 0; x < src_w; x++) {
1041 const uint16_t *c0_data = (uint16_t *)in->
data[plane + 0];
1042 const uint16_t *c1_data = (uint16_t *)in->
data[(plane + 1) % s->
ncomp];
1043 const uint16_t *c2_data = (uint16_t *)in->
data[(plane + 2) % s->
ncomp];
1044 uint16_t *d0_data = (uint16_t *)out->
data[
plane] + offset_y * d0_linesize + offset_x;
1045 uint16_t *d1_data = (uint16_t *)out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
1046 uint16_t *d2_data = (uint16_t *)out->
data[(plane + 2) % s->
ncomp] + offset_y * d2_linesize + offset_x;
1047 uint16_t *
const d0_bottom_line = d0_data + d0_linesize * (s->
size - 1);
1048 uint16_t *
const d0 = (mirror ? d0_bottom_line : d0_data);
1049 uint16_t *
const d1_bottom_line = d1_data + d1_linesize * (s->
size - 1);
1050 uint16_t *
const d1 = (mirror ? d1_bottom_line : d1_data);
1051 uint16_t *
const d2_bottom_line = d2_data + d2_linesize * (s->
size - 1);
1052 uint16_t *
const d2 = (mirror ? d2_bottom_line : d2_data);
1054 for (y = 0; y < src_h; y++) {
1055 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit) + mid;
1056 const int c1 =
FFMIN(c1_data[x >> c1_shift_w], limit) - mid;
1057 const int c2 =
FFMIN(c2_data[x >> c2_shift_w], limit) - mid;
1060 target = d0 + x + d0_signed_linesize * c0;
1061 update16(target, max, intensity, limit);
1063 target = d1 + x + d1_signed_linesize * (c0 +
c1);
1064 update16(target, max, intensity, limit);
1066 target = d2 + x + d2_signed_linesize * (c0 +
c2);
1067 update16(target, max, intensity, limit);
1069 if (!c0_shift_h || (y & c0_shift_h))
1070 c0_data += c0_linesize;
1071 if (!c1_shift_h || (y & c1_shift_h))
1072 c1_data += c1_linesize;
1073 if (!c2_shift_h || (y & c2_shift_h))
1074 c2_data += c2_linesize;
1075 d0_data += d0_linesize;
1076 d1_data += d1_linesize;
1077 d2_data += d2_linesize;
1081 const uint16_t *c0_data = (uint16_t *)in->
data[plane];
1082 const uint16_t *c1_data = (uint16_t *)in->
data[(plane + 1) % s->
ncomp];
1083 const uint16_t *c2_data = (uint16_t *)in->
data[(plane + 2) % s->
ncomp];
1084 uint16_t *d0_data = (uint16_t *)out->
data[
plane] + offset_y * d0_linesize + offset_x;
1085 uint16_t *d1_data = (uint16_t *)out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
1086 uint16_t *d2_data = (uint16_t *)out->
data[(plane + 2) % s->
ncomp] + offset_y * d2_linesize + offset_x;
1089 d0_data += s->
size - 1;
1090 d1_data += s->
size - 1;
1091 d2_data += s->
size - 1;
1094 for (y = 0; y < src_h; y++) {
1095 for (x = 0; x < src_w; x++) {
1096 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit) + mid;
1097 const int c1 =
FFMIN(c1_data[x >> c1_shift_w], limit) - mid;
1098 const int c2 =
FFMIN(c2_data[x >> c2_shift_w], limit) - mid;
1102 target = d0_data - c0;
1103 update16(target, max, intensity, limit);
1104 target = d1_data - (c0 +
c1);
1105 update16(target, max, intensity, limit);
1106 target = d2_data - (c0 +
c2);
1107 update16(target, max, intensity, limit);
1109 target = d0_data + c0;
1110 update16(target, max, intensity, limit);
1111 target = d1_data + (c0 +
c1);
1112 update16(target, max, intensity, limit);
1113 target = d2_data + (c0 +
c2);
1114 update16(target, max, intensity, limit);
1118 if (!c0_shift_h || (y & c0_shift_h))
1119 c0_data += c0_linesize;
1120 if (!c1_shift_h || (y & c1_shift_h))
1121 c1_data += c1_linesize;
1122 if (!c2_shift_h || (y & c2_shift_h))
1123 c2_data += c2_linesize;
1124 d0_data += d0_linesize;
1125 d1_data += d1_linesize;
1126 d2_data += d2_linesize;
1130 envelope16(s, out, plane, (plane + 0) % s->
ncomp, column ? offset_x : offset_y);
1131 envelope16(s, out, plane, (plane + 1) % s->
ncomp, column ? offset_x : offset_y);
1132 envelope16(s, out, plane, (plane + 2) % s->
ncomp, column ? offset_x : offset_y);
1138 int offset_y,
int offset_x,
1142 const int c0_linesize = in->
linesize[ plane + 0 ];
1143 const int c1_linesize = in->
linesize[(plane + 1) % s->
ncomp];
1144 const int c2_linesize = in->
linesize[(plane + 2) % s->
ncomp];
1145 const int c0_shift_w = s->
shift_w[ component + 0 ];
1146 const int c1_shift_w = s->
shift_w[(component + 1) % s->
ncomp];
1147 const int c2_shift_w = s->
shift_w[(component + 2) % s->
ncomp];
1148 const int c0_shift_h = s->
shift_h[ component + 0 ];
1149 const int c1_shift_h = s->
shift_h[(component + 1) % s->
ncomp];
1150 const int c2_shift_h = s->
shift_h[(component + 2) % s->
ncomp];
1151 const int d0_linesize = out->
linesize[ plane + 0 ];
1152 const int d1_linesize = out->
linesize[(plane + 1) % s->
ncomp];
1153 const int d2_linesize = out->
linesize[(plane + 2) % s->
ncomp];
1155 const int src_h = in->
height;
1156 const int src_w = in->
width;
1160 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1);
1161 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1);
1162 const int d2_signed_linesize = d2_linesize * (mirror == 1 ? -1 : 1);
1164 for (x = 0; x < src_w; x++) {
1169 uint8_t *d1_data = out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
1170 uint8_t *d2_data = out->
data[(plane + 2) % s->
ncomp] + offset_y * d2_linesize + offset_x;
1171 uint8_t *
const d0_bottom_line = d0_data + d0_linesize * (s->
size - 1);
1172 uint8_t *
const d0 = (mirror ? d0_bottom_line : d0_data);
1173 uint8_t *
const d1_bottom_line = d1_data + d1_linesize * (s->
size - 1);
1174 uint8_t *
const d1 = (mirror ? d1_bottom_line : d1_data);
1175 uint8_t *
const d2_bottom_line = d2_data + d2_linesize * (s->
size - 1);
1176 uint8_t *
const d2 = (mirror ? d2_bottom_line : d2_data);
1178 for (y = 0; y < src_h; y++) {
1179 const int c0 = c0_data[x >> c0_shift_w] + 128;
1180 const int c1 = c1_data[x >> c1_shift_w] - 128;
1181 const int c2 = c2_data[x >> c2_shift_w] - 128;
1184 target = d0 + x + d0_signed_linesize * c0;
1185 update(target, max, intensity);
1187 target = d1 + x + d1_signed_linesize * (c0 +
c1);
1188 update(target, max, intensity);
1190 target = d2 + x + d2_signed_linesize * (c0 +
c2);
1191 update(target, max, intensity);
1193 if (!c0_shift_h || (y & c0_shift_h))
1194 c0_data += c0_linesize;
1195 if (!c1_shift_h || (y & c1_shift_h))
1196 c1_data += c1_linesize;
1197 if (!c1_shift_h || (y & c1_shift_h))
1198 c2_data += c1_linesize;
1199 d0_data += d0_linesize;
1200 d1_data += d1_linesize;
1201 d2_data += d2_linesize;
1209 uint8_t *d1_data = out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
1210 uint8_t *d2_data = out->
data[(plane + 2) % s->
ncomp] + offset_y * d2_linesize + offset_x;
1213 d0_data += s->
size - 1;
1214 d1_data += s->
size - 1;
1215 d2_data += s->
size - 1;
1218 for (y = 0; y < src_h; y++) {
1219 for (x = 0; x < src_w; x++) {
1220 const int c0 = c0_data[x >> c0_shift_w] + 128;
1221 const int c1 = c1_data[x >> c1_shift_w] - 128;
1222 const int c2 = c2_data[x >> c2_shift_w] - 128;
1226 target = d0_data - c0;
1227 update(target, max, intensity);
1228 target = d1_data - (c0 +
c1);
1229 update(target, max, intensity);
1230 target = d2_data - (c0 +
c2);
1231 update(target, max, intensity);
1233 target = d0_data + c0;
1234 update(target, max, intensity);
1235 target = d1_data + (c0 +
c1);
1236 update(target, max, intensity);
1237 target = d2_data + (c0 +
c2);
1238 update(target, max, intensity);
1242 if (!c0_shift_h || (y & c0_shift_h))
1243 c0_data += c0_linesize;
1244 if (!c1_shift_h || (y & c1_shift_h))
1245 c1_data += c1_linesize;
1246 if (!c2_shift_h || (y & c2_shift_h))
1247 c2_data += c2_linesize;
1248 d0_data += d0_linesize;
1249 d1_data += d1_linesize;
1250 d2_data += d2_linesize;
1254 envelope(s, out, plane, (plane + 0) % s->
ncomp, column ? offset_x : offset_y);
1255 envelope(s, out, plane, (plane + 1) % s->
ncomp, column ? offset_x : offset_y);
1256 envelope(s, out, plane, (plane + 2) % s->
ncomp, column ? offset_x : offset_y);
1262 int offset_y,
int offset_x,
1266 const int c0_linesize = in->
linesize[(plane + 1) % s->
ncomp] / 2;
1267 const int c1_linesize = in->
linesize[(plane + 2) % s->
ncomp] / 2;
1269 const int limit = s->
max - 1;
1271 const int mid = s->
max / 2;
1272 const int c0_shift_w = s->
shift_w[(component + 1) % s->
ncomp];
1273 const int c1_shift_w = s->
shift_w[(component + 2) % s->
ncomp];
1274 const int c0_shift_h = s->
shift_h[(component + 1) % s->
ncomp];
1275 const int c1_shift_h = s->
shift_h[(component + 2) % s->
ncomp];
1276 const int src_h = in->
height;
1277 const int src_w = in->
width;
1281 const int dst_signed_linesize = dst_linesize * (mirror == 1 ? -1 : 1);
1283 for (x = 0; x < src_w; x++) {
1284 const uint16_t *c0_data = (uint16_t *)in->
data[(plane + 1) % s->
ncomp];
1285 const uint16_t *c1_data = (uint16_t *)in->
data[(plane + 2) % s->
ncomp];
1286 uint16_t *dst_data = (uint16_t *)out->
data[plane] + offset_y * dst_linesize + offset_x;
1287 uint16_t *
const dst_bottom_line = dst_data + dst_linesize * (s->
size - 1);
1288 uint16_t *
const dst_line = (mirror ? dst_bottom_line : dst_data);
1289 uint16_t *dst = dst_line;
1291 for (y = 0; y < src_h; y++) {
1292 const int sum =
FFMIN(
FFABS(c0_data[x >> c0_shift_w] - mid) +
FFABS(c1_data[x >> c1_shift_w] - mid - 1), limit);
1295 target = dst + x + dst_signed_linesize * sum;
1296 update16(target, max, intensity, limit);
1298 if (!c0_shift_h || (y & c0_shift_h))
1299 c0_data += c0_linesize;
1300 if (!c1_shift_h || (y & c1_shift_h))
1301 c1_data += c1_linesize;
1302 dst_data += dst_linesize;
1306 const uint16_t *c0_data = (uint16_t *)in->
data[(plane + 1) % s->
ncomp];
1307 const uint16_t *c1_data = (uint16_t *)in->
data[(plane + 2) % s->
ncomp];
1308 uint16_t *dst_data = (uint16_t *)out->
data[plane] + offset_y * dst_linesize + offset_x;
1311 dst_data += s->
size - 1;
1312 for (y = 0; y < src_h; y++) {
1313 for (x = 0; x < src_w; x++) {
1314 const int sum =
FFMIN(
FFABS(c0_data[x >> c0_shift_w] - mid) +
FFABS(c1_data[x >> c1_shift_w] - mid - 1), limit);
1318 target = dst_data - sum;
1319 update16(target, max, intensity, limit);
1321 target = dst_data + sum;
1322 update16(target, max, intensity, limit);
1326 if (!c0_shift_h || (y & c0_shift_h))
1327 c0_data += c0_linesize;
1328 if (!c1_shift_h || (y & c1_shift_h))
1329 c1_data += c1_linesize;
1330 dst_data += dst_linesize;
1334 envelope16(s, out, plane, plane, column ? offset_x : offset_y);
1340 int offset_y,
int offset_x,
1344 const int c0_linesize = in->
linesize[(plane + 1) % s->
ncomp];
1345 const int c1_linesize = in->
linesize[(plane + 2) % s->
ncomp];
1348 const int c0_shift_w = s->
shift_w[(component + 1) % s->
ncomp];
1349 const int c1_shift_w = s->
shift_w[(component + 2) % s->
ncomp];
1350 const int c0_shift_h = s->
shift_h[(component + 1) % s->
ncomp];
1351 const int c1_shift_h = s->
shift_h[(component + 2) % s->
ncomp];
1352 const int src_h = in->
height;
1353 const int src_w = in->
width;
1357 const int dst_signed_linesize = dst_linesize * (mirror == 1 ? -1 : 1);
1359 for (x = 0; x < src_w; x++) {
1363 uint8_t *
const dst_bottom_line = dst_data + dst_linesize * (s->
size - 1);
1364 uint8_t *
const dst_line = (mirror ? dst_bottom_line : dst_data);
1367 for (y = 0; y < src_h; y++) {
1368 const int sum =
FFABS(c0_data[x >> c0_shift_w] - 128) +
FFABS(c1_data[x >> c1_shift_w] - 127);
1371 target = dst + x + dst_signed_linesize * sum;
1372 update(target, max, intensity);
1374 if (!c0_shift_h || (y & c0_shift_h))
1375 c0_data += c0_linesize;
1376 if (!c1_shift_h || (y & c1_shift_h))
1377 c1_data += c1_linesize;
1378 dst_data += dst_linesize;
1387 dst_data += s->
size - 1;
1388 for (y = 0; y < src_h; y++) {
1389 for (x = 0; x < src_w; x++) {
1390 const int sum =
FFABS(c0_data[x >> c0_shift_w] - 128) +
FFABS(c1_data[x >> c1_shift_w] - 127);
1394 target = dst_data - sum;
1395 update(target, max, intensity);
1397 target = dst_data + sum;
1398 update(target, max, intensity);
1402 if (!c0_shift_h || (y & c0_shift_h))
1403 c0_data += c0_linesize;
1404 if (!c1_shift_h || (y & c1_shift_h))
1405 c1_data += c1_linesize;
1406 dst_data += dst_linesize;
1410 envelope(s, out, plane, plane, column ? offset_x : offset_y);
1416 int offset_y,
int offset_x,
1420 const int limit = s->
max - 1;
1421 const uint16_t *c0_data = (
const uint16_t *)in->
data[plane + 0];
1422 const uint16_t *c1_data = (
const uint16_t *)in->
data[(plane + 1) % s->
ncomp];
1423 const uint16_t *c2_data = (
const uint16_t *)in->
data[(plane + 2) % s->
ncomp];
1424 const int c0_linesize = in->
linesize[ plane + 0 ] / 2;
1425 const int c1_linesize = in->
linesize[(plane + 1) % s->
ncomp] / 2;
1426 const int c2_linesize = in->
linesize[(plane + 2) % s->
ncomp] / 2;
1427 const int d0_linesize = out->
linesize[ plane + 0 ] / 2;
1428 const int d1_linesize = out->
linesize[(plane + 1) % s->
ncomp] / 2;
1429 const int d2_linesize = out->
linesize[(plane + 2) % s->
ncomp] / 2;
1430 const int c0_shift_w = s->
shift_w[ component + 0 ];
1431 const int c1_shift_w = s->
shift_w[(component + 1) % s->
ncomp];
1432 const int c2_shift_w = s->
shift_w[(component + 2) % s->
ncomp];
1433 const int c0_shift_h = s->
shift_h[ component + 0 ];
1434 const int c1_shift_h = s->
shift_h[(component + 1) % s->
ncomp];
1435 const int c2_shift_h = s->
shift_h[(component + 2) % s->
ncomp];
1436 const int src_h = in->
height;
1437 const int src_w = in->
width;
1441 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1);
1442 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1);
1443 const int d2_signed_linesize = d2_linesize * (mirror == 1 ? -1 : 1);
1444 uint16_t *d0_data = (uint16_t *)out->
data[plane] + offset_y * d0_linesize + offset_x;
1445 uint16_t *d1_data = (uint16_t *)out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
1446 uint16_t *d2_data = (uint16_t *)out->
data[(plane + 2) % s->
ncomp] + offset_y * d2_linesize + offset_x;
1447 uint16_t *
const d0_bottom_line = d0_data + d0_linesize * (s->
size - 1);
1448 uint16_t *
const d0 = (mirror ? d0_bottom_line : d0_data);
1449 uint16_t *
const d1_bottom_line = d1_data + d1_linesize * (s->
size - 1);
1450 uint16_t *
const d1 = (mirror ? d1_bottom_line : d1_data);
1451 uint16_t *
const d2_bottom_line = d2_data + d2_linesize * (s->
size - 1);
1452 uint16_t *
const d2 = (mirror ? d2_bottom_line : d2_data);
1454 for (y = 0; y < src_h; y++) {
1455 for (x = 0; x < src_w; x++) {
1456 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit);
1457 const int c1 = c1_data[x >> c1_shift_w];
1458 const int c2 = c2_data[x >> c2_shift_w];
1460 *(d0 + d0_signed_linesize * c0 + x) = c0;
1461 *(d1 + d1_signed_linesize * c0 + x) = c1;
1462 *(d2 + d2_signed_linesize * c0 + x) = c2;
1465 if (!c0_shift_h || (y & c0_shift_h))
1466 c0_data += c0_linesize;
1467 if (!c1_shift_h || (y & c1_shift_h))
1468 c1_data += c1_linesize;
1469 if (!c2_shift_h || (y & c2_shift_h))
1470 c2_data += c2_linesize;
1471 d0_data += d0_linesize;
1472 d1_data += d1_linesize;
1473 d2_data += d2_linesize;
1476 uint16_t *d0_data = (uint16_t *)out->
data[plane] + offset_y * d0_linesize + offset_x;
1477 uint16_t *d1_data = (uint16_t *)out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
1478 uint16_t *d2_data = (uint16_t *)out->
data[(plane + 2) % s->
ncomp] + offset_y * d2_linesize + offset_x;
1481 d0_data += s->
size - 1;
1482 d1_data += s->
size - 1;
1483 d2_data += s->
size - 1;
1486 for (y = 0; y < src_h; y++) {
1487 for (x = 0; x < src_w; x++) {
1488 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit);
1489 const int c1 = c1_data[x >> c1_shift_w];
1490 const int c2 = c2_data[x >> c2_shift_w];
1493 *(d0_data - c0) = c0;
1494 *(d1_data - c0) = c1;
1495 *(d2_data - c0) = c2;
1497 *(d0_data + c0) = c0;
1498 *(d1_data + c0) = c1;
1499 *(d2_data + c0) = c2;
1503 if (!c0_shift_h || (y & c0_shift_h))
1504 c0_data += c0_linesize;
1505 if (!c1_shift_h || (y & c1_shift_h))
1506 c1_data += c1_linesize;
1507 if (!c2_shift_h || (y & c2_shift_h))
1508 c2_data += c2_linesize;
1509 d0_data += d0_linesize;
1510 d1_data += d1_linesize;
1511 d2_data += d2_linesize;
1515 envelope16(s, out, plane, plane, column ? offset_x : offset_y);
1521 int offset_y,
int offset_x,
1528 const int c0_linesize = in->
linesize[ plane + 0 ];
1529 const int c1_linesize = in->
linesize[(plane + 1) % s->
ncomp];
1530 const int c2_linesize = in->
linesize[(plane + 2) % s->
ncomp];
1531 const int d0_linesize = out->
linesize[ plane + 0 ];
1532 const int d1_linesize = out->
linesize[(plane + 1) % s->
ncomp];
1533 const int d2_linesize = out->
linesize[(plane + 2) % s->
ncomp];
1534 const int c0_shift_w = s->
shift_w[ component + 0 ];
1535 const int c1_shift_w = s->
shift_w[(component + 1) % s->
ncomp];
1536 const int c2_shift_w = s->
shift_w[(component + 2) % s->
ncomp];
1537 const int c0_shift_h = s->
shift_h[ component + 0 ];
1538 const int c1_shift_h = s->
shift_h[(component + 1) % s->
ncomp];
1539 const int c2_shift_h = s->
shift_h[(component + 2) % s->
ncomp];
1540 const int src_h = in->
height;
1541 const int src_w = in->
width;
1545 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1);
1546 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1);
1547 const int d2_signed_linesize = d2_linesize * (mirror == 1 ? -1 : 1);
1549 uint8_t *d1_data = out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
1550 uint8_t *d2_data = out->
data[(plane + 2) % s->
ncomp] + offset_y * d2_linesize + offset_x;
1551 uint8_t *
const d0_bottom_line = d0_data + d0_linesize * (s->
size - 1);
1552 uint8_t *
const d0 = (mirror ? d0_bottom_line : d0_data);
1553 uint8_t *
const d1_bottom_line = d1_data + d1_linesize * (s->
size - 1);
1554 uint8_t *
const d1 = (mirror ? d1_bottom_line : d1_data);
1555 uint8_t *
const d2_bottom_line = d2_data + d2_linesize * (s->
size - 1);
1556 uint8_t *
const d2 = (mirror ? d2_bottom_line : d2_data);
1558 for (y = 0; y < src_h; y++) {
1559 for (x = 0; x < src_w; x++) {
1560 const int c0 = c0_data[x >> c0_shift_w];
1561 const int c1 = c1_data[x >> c1_shift_w];
1562 const int c2 = c2_data[x >> c2_shift_w];
1564 *(d0 + d0_signed_linesize * c0 + x) = c0;
1565 *(d1 + d1_signed_linesize * c0 + x) = c1;
1566 *(d2 + d2_signed_linesize * c0 + x) = c2;
1569 if (!c0_shift_h || (y & c0_shift_h))
1570 c0_data += c0_linesize;
1571 if (!c1_shift_h || (y & c1_shift_h))
1572 c1_data += c1_linesize;
1573 if (!c2_shift_h || (y & c2_shift_h))
1574 c2_data += c2_linesize;
1575 d0_data += d0_linesize;
1576 d1_data += d1_linesize;
1577 d2_data += d2_linesize;
1581 uint8_t *d1_data = out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
1582 uint8_t *d2_data = out->
data[(plane + 2) % s->
ncomp] + offset_y * d2_linesize + offset_x;
1585 d0_data += s->
size - 1;
1586 d1_data += s->
size - 1;
1587 d2_data += s->
size - 1;
1590 for (y = 0; y < src_h; y++) {
1591 for (x = 0; x < src_w; x++) {
1592 const int c0 = c0_data[x >> c0_shift_w];
1593 const int c1 = c1_data[x >> c1_shift_w];
1594 const int c2 = c2_data[x >> c2_shift_w];
1597 *(d0_data - c0) = c0;
1598 *(d1_data - c0) = c1;
1599 *(d2_data - c0) = c2;
1601 *(d0_data + c0) = c0;
1602 *(d1_data + c0) = c1;
1603 *(d2_data + c0) = c2;
1607 if (!c0_shift_h || (y & c0_shift_h))
1608 c0_data += c0_linesize;
1609 if (!c1_shift_h || (y & c1_shift_h))
1610 c1_data += c1_linesize;
1611 if (!c2_shift_h || (y & c2_shift_h))
1612 c2_data += c2_linesize;
1613 d0_data += d0_linesize;
1614 d1_data += d1_linesize;
1615 d2_data += d2_linesize;
1619 envelope(s, out, plane, plane, column ? offset_x : offset_y);
1625 int offset_y,
int offset_x,
1629 const int limit = s->
max - 1;
1631 const uint16_t *c0_data = (
const uint16_t *)in->
data[plane + 0];
1632 const uint16_t *c1_data = (
const uint16_t *)in->
data[(plane + 1) % s->
ncomp];
1633 const uint16_t *c2_data = (
const uint16_t *)in->
data[(plane + 2) % s->
ncomp];
1634 const int c0_linesize = in->
linesize[ plane + 0 ] / 2;
1635 const int c1_linesize = in->
linesize[(plane + 1) % s->
ncomp] / 2;
1636 const int c2_linesize = in->
linesize[(plane + 2) % s->
ncomp] / 2;
1637 const int d0_linesize = out->
linesize[ plane + 0 ] / 2;
1638 const int d1_linesize = out->
linesize[(plane + 1) % s->
ncomp] / 2;
1639 const int d2_linesize = out->
linesize[(plane + 2) % s->
ncomp] / 2;
1640 const int c0_shift_w = s->
shift_w[ component + 0 ];
1641 const int c1_shift_w = s->
shift_w[(component + 1) % s->
ncomp];
1642 const int c2_shift_w = s->
shift_w[(component + 2) % s->
ncomp];
1643 const int c0_shift_h = s->
shift_h[ component + 0 ];
1644 const int c1_shift_h = s->
shift_h[(component + 1) % s->
ncomp];
1645 const int c2_shift_h = s->
shift_h[(component + 2) % s->
ncomp];
1646 const int src_h = in->
height;
1647 const int src_w = in->
width;
1651 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1);
1652 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1);
1653 const int d2_signed_linesize = d2_linesize * (mirror == 1 ? -1 : 1);
1654 uint16_t *d0_data = (uint16_t *)out->
data[plane] + offset_y * d0_linesize + offset_x;
1655 uint16_t *d1_data = (uint16_t *)out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
1656 uint16_t *d2_data = (uint16_t *)out->
data[(plane + 2) % s->
ncomp] + offset_y * d2_linesize + offset_x;
1657 uint16_t *
const d0_bottom_line = d0_data + d0_linesize * (s->
size - 1);
1658 uint16_t *
const d0 = (mirror ? d0_bottom_line : d0_data);
1659 uint16_t *
const d1_bottom_line = d1_data + d1_linesize * (s->
size - 1);
1660 uint16_t *
const d1 = (mirror ? d1_bottom_line : d1_data);
1661 uint16_t *
const d2_bottom_line = d2_data + d2_linesize * (s->
size - 1);
1662 uint16_t *
const d2 = (mirror ? d2_bottom_line : d2_data);
1664 for (y = 0; y < src_h; y++) {
1665 for (x = 0; x < src_w; x++) {
1666 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit);
1667 const int c1 = c1_data[x >> c1_shift_w];
1668 const int c2 = c2_data[x >> c2_shift_w];
1670 update16(d0 + d0_signed_linesize * c0 + x, max, intensity, limit);
1671 *(d1 + d1_signed_linesize * c0 + x) = c1;
1672 *(d2 + d2_signed_linesize * c0 + x) = c2;
1675 if (!c0_shift_h || (y & c0_shift_h))
1676 c0_data += c0_linesize;
1677 if (!c1_shift_h || (y & c1_shift_h))
1678 c1_data += c1_linesize;
1679 if (!c2_shift_h || (y & c2_shift_h))
1680 c2_data += c2_linesize;
1681 d0_data += d0_linesize;
1682 d1_data += d1_linesize;
1683 d2_data += d2_linesize;
1686 uint16_t *d0_data = (uint16_t *)out->
data[plane] + offset_y * d0_linesize + offset_x;
1687 uint16_t *d1_data = (uint16_t *)out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
1688 uint16_t *d2_data = (uint16_t *)out->
data[(plane + 2) % s->
ncomp] + offset_y * d2_linesize + offset_x;
1691 d0_data += s->
size - 1;
1692 d1_data += s->
size - 1;
1693 d2_data += s->
size - 1;
1696 for (y = 0; y < src_h; y++) {
1697 for (x = 0; x < src_w; x++) {
1698 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit);
1699 const int c1 = c1_data[x >> c1_shift_w];
1700 const int c2 = c2_data[x >> c2_shift_w];
1703 update16(d0_data - c0, max, intensity, limit);
1704 *(d1_data - c0) = c1;
1705 *(d2_data - c0) = c2;
1707 update16(d0_data + c0, max, intensity, limit);
1708 *(d1_data + c0) = c1;
1709 *(d2_data + c0) = c2;
1713 if (!c0_shift_h || (y & c0_shift_h))
1714 c0_data += c0_linesize;
1715 if (!c1_shift_h || (y & c1_shift_h))
1716 c1_data += c1_linesize;
1717 if (!c2_shift_h || (y & c2_shift_h))
1718 c2_data += c2_linesize;
1719 d0_data += d0_linesize;
1720 d1_data += d1_linesize;
1721 d2_data += d2_linesize;
1725 envelope16(s, out, plane, plane, column ? offset_x : offset_y);
1731 int offset_y,
int offset_x,
1738 const int c0_linesize = in->
linesize[ plane + 0 ];
1739 const int c1_linesize = in->
linesize[(plane + 1) % s->
ncomp];
1740 const int c2_linesize = in->
linesize[(plane + 2) % s->
ncomp];
1741 const int d0_linesize = out->
linesize[ plane + 0 ];
1742 const int d1_linesize = out->
linesize[(plane + 1) % s->
ncomp];
1743 const int d2_linesize = out->
linesize[(plane + 2) % s->
ncomp];
1744 const int c0_shift_w = s->
shift_w[ component + 0 ];
1745 const int c1_shift_w = s->
shift_w[(component + 1) % s->
ncomp];
1746 const int c2_shift_w = s->
shift_w[(component + 2) % s->
ncomp];
1747 const int c0_shift_h = s->
shift_h[ component + 0 ];
1748 const int c1_shift_h = s->
shift_h[(component + 1) % s->
ncomp];
1749 const int c2_shift_h = s->
shift_h[(component + 2) % s->
ncomp];
1751 const int src_h = in->
height;
1752 const int src_w = in->
width;
1756 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1);
1757 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1);
1758 const int d2_signed_linesize = d2_linesize * (mirror == 1 ? -1 : 1);
1760 uint8_t *d1_data = out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
1761 uint8_t *d2_data = out->
data[(plane + 2) % s->
ncomp] + offset_y * d2_linesize + offset_x;
1762 uint8_t *
const d0_bottom_line = d0_data + d0_linesize * (s->
size - 1);
1763 uint8_t *
const d0 = (mirror ? d0_bottom_line : d0_data);
1764 uint8_t *
const d1_bottom_line = d1_data + d1_linesize * (s->
size - 1);
1765 uint8_t *
const d1 = (mirror ? d1_bottom_line : d1_data);
1766 uint8_t *
const d2_bottom_line = d2_data + d2_linesize * (s->
size - 1);
1767 uint8_t *
const d2 = (mirror ? d2_bottom_line : d2_data);
1769 for (y = 0; y < src_h; y++) {
1770 for (x = 0; x < src_w; x++) {
1771 const int c0 = c0_data[x >> c0_shift_w];
1772 const int c1 = c1_data[x >> c1_shift_w];
1773 const int c2 = c2_data[x >> c2_shift_w];
1775 update(d0 + d0_signed_linesize * c0 + x, max, intensity);
1776 *(d1 + d1_signed_linesize * c0 + x) = c1;
1777 *(d2 + d2_signed_linesize * c0 + x) = c2;
1780 if (!c0_shift_h || (y & c0_shift_h))
1781 c0_data += c0_linesize;
1782 if (!c1_shift_h || (y & c1_shift_h))
1783 c1_data += c1_linesize;
1784 if (!c2_shift_h || (y & c2_shift_h))
1785 c2_data += c2_linesize;
1786 d0_data += d0_linesize;
1787 d1_data += d1_linesize;
1788 d2_data += d2_linesize;
1792 uint8_t *d1_data = out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
1793 uint8_t *d2_data = out->
data[(plane + 2) % s->
ncomp] + offset_y * d2_linesize + offset_x;
1796 d0_data += s->
size - 1;
1797 d1_data += s->
size - 1;
1798 d2_data += s->
size - 1;
1801 for (y = 0; y < src_h; y++) {
1802 for (x = 0; x < src_w; x++) {
1803 const int c0 = c0_data[x >> c0_shift_w];
1804 const int c1 = c1_data[x >> c1_shift_w];
1805 const int c2 = c2_data[x >> c2_shift_w];
1808 update(d0_data - c0, max, intensity);
1809 *(d1_data - c0) = c1;
1810 *(d2_data - c0) = c2;
1812 update(d0_data + c0, max, intensity);
1813 *(d1_data + c0) = c1;
1814 *(d2_data + c0) = c2;
1818 if (!c0_shift_h || (y & c0_shift_h))
1819 c0_data += c0_linesize;
1820 if (!c1_shift_h || (y & c1_shift_h))
1821 c1_data += c1_linesize;
1822 if (!c2_shift_h || (y & c2_shift_h))
1823 c2_data += c2_linesize;
1824 d0_data += d0_linesize;
1825 d1_data += d1_linesize;
1826 d2_data += d2_linesize;
1830 envelope(s, out, plane, plane, column ? offset_x : offset_y);
1838 { { {
"16", 16+128 }, {
"16", 16+128 }, {
"16", 16+128 }, {
"0", 0+128 } } },
1839 { { {
"128", 128+128 }, {
"128", 128+128 }, {
"128", 128+128 }, {
"128", 128+128 } } },
1840 { { {
"235", 235+128 }, {
"240", 240+128 }, {
"240", 240+128 }, {
"255", 255+128 } } },
1844 { { {
"32", 32+256 }, {
"32", 32+256 }, {
"32", 32+256 }, {
"0", 0+256 } } },
1845 { { {
"256", 256+256 }, {
"256", 256+256 }, {
"256", 256+256 }, {
"256", 256+256 } } },
1846 { { {
"470", 470+256 }, {
"480", 480+256 }, {
"480", 480+256 }, {
"511", 511+256 } } },
1850 { { {
"64", 64+512 }, {
"64", 64+512 }, {
"64", 64+512 }, {
"0", 0+512 } } },
1851 { { {
"512", 512+512 }, {
"512", 512+512 }, {
"512", 512+512 }, {
"512", 512+512 } } },
1852 { { {
"940", 940+512 }, {
"960", 960+512 }, {
"960", 960+512 }, {
"1023", 1023+512 } } },
1856 { { {
"256", 256+2048 }, {
"256", 256+2048 }, {
"256", 256+2048 }, {
"0", 0+2048 } } },
1857 { { {
"2048", 2048+2048 }, {
"2048", 2048+2048 }, {
"2048", 2048+2048 }, {
"2048", 2048+2048 } } },
1858 { { {
"3760", 3760+2048 }, {
"3840", 3840+2048 }, {
"3840", 3840+2048 }, {
"4095", 4095+2048 } } },
1862 { { {
"0", 16+128 }, {
"0", 16+128 }, {
"0", 16+128 }, {
"0", 0+128 } } },
1863 { { {
"175", 71+128 }, {
"175", 72+128 }, {
"175", 72+128 }, {
"175", 64+128 } } },
1864 { { {
"350", 126+128 }, {
"350", 128+128 }, {
"350", 128+128 }, {
"350", 128+128 } } },
1865 { { {
"525", 180+128 }, {
"525", 184+128 }, {
"525", 184+128 }, {
"525", 192+128 } } },
1866 { { {
"700", 235+128 }, {
"700", 240+128 }, {
"700", 240+128 }, {
"700", 255+128 } } },
1870 { { {
"0", 32+256 }, {
"0", 32+256 }, {
"0", 32+256 }, {
"0", 0+256 } } },
1871 { { {
"175", 142+256 }, {
"175", 144+256 }, {
"175", 144+256 }, {
"175", 128+256 } } },
1872 { { {
"350", 251+256 }, {
"350", 256+256 }, {
"350", 256+256 }, {
"350", 256+256 } } },
1873 { { {
"525", 361+256 }, {
"525", 368+256 }, {
"525", 368+256 }, {
"525", 384+256 } } },
1874 { { {
"700", 470+256 }, {
"700", 480+256 }, {
"700", 480+256 }, {
"700", 511+256 } } },
1878 { { {
"0", 64+512 }, {
"0", 64+512 }, {
"0", 64+512 }, {
"0", 0+512 } } },
1879 { { {
"175", 283+512 }, {
"175", 288+512 }, {
"175", 288+512 }, {
"175", 256+512 } } },
1880 { { {
"350", 502+512 }, {
"350", 512+512 }, {
"350", 512+512 }, {
"350", 512+512 } } },
1881 { { {
"525", 721+512 }, {
"525", 736+512 }, {
"525", 736+512 }, {
"525", 768+512 } } },
1882 { { {
"700", 940+512 }, {
"700", 960+512 }, {
"700", 960+512 }, {
"700", 1023+512 } } },
1886 { { {
"0", 256+2048 }, {
"0", 256+2048 }, {
"0", 256+2048 }, {
"0", 0+2048 } } },
1887 { { {
"175", 1132+2048 }, {
"175", 1152+2048 }, {
"175", 1152+2048 }, {
"175", 1024+2048 } } },
1888 { { {
"350", 2008+2048 }, {
"350", 2048+2048 }, {
"350", 2048+2048 }, {
"350", 2048+2048 } } },
1889 { { {
"525", 2884+2048 }, {
"525", 2944+2048 }, {
"525", 2944+2048 }, {
"525", 3072+2048 } } },
1890 { { {
"700", 3760+2048 }, {
"700", 3840+2048 }, {
"700", 3840+2048 }, {
"700", 4095+2048 } } },
1894 { { {
"-25", -39+128 }, {
"-25", -40+128 }, {
"-25", -40+128 }, {
"-25", -64+128 } } },
1895 { { {
"0", 16+128 }, {
"0", 16+128 }, {
"0", 16+128 }, {
"0", 0+128 } } },
1896 { { {
"25", 71+128 }, {
"25", 72+128 }, {
"25", 72+128 }, {
"25", 64+128 } } },
1897 { { {
"50", 126+128 }, {
"50", 128+128 }, {
"50", 128+128 }, {
"50", 128+128 } } },
1898 { { {
"75", 180+128 }, {
"75", 184+128 }, {
"75", 184+128 }, {
"75", 192+128 } } },
1899 { { {
"100", 235+128 }, {
"100", 240+128 }, {
"100", 240+128 }, {
"100", 256+128 } } },
1900 { { {
"125", 290+128 }, {
"125", 296+128 }, {
"125", 296+128 }, {
"125", 320+128 } } },
1904 { { {
"-25", -78+256 }, {
"-25", -80+256 }, {
"-25", -80+256 }, {
"-25",-128+256 } } },
1905 { { {
"0", 32+256 }, {
"0", 32+256 }, {
"0", 32+256 }, {
"0", 0+256 } } },
1906 { { {
"25", 142+256 }, {
"25", 144+256 }, {
"25", 144+256 }, {
"25", 128+256 } } },
1907 { { {
"50", 251+256 }, {
"50", 256+256 }, {
"50", 256+256 }, {
"50", 256+256 } } },
1908 { { {
"75", 361+256 }, {
"75", 368+256 }, {
"75", 368+256 }, {
"75", 384+256 } } },
1909 { { {
"100", 470+256 }, {
"100", 480+256 }, {
"100", 480+256 }, {
"100", 512+256 } } },
1910 { { {
"125", 580+256 }, {
"125", 592+256 }, {
"125", 592+256 }, {
"125", 640+256 } } },
1914 { { {
"-25",-156+512 }, {
"-25",-160+512 }, {
"-25",-160+512 }, {
"-25", -256+512 } } },
1915 { { {
"0", 64+512 }, {
"0", 64+512 }, {
"0", 64+512 }, {
"0", 0+512 } } },
1916 { { {
"25", 283+512 }, {
"25", 288+512 }, {
"25", 288+512 }, {
"25", 256+512 } } },
1917 { { {
"50", 502+512 }, {
"50", 512+512 }, {
"50", 512+512 }, {
"50", 512+512 } } },
1918 { { {
"75", 721+512 }, {
"75", 736+512 }, {
"75", 736+512 }, {
"75", 768+512 } } },
1919 { { {
"100", 940+512 }, {
"100", 960+512 }, {
"100", 960+512 }, {
"100", 1024+512 } } },
1920 { { {
"125",1160+512 }, {
"125",1184+512 }, {
"125",1184+512 }, {
"125", 1280+512 } } },
1924 { { {
"-25", -624+2048 }, {
"-25", -640+2048 }, {
"-25", -640+2048 }, {
"-25",-1024+2048 } } },
1925 { { {
"0", 256+2048 }, {
"0", 256+2048 }, {
"0", 256+2048 }, {
"0", 0+2048 } } },
1926 { { {
"25", 1132+2048 }, {
"25", 1152+2048 }, {
"25", 1152+2048 }, {
"25", 1024+2048 } } },
1927 { { {
"50", 2008+2048 }, {
"50", 2048+2048 }, {
"50", 2048+2048 }, {
"50", 2048+2048 } } },
1928 { { {
"75", 2884+2048 }, {
"75", 2944+2048 }, {
"75", 2944+2048 }, {
"75", 3072+2048 } } },
1929 { { {
"100", 3760+2048 }, {
"100", 3840+2048 }, {
"100", 3840+2048 }, {
"100", 4096+2048 } } },
1930 { { {
"125", 4640+2048 }, {
"125", 4736+2048 }, {
"125", 4736+2048 }, {
"125", 5120+2048 } } },
1934 { { {
"16", 16+256 }, {
"16", 16+256 }, {
"16", 16+256 }, {
"0", 0+256 } } },
1935 { { {
"128", 128+256 }, {
"128", 128+256 }, {
"128", 128+256 }, {
"128", 128+256 } } },
1936 { { {
"235", 235+256 }, {
"240", 240+256 }, {
"240", 240+256 }, {
"255", 255+256 } } },
1940 { { {
"32", 32+512 }, {
"32", 32+512 }, {
"32", 32+512 }, {
"0", 0+512 } } },
1941 { { {
"256", 256+512 }, {
"256", 256+512 }, {
"256", 256+512 }, {
"256", 256+512 } } },
1942 { { {
"470", 470+512 }, {
"480", 480+512 }, {
"480", 480+512 }, {
"511", 511+512 } } },
1946 { { {
"64", 64+1024 }, {
"64", 64+1024 }, {
"64", 64+1024 }, {
"0", 0+1024 } } },
1947 { { {
"512", 512+1024 }, {
"512", 512+1024 }, {
"512", 512+1024 }, {
"512", 512+1024 } } },
1948 { { {
"940", 940+1024 }, {
"960", 960+1024 }, {
"960", 960+1024 }, {
"1023", 1023+1024 } } },
1952 { { {
"256", 256+4096 }, {
"256", 256+4096 }, {
"256", 256+4096 }, {
"0", 0+4096 } } },
1953 { { {
"2048", 2048+4096 }, {
"2048", 2048+4096 }, {
"2048", 2048+4096 }, {
"2048", 2048+4096 } } },
1954 { { {
"3760", 3760+4096 }, {
"3840", 3840+4096 }, {
"3840", 3840+4096 }, {
"4095", 4095+4096 } } },
1958 { { {
"0", 16+256 }, {
"0", 16+256 }, {
"0", 16+256 }, {
"0", 0+256 } } },
1959 { { {
"175", 71+256 }, {
"175", 72+256 }, {
"175", 72+256 }, {
"175", 64+256 } } },
1960 { { {
"350", 126+256 }, {
"350", 128+256 }, {
"350", 128+256 }, {
"350", 128+256 } } },
1961 { { {
"525", 180+256 }, {
"525", 184+256 }, {
"525", 184+256 }, {
"525", 192+256 } } },
1962 { { {
"700", 235+256 }, {
"700", 240+256 }, {
"700", 240+256 }, {
"700", 255+256 } } },
1966 { { {
"0", 32+512 }, {
"0", 32+512 }, {
"0", 32+512 }, {
"0", 0+512 } } },
1967 { { {
"175", 142+512 }, {
"175", 144+512 }, {
"175", 144+512 }, {
"175", 128+512 } } },
1968 { { {
"350", 251+512 }, {
"350", 256+512 }, {
"350", 256+512 }, {
"350", 256+512 } } },
1969 { { {
"525", 361+512 }, {
"525", 368+512 }, {
"525", 368+512 }, {
"525", 384+512 } } },
1970 { { {
"700", 470+512 }, {
"700", 480+512 }, {
"700", 480+512 }, {
"700", 511+512 } } },
1974 { { {
"0", 64+1024 }, {
"0", 64+1024 }, {
"0", 64+1024 }, {
"0", 0+1024 } } },
1975 { { {
"175", 283+1024 }, {
"175", 288+1024 }, {
"175", 288+1024 }, {
"175", 256+1024 } } },
1976 { { {
"350", 502+1024 }, {
"350", 512+1024 }, {
"350", 512+1024 }, {
"350", 512+1024 } } },
1977 { { {
"525", 721+1024 }, {
"525", 736+1024 }, {
"525", 736+1024 }, {
"525", 768+1024 } } },
1978 { { {
"700", 940+1024 }, {
"700", 960+1024 }, {
"700", 960+1024 }, {
"700", 1023+1024 } } },
1982 { { {
"0", 256+4096 }, {
"0", 256+4096 }, {
"0", 256+4096 }, {
"0", 0+4096 } } },
1983 { { {
"175", 1132+4096 }, {
"175", 1152+4096 }, {
"175", 1152+4096 }, {
"175", 1024+4096 } } },
1984 { { {
"350", 2008+4096 }, {
"350", 2048+4096 }, {
"350", 2048+4096 }, {
"350", 2048+4096 } } },
1985 { { {
"525", 2884+4096 }, {
"525", 2944+4096 }, {
"525", 2944+4096 }, {
"525", 3072+4096 } } },
1986 { { {
"700", 3760+4096 }, {
"700", 3840+4096 }, {
"700", 3840+4096 }, {
"700", 4095+4096 } } },
1990 { { {
"-25", -39+256 }, {
"-25", -40+256 }, {
"-25", -40+256 }, {
"-25", -64+256 } } },
1991 { { {
"0", 16+256 }, {
"0", 16+256 }, {
"0", 16+256 }, {
"0", 0+256 } } },
1992 { { {
"25", 71+256 }, {
"25", 72+256 }, {
"25", 72+256 }, {
"25", 64+256 } } },
1993 { { {
"50", 126+256 }, {
"50", 128+256 }, {
"50", 128+256 }, {
"50", 128+256 } } },
1994 { { {
"75", 180+256 }, {
"75", 184+256 }, {
"75", 184+256 }, {
"75", 192+256 } } },
1995 { { {
"100", 235+256 }, {
"100", 240+256 }, {
"100", 240+256 }, {
"100", 256+256 } } },
1996 { { {
"125", 290+256 }, {
"125", 296+256 }, {
"125", 296+256 }, {
"125", 320+256 } } },
2000 { { {
"-25", -78+512 }, {
"-25", -80+512 }, {
"-25", -80+512 }, {
"-25",-128+512 } } },
2001 { { {
"0", 32+512 }, {
"0", 32+512 }, {
"0", 32+512 }, {
"0", 0+512 } } },
2002 { { {
"25", 142+512 }, {
"25", 144+512 }, {
"25", 144+512 }, {
"25", 128+512 } } },
2003 { { {
"50", 251+512 }, {
"50", 256+512 }, {
"50", 256+512 }, {
"50", 256+512 } } },
2004 { { {
"75", 361+512 }, {
"75", 368+512 }, {
"75", 368+512 }, {
"75", 384+512 } } },
2005 { { {
"100", 470+512 }, {
"100", 480+512 }, {
"100", 480+512 }, {
"100", 512+512 } } },
2006 { { {
"125", 580+512 }, {
"125", 592+512 }, {
"125", 592+512 }, {
"125", 640+512 } } },
2010 { { {
"-25",-156+1024 }, {
"-25",-160+1024 }, {
"-25",-160+1024 }, {
"-25", -256+1024 } } },
2011 { { {
"0", 64+1024 }, {
"0", 64+1024 }, {
"0", 64+1024 }, {
"0", 0+1024 } } },
2012 { { {
"25", 283+1024 }, {
"25", 288+1024 }, {
"25", 288+1024 }, {
"25", 256+1024 } } },
2013 { { {
"50", 502+1024 }, {
"50", 512+1024 }, {
"50", 512+1024 }, {
"50", 512+1024 } } },
2014 { { {
"75", 721+1024 }, {
"75", 736+1024 }, {
"75", 736+1024 }, {
"75", 768+1024 } } },
2015 { { {
"100", 940+1024 }, {
"100", 960+1024 }, {
"100", 960+1024 }, {
"100", 1024+1024 } } },
2016 { { {
"125",1160+1024 }, {
"125",1184+1024 }, {
"125",1184+1024 }, {
"125", 1280+1024 } } },
2020 { { {
"-25", -624+4096 }, {
"-25", -640+4096 }, {
"-25", -640+4096 }, {
"-25",-1024+4096 } } },
2021 { { {
"0", 256+4096 }, {
"0", 256+4096 }, {
"0", 256+4096 }, {
"0", 0+4096 } } },
2022 { { {
"25", 1132+4096 }, {
"25", 1152+4096 }, {
"25", 1152+4096 }, {
"25", 1024+4096 } } },
2023 { { {
"50", 2008+4096 }, {
"50", 2048+4096 }, {
"50", 2048+4096 }, {
"50", 2048+4096 } } },
2024 { { {
"75", 2884+4096 }, {
"75", 2944+4096 }, {
"75", 2944+4096 }, {
"75", 3072+4096 } } },
2025 { { {
"100", 3760+4096 }, {
"100", 3840+4096 }, {
"100", 3840+4096 }, {
"100", 4096+4096 } } },
2026 { { {
"125", 4640+4096 }, {
"125", 4736+4096 }, {
"125", 4736+4096 }, {
"125", 5120+4096 } } },
2030 { { {
"16", 16 }, {
"16", 16 }, {
"16", 16 }, {
"0", 0 } } },
2031 { { {
"128", 128 }, {
"128", 128 }, {
"128", 128 }, {
"128", 128 } } },
2032 { { {
"235", 235 }, {
"240", 240 }, {
"240", 240 }, {
"255", 255 } } },
2036 { { {
"32", 32 }, {
"32", 32 }, {
"32", 32 }, {
"0", 0 } } },
2037 { { {
"256", 256 }, {
"256", 256 }, {
"256", 256 }, {
"256", 256 } } },
2038 { { {
"470", 470 }, {
"480", 480 }, {
"480", 480 }, {
"511", 511 } } },
2042 { { {
"64", 64 }, {
"64", 64 }, {
"64", 64 }, {
"0", 0 } } },
2043 { { {
"512", 512 }, {
"512", 512 }, {
"512", 512 }, {
"512", 512 } } },
2044 { { {
"940", 940 }, {
"960", 960 }, {
"960", 960 }, {
"1023", 1023 } } },
2048 { { {
"256", 256 }, {
"256", 256 }, {
"256", 256 }, {
"0", 0 } } },
2049 { { {
"2048", 2048 }, {
"2048", 2048 }, {
"2048", 2048 }, {
"2048", 2048 } } },
2050 { { {
"3760", 3760 }, {
"3840", 3840 }, {
"3840", 3840 }, {
"4095", 4095 } } },
2054 { { {
"0", 16 }, {
"0", 16 }, {
"0", 16 }, {
"0", 0 } } },
2055 { { {
"175", 71 }, {
"175", 72 }, {
"175", 72 }, {
"175", 64 } } },
2056 { { {
"350", 126 }, {
"350", 128 }, {
"350", 128 }, {
"350", 128 } } },
2057 { { {
"525", 180 }, {
"525", 184 }, {
"525", 184 }, {
"525", 192 } } },
2058 { { {
"700", 235 }, {
"700", 240 }, {
"700", 240 }, {
"700", 255 } } },
2062 { { {
"0", 32 }, {
"0", 32 }, {
"0", 32 }, {
"0", 0 } } },
2063 { { {
"175", 142 }, {
"175", 144 }, {
"175", 144 }, {
"175", 128 } } },
2064 { { {
"350", 251 }, {
"350", 256 }, {
"350", 256 }, {
"350", 256 } } },
2065 { { {
"525", 361 }, {
"525", 368 }, {
"525", 368 }, {
"525", 384 } } },
2066 { { {
"700", 470 }, {
"700", 480 }, {
"700", 480 }, {
"700", 511 } } },
2070 { { {
"0", 64 }, {
"0", 64 }, {
"0", 64 }, {
"0", 0 } } },
2071 { { {
"175", 283 }, {
"175", 288 }, {
"175", 288 }, {
"175", 256 } } },
2072 { { {
"350", 502 }, {
"350", 512 }, {
"350", 512 }, {
"350", 512 } } },
2073 { { {
"525", 721 }, {
"525", 736 }, {
"525", 736 }, {
"525", 768 } } },
2074 { { {
"700", 940 }, {
"700", 960 }, {
"700", 960 }, {
"700", 1023 } } },
2078 { { {
"0", 256 }, {
"0", 256 }, {
"0", 256 }, {
"0", 0 } } },
2079 { { {
"175", 1132 }, {
"175", 1152 }, {
"175", 1152 }, {
"175", 1024 } } },
2080 { { {
"350", 2008 }, {
"350", 2048 }, {
"350", 2048 }, {
"350", 2048 } } },
2081 { { {
"525", 2884 }, {
"525", 2944 }, {
"525", 2944 }, {
"525", 3072 } } },
2082 { { {
"700", 3760 }, {
"700", 3840 }, {
"700", 3840 }, {
"700", 4095 } } },
2086 { { {
"0", 16 }, {
"0", 16 }, {
"0", 16 }, {
"0", 0 } } },
2087 { { {
"25", 71 }, {
"25", 72 }, {
"25", 72 }, {
"25", 64 } } },
2088 { { {
"50", 126 }, {
"50", 128 }, {
"50", 128 }, {
"50", 128 } } },
2089 { { {
"75", 180 }, {
"75", 184 }, {
"75", 184 }, {
"75", 192 } } },
2090 { { {
"100", 235 }, {
"100", 240 }, {
"100", 240 }, {
"100", 255 } } },
2094 { { {
"0", 32 }, {
"0", 32 }, {
"0", 32 }, {
"0", 0 } } },
2095 { { {
"25", 142 }, {
"25", 144 }, {
"25", 144 }, {
"25", 128 } } },
2096 { { {
"50", 251 }, {
"50", 256 }, {
"50", 256 }, {
"50", 256 } } },
2097 { { {
"75", 361 }, {
"75", 368 }, {
"75", 368 }, {
"75", 384 } } },
2098 { { {
"100", 470 }, {
"100", 480 }, {
"100", 480 }, {
"100", 511 } } },
2102 { { {
"0", 64 }, {
"0", 64 }, {
"0", 64 }, {
"0", 0 } } },
2103 { { {
"25", 283 }, {
"25", 288 }, {
"25", 288 }, {
"25", 256 } } },
2104 { { {
"50", 502 }, {
"50", 512 }, {
"50", 512 }, {
"50", 512 } } },
2105 { { {
"75", 721 }, {
"75", 736 }, {
"75", 736 }, {
"75", 768 } } },
2106 { { {
"100", 940 }, {
"100", 960 }, {
"100", 960 }, {
"100", 1023 } } },
2110 { { {
"0", 256 }, {
"0", 256 }, {
"0", 256 }, {
"0", 0 } } },
2111 { { {
"25", 1132 }, {
"25", 1152 }, {
"25", 1152 }, {
"25", 1024 } } },
2112 { { {
"50", 2008 }, {
"50", 2048 }, {
"50", 2048 }, {
"50", 2048 } } },
2113 { { {
"75", 2884 }, {
"75", 2944 }, {
"75", 2944 }, {
"75", 3072 } } },
2114 { { {
"100", 3760 }, {
"100", 3840 }, {
"100", 3840 }, {
"100", 4095 } } },
2118 { { {
"50", 50 }, {
"50", 50 }, {
"50", 50 }, {
"50", 50 } } },
2119 { { {
"100", 100 }, {
"100", 100 }, {
"100", 100 }, {
"100", 100 } } },
2120 { { {
"150", 150 }, {
"150", 150 }, {
"150", 150 }, {
"150", 150 } } },
2121 { { {
"200", 200 }, {
"200", 200 }, {
"200", 200 }, {
"200", 200 } } },
2122 { { {
"255", 255 }, {
"255", 255 }, {
"255", 255 }, {
"255", 255 } } },
2126 { { {
"100", 100 }, {
"100", 100 }, {
"100", 100 }, {
"100", 100 } } },
2127 { { {
"200", 200 }, {
"200", 200 }, {
"200", 200 }, {
"200", 200 } } },
2128 { { {
"300", 300 }, {
"300", 300 }, {
"300", 300 }, {
"300", 300 } } },
2129 { { {
"400", 400 }, {
"400", 400 }, {
"400", 400 }, {
"400", 400 } } },
2130 { { {
"500", 500 }, {
"500", 500 }, {
"500", 500 }, {
"500", 500 } } },
2134 { { {
"200", 200 }, {
"200", 200 }, {
"200", 200 }, {
"200", 200 } } },
2135 { { {
"400", 400 }, {
"400", 400 }, {
"400", 400 }, {
"400", 400 } } },
2136 { { {
"600", 600 }, {
"600", 600 }, {
"600", 600 }, {
"600", 600 } } },
2137 { { {
"800", 800 }, {
"800", 800 }, {
"800", 800 }, {
"800", 800 } } },
2138 { { {
"1000",1000 }, {
"1000",1000 }, {
"1000",1000 }, {
"1000",1000 } } },
2142 { { {
"800", 800 }, {
"800", 800 }, {
"800", 800 }, {
"800", 800 } } },
2143 { { {
"1600", 1600 }, {
"1600", 1600 }, {
"1600", 1600 }, {
"1600", 1600 } } },
2144 { { {
"2400", 2400 }, {
"2400", 2400 }, {
"2400", 2400 }, {
"2400", 2400 } } },
2145 { { {
"3200", 3200 }, {
"3200", 3200 }, {
"3200", 3200 }, {
"3200", 3200 } } },
2146 { { {
"4000", 4000 }, {
"4000", 4000 }, {
"4000", 4000 }, {
"4000", 4000 } } },
2153 for (y = 0; y <
height; y += step) {
2154 dst[0] = v * o1 + dst[0] * o2;
2156 dst += linesize * step;
2164 for (y = 0; y <
height; y += step) {
2165 dst[0] = v * o1 + dst[0] * o2;
2167 dst += (linesize / 2) * step;
2175 for (x = 0; x <
width; x += step) {
2176 dst[x] = v * o1 + dst[x] * o2;
2184 for (x = 0; x <
width; x += step) {
2185 dst[x] = v * o1 + dst[x] * o2;
2197 for (plane = 0; plane < 4 && out->
data[
plane]; plane++) {
2198 for (i = 0; txt[i]; i++) {
2200 int v = color[
plane];
2203 for (char_y = 0; char_y < font_height; char_y++) {
2204 for (mask = 0x80;
mask; mask >>= 1) {
2205 if (font[txt[i] * font_height + char_y] & mask)
2206 p[0] = p[0] * o2 + v * o1;
2223 for (plane = 0; plane < 4 && out->
data[
plane]; plane++) {
2224 for (i = 0; txt[i]; i++) {
2228 uint16_t *p = (uint16_t *)(out->
data[plane] + y * out->
linesize[plane]) + (x + i * 8);
2229 for (char_y = 0; char_y < font_height; char_y++) {
2230 for (mask = 0x80;
mask; mask >>= 1) {
2231 if (font[txt[i] * font_height + char_y] & mask)
2232 p[0] = p[0] * o2 + v * o1;
2249 for (plane = 0; plane < 4 && out->
data[
plane]; plane++) {
2250 for (i = 0; txt[i]; i++) {
2252 int v = color[
plane];
2254 for (char_y = font_height - 1; char_y >= 0; char_y--) {
2256 for (mask = 0x80;
mask; mask >>= 1) {
2257 if (font[txt[i] * font_height + font_height - 1 - char_y] & mask)
2258 p[char_y] = p[char_y] * o2 + v * o1;
2274 for (plane = 0; plane < 4 && out->
data[
plane]; plane++) {
2275 for (i = 0; txt[i]; i++) {
2279 for (char_y = 0; char_y < font_height; char_y++) {
2280 uint16_t *p = (uint16_t *)(out->
data[plane] + (y + i * 10) * out->
linesize[
plane]) + x;
2281 for (mask = 0x80;
mask; mask >>= 1) {
2282 if (font[txt[i] * font_height + font_height - 1 - char_y] & mask)
2283 p[char_y] = p[char_y] * o2 + v * o1;
2297 const int step = (s->
flags & 2) + 1;
2299 const float o2 = 1. - o1;
2301 int k = 0,
c, p, l, offset_x = 0, offset_y = 0;
2308 for (p = 0; p < s->
ncomp; p++) {
2312 int x = offset_x + (s->
mirror ? s->
size - 1 - pos : pos);
2322 int x = offset_x + (s->
mirror ? s->
size - 1 - pos : pos) - 10;
2337 const int step = (s->
flags & 2) + 1;
2339 const float o2 = 1. - o1;
2342 int k = 0,
c, p, l, offset_x = 0, offset_y = 0;
2349 for (p = 0; p < s->
ncomp; p++) {
2353 int x = offset_x + (s->
mirror ? s->
size - 1 - pos : pos);
2354 uint16_t *dst = (uint16_t *)(out->
data[p] + offset_y * out->
linesize[p]) + x;
2363 int x = offset_x + (s->
mirror ? s->
size - 1 - pos : pos) - 10;
2378 const int step = (s->
flags & 2) + 1;
2380 const float o2 = 1. - o1;
2382 int k = 0,
c, p, l, offset_y = 0, offset_x = 0;
2389 for (p = 0; p < s->
ncomp; p++) {
2393 int y = offset_y + (s->
mirror ? s->
size - 1 - pos : pos);
2403 int y = offset_y + (s->
mirror ? s->
size - 1 - pos : pos) - 10;
2418 const int step = (s->
flags & 2) + 1;
2420 const float o2 = 1. - o1;
2423 int k = 0,
c, p, l, offset_x = 0, offset_y = 0;
2430 for (p = 0; p < s->
ncomp; p++) {
2434 int y = offset_y + (s->
mirror ? s->
size - 1 - pos : pos);
2435 uint16_t *dst = (uint16_t *)(out->
data[p] + y * out->
linesize[p]) + offset_x;
2444 int y = offset_y + (s->
mirror ? s->
size - 1 - pos: pos) - 10;
2477 case FLAT: s->
size = 256 * 3;
break;
2478 default: s->
size = 256;
break;
2483 case 0x1100: s->
waveform = lowpass_column_mirror;
break;
2484 case 0x1000: s->
waveform = lowpass_row_mirror;
break;
2485 case 0x0100: s->
waveform = lowpass_column;
break;
2486 case 0x0000: s->
waveform = lowpass_row;
break;
2487 case 0x1110: s->
waveform = lowpass16_column_mirror;
break;
2488 case 0x1010: s->
waveform = lowpass16_row_mirror;
break;
2489 case 0x0110: s->
waveform = lowpass16_column;
break;
2490 case 0x0010: s->
waveform = lowpass16_row;
break;
2666 switch (inlink->
format) {
2689 int comp = 0, i, j = 0, k, p,
size;
2691 for (i = 0; i < s->
ncomp; i++) {
2692 if ((1 << i) & s->
pcomp)
2715 for (p = 0; p < s->
ncomp; p++) {
2719 if (!((1 << p) & s->
pcomp))
2722 for (k = 0; k < 4; k++) {
2730 for (i = 0; i <
size; i++) {
2731 for (k = 0; k < 4; k++) {
2759 for (k = 0; k < s->
dcomp; k++) {
2761 for (i = 0; i < outlink->
h ; i++)
2766 const int mult = s->
max / 256;
2769 for (i = 0; i < outlink->
h ; i++) {
2770 for (j = 0; j < outlink->
w; j++)
2777 for (k = 0, i = 0; k < s->
ncomp; k++) {
2778 if ((1 << k) & s->
pcomp) {
2783 offset_x = s->
mode ? i++ * inlink->
w : 0;
2784 offset_y = s->
mode ? 0 : i++ * inlink->
h;
2828 .priv_class = &waveform_class,
int plane
Which of the 4 planes contains the component.
#define AV_PIX_FMT_YUVA422P9
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
This structure describes decoded (raw) audio or video data.
#define AV_PIX_FMT_YUVA420P10
#define AV_PIX_FMT_YUVA422P10
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Main libavfilter public API header.
int h
agreed upon image height
#define AV_PIX_FMT_GBRP10
#define AV_PIX_FMT_YUV420P12
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
#define AV_PIX_FMT_GRAY10
const char * name
Pad name.
#define AV_PIX_FMT_GRAY12
AVFilterLink ** inputs
array of pointers to input links
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
static av_cold int end(AVCodecContext *avctx)
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
static void filter(int16_t *output, ptrdiff_t out_stride, int16_t *low, ptrdiff_t low_stride, int16_t *high, ptrdiff_t high_stride, int len, uint8_t clip)
#define AV_PIX_FMT_YUVA420P9
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range...
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
#define AV_PIX_FMT_YUV422P12
void av_frame_set_color_range(AVFrame *frame, enum AVColorRange val)
A filter pad used for either input or output.
A link between two filters.
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
int width
width and height of the video frame
const uint8_t avpriv_cga_font[2048]
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
static const uint16_t mask[17]
struct GraticuleLine line[4]
#define AV_PIX_FMT_FLAG_RGB
The pixel format contains RGB-like data (as opposed to YUV/grayscale).
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void * priv
private data for use by the filter
simple assert() macros that are a bit more flexible than ISO C assert().
AVFilterFormats * in_formats
Lists of formats and channel layouts supported by the input and output filters respectively.
#define AV_PIX_FMT_YUV444P10
static enum AVPixelFormat in_pix_fmts[]
static const uint8_t offset[127][2]
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
int w
agreed upon image width
uint64_t flags
Combination of AV_PIX_FMT_FLAG_...
#define AV_PIX_FMT_YUV422P9
uint8_t nb_components
The number of components each pixel has, (1-4)
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
typedef void(APIENTRY *FF_PFNGLACTIVETEXTUREPROC)(GLenum texture)
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
AVFilterContext * src
source filter
#define AV_PIX_FMT_YUVA444P10
#define AV_PIX_FMT_YUV444P9
int format
agreed upon media format
#define FF_ARRAY_ELEMS(a)
the normal 2^n-1 "JPEG" YUV ranges
static void comp(unsigned char *dst, ptrdiff_t dst_stride, unsigned char *src, ptrdiff_t src_stride, int add)
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31))))#defineSET_CONV_FUNC_GROUP(ofmt, ifmt) staticvoidset_generic_function(AudioConvert *ac){}voidff_audio_convert_free(AudioConvert **ac){if(!*ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);}AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, intsample_rate, intapply_map){AudioConvert *ac;intin_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) returnNULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method!=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt)>2){ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc){av_free(ac);returnNULL;}returnac;}in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar){ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar?ac->channels:1;}elseif(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;elseac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);returnac;}intff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in){intuse_generic=1;intlen=in->nb_samples;intp;if(ac->dc){av_log(ac->avr, AV_LOG_TRACE,"%dsamples-audio_convert:%sto%s(dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));returnff_convert_dither(ac-> in
static int16_t mult(Float11 *f1, Float11 *f2)
#define AV_PIX_FMT_YUV420P10
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Describe the class of an AVClass context structure.
Rational number (pair of numerator and denominator).
const char * name
Filter name.
#define AV_PIX_FMT_YUV440P12
#define AV_PIX_FMT_YUV420P9
AVRational sample_aspect_ratio
agreed upon sample aspect ratio
AVFilterLink ** outputs
array of pointers to output links
#define AV_PIX_FMT_GBRP12
#define AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_YUV444P12
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
void(* graticulef)(struct WaveformContext *s, AVFrame *out)
planar GBRA 4:4:4:4 32bpp
#define AV_PIX_FMT_YUVA444P9
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
static enum AVPixelFormat out_pix_fmts[]
void(* waveform)(struct WaveformContext *s, AVFrame *in, AVFrame *out, int component, int intensity, int offset_y, int offset_x, int column, int mirror)
AVFilterContext * dst
dest filter
const AVPixFmtDescriptor * odesc
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor ...
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
#define av_malloc_array(a, b)
int depth
Number of bits in the component.
const AVPixFmtDescriptor * desc
AVPixelFormat
Pixel format.
mode
Use these values in ebur128_init (or'ed).
CGA/EGA/VGA ROM font data.
AVFilterFormats * out_formats
#define AV_CEIL_RSHIFT(a, b)