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
304 else if (rgb && depth == 8 && ncomp > 2)
306 else if (rgb && depth == 9 && ncomp > 2)
308 else if (rgb && depth == 10 && ncomp > 2)
310 else if (rgb && depth == 12 && ncomp > 2)
312 else if (depth == 8 && ncomp > 2)
314 else if (depth == 9 && ncomp > 2)
316 else if (depth == 10 && ncomp > 2)
318 else if (depth == 12 && ncomp > 2)
330 const int dst_linesize = out->
linesize[component] / 2;
331 const int bg = s->
bg_color[component] * (s->
max / 256);
332 const int limit = s->
max - 1;
341 for (x = offset; x < offset + dst_w; x++) {
342 for (y = start; y <
end; y++) {
343 dst = (uint16_t *)out->
data[component] + y * dst_linesize + x;
349 for (y = end - 1; y >=
start; y--) {
350 dst = (uint16_t *)out->
data[component] + y * dst_linesize + x;
358 for (y = offset; y < offset + dst_h; y++) {
359 dst = (uint16_t *)out->
data[component] + y * dst_linesize;
360 for (x = start; x <
end; x++) {
366 for (x = end - 1; x >=
start; x--) {
378 const int dst_linesize = out->
linesize[component];
388 for (x = offset; x < offset + dst_w; x++) {
389 for (y = start; y <
end; y++) {
390 dst = out->
data[component] + y * dst_linesize + x;
396 for (y = end - 1; y >=
start; y--) {
397 dst = out->
data[component] + y * dst_linesize + x;
405 for (y = offset; y < offset + dst_h; y++) {
406 dst = out->
data[component] + y * dst_linesize;
407 for (x = start; x <
end; x++) {
413 for (x = end - 1; x >=
start; x--) {
425 const int dst_linesize = out->
linesize[component] / 2;
426 const int bg = s->
bg_color[component] * (s->
max / 256);
427 const int limit = s->
max - 1;
438 for (x = offset; x < offset + dst_w; x++) {
439 for (y = start; y < end && y < emin[x -
offset]; y++) {
440 dst = (uint16_t *)out->
data[component] + y * dst_linesize + x;
446 for (y = end - 1; y >= start && y >= emax[x -
offset]; y--) {
447 dst = (uint16_t *)out->
data[component] + y * dst_linesize + x;
458 for (x = offset; x < offset + dst_w; x++) {
459 dst = (uint16_t *)out->
data[component] + emin[x - offset] * dst_linesize + x;
461 dst = (uint16_t *)out->
data[component] + emax[x -
offset] * dst_linesize + x;
465 for (y = offset; y < offset + dst_h; y++) {
466 dst = (uint16_t *)out->
data[component] + y * dst_linesize;
467 for (x = start; x < end && x < emin[y -
offset]; x++) {
473 for (x = end - 1; x >= start && x >= emax[y -
offset]; x--) {
484 for (y = offset; y < offset + dst_h; y++) {
485 dst = (uint16_t *)out->
data[component] + y * dst_linesize + emin[y - offset];
487 dst = (uint16_t *)out->
data[component] + y * dst_linesize + emax[y -
offset];
495 const int dst_linesize = out->
linesize[component];
496 const int bg = s->
bg_color[component];
507 for (x = offset; x < offset + dst_w; x++) {
508 for (y = start; y < end && y < emin[x -
offset]; y++) {
509 dst = out->
data[component] + y * dst_linesize + x;
515 for (y = end - 1; y >= start && y >= emax[x -
offset]; y--) {
516 dst = out->
data[component] + y * dst_linesize + x;
527 for (x = offset; x < offset + dst_w; x++) {
528 dst = out->
data[component] + emin[x -
offset] * dst_linesize + x;
530 dst = out->
data[component] + emax[x -
offset] * dst_linesize + x;
534 for (y = offset; y < offset + dst_h; y++) {
535 dst = out->
data[component] + y * dst_linesize;
536 for (x = start; x < end && x < emin[y -
offset]; x++) {
542 for (x = end - 1; x >= start && x >= emax[y -
offset]; x--) {
553 for (y = offset; y < offset + dst_h; y++) {
554 dst = out->
data[component] + y * dst_linesize + emin[y -
offset];
556 dst = out->
data[component] + y * dst_linesize + emax[y -
offset];
603 int offset_y,
int offset_x,
611 const int dst_signed_linesize = dst_linesize * (mirror == 1 ? -1 : 1);
612 const int limit = s->
max - 1;
616 const uint16_t *src_data = (
const uint16_t *)in->
data[plane];
617 uint16_t *dst_data = (uint16_t *)out->
data[
plane] + offset_y * dst_linesize + offset_x;
618 uint16_t *
const dst_bottom_line = dst_data + dst_linesize * (s->
size - 1);
619 uint16_t *
const dst_line = (mirror ? dst_bottom_line : dst_data);
620 const int step = column ? 1 << shift_w : 1 <<
shift_h;
624 if (!column && mirror)
627 for (y = 0; y < src_h; y++) {
628 const uint16_t *src_data_end = src_data + src_w;
629 uint16_t *dst = dst_line;
631 for (p = src_data; p < src_data_end; p++) {
633 int i = 0, v =
FFMIN(*p, limit);
637 target = dst++ + dst_signed_linesize * v;
638 update16(target, max, intensity, limit);
639 }
while (++i < step);
641 uint16_t *row = dst_data;
644 target = row - v - 1;
647 update16(target, max, intensity, limit);
649 }
while (++i < step);
652 src_data += src_linesize;
653 dst_data += dst_linesize * step;
656 envelope16(s, out, plane, plane, column ? offset_x : offset_y);
659 #define LOWPASS16_FUNC(name, column, mirror) \
660 static void lowpass16_##name(WaveformContext *s, \
661 AVFrame *in, AVFrame *out, \
662 int component, int intensity, \
663 int offset_y, int offset_x, \
664 int unused1, int unused2) \
666 lowpass16(s, in, out, component, intensity, \
667 offset_y, offset_x, column, mirror); \
678 int offset_y,
int offset_x,
681 const int plane = s->desc->comp[component].plane;
682 const int shift_w = s->shift_w[component];
683 const int shift_h = s->shift_h[component];
684 const int src_linesize = in->linesize[
plane];
685 const int dst_linesize = out->linesize[
plane];
686 const int dst_signed_linesize = dst_linesize * (mirror == 1 ? -1 : 1);
691 uint8_t *dst_data = out->data[
plane] + offset_y * dst_linesize + offset_x;
692 uint8_t *
const dst_bottom_line = dst_data + dst_linesize * (s->size - 1);
693 uint8_t *
const dst_line = (mirror ? dst_bottom_line : dst_data);
694 const int step = column ? 1 << shift_w : 1 <<
shift_h;
698 if (!column && mirror)
701 for (y = 0; y < src_h; y++) {
702 const uint8_t *src_data_end = src_data + src_w;
705 for (p = src_data; p < src_data_end; p++) {
708 target = dst + dst_signed_linesize * *p;
710 update(target, max, intensity);
714 target = row - *p - 1;
717 update(target, max, intensity);
721 src_data += src_linesize;
722 dst_data += dst_linesize * step;
725 if (column && step > 1) {
726 const int dst_w = s->display ==
PARADE ? out->width / s->acomp : out->width;
727 const int dst_h = 256;
731 dst = out->data[
plane] + offset_y * dst_linesize + offset_x;
732 for (y = 0; y < dst_h; y++) {
733 for (x = 0; x < dst_w; x+=step) {
734 for (z = 1; z < step; z++) {
740 }
else if (step > 1) {
741 const int dst_h = s->display ==
PARADE ? out->height / s->acomp : out->height;
742 const int dst_w = 256;
746 dst = out->data[
plane] + offset_y * dst_linesize + offset_x;
747 for (y = 0; y < dst_h; y+=step) {
748 for (z = 1; z < step; z++)
749 memcpy(dst + dst_linesize * z, dst, dst_w);
750 dst += dst_linesize * step;
754 envelope(s, out, plane, plane, column ? offset_x : offset_y);
757 #define LOWPASS_FUNC(name, column, mirror) \
758 static void lowpass_##name(WaveformContext *s, \
759 AVFrame *in, AVFrame *out, \
760 int component, int intensity, \
761 int offset_y, int offset_x, \
762 int unused1, int unused2) \
764 lowpass(s, in, out, component, intensity, \
765 offset_y, offset_x, column, mirror); \
776 int offset_y,
int offset_x,
779 const int plane = s->desc->comp[component].plane;
780 const int c0_linesize = in->linesize[ plane + 0 ] / 2;
781 const int c1_linesize = in->linesize[(plane + 1) % s->ncomp] / 2;
782 const int c2_linesize = in->linesize[(plane + 2) % s->ncomp] / 2;
783 const int c0_shift_w = s->shift_w[ component + 0 ];
784 const int c1_shift_w = s->shift_w[(component + 1) % s->ncomp];
785 const int c2_shift_w = s->shift_w[(component + 2) % s->ncomp];
786 const int c0_shift_h = s->shift_h[ component + 0 ];
787 const int c1_shift_h = s->shift_h[(component + 1) % s->ncomp];
788 const int c2_shift_h = s->shift_h[(component + 2) % s->ncomp];
789 const int d0_linesize = out->linesize[ plane + 0 ] / 2;
790 const int d1_linesize = out->linesize[(plane + 1) % s->ncomp] / 2;
791 const int limit = s->max - 1;
792 const int max = limit - intensity;
793 const int mid = s->max / 2;
794 const int src_h = in->height;
795 const int src_w = in->width;
799 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1);
800 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1);
802 for (x = 0; x < src_w; x++) {
803 const uint16_t *c0_data = (uint16_t *)in->data[plane + 0];
804 const uint16_t *c1_data = (uint16_t *)in->data[(plane + 1) % s->ncomp];
805 const uint16_t *c2_data = (uint16_t *)in->data[(plane + 2) % s->ncomp];
806 uint16_t *d0_data = (uint16_t *)(out->data[
plane]) + offset_y * d0_linesize + offset_x;
807 uint16_t *d1_data = (uint16_t *)(out->data[(plane + 1) % s->ncomp]) + offset_y * d1_linesize + offset_x;
808 uint16_t *
const d0_bottom_line = d0_data + d0_linesize * (s->size - 1);
809 uint16_t *
const d0 = (mirror ? d0_bottom_line : d0_data);
810 uint16_t *
const d1_bottom_line = d1_data + d1_linesize * (s->size - 1);
811 uint16_t *
const d1 = (mirror ? d1_bottom_line : d1_data);
813 for (y = 0; y < src_h; y++) {
814 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit) + s->max;
815 const int c1 =
FFMIN(
FFABS(c1_data[x >> c1_shift_w] - mid) +
FFABS(c2_data[x >> c2_shift_w] - mid), limit);
818 target = d0 + x + d0_signed_linesize * c0;
820 target = d1 + x + d1_signed_linesize * (c0 -
c1);
822 target = d1 + x + d1_signed_linesize * (c0 +
c1);
825 if (!c0_shift_h || (y & c0_shift_h))
826 c0_data += c0_linesize;
827 if (!c1_shift_h || (y & c1_shift_h))
828 c1_data += c1_linesize;
829 if (!c2_shift_h || (y & c2_shift_h))
830 c2_data += c2_linesize;
831 d0_data += d0_linesize;
832 d1_data += d1_linesize;
836 const uint16_t *c0_data = (uint16_t *)in->data[plane];
837 const uint16_t *c1_data = (uint16_t *)in->data[(plane + 1) % s->ncomp];
838 const uint16_t *c2_data = (uint16_t *)in->data[(plane + 2) % s->ncomp];
839 uint16_t *d0_data = (uint16_t *)(out->data[
plane]) + offset_y * d0_linesize + offset_x;
840 uint16_t *d1_data = (uint16_t *)(out->data[(plane + 1) % s->ncomp]) + offset_y * d1_linesize + offset_x;
843 d0_data += s->size - 1;
844 d1_data += s->size - 1;
847 for (y = 0; y < src_h; y++) {
848 for (x = 0; x < src_w; x++) {
849 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit) + s->max;
850 const int c1 =
FFMIN(
FFABS(c1_data[x >> c1_shift_w] - mid) +
FFABS(c2_data[x >> c2_shift_w] - mid), limit);
854 target = d0_data - c0;
856 target = d1_data - (c0 -
c1);
858 target = d1_data - (c0 +
c1);
861 target = d0_data + c0;
863 target = d1_data + (c0 -
c1);
865 target = d1_data + (c0 +
c1);
870 if (!c0_shift_h || (y & c0_shift_h))
871 c0_data += c0_linesize;
872 if (!c1_shift_h || (y & c1_shift_h))
873 c1_data += c1_linesize;
874 if (!c2_shift_h || (y & c2_shift_h))
875 c2_data += c2_linesize;
876 d0_data += d0_linesize;
877 d1_data += d1_linesize;
881 envelope16(s, out, plane, plane, column ? offset_x : offset_y);
882 envelope16(s, out, plane, (plane + 1) % s->ncomp, column ? offset_x : offset_y);
888 int offset_y,
int offset_x,
892 const int c0_linesize = in->
linesize[ plane + 0 ];
893 const int c1_linesize = in->
linesize[(plane + 1) % s->
ncomp];
894 const int c2_linesize = in->
linesize[(plane + 2) % s->
ncomp];
895 const int c0_shift_w = s->
shift_w[ component + 0 ];
896 const int c1_shift_w = s->
shift_w[(component + 1) % s->
ncomp];
897 const int c2_shift_w = s->
shift_w[(component + 2) % s->
ncomp];
898 const int c0_shift_h = s->
shift_h[ component + 0 ];
899 const int c1_shift_h = s->
shift_h[(component + 1) % s->
ncomp];
900 const int c2_shift_h = s->
shift_h[(component + 2) % s->
ncomp];
901 const int d0_linesize = out->
linesize[ plane + 0 ];
902 const int d1_linesize = out->
linesize[(plane + 1) % s->
ncomp];
903 const int max = 255 - intensity;
904 const int src_h = in->
height;
905 const int src_w = in->
width;
909 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1);
910 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1);
912 for (x = 0; x < src_w; x++) {
917 uint8_t *d1_data = out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
918 uint8_t *
const d0_bottom_line = d0_data + d0_linesize * (s->
size - 1);
919 uint8_t *
const d0 = (mirror ? d0_bottom_line : d0_data);
920 uint8_t *
const d1_bottom_line = d1_data + d1_linesize * (s->
size - 1);
921 uint8_t *
const d1 = (mirror ? d1_bottom_line : d1_data);
923 for (y = 0; y < src_h; y++) {
924 const int c0 = c0_data[x >> c0_shift_w] + 256;
925 const int c1 =
FFABS(c1_data[x >> c1_shift_w] - 128) +
FFABS(c2_data[x >> c2_shift_w] - 128);
928 target = d0 + x + d0_signed_linesize * c0;
930 target = d1 + x + d1_signed_linesize * (c0 -
c1);
932 target = d1 + x + d1_signed_linesize * (c0 +
c1);
935 if (!c0_shift_h || (y & c0_shift_h))
936 c0_data += c0_linesize;
937 if (!c1_shift_h || (y & c1_shift_h))
938 c1_data += c1_linesize;
939 if (!c2_shift_h || (y & c2_shift_h))
940 c2_data += c2_linesize;
941 d0_data += d0_linesize;
942 d1_data += d1_linesize;
950 uint8_t *d1_data = out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
953 d0_data += s->
size - 1;
954 d1_data += s->
size - 1;
957 for (y = 0; y < src_h; y++) {
958 for (x = 0; x < src_w; x++) {
959 int c0 = c0_data[x >> c0_shift_w] + 256;
960 const int c1 =
FFABS(c1_data[x >> c1_shift_w] - 128) +
FFABS(c2_data[x >> c2_shift_w] - 128);
964 target = d0_data - c0;
966 target = d1_data - (c0 -
c1);
968 target = d1_data - (c0 +
c1);
971 target = d0_data + c0;
973 target = d1_data + (c0 -
c1);
975 target = d1_data + (c0 +
c1);
980 if (!c0_shift_h || (y & c0_shift_h))
981 c0_data += c0_linesize;
982 if (!c1_shift_h || (y & c1_shift_h))
983 c1_data += c1_linesize;
984 if (!c2_shift_h || (y & c2_shift_h))
985 c2_data += c2_linesize;
986 d0_data += d0_linesize;
987 d1_data += d1_linesize;
991 envelope(s, out, plane, plane, column ? offset_x : offset_y);
992 envelope(s, out, plane, (plane + 1) % s->
ncomp, column ? offset_x : offset_y);
998 int offset_y,
int offset_x,
1002 const int c0_linesize = in->
linesize[ plane + 0 ] / 2;
1003 const int c1_linesize = in->
linesize[(plane + 1) % s->
ncomp] / 2;
1004 const int c2_linesize = in->
linesize[(plane + 2) % s->
ncomp] / 2;
1005 const int c0_shift_w = s->
shift_w[ component + 0 ];
1006 const int c1_shift_w = s->
shift_w[(component + 1) % s->
ncomp];
1007 const int c2_shift_w = s->
shift_w[(component + 2) % s->
ncomp];
1008 const int c0_shift_h = s->
shift_h[ component + 0 ];
1009 const int c1_shift_h = s->
shift_h[(component + 1) % s->
ncomp];
1010 const int c2_shift_h = s->
shift_h[(component + 2) % s->
ncomp];
1011 const int d0_linesize = out->
linesize[ plane + 0 ] / 2;
1012 const int d1_linesize = out->
linesize[(plane + 1) % s->
ncomp] / 2;
1013 const int d2_linesize = out->
linesize[(plane + 2) % s->
ncomp] / 2;
1014 const int limit = s->
max - 1;
1016 const int mid = s->
max / 2;
1017 const int src_h = in->
height;
1018 const int src_w = in->
width;
1022 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1);
1023 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1);
1024 const int d2_signed_linesize = d2_linesize * (mirror == 1 ? -1 : 1);
1026 for (x = 0; x < src_w; x++) {
1027 const uint16_t *c0_data = (uint16_t *)in->
data[plane + 0];
1028 const uint16_t *c1_data = (uint16_t *)in->
data[(plane + 1) % s->
ncomp];
1029 const uint16_t *c2_data = (uint16_t *)in->
data[(plane + 2) % s->
ncomp];
1030 uint16_t *d0_data = (uint16_t *)out->
data[
plane] + offset_y * d0_linesize + offset_x;
1031 uint16_t *d1_data = (uint16_t *)out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
1032 uint16_t *d2_data = (uint16_t *)out->
data[(plane + 2) % s->
ncomp] + offset_y * d2_linesize + offset_x;
1033 uint16_t *
const d0_bottom_line = d0_data + d0_linesize * (s->
size - 1);
1034 uint16_t *
const d0 = (mirror ? d0_bottom_line : d0_data);
1035 uint16_t *
const d1_bottom_line = d1_data + d1_linesize * (s->
size - 1);
1036 uint16_t *
const d1 = (mirror ? d1_bottom_line : d1_data);
1037 uint16_t *
const d2_bottom_line = d2_data + d2_linesize * (s->
size - 1);
1038 uint16_t *
const d2 = (mirror ? d2_bottom_line : d2_data);
1040 for (y = 0; y < src_h; y++) {
1041 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit) + mid;
1042 const int c1 =
FFMIN(c1_data[x >> c1_shift_w], limit) - mid;
1043 const int c2 =
FFMIN(c2_data[x >> c2_shift_w], limit) - mid;
1046 target = d0 + x + d0_signed_linesize * c0;
1047 update16(target, max, intensity, limit);
1049 target = d1 + x + d1_signed_linesize * (c0 +
c1);
1050 update16(target, max, intensity, limit);
1052 target = d2 + x + d2_signed_linesize * (c0 +
c2);
1053 update16(target, max, intensity, limit);
1055 if (!c0_shift_h || (y & c0_shift_h))
1056 c0_data += c0_linesize;
1057 if (!c1_shift_h || (y & c1_shift_h))
1058 c1_data += c1_linesize;
1059 if (!c2_shift_h || (y & c2_shift_h))
1060 c2_data += c2_linesize;
1061 d0_data += d0_linesize;
1062 d1_data += d1_linesize;
1063 d2_data += d2_linesize;
1067 const uint16_t *c0_data = (uint16_t *)in->
data[plane];
1068 const uint16_t *c1_data = (uint16_t *)in->
data[(plane + 1) % s->
ncomp];
1069 const uint16_t *c2_data = (uint16_t *)in->
data[(plane + 2) % s->
ncomp];
1070 uint16_t *d0_data = (uint16_t *)out->
data[
plane] + offset_y * d0_linesize + offset_x;
1071 uint16_t *d1_data = (uint16_t *)out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
1072 uint16_t *d2_data = (uint16_t *)out->
data[(plane + 2) % s->
ncomp] + offset_y * d2_linesize + offset_x;
1075 d0_data += s->
size - 1;
1076 d1_data += s->
size - 1;
1077 d2_data += s->
size - 1;
1080 for (y = 0; y < src_h; y++) {
1081 for (x = 0; x < src_w; x++) {
1082 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit) + mid;
1083 const int c1 =
FFMIN(c1_data[x >> c1_shift_w], limit) - mid;
1084 const int c2 =
FFMIN(c2_data[x >> c2_shift_w], limit) - mid;
1088 target = d0_data - c0;
1089 update16(target, max, intensity, limit);
1090 target = d1_data - (c0 +
c1);
1091 update16(target, max, intensity, limit);
1092 target = d2_data - (c0 +
c2);
1093 update16(target, max, intensity, limit);
1095 target = d0_data + c0;
1096 update16(target, max, intensity, limit);
1097 target = d1_data + (c0 +
c1);
1098 update16(target, max, intensity, limit);
1099 target = d2_data + (c0 +
c2);
1100 update16(target, max, intensity, limit);
1104 if (!c0_shift_h || (y & c0_shift_h))
1105 c0_data += c0_linesize;
1106 if (!c1_shift_h || (y & c1_shift_h))
1107 c1_data += c1_linesize;
1108 if (!c2_shift_h || (y & c2_shift_h))
1109 c2_data += c2_linesize;
1110 d0_data += d0_linesize;
1111 d1_data += d1_linesize;
1112 d2_data += d2_linesize;
1116 envelope16(s, out, plane, (plane + 0) % s->
ncomp, column ? offset_x : offset_y);
1117 envelope16(s, out, plane, (plane + 1) % s->
ncomp, column ? offset_x : offset_y);
1118 envelope16(s, out, plane, (plane + 2) % s->
ncomp, column ? offset_x : offset_y);
1124 int offset_y,
int offset_x,
1128 const int c0_linesize = in->
linesize[ plane + 0 ];
1129 const int c1_linesize = in->
linesize[(plane + 1) % s->
ncomp];
1130 const int c2_linesize = in->
linesize[(plane + 2) % s->
ncomp];
1131 const int c0_shift_w = s->
shift_w[ component + 0 ];
1132 const int c1_shift_w = s->
shift_w[(component + 1) % s->
ncomp];
1133 const int c2_shift_w = s->
shift_w[(component + 2) % s->
ncomp];
1134 const int c0_shift_h = s->
shift_h[ component + 0 ];
1135 const int c1_shift_h = s->
shift_h[(component + 1) % s->
ncomp];
1136 const int c2_shift_h = s->
shift_h[(component + 2) % s->
ncomp];
1137 const int d0_linesize = out->
linesize[ plane + 0 ];
1138 const int d1_linesize = out->
linesize[(plane + 1) % s->
ncomp];
1139 const int d2_linesize = out->
linesize[(plane + 2) % s->
ncomp];
1141 const int src_h = in->
height;
1142 const int src_w = in->
width;
1146 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1);
1147 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1);
1148 const int d2_signed_linesize = d2_linesize * (mirror == 1 ? -1 : 1);
1150 for (x = 0; x < src_w; x++) {
1155 uint8_t *d1_data = out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
1156 uint8_t *d2_data = out->
data[(plane + 2) % s->
ncomp] + offset_y * d2_linesize + offset_x;
1157 uint8_t *
const d0_bottom_line = d0_data + d0_linesize * (s->
size - 1);
1158 uint8_t *
const d0 = (mirror ? d0_bottom_line : d0_data);
1159 uint8_t *
const d1_bottom_line = d1_data + d1_linesize * (s->
size - 1);
1160 uint8_t *
const d1 = (mirror ? d1_bottom_line : d1_data);
1161 uint8_t *
const d2_bottom_line = d2_data + d2_linesize * (s->
size - 1);
1162 uint8_t *
const d2 = (mirror ? d2_bottom_line : d2_data);
1164 for (y = 0; y < src_h; y++) {
1165 const int c0 = c0_data[x >> c0_shift_w] + 128;
1166 const int c1 = c1_data[x >> c1_shift_w] - 128;
1167 const int c2 = c2_data[x >> c2_shift_w] - 128;
1170 target = d0 + x + d0_signed_linesize * c0;
1171 update(target, max, intensity);
1173 target = d1 + x + d1_signed_linesize * (c0 +
c1);
1174 update(target, max, intensity);
1176 target = d2 + x + d2_signed_linesize * (c0 +
c2);
1177 update(target, max, intensity);
1179 if (!c0_shift_h || (y & c0_shift_h))
1180 c0_data += c0_linesize;
1181 if (!c1_shift_h || (y & c1_shift_h))
1182 c1_data += c1_linesize;
1183 if (!c1_shift_h || (y & c1_shift_h))
1184 c2_data += c1_linesize;
1185 d0_data += d0_linesize;
1186 d1_data += d1_linesize;
1187 d2_data += d2_linesize;
1195 uint8_t *d1_data = out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
1196 uint8_t *d2_data = out->
data[(plane + 2) % s->
ncomp] + offset_y * d2_linesize + offset_x;
1199 d0_data += s->
size - 1;
1200 d1_data += s->
size - 1;
1201 d2_data += s->
size - 1;
1204 for (y = 0; y < src_h; y++) {
1205 for (x = 0; x < src_w; x++) {
1206 const int c0 = c0_data[x >> c0_shift_w] + 128;
1207 const int c1 = c1_data[x >> c1_shift_w] - 128;
1208 const int c2 = c2_data[x >> c2_shift_w] - 128;
1212 target = d0_data - c0;
1213 update(target, max, intensity);
1214 target = d1_data - (c0 +
c1);
1215 update(target, max, intensity);
1216 target = d2_data - (c0 +
c2);
1217 update(target, max, intensity);
1219 target = d0_data + c0;
1220 update(target, max, intensity);
1221 target = d1_data + (c0 +
c1);
1222 update(target, max, intensity);
1223 target = d2_data + (c0 +
c2);
1224 update(target, max, intensity);
1228 if (!c0_shift_h || (y & c0_shift_h))
1229 c0_data += c0_linesize;
1230 if (!c1_shift_h || (y & c1_shift_h))
1231 c1_data += c1_linesize;
1232 if (!c2_shift_h || (y & c2_shift_h))
1233 c2_data += c2_linesize;
1234 d0_data += d0_linesize;
1235 d1_data += d1_linesize;
1236 d2_data += d2_linesize;
1240 envelope(s, out, plane, (plane + 0) % s->
ncomp, column ? offset_x : offset_y);
1241 envelope(s, out, plane, (plane + 1) % s->
ncomp, column ? offset_x : offset_y);
1242 envelope(s, out, plane, (plane + 2) % s->
ncomp, column ? offset_x : offset_y);
1248 int offset_y,
int offset_x,
1252 const int c0_linesize = in->
linesize[(plane + 1) % s->
ncomp] / 2;
1253 const int c1_linesize = in->
linesize[(plane + 2) % s->
ncomp] / 2;
1255 const int limit = s->
max - 1;
1257 const int mid = s->
max / 2;
1258 const int c0_shift_w = s->
shift_w[(component + 1) % s->
ncomp];
1259 const int c1_shift_w = s->
shift_w[(component + 2) % s->
ncomp];
1260 const int c0_shift_h = s->
shift_h[(component + 1) % s->
ncomp];
1261 const int c1_shift_h = s->
shift_h[(component + 2) % s->
ncomp];
1262 const int src_h = in->
height;
1263 const int src_w = in->
width;
1267 const int dst_signed_linesize = dst_linesize * (mirror == 1 ? -1 : 1);
1269 for (x = 0; x < src_w; x++) {
1270 const uint16_t *c0_data = (uint16_t *)in->
data[(plane + 1) % s->
ncomp];
1271 const uint16_t *c1_data = (uint16_t *)in->
data[(plane + 2) % s->
ncomp];
1272 uint16_t *dst_data = (uint16_t *)out->
data[plane] + offset_y * dst_linesize + offset_x;
1273 uint16_t *
const dst_bottom_line = dst_data + dst_linesize * (s->
size - 1);
1274 uint16_t *
const dst_line = (mirror ? dst_bottom_line : dst_data);
1275 uint16_t *dst = dst_line;
1277 for (y = 0; y < src_h; y++) {
1278 const int sum =
FFMIN(
FFABS(c0_data[x >> c0_shift_w] - mid) +
FFABS(c1_data[x >> c1_shift_w] - mid - 1), limit);
1281 target = dst + x + dst_signed_linesize * sum;
1282 update16(target, max, intensity, limit);
1284 if (!c0_shift_h || (y & c0_shift_h))
1285 c0_data += c0_linesize;
1286 if (!c1_shift_h || (y & c1_shift_h))
1287 c1_data += c1_linesize;
1288 dst_data += dst_linesize;
1292 const uint16_t *c0_data = (uint16_t *)in->
data[(plane + 1) % s->
ncomp];
1293 const uint16_t *c1_data = (uint16_t *)in->
data[(plane + 2) % s->
ncomp];
1294 uint16_t *dst_data = (uint16_t *)out->
data[plane] + offset_y * dst_linesize + offset_x;
1297 dst_data += s->
size - 1;
1298 for (y = 0; y < src_h; y++) {
1299 for (x = 0; x < src_w; x++) {
1300 const int sum =
FFMIN(
FFABS(c0_data[x >> c0_shift_w] - mid) +
FFABS(c1_data[x >> c1_shift_w] - mid - 1), limit);
1304 target = dst_data - sum;
1305 update16(target, max, intensity, limit);
1307 target = dst_data + sum;
1308 update16(target, max, intensity, limit);
1312 if (!c0_shift_h || (y & c0_shift_h))
1313 c0_data += c0_linesize;
1314 if (!c1_shift_h || (y & c1_shift_h))
1315 c1_data += c1_linesize;
1316 dst_data += dst_linesize;
1320 envelope16(s, out, plane, plane, column ? offset_x : offset_y);
1326 int offset_y,
int offset_x,
1330 const int c0_linesize = in->
linesize[(plane + 1) % s->
ncomp];
1331 const int c1_linesize = in->
linesize[(plane + 2) % s->
ncomp];
1334 const int c0_shift_w = s->
shift_w[(component + 1) % s->
ncomp];
1335 const int c1_shift_w = s->
shift_w[(component + 2) % s->
ncomp];
1336 const int c0_shift_h = s->
shift_h[(component + 1) % s->
ncomp];
1337 const int c1_shift_h = s->
shift_h[(component + 2) % s->
ncomp];
1338 const int src_h = in->
height;
1339 const int src_w = in->
width;
1343 const int dst_signed_linesize = dst_linesize * (mirror == 1 ? -1 : 1);
1345 for (x = 0; x < src_w; x++) {
1349 uint8_t *
const dst_bottom_line = dst_data + dst_linesize * (s->
size - 1);
1350 uint8_t *
const dst_line = (mirror ? dst_bottom_line : dst_data);
1353 for (y = 0; y < src_h; y++) {
1354 const int sum =
FFABS(c0_data[x >> c0_shift_w] - 128) +
FFABS(c1_data[x >> c1_shift_w] - 127);
1357 target = dst + x + dst_signed_linesize * sum;
1358 update(target, max, intensity);
1360 if (!c0_shift_h || (y & c0_shift_h))
1361 c0_data += c0_linesize;
1362 if (!c1_shift_h || (y & c1_shift_h))
1363 c1_data += c1_linesize;
1364 dst_data += dst_linesize;
1373 dst_data += s->
size - 1;
1374 for (y = 0; y < src_h; y++) {
1375 for (x = 0; x < src_w; x++) {
1376 const int sum =
FFABS(c0_data[x >> c0_shift_w] - 128) +
FFABS(c1_data[x >> c1_shift_w] - 127);
1380 target = dst_data - sum;
1381 update(target, max, intensity);
1383 target = dst_data + sum;
1384 update(target, max, intensity);
1388 if (!c0_shift_h || (y & c0_shift_h))
1389 c0_data += c0_linesize;
1390 if (!c1_shift_h || (y & c1_shift_h))
1391 c1_data += c1_linesize;
1392 dst_data += dst_linesize;
1396 envelope(s, out, plane, plane, column ? offset_x : offset_y);
1402 int offset_y,
int offset_x,
1406 const int limit = s->
max - 1;
1407 const uint16_t *c0_data = (
const uint16_t *)in->
data[plane + 0];
1408 const uint16_t *c1_data = (
const uint16_t *)in->
data[(plane + 1) % s->
ncomp];
1409 const uint16_t *c2_data = (
const uint16_t *)in->
data[(plane + 2) % s->
ncomp];
1410 const int c0_linesize = in->
linesize[ plane + 0 ] / 2;
1411 const int c1_linesize = in->
linesize[(plane + 1) % s->
ncomp] / 2;
1412 const int c2_linesize = in->
linesize[(plane + 2) % s->
ncomp] / 2;
1413 const int d0_linesize = out->
linesize[ plane + 0 ] / 2;
1414 const int d1_linesize = out->
linesize[(plane + 1) % s->
ncomp] / 2;
1415 const int d2_linesize = out->
linesize[(plane + 2) % s->
ncomp] / 2;
1416 const int c0_shift_w = s->
shift_w[ component + 0 ];
1417 const int c1_shift_w = s->
shift_w[(component + 1) % s->
ncomp];
1418 const int c2_shift_w = s->
shift_w[(component + 2) % s->
ncomp];
1419 const int c0_shift_h = s->
shift_h[ component + 0 ];
1420 const int c1_shift_h = s->
shift_h[(component + 1) % s->
ncomp];
1421 const int c2_shift_h = s->
shift_h[(component + 2) % s->
ncomp];
1422 const int src_h = in->
height;
1423 const int src_w = in->
width;
1427 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1);
1428 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1);
1429 const int d2_signed_linesize = d2_linesize * (mirror == 1 ? -1 : 1);
1430 uint16_t *d0_data = (uint16_t *)out->
data[plane] + offset_y * d0_linesize + offset_x;
1431 uint16_t *d1_data = (uint16_t *)out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
1432 uint16_t *d2_data = (uint16_t *)out->
data[(plane + 2) % s->
ncomp] + offset_y * d2_linesize + offset_x;
1433 uint16_t *
const d0_bottom_line = d0_data + d0_linesize * (s->
size - 1);
1434 uint16_t *
const d0 = (mirror ? d0_bottom_line : d0_data);
1435 uint16_t *
const d1_bottom_line = d1_data + d1_linesize * (s->
size - 1);
1436 uint16_t *
const d1 = (mirror ? d1_bottom_line : d1_data);
1437 uint16_t *
const d2_bottom_line = d2_data + d2_linesize * (s->
size - 1);
1438 uint16_t *
const d2 = (mirror ? d2_bottom_line : d2_data);
1440 for (y = 0; y < src_h; y++) {
1441 for (x = 0; x < src_w; x++) {
1442 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit);
1443 const int c1 = c1_data[x >> c1_shift_w];
1444 const int c2 = c2_data[x >> c2_shift_w];
1446 *(d0 + d0_signed_linesize * c0 + x) = c0;
1447 *(d1 + d1_signed_linesize * c0 + x) = c1;
1448 *(d2 + d2_signed_linesize * c0 + x) = c2;
1451 if (!c0_shift_h || (y & c0_shift_h))
1452 c0_data += c0_linesize;
1453 if (!c1_shift_h || (y & c1_shift_h))
1454 c1_data += c1_linesize;
1455 if (!c2_shift_h || (y & c2_shift_h))
1456 c2_data += c2_linesize;
1457 d0_data += d0_linesize;
1458 d1_data += d1_linesize;
1459 d2_data += d2_linesize;
1462 uint16_t *d0_data = (uint16_t *)out->
data[plane] + offset_y * d0_linesize + offset_x;
1463 uint16_t *d1_data = (uint16_t *)out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
1464 uint16_t *d2_data = (uint16_t *)out->
data[(plane + 2) % s->
ncomp] + offset_y * d2_linesize + offset_x;
1467 d0_data += s->
size - 1;
1468 d1_data += s->
size - 1;
1469 d2_data += s->
size - 1;
1472 for (y = 0; y < src_h; y++) {
1473 for (x = 0; x < src_w; x++) {
1474 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit);
1475 const int c1 = c1_data[x >> c1_shift_w];
1476 const int c2 = c2_data[x >> c2_shift_w];
1479 *(d0_data - c0) = c0;
1480 *(d1_data - c0) = c1;
1481 *(d2_data - c0) = c2;
1483 *(d0_data + c0) = c0;
1484 *(d1_data + c0) = c1;
1485 *(d2_data + c0) = c2;
1489 if (!c0_shift_h || (y & c0_shift_h))
1490 c0_data += c0_linesize;
1491 if (!c1_shift_h || (y & c1_shift_h))
1492 c1_data += c1_linesize;
1493 if (!c2_shift_h || (y & c2_shift_h))
1494 c2_data += c2_linesize;
1495 d0_data += d0_linesize;
1496 d1_data += d1_linesize;
1497 d2_data += d2_linesize;
1501 envelope16(s, out, plane, plane, column ? offset_x : offset_y);
1507 int offset_y,
int offset_x,
1514 const int c0_linesize = in->
linesize[ plane + 0 ];
1515 const int c1_linesize = in->
linesize[(plane + 1) % s->
ncomp];
1516 const int c2_linesize = in->
linesize[(plane + 2) % s->
ncomp];
1517 const int d0_linesize = out->
linesize[ plane + 0 ];
1518 const int d1_linesize = out->
linesize[(plane + 1) % s->
ncomp];
1519 const int d2_linesize = out->
linesize[(plane + 2) % s->
ncomp];
1520 const int c0_shift_w = s->
shift_w[ component + 0 ];
1521 const int c1_shift_w = s->
shift_w[(component + 1) % s->
ncomp];
1522 const int c2_shift_w = s->
shift_w[(component + 2) % s->
ncomp];
1523 const int c0_shift_h = s->
shift_h[ component + 0 ];
1524 const int c1_shift_h = s->
shift_h[(component + 1) % s->
ncomp];
1525 const int c2_shift_h = s->
shift_h[(component + 2) % s->
ncomp];
1526 const int src_h = in->
height;
1527 const int src_w = in->
width;
1531 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1);
1532 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1);
1533 const int d2_signed_linesize = d2_linesize * (mirror == 1 ? -1 : 1);
1535 uint8_t *d1_data = out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
1536 uint8_t *d2_data = out->
data[(plane + 2) % s->
ncomp] + offset_y * d2_linesize + offset_x;
1537 uint8_t *
const d0_bottom_line = d0_data + d0_linesize * (s->
size - 1);
1538 uint8_t *
const d0 = (mirror ? d0_bottom_line : d0_data);
1539 uint8_t *
const d1_bottom_line = d1_data + d1_linesize * (s->
size - 1);
1540 uint8_t *
const d1 = (mirror ? d1_bottom_line : d1_data);
1541 uint8_t *
const d2_bottom_line = d2_data + d2_linesize * (s->
size - 1);
1542 uint8_t *
const d2 = (mirror ? d2_bottom_line : d2_data);
1544 for (y = 0; y < src_h; y++) {
1545 for (x = 0; x < src_w; x++) {
1546 const int c0 = c0_data[x >> c0_shift_w];
1547 const int c1 = c1_data[x >> c1_shift_w];
1548 const int c2 = c2_data[x >> c2_shift_w];
1550 *(d0 + d0_signed_linesize * c0 + x) = c0;
1551 *(d1 + d1_signed_linesize * c0 + x) = c1;
1552 *(d2 + d2_signed_linesize * c0 + x) = c2;
1555 if (!c0_shift_h || (y & c0_shift_h))
1556 c0_data += c0_linesize;
1557 if (!c1_shift_h || (y & c1_shift_h))
1558 c1_data += c1_linesize;
1559 if (!c2_shift_h || (y & c2_shift_h))
1560 c2_data += c2_linesize;
1561 d0_data += d0_linesize;
1562 d1_data += d1_linesize;
1563 d2_data += d2_linesize;
1567 uint8_t *d1_data = out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
1568 uint8_t *d2_data = out->
data[(plane + 2) % s->
ncomp] + offset_y * d2_linesize + offset_x;
1571 d0_data += s->
size - 1;
1572 d1_data += s->
size - 1;
1573 d2_data += s->
size - 1;
1576 for (y = 0; y < src_h; y++) {
1577 for (x = 0; x < src_w; x++) {
1578 const int c0 = c0_data[x >> c0_shift_w];
1579 const int c1 = c1_data[x >> c1_shift_w];
1580 const int c2 = c2_data[x >> c2_shift_w];
1583 *(d0_data - c0) = c0;
1584 *(d1_data - c0) = c1;
1585 *(d2_data - c0) = c2;
1587 *(d0_data + c0) = c0;
1588 *(d1_data + c0) = c1;
1589 *(d2_data + c0) = c2;
1593 if (!c0_shift_h || (y & c0_shift_h))
1594 c0_data += c0_linesize;
1595 if (!c1_shift_h || (y & c1_shift_h))
1596 c1_data += c1_linesize;
1597 if (!c2_shift_h || (y & c2_shift_h))
1598 c2_data += c2_linesize;
1599 d0_data += d0_linesize;
1600 d1_data += d1_linesize;
1601 d2_data += d2_linesize;
1605 envelope(s, out, plane, plane, column ? offset_x : offset_y);
1611 int offset_y,
int offset_x,
1615 const int limit = s->
max - 1;
1617 const uint16_t *c0_data = (
const uint16_t *)in->
data[plane + 0];
1618 const uint16_t *c1_data = (
const uint16_t *)in->
data[(plane + 1) % s->
ncomp];
1619 const uint16_t *c2_data = (
const uint16_t *)in->
data[(plane + 2) % s->
ncomp];
1620 const int c0_linesize = in->
linesize[ plane + 0 ] / 2;
1621 const int c1_linesize = in->
linesize[(plane + 1) % s->
ncomp] / 2;
1622 const int c2_linesize = in->
linesize[(plane + 2) % s->
ncomp] / 2;
1623 const int d0_linesize = out->
linesize[ plane + 0 ] / 2;
1624 const int d1_linesize = out->
linesize[(plane + 1) % s->
ncomp] / 2;
1625 const int d2_linesize = out->
linesize[(plane + 2) % s->
ncomp] / 2;
1626 const int c0_shift_w = s->
shift_w[ component + 0 ];
1627 const int c1_shift_w = s->
shift_w[(component + 1) % s->
ncomp];
1628 const int c2_shift_w = s->
shift_w[(component + 2) % s->
ncomp];
1629 const int c0_shift_h = s->
shift_h[ component + 0 ];
1630 const int c1_shift_h = s->
shift_h[(component + 1) % s->
ncomp];
1631 const int c2_shift_h = s->
shift_h[(component + 2) % s->
ncomp];
1632 const int src_h = in->
height;
1633 const int src_w = in->
width;
1637 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1);
1638 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1);
1639 const int d2_signed_linesize = d2_linesize * (mirror == 1 ? -1 : 1);
1640 uint16_t *d0_data = (uint16_t *)out->
data[plane] + offset_y * d0_linesize + offset_x;
1641 uint16_t *d1_data = (uint16_t *)out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
1642 uint16_t *d2_data = (uint16_t *)out->
data[(plane + 2) % s->
ncomp] + offset_y * d2_linesize + offset_x;
1643 uint16_t *
const d0_bottom_line = d0_data + d0_linesize * (s->
size - 1);
1644 uint16_t *
const d0 = (mirror ? d0_bottom_line : d0_data);
1645 uint16_t *
const d1_bottom_line = d1_data + d1_linesize * (s->
size - 1);
1646 uint16_t *
const d1 = (mirror ? d1_bottom_line : d1_data);
1647 uint16_t *
const d2_bottom_line = d2_data + d2_linesize * (s->
size - 1);
1648 uint16_t *
const d2 = (mirror ? d2_bottom_line : d2_data);
1650 for (y = 0; y < src_h; y++) {
1651 for (x = 0; x < src_w; x++) {
1652 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit);
1653 const int c1 = c1_data[x >> c1_shift_w];
1654 const int c2 = c2_data[x >> c2_shift_w];
1656 update16(d0 + d0_signed_linesize * c0 + x, max, intensity, limit);
1657 *(d1 + d1_signed_linesize * c0 + x) = c1;
1658 *(d2 + d2_signed_linesize * c0 + x) = c2;
1661 if (!c0_shift_h || (y & c0_shift_h))
1662 c0_data += c0_linesize;
1663 if (!c1_shift_h || (y & c1_shift_h))
1664 c1_data += c1_linesize;
1665 if (!c2_shift_h || (y & c2_shift_h))
1666 c2_data += c2_linesize;
1667 d0_data += d0_linesize;
1668 d1_data += d1_linesize;
1669 d2_data += d2_linesize;
1672 uint16_t *d0_data = (uint16_t *)out->
data[plane] + offset_y * d0_linesize + offset_x;
1673 uint16_t *d1_data = (uint16_t *)out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
1674 uint16_t *d2_data = (uint16_t *)out->
data[(plane + 2) % s->
ncomp] + offset_y * d2_linesize + offset_x;
1677 d0_data += s->
size - 1;
1678 d1_data += s->
size - 1;
1679 d2_data += s->
size - 1;
1682 for (y = 0; y < src_h; y++) {
1683 for (x = 0; x < src_w; x++) {
1684 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit);
1685 const int c1 = c1_data[x >> c1_shift_w];
1686 const int c2 = c2_data[x >> c2_shift_w];
1689 update16(d0_data - c0, max, intensity, limit);
1690 *(d1_data - c0) = c1;
1691 *(d2_data - c0) = c2;
1693 update16(d0_data + c0, max, intensity, limit);
1694 *(d1_data + c0) = c1;
1695 *(d2_data + c0) = c2;
1699 if (!c0_shift_h || (y & c0_shift_h))
1700 c0_data += c0_linesize;
1701 if (!c1_shift_h || (y & c1_shift_h))
1702 c1_data += c1_linesize;
1703 if (!c2_shift_h || (y & c2_shift_h))
1704 c2_data += c2_linesize;
1705 d0_data += d0_linesize;
1706 d1_data += d1_linesize;
1707 d2_data += d2_linesize;
1711 envelope16(s, out, plane, plane, column ? offset_x : offset_y);
1717 int offset_y,
int offset_x,
1724 const int c0_linesize = in->
linesize[ plane + 0 ];
1725 const int c1_linesize = in->
linesize[(plane + 1) % s->
ncomp];
1726 const int c2_linesize = in->
linesize[(plane + 2) % s->
ncomp];
1727 const int d0_linesize = out->
linesize[ plane + 0 ];
1728 const int d1_linesize = out->
linesize[(plane + 1) % s->
ncomp];
1729 const int d2_linesize = out->
linesize[(plane + 2) % s->
ncomp];
1730 const int c0_shift_w = s->
shift_w[ component + 0 ];
1731 const int c1_shift_w = s->
shift_w[(component + 1) % s->
ncomp];
1732 const int c2_shift_w = s->
shift_w[(component + 2) % s->
ncomp];
1733 const int c0_shift_h = s->
shift_h[ component + 0 ];
1734 const int c1_shift_h = s->
shift_h[(component + 1) % s->
ncomp];
1735 const int c2_shift_h = s->
shift_h[(component + 2) % s->
ncomp];
1737 const int src_h = in->
height;
1738 const int src_w = in->
width;
1742 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1);
1743 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1);
1744 const int d2_signed_linesize = d2_linesize * (mirror == 1 ? -1 : 1);
1746 uint8_t *d1_data = out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
1747 uint8_t *d2_data = out->
data[(plane + 2) % s->
ncomp] + offset_y * d2_linesize + offset_x;
1748 uint8_t *
const d0_bottom_line = d0_data + d0_linesize * (s->
size - 1);
1749 uint8_t *
const d0 = (mirror ? d0_bottom_line : d0_data);
1750 uint8_t *
const d1_bottom_line = d1_data + d1_linesize * (s->
size - 1);
1751 uint8_t *
const d1 = (mirror ? d1_bottom_line : d1_data);
1752 uint8_t *
const d2_bottom_line = d2_data + d2_linesize * (s->
size - 1);
1753 uint8_t *
const d2 = (mirror ? d2_bottom_line : d2_data);
1755 for (y = 0; y < src_h; y++) {
1756 for (x = 0; x < src_w; x++) {
1757 const int c0 = c0_data[x >> c0_shift_w];
1758 const int c1 = c1_data[x >> c1_shift_w];
1759 const int c2 = c2_data[x >> c2_shift_w];
1761 update(d0 + d0_signed_linesize * c0 + x, max, intensity);
1762 *(d1 + d1_signed_linesize * c0 + x) = c1;
1763 *(d2 + d2_signed_linesize * c0 + x) = c2;
1766 if (!c0_shift_h || (y & c0_shift_h))
1767 c0_data += c0_linesize;
1768 if (!c1_shift_h || (y & c1_shift_h))
1769 c1_data += c1_linesize;
1770 if (!c2_shift_h || (y & c2_shift_h))
1771 c2_data += c2_linesize;
1772 d0_data += d0_linesize;
1773 d1_data += d1_linesize;
1774 d2_data += d2_linesize;
1778 uint8_t *d1_data = out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
1779 uint8_t *d2_data = out->
data[(plane + 2) % s->
ncomp] + offset_y * d2_linesize + offset_x;
1782 d0_data += s->
size - 1;
1783 d1_data += s->
size - 1;
1784 d2_data += s->
size - 1;
1787 for (y = 0; y < src_h; y++) {
1788 for (x = 0; x < src_w; x++) {
1789 const int c0 = c0_data[x >> c0_shift_w];
1790 const int c1 = c1_data[x >> c1_shift_w];
1791 const int c2 = c2_data[x >> c2_shift_w];
1794 update(d0_data - c0, max, intensity);
1795 *(d1_data - c0) = c1;
1796 *(d2_data - c0) = c2;
1798 update(d0_data + c0, max, intensity);
1799 *(d1_data + c0) = c1;
1800 *(d2_data + c0) = c2;
1804 if (!c0_shift_h || (y & c0_shift_h))
1805 c0_data += c0_linesize;
1806 if (!c1_shift_h || (y & c1_shift_h))
1807 c1_data += c1_linesize;
1808 if (!c2_shift_h || (y & c2_shift_h))
1809 c2_data += c2_linesize;
1810 d0_data += d0_linesize;
1811 d1_data += d1_linesize;
1812 d2_data += d2_linesize;
1816 envelope(s, out, plane, plane, column ? offset_x : offset_y);
1824 { { {
"16", 16+128 }, {
"16", 16+128 }, {
"16", 16+128 }, {
"0", 0+128 } } },
1825 { { {
"128", 128+128 }, {
"128", 128+128 }, {
"128", 128+128 }, {
"128", 128+128 } } },
1826 { { {
"235", 235+128 }, {
"240", 240+128 }, {
"240", 240+128 }, {
"255", 255+128 } } },
1830 { { {
"32", 32+256 }, {
"32", 32+256 }, {
"32", 32+256 }, {
"0", 0+256 } } },
1831 { { {
"256", 256+256 }, {
"256", 256+256 }, {
"256", 256+256 }, {
"256", 256+256 } } },
1832 { { {
"470", 470+256 }, {
"480", 480+256 }, {
"480", 480+256 }, {
"511", 511+256 } } },
1836 { { {
"64", 64+512 }, {
"64", 64+512 }, {
"64", 64+512 }, {
"0", 0+512 } } },
1837 { { {
"512", 512+512 }, {
"512", 512+512 }, {
"512", 512+512 }, {
"512", 512+512 } } },
1838 { { {
"940", 940+512 }, {
"960", 960+512 }, {
"960", 960+512 }, {
"1023", 1023+512 } } },
1842 { { {
"256", 256+2048 }, {
"256", 256+2048 }, {
"256", 256+2048 }, {
"0", 0+2048 } } },
1843 { { {
"2048", 2048+2048 }, {
"2048", 2048+2048 }, {
"2048", 2048+2048 }, {
"2048", 2048+2048 } } },
1844 { { {
"3760", 3760+2048 }, {
"3840", 3840+2048 }, {
"3840", 3840+2048 }, {
"4095", 4095+2048 } } },
1848 { { {
"0", 16+128 }, {
"0", 16+128 }, {
"0", 16+128 }, {
"0", 0+128 } } },
1849 { { {
"175", 71+128 }, {
"175", 72+128 }, {
"175", 72+128 }, {
"175", 64+128 } } },
1850 { { {
"350", 126+128 }, {
"350", 128+128 }, {
"350", 128+128 }, {
"350", 128+128 } } },
1851 { { {
"525", 180+128 }, {
"525", 184+128 }, {
"525", 184+128 }, {
"525", 192+128 } } },
1852 { { {
"700", 235+128 }, {
"700", 240+128 }, {
"700", 240+128 }, {
"700", 255+128 } } },
1856 { { {
"0", 32+256 }, {
"0", 32+256 }, {
"0", 32+256 }, {
"0", 0+256 } } },
1857 { { {
"175", 142+256 }, {
"175", 144+256 }, {
"175", 144+256 }, {
"175", 128+256 } } },
1858 { { {
"350", 251+256 }, {
"350", 256+256 }, {
"350", 256+256 }, {
"350", 256+256 } } },
1859 { { {
"525", 361+256 }, {
"525", 368+256 }, {
"525", 368+256 }, {
"525", 384+256 } } },
1860 { { {
"700", 470+256 }, {
"700", 480+256 }, {
"700", 480+256 }, {
"700", 511+256 } } },
1864 { { {
"0", 64+512 }, {
"0", 64+512 }, {
"0", 64+512 }, {
"0", 0+512 } } },
1865 { { {
"175", 283+512 }, {
"175", 288+512 }, {
"175", 288+512 }, {
"175", 256+512 } } },
1866 { { {
"350", 502+512 }, {
"350", 512+512 }, {
"350", 512+512 }, {
"350", 512+512 } } },
1867 { { {
"525", 721+512 }, {
"525", 736+512 }, {
"525", 736+512 }, {
"525", 768+512 } } },
1868 { { {
"700", 940+512 }, {
"700", 960+512 }, {
"700", 960+512 }, {
"700", 1023+512 } } },
1872 { { {
"0", 256+2048 }, {
"0", 256+2048 }, {
"0", 256+2048 }, {
"0", 0+2048 } } },
1873 { { {
"175", 1132+2048 }, {
"175", 1152+2048 }, {
"175", 1152+2048 }, {
"175", 1024+2048 } } },
1874 { { {
"350", 2008+2048 }, {
"350", 2048+2048 }, {
"350", 2048+2048 }, {
"350", 2048+2048 } } },
1875 { { {
"525", 2884+2048 }, {
"525", 2944+2048 }, {
"525", 2944+2048 }, {
"525", 3072+2048 } } },
1876 { { {
"700", 3760+2048 }, {
"700", 3840+2048 }, {
"700", 3840+2048 }, {
"700", 4095+2048 } } },
1880 { { {
"-25", -39+128 }, {
"-25", -40+128 }, {
"-25", -40+128 }, {
"-25", -64+128 } } },
1881 { { {
"0", 16+128 }, {
"0", 16+128 }, {
"0", 16+128 }, {
"0", 0+128 } } },
1882 { { {
"25", 71+128 }, {
"25", 72+128 }, {
"25", 72+128 }, {
"25", 64+128 } } },
1883 { { {
"50", 126+128 }, {
"50", 128+128 }, {
"50", 128+128 }, {
"50", 128+128 } } },
1884 { { {
"75", 180+128 }, {
"75", 184+128 }, {
"75", 184+128 }, {
"75", 192+128 } } },
1885 { { {
"100", 235+128 }, {
"100", 240+128 }, {
"100", 240+128 }, {
"100", 256+128 } } },
1886 { { {
"125", 290+128 }, {
"125", 296+128 }, {
"125", 296+128 }, {
"125", 320+128 } } },
1890 { { {
"-25", -78+256 }, {
"-25", -80+256 }, {
"-25", -80+256 }, {
"-25",-128+256 } } },
1891 { { {
"0", 32+256 }, {
"0", 32+256 }, {
"0", 32+256 }, {
"0", 0+256 } } },
1892 { { {
"25", 142+256 }, {
"25", 144+256 }, {
"25", 144+256 }, {
"25", 128+256 } } },
1893 { { {
"50", 251+256 }, {
"50", 256+256 }, {
"50", 256+256 }, {
"50", 256+256 } } },
1894 { { {
"75", 361+256 }, {
"75", 368+256 }, {
"75", 368+256 }, {
"75", 384+256 } } },
1895 { { {
"100", 470+256 }, {
"100", 480+256 }, {
"100", 480+256 }, {
"100", 512+256 } } },
1896 { { {
"125", 580+256 }, {
"125", 592+256 }, {
"125", 592+256 }, {
"125", 640+256 } } },
1900 { { {
"-25",-156+512 }, {
"-25",-160+512 }, {
"-25",-160+512 }, {
"-25", -256+512 } } },
1901 { { {
"0", 64+512 }, {
"0", 64+512 }, {
"0", 64+512 }, {
"0", 0+512 } } },
1902 { { {
"25", 283+512 }, {
"25", 288+512 }, {
"25", 288+512 }, {
"25", 256+512 } } },
1903 { { {
"50", 502+512 }, {
"50", 512+512 }, {
"50", 512+512 }, {
"50", 512+512 } } },
1904 { { {
"75", 721+512 }, {
"75", 736+512 }, {
"75", 736+512 }, {
"75", 768+512 } } },
1905 { { {
"100", 940+512 }, {
"100", 960+512 }, {
"100", 960+512 }, {
"100", 1024+512 } } },
1906 { { {
"125",1160+512 }, {
"125",1184+512 }, {
"125",1184+512 }, {
"125", 1280+512 } } },
1910 { { {
"-25", -624+2048 }, {
"-25", -640+2048 }, {
"-25", -640+2048 }, {
"-25",-1024+2048 } } },
1911 { { {
"0", 256+2048 }, {
"0", 256+2048 }, {
"0", 256+2048 }, {
"0", 0+2048 } } },
1912 { { {
"25", 1132+2048 }, {
"25", 1152+2048 }, {
"25", 1152+2048 }, {
"25", 1024+2048 } } },
1913 { { {
"50", 2008+2048 }, {
"50", 2048+2048 }, {
"50", 2048+2048 }, {
"50", 2048+2048 } } },
1914 { { {
"75", 2884+2048 }, {
"75", 2944+2048 }, {
"75", 2944+2048 }, {
"75", 3072+2048 } } },
1915 { { {
"100", 3760+2048 }, {
"100", 3840+2048 }, {
"100", 3840+2048 }, {
"100", 4096+2048 } } },
1916 { { {
"125", 4640+2048 }, {
"125", 4736+2048 }, {
"125", 4736+2048 }, {
"125", 5120+2048 } } },
1920 { { {
"16", 16+256 }, {
"16", 16+256 }, {
"16", 16+256 }, {
"0", 0+256 } } },
1921 { { {
"128", 128+256 }, {
"128", 128+256 }, {
"128", 128+256 }, {
"128", 128+256 } } },
1922 { { {
"235", 235+256 }, {
"240", 240+256 }, {
"240", 240+256 }, {
"255", 255+256 } } },
1926 { { {
"32", 32+512 }, {
"32", 32+512 }, {
"32", 32+512 }, {
"0", 0+512 } } },
1927 { { {
"256", 256+512 }, {
"256", 256+512 }, {
"256", 256+512 }, {
"256", 256+512 } } },
1928 { { {
"470", 470+512 }, {
"480", 480+512 }, {
"480", 480+512 }, {
"511", 511+512 } } },
1932 { { {
"64", 64+1024 }, {
"64", 64+1024 }, {
"64", 64+1024 }, {
"0", 0+1024 } } },
1933 { { {
"512", 512+1024 }, {
"512", 512+1024 }, {
"512", 512+1024 }, {
"512", 512+1024 } } },
1934 { { {
"940", 940+1024 }, {
"960", 960+1024 }, {
"960", 960+1024 }, {
"1023", 1023+1024 } } },
1938 { { {
"256", 256+4096 }, {
"256", 256+4096 }, {
"256", 256+4096 }, {
"0", 0+4096 } } },
1939 { { {
"2048", 2048+4096 }, {
"2048", 2048+4096 }, {
"2048", 2048+4096 }, {
"2048", 2048+4096 } } },
1940 { { {
"3760", 3760+4096 }, {
"3840", 3840+4096 }, {
"3840", 3840+4096 }, {
"4095", 4095+4096 } } },
1944 { { {
"0", 16+256 }, {
"0", 16+256 }, {
"0", 16+256 }, {
"0", 0+256 } } },
1945 { { {
"175", 71+256 }, {
"175", 72+256 }, {
"175", 72+256 }, {
"175", 64+256 } } },
1946 { { {
"350", 126+256 }, {
"350", 128+256 }, {
"350", 128+256 }, {
"350", 128+256 } } },
1947 { { {
"525", 180+256 }, {
"525", 184+256 }, {
"525", 184+256 }, {
"525", 192+256 } } },
1948 { { {
"700", 235+256 }, {
"700", 240+256 }, {
"700", 240+256 }, {
"700", 255+256 } } },
1952 { { {
"0", 32+512 }, {
"0", 32+512 }, {
"0", 32+512 }, {
"0", 0+512 } } },
1953 { { {
"175", 142+512 }, {
"175", 144+512 }, {
"175", 144+512 }, {
"175", 128+512 } } },
1954 { { {
"350", 251+512 }, {
"350", 256+512 }, {
"350", 256+512 }, {
"350", 256+512 } } },
1955 { { {
"525", 361+512 }, {
"525", 368+512 }, {
"525", 368+512 }, {
"525", 384+512 } } },
1956 { { {
"700", 470+512 }, {
"700", 480+512 }, {
"700", 480+512 }, {
"700", 511+512 } } },
1960 { { {
"0", 64+1024 }, {
"0", 64+1024 }, {
"0", 64+1024 }, {
"0", 0+1024 } } },
1961 { { {
"175", 283+1024 }, {
"175", 288+1024 }, {
"175", 288+1024 }, {
"175", 256+1024 } } },
1962 { { {
"350", 502+1024 }, {
"350", 512+1024 }, {
"350", 512+1024 }, {
"350", 512+1024 } } },
1963 { { {
"525", 721+1024 }, {
"525", 736+1024 }, {
"525", 736+1024 }, {
"525", 768+1024 } } },
1964 { { {
"700", 940+1024 }, {
"700", 960+1024 }, {
"700", 960+1024 }, {
"700", 1023+1024 } } },
1968 { { {
"0", 256+4096 }, {
"0", 256+4096 }, {
"0", 256+4096 }, {
"0", 0+4096 } } },
1969 { { {
"175", 1132+4096 }, {
"175", 1152+4096 }, {
"175", 1152+4096 }, {
"175", 1024+4096 } } },
1970 { { {
"350", 2008+4096 }, {
"350", 2048+4096 }, {
"350", 2048+4096 }, {
"350", 2048+4096 } } },
1971 { { {
"525", 2884+4096 }, {
"525", 2944+4096 }, {
"525", 2944+4096 }, {
"525", 3072+4096 } } },
1972 { { {
"700", 3760+4096 }, {
"700", 3840+4096 }, {
"700", 3840+4096 }, {
"700", 4095+4096 } } },
1976 { { {
"-25", -39+256 }, {
"-25", -40+256 }, {
"-25", -40+256 }, {
"-25", -64+256 } } },
1977 { { {
"0", 16+256 }, {
"0", 16+256 }, {
"0", 16+256 }, {
"0", 0+256 } } },
1978 { { {
"25", 71+256 }, {
"25", 72+256 }, {
"25", 72+256 }, {
"25", 64+256 } } },
1979 { { {
"50", 126+256 }, {
"50", 128+256 }, {
"50", 128+256 }, {
"50", 128+256 } } },
1980 { { {
"75", 180+256 }, {
"75", 184+256 }, {
"75", 184+256 }, {
"75", 192+256 } } },
1981 { { {
"100", 235+256 }, {
"100", 240+256 }, {
"100", 240+256 }, {
"100", 256+256 } } },
1982 { { {
"125", 290+256 }, {
"125", 296+256 }, {
"125", 296+256 }, {
"125", 320+256 } } },
1986 { { {
"-25", -78+512 }, {
"-25", -80+512 }, {
"-25", -80+512 }, {
"-25",-128+512 } } },
1987 { { {
"0", 32+512 }, {
"0", 32+512 }, {
"0", 32+512 }, {
"0", 0+512 } } },
1988 { { {
"25", 142+512 }, {
"25", 144+512 }, {
"25", 144+512 }, {
"25", 128+512 } } },
1989 { { {
"50", 251+512 }, {
"50", 256+512 }, {
"50", 256+512 }, {
"50", 256+512 } } },
1990 { { {
"75", 361+512 }, {
"75", 368+512 }, {
"75", 368+512 }, {
"75", 384+512 } } },
1991 { { {
"100", 470+512 }, {
"100", 480+512 }, {
"100", 480+512 }, {
"100", 512+512 } } },
1992 { { {
"125", 580+512 }, {
"125", 592+512 }, {
"125", 592+512 }, {
"125", 640+512 } } },
1996 { { {
"-25",-156+1024 }, {
"-25",-160+1024 }, {
"-25",-160+1024 }, {
"-25", -256+1024 } } },
1997 { { {
"0", 64+1024 }, {
"0", 64+1024 }, {
"0", 64+1024 }, {
"0", 0+1024 } } },
1998 { { {
"25", 283+1024 }, {
"25", 288+1024 }, {
"25", 288+1024 }, {
"25", 256+1024 } } },
1999 { { {
"50", 502+1024 }, {
"50", 512+1024 }, {
"50", 512+1024 }, {
"50", 512+1024 } } },
2000 { { {
"75", 721+1024 }, {
"75", 736+1024 }, {
"75", 736+1024 }, {
"75", 768+1024 } } },
2001 { { {
"100", 940+1024 }, {
"100", 960+1024 }, {
"100", 960+1024 }, {
"100", 1024+1024 } } },
2002 { { {
"125",1160+1024 }, {
"125",1184+1024 }, {
"125",1184+1024 }, {
"125", 1280+1024 } } },
2006 { { {
"-25", -624+4096 }, {
"-25", -640+4096 }, {
"-25", -640+4096 }, {
"-25",-1024+4096 } } },
2007 { { {
"0", 256+4096 }, {
"0", 256+4096 }, {
"0", 256+4096 }, {
"0", 0+4096 } } },
2008 { { {
"25", 1132+4096 }, {
"25", 1152+4096 }, {
"25", 1152+4096 }, {
"25", 1024+4096 } } },
2009 { { {
"50", 2008+4096 }, {
"50", 2048+4096 }, {
"50", 2048+4096 }, {
"50", 2048+4096 } } },
2010 { { {
"75", 2884+4096 }, {
"75", 2944+4096 }, {
"75", 2944+4096 }, {
"75", 3072+4096 } } },
2011 { { {
"100", 3760+4096 }, {
"100", 3840+4096 }, {
"100", 3840+4096 }, {
"100", 4096+4096 } } },
2012 { { {
"125", 4640+4096 }, {
"125", 4736+4096 }, {
"125", 4736+4096 }, {
"125", 5120+4096 } } },
2016 { { {
"16", 16 }, {
"16", 16 }, {
"16", 16 }, {
"0", 0 } } },
2017 { { {
"128", 128 }, {
"128", 128 }, {
"128", 128 }, {
"128", 128 } } },
2018 { { {
"235", 235 }, {
"240", 240 }, {
"240", 240 }, {
"255", 255 } } },
2022 { { {
"32", 32 }, {
"32", 32 }, {
"32", 32 }, {
"0", 0 } } },
2023 { { {
"256", 256 }, {
"256", 256 }, {
"256", 256 }, {
"256", 256 } } },
2024 { { {
"470", 470 }, {
"480", 480 }, {
"480", 480 }, {
"511", 511 } } },
2028 { { {
"64", 64 }, {
"64", 64 }, {
"64", 64 }, {
"0", 0 } } },
2029 { { {
"512", 512 }, {
"512", 512 }, {
"512", 512 }, {
"512", 512 } } },
2030 { { {
"940", 940 }, {
"960", 960 }, {
"960", 960 }, {
"1023", 1023 } } },
2034 { { {
"256", 256 }, {
"256", 256 }, {
"256", 256 }, {
"0", 0 } } },
2035 { { {
"2048", 2048 }, {
"2048", 2048 }, {
"2048", 2048 }, {
"2048", 2048 } } },
2036 { { {
"3760", 3760 }, {
"3840", 3840 }, {
"3840", 3840 }, {
"4095", 4095 } } },
2040 { { {
"0", 16 }, {
"0", 16 }, {
"0", 16 }, {
"0", 0 } } },
2041 { { {
"175", 71 }, {
"175", 72 }, {
"175", 72 }, {
"175", 64 } } },
2042 { { {
"350", 126 }, {
"350", 128 }, {
"350", 128 }, {
"350", 128 } } },
2043 { { {
"525", 180 }, {
"525", 184 }, {
"525", 184 }, {
"525", 192 } } },
2044 { { {
"700", 235 }, {
"700", 240 }, {
"700", 240 }, {
"700", 255 } } },
2048 { { {
"0", 32 }, {
"0", 32 }, {
"0", 32 }, {
"0", 0 } } },
2049 { { {
"175", 142 }, {
"175", 144 }, {
"175", 144 }, {
"175", 128 } } },
2050 { { {
"350", 251 }, {
"350", 256 }, {
"350", 256 }, {
"350", 256 } } },
2051 { { {
"525", 361 }, {
"525", 368 }, {
"525", 368 }, {
"525", 384 } } },
2052 { { {
"700", 470 }, {
"700", 480 }, {
"700", 480 }, {
"700", 511 } } },
2056 { { {
"0", 64 }, {
"0", 64 }, {
"0", 64 }, {
"0", 0 } } },
2057 { { {
"175", 283 }, {
"175", 288 }, {
"175", 288 }, {
"175", 256 } } },
2058 { { {
"350", 502 }, {
"350", 512 }, {
"350", 512 }, {
"350", 512 } } },
2059 { { {
"525", 721 }, {
"525", 736 }, {
"525", 736 }, {
"525", 768 } } },
2060 { { {
"700", 940 }, {
"700", 960 }, {
"700", 960 }, {
"700", 1023 } } },
2064 { { {
"0", 256 }, {
"0", 256 }, {
"0", 256 }, {
"0", 0 } } },
2065 { { {
"175", 1132 }, {
"175", 1152 }, {
"175", 1152 }, {
"175", 1024 } } },
2066 { { {
"350", 2008 }, {
"350", 2048 }, {
"350", 2048 }, {
"350", 2048 } } },
2067 { { {
"525", 2884 }, {
"525", 2944 }, {
"525", 2944 }, {
"525", 3072 } } },
2068 { { {
"700", 3760 }, {
"700", 3840 }, {
"700", 3840 }, {
"700", 4095 } } },
2072 { { {
"0", 16 }, {
"0", 16 }, {
"0", 16 }, {
"0", 0 } } },
2073 { { {
"25", 71 }, {
"25", 72 }, {
"25", 72 }, {
"25", 64 } } },
2074 { { {
"50", 126 }, {
"50", 128 }, {
"50", 128 }, {
"50", 128 } } },
2075 { { {
"75", 180 }, {
"75", 184 }, {
"75", 184 }, {
"75", 192 } } },
2076 { { {
"100", 235 }, {
"100", 240 }, {
"100", 240 }, {
"100", 255 } } },
2080 { { {
"0", 32 }, {
"0", 32 }, {
"0", 32 }, {
"0", 0 } } },
2081 { { {
"25", 142 }, {
"25", 144 }, {
"25", 144 }, {
"25", 128 } } },
2082 { { {
"50", 251 }, {
"50", 256 }, {
"50", 256 }, {
"50", 256 } } },
2083 { { {
"75", 361 }, {
"75", 368 }, {
"75", 368 }, {
"75", 384 } } },
2084 { { {
"100", 470 }, {
"100", 480 }, {
"100", 480 }, {
"100", 511 } } },
2088 { { {
"0", 64 }, {
"0", 64 }, {
"0", 64 }, {
"0", 0 } } },
2089 { { {
"25", 283 }, {
"25", 288 }, {
"25", 288 }, {
"25", 256 } } },
2090 { { {
"50", 502 }, {
"50", 512 }, {
"50", 512 }, {
"50", 512 } } },
2091 { { {
"75", 721 }, {
"75", 736 }, {
"75", 736 }, {
"75", 768 } } },
2092 { { {
"100", 940 }, {
"100", 960 }, {
"100", 960 }, {
"100", 1023 } } },
2096 { { {
"0", 256 }, {
"0", 256 }, {
"0", 256 }, {
"0", 0 } } },
2097 { { {
"25", 1132 }, {
"25", 1152 }, {
"25", 1152 }, {
"25", 1024 } } },
2098 { { {
"50", 2008 }, {
"50", 2048 }, {
"50", 2048 }, {
"50", 2048 } } },
2099 { { {
"75", 2884 }, {
"75", 2944 }, {
"75", 2944 }, {
"75", 3072 } } },
2100 { { {
"100", 3760 }, {
"100", 3840 }, {
"100", 3840 }, {
"100", 4095 } } },
2104 { { {
"50", 50 }, {
"50", 50 }, {
"50", 50 }, {
"50", 50 } } },
2105 { { {
"100", 100 }, {
"100", 100 }, {
"100", 100 }, {
"100", 100 } } },
2106 { { {
"150", 150 }, {
"150", 150 }, {
"150", 150 }, {
"150", 150 } } },
2107 { { {
"200", 200 }, {
"200", 200 }, {
"200", 200 }, {
"200", 200 } } },
2108 { { {
"255", 255 }, {
"255", 255 }, {
"255", 255 }, {
"255", 255 } } },
2112 { { {
"100", 100 }, {
"100", 100 }, {
"100", 100 }, {
"100", 100 } } },
2113 { { {
"200", 200 }, {
"200", 200 }, {
"200", 200 }, {
"200", 200 } } },
2114 { { {
"300", 300 }, {
"300", 300 }, {
"300", 300 }, {
"300", 300 } } },
2115 { { {
"400", 400 }, {
"400", 400 }, {
"400", 400 }, {
"400", 400 } } },
2116 { { {
"500", 500 }, {
"500", 500 }, {
"500", 500 }, {
"500", 500 } } },
2120 { { {
"200", 200 }, {
"200", 200 }, {
"200", 200 }, {
"200", 200 } } },
2121 { { {
"400", 400 }, {
"400", 400 }, {
"400", 400 }, {
"400", 400 } } },
2122 { { {
"600", 600 }, {
"600", 600 }, {
"600", 600 }, {
"600", 600 } } },
2123 { { {
"800", 800 }, {
"800", 800 }, {
"800", 800 }, {
"800", 800 } } },
2124 { { {
"1000",1000 }, {
"1000",1000 }, {
"1000",1000 }, {
"1000",1000 } } },
2128 { { {
"800", 800 }, {
"800", 800 }, {
"800", 800 }, {
"800", 800 } } },
2129 { { {
"1600", 1600 }, {
"1600", 1600 }, {
"1600", 1600 }, {
"1600", 1600 } } },
2130 { { {
"2400", 2400 }, {
"2400", 2400 }, {
"2400", 2400 }, {
"2400", 2400 } } },
2131 { { {
"3200", 3200 }, {
"3200", 3200 }, {
"3200", 3200 }, {
"3200", 3200 } } },
2132 { { {
"4000", 4000 }, {
"4000", 4000 }, {
"4000", 4000 }, {
"4000", 4000 } } },
2139 for (y = 0; y <
height; y += step) {
2140 dst[0] = v * o1 + dst[0] * o2;
2142 dst += linesize * step;
2150 for (y = 0; y <
height; y += step) {
2151 dst[0] = v * o1 + dst[0] * o2;
2153 dst += (linesize / 2) * step;
2161 for (x = 0; x <
width; x += step) {
2162 dst[x] = v * o1 + dst[x] * o2;
2170 for (x = 0; x <
width; x += step) {
2171 dst[x] = v * o1 + dst[x] * o2;
2183 for (plane = 0; plane < 4 && out->
data[
plane]; plane++) {
2184 for (i = 0; txt[i]; i++) {
2186 int v = color[
plane];
2189 for (char_y = 0; char_y < font_height; char_y++) {
2190 for (mask = 0x80;
mask; mask >>= 1) {
2191 if (font[txt[i] * font_height + char_y] & mask)
2192 p[0] = p[0] * o2 + v * o1;
2209 for (plane = 0; plane < 4 && out->
data[
plane]; plane++) {
2210 for (i = 0; txt[i]; i++) {
2214 uint16_t *p = (uint16_t *)(out->
data[plane] + y * out->
linesize[plane]) + (x + i * 8);
2215 for (char_y = 0; char_y < font_height; char_y++) {
2216 for (mask = 0x80;
mask; mask >>= 1) {
2217 if (font[txt[i] * font_height + char_y] & mask)
2218 p[0] = p[0] * o2 + v * o1;
2235 for (plane = 0; plane < 4 && out->
data[
plane]; plane++) {
2236 for (i = 0; txt[i]; i++) {
2238 int v = color[
plane];
2240 for (char_y = font_height - 1; char_y >= 0; char_y--) {
2242 for (mask = 0x80;
mask; mask >>= 1) {
2243 if (font[txt[i] * font_height + font_height - 1 - char_y] & mask)
2244 p[char_y] = p[char_y] * o2 + v * o1;
2260 for (plane = 0; plane < 4 && out->
data[
plane]; plane++) {
2261 for (i = 0; txt[i]; i++) {
2265 for (char_y = 0; char_y < font_height; char_y++) {
2266 uint16_t *p = (uint16_t *)(out->
data[plane] + (y + i * 10) * out->
linesize[
plane]) + x;
2267 for (mask = 0x80;
mask; mask >>= 1) {
2268 if (font[txt[i] * font_height + font_height - 1 - char_y] & mask)
2269 p[char_y] = p[char_y] * o2 + v * o1;
2283 const int step = (s->
flags & 2) + 1;
2285 const float o2 = 1. - o1;
2287 int k = 0,
c, p, l, offset_x = 0, offset_y = 0;
2294 for (p = 0; p < s->
ncomp; p++) {
2298 int x = offset_x + (s->
mirror ? s->
size - 1 - pos : pos);
2308 int x = offset_x + (s->
mirror ? s->
size - 1 - pos : pos) - 10;
2323 const int step = (s->
flags & 2) + 1;
2325 const float o2 = 1. - o1;
2328 int k = 0,
c, p, l, offset_x = 0, offset_y = 0;
2335 for (p = 0; p < s->
ncomp; p++) {
2339 int x = offset_x + (s->
mirror ? s->
size - 1 - pos : pos);
2340 uint16_t *dst = (uint16_t *)(out->
data[p] + offset_y * out->
linesize[p]) + x;
2349 int x = offset_x + (s->
mirror ? s->
size - 1 - pos : pos) - 10;
2364 const int step = (s->
flags & 2) + 1;
2366 const float o2 = 1. - o1;
2368 int k = 0,
c, p, l, offset_y = 0, offset_x = 0;
2375 for (p = 0; p < s->
ncomp; p++) {
2379 int y = offset_y + (s->
mirror ? s->
size - 1 - pos : pos);
2389 int y = offset_y + (s->
mirror ? s->
size - 1 - pos : pos) - 10;
2404 const int step = (s->
flags & 2) + 1;
2406 const float o2 = 1. - o1;
2409 int k = 0,
c, p, l, offset_x = 0, offset_y = 0;
2416 for (p = 0; p < s->
ncomp; p++) {
2420 int y = offset_y + (s->
mirror ? s->
size - 1 - pos : pos);
2421 uint16_t *dst = (uint16_t *)(out->
data[p] + y * out->
linesize[p]) + offset_x;
2430 int y = offset_y + (s->
mirror ? s->
size - 1 - pos: pos) - 10;
2463 case FLAT: s->
size = 256 * 3;
break;
2464 default: s->
size = 256;
break;
2469 case 0x1100: s->
waveform = lowpass_column_mirror;
break;
2470 case 0x1000: s->
waveform = lowpass_row_mirror;
break;
2471 case 0x0100: s->
waveform = lowpass_column;
break;
2472 case 0x0000: s->
waveform = lowpass_row;
break;
2473 case 0x1110: s->
waveform = lowpass16_column_mirror;
break;
2474 case 0x1010: s->
waveform = lowpass16_row_mirror;
break;
2475 case 0x0110: s->
waveform = lowpass16_column;
break;
2476 case 0x0010: s->
waveform = lowpass16_row;
break;
2652 switch (inlink->
format) {
2675 int comp = 0, i, j = 0, k, p,
size;
2677 for (i = 0; i < s->
ncomp; i++) {
2678 if ((1 << i) & s->
pcomp)
2701 for (p = 0; p < s->
ncomp; p++) {
2705 if (!((1 << p) & s->
pcomp))
2708 for (k = 0; k < 4; k++) {
2716 for (i = 0; i <
size; i++) {
2717 for (k = 0; k < 4; k++) {
2745 for (k = 0; k < s->
dcomp; k++) {
2747 for (i = 0; i < outlink->
h ; i++)
2752 const int mult = s->
max / 256;
2755 for (i = 0; i < outlink->
h ; i++) {
2756 for (j = 0; j < outlink->
w; j++)
2763 for (k = 0, i = 0; k < s->
ncomp; k++) {
2764 if ((1 << k) & s->
pcomp) {
2769 offset_x = s->
mode ? i++ * inlink->
w : 0;
2770 offset_y = s->
mode ? 0 : i++ * inlink->
h;
2814 .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.
const char * name
Pad name.
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
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 ...
static void comp(unsigned char *dst, int dst_stride, unsigned char *src, int src_stride, int add)
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.
CGA/EGA/VGA ROM font data.
AVFilterFormats * out_formats
#define AV_CEIL_RSHIFT(a, b)