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
284 int depth, rgb, i, ret,
ncomp;
325 else if (rgb && depth == 8 && ncomp > 2)
327 else if (rgb && depth == 9 && ncomp > 2)
329 else if (rgb && depth == 10 && ncomp > 2)
331 else if (rgb && depth == 12 && ncomp > 2)
333 else if (depth == 8 && ncomp > 2)
335 else if (depth == 9 && ncomp > 2)
337 else if (depth == 10 && ncomp > 2)
339 else if (depth == 12 && ncomp > 2)
351 const int dst_linesize = out->
linesize[component] / 2;
352 const int bg = s->
bg_color[component] * (s->
max / 256);
353 const int limit = s->
max - 1;
362 for (x = offset; x < offset + dst_w; x++) {
363 for (y = start; y <
end; y++) {
364 dst = (uint16_t *)out->
data[component] + y * dst_linesize + x;
370 for (y = end - 1; y >=
start; y--) {
371 dst = (uint16_t *)out->
data[component] + y * dst_linesize + x;
379 for (y = offset; y < offset + dst_h; y++) {
380 dst = (uint16_t *)out->
data[component] + y * dst_linesize;
381 for (x = start; x <
end; x++) {
387 for (x = end - 1; x >=
start; x--) {
399 const int dst_linesize = out->
linesize[component];
409 for (x = offset; x < offset + dst_w; x++) {
410 for (y = start; y <
end; y++) {
411 dst = out->
data[component] + y * dst_linesize + x;
417 for (y = end - 1; y >=
start; y--) {
418 dst = out->
data[component] + y * dst_linesize + x;
426 for (y = offset; y < offset + dst_h; y++) {
427 dst = out->
data[component] + y * dst_linesize;
428 for (x = start; x <
end; x++) {
434 for (x = end - 1; x >=
start; x--) {
446 const int dst_linesize = out->
linesize[component] / 2;
447 const int bg = s->
bg_color[component] * (s->
max / 256);
448 const int limit = s->
max - 1;
459 for (x = offset; x < offset + dst_w; x++) {
460 for (y = start; y < end && y < emin[x -
offset]; y++) {
461 dst = (uint16_t *)out->
data[component] + y * dst_linesize + x;
467 for (y = end - 1; y >= start && y >= emax[x -
offset]; y--) {
468 dst = (uint16_t *)out->
data[component] + y * dst_linesize + x;
479 for (x = offset; x < offset + dst_w; x++) {
480 dst = (uint16_t *)out->
data[component] + emin[x - offset] * dst_linesize + x;
482 dst = (uint16_t *)out->
data[component] + emax[x -
offset] * dst_linesize + x;
486 for (y = offset; y < offset + dst_h; y++) {
487 dst = (uint16_t *)out->
data[component] + y * dst_linesize;
488 for (x = start; x < end && x < emin[y -
offset]; x++) {
494 for (x = end - 1; x >= start && x >= emax[y -
offset]; x--) {
505 for (y = offset; y < offset + dst_h; y++) {
506 dst = (uint16_t *)out->
data[component] + y * dst_linesize + emin[y - offset];
508 dst = (uint16_t *)out->
data[component] + y * dst_linesize + emax[y -
offset];
516 const int dst_linesize = out->
linesize[component];
517 const int bg = s->
bg_color[component];
528 for (x = offset; x < offset + dst_w; x++) {
529 for (y = start; y < end && y < emin[x -
offset]; y++) {
530 dst = out->
data[component] + y * dst_linesize + x;
536 for (y = end - 1; y >= start && y >= emax[x -
offset]; y--) {
537 dst = out->
data[component] + y * dst_linesize + x;
548 for (x = offset; x < offset + dst_w; x++) {
549 dst = out->
data[component] + emin[x -
offset] * dst_linesize + x;
551 dst = out->
data[component] + emax[x -
offset] * dst_linesize + x;
555 for (y = offset; y < offset + dst_h; y++) {
556 dst = out->
data[component] + y * dst_linesize;
557 for (x = start; x < end && x < emin[y -
offset]; x++) {
563 for (x = end - 1; x >= start && x >= emax[y -
offset]; x--) {
574 for (y = offset; y < offset + dst_h; y++) {
575 dst = out->
data[component] + y * dst_linesize + emin[y -
offset];
577 dst = out->
data[component] + y * dst_linesize + emax[y -
offset];
624 int offset_y,
int offset_x,
632 const int dst_signed_linesize = dst_linesize * (mirror == 1 ? -1 : 1);
633 const int limit = s->
max - 1;
637 const uint16_t *src_data = (
const uint16_t *)in->
data[plane];
638 uint16_t *dst_data = (uint16_t *)out->
data[
plane] + offset_y * dst_linesize + offset_x;
639 uint16_t *
const dst_bottom_line = dst_data + dst_linesize * (s->
size - 1);
640 uint16_t *
const dst_line = (mirror ? dst_bottom_line : dst_data);
641 const int step = column ? 1 << shift_w : 1 <<
shift_h;
645 if (!column && mirror)
648 for (y = 0; y < src_h; y++) {
649 const uint16_t *src_data_end = src_data + src_w;
650 uint16_t *dst = dst_line;
652 for (p = src_data; p < src_data_end; p++) {
654 int i = 0, v =
FFMIN(*p, limit);
658 target = dst++ + dst_signed_linesize * v;
659 update16(target, max, intensity, limit);
660 }
while (++i < step);
662 uint16_t *row = dst_data;
665 target = row - v - 1;
668 update16(target, max, intensity, limit);
670 }
while (++i < step);
673 src_data += src_linesize;
674 dst_data += dst_linesize * step;
677 envelope16(s, out, plane, plane, column ? offset_x : offset_y);
680 #define LOWPASS16_FUNC(name, column, mirror) \
681 static void lowpass16_##name(WaveformContext *s, \
682 AVFrame *in, AVFrame *out, \
683 int component, int intensity, \
684 int offset_y, int offset_x, \
685 int unused1, int unused2) \
687 lowpass16(s, in, out, component, intensity, \
688 offset_y, offset_x, column, mirror); \
699 int offset_y,
int offset_x,
702 const int plane = s->desc->comp[component].plane;
703 const int shift_w = s->shift_w[component];
704 const int shift_h = s->shift_h[component];
705 const int src_linesize = in->linesize[
plane];
706 const int dst_linesize = out->linesize[
plane];
707 const int dst_signed_linesize = dst_linesize * (mirror == 1 ? -1 : 1);
712 uint8_t *dst_data = out->data[
plane] + offset_y * dst_linesize + offset_x;
713 uint8_t *
const dst_bottom_line = dst_data + dst_linesize * (s->size - 1);
714 uint8_t *
const dst_line = (mirror ? dst_bottom_line : dst_data);
715 const int step = column ? 1 << shift_w : 1 <<
shift_h;
719 if (!column && mirror)
722 for (y = 0; y < src_h; y++) {
723 const uint8_t *src_data_end = src_data + src_w;
726 for (p = src_data; p < src_data_end; p++) {
729 target = dst + dst_signed_linesize * *p;
731 update(target, max, intensity);
735 target = row - *p - 1;
738 update(target, max, intensity);
742 src_data += src_linesize;
743 dst_data += dst_linesize * step;
746 if (column && step > 1) {
747 const int dst_w = s->display ==
PARADE ? out->width / s->acomp : out->width;
748 const int dst_h = 256;
752 dst = out->data[
plane] + offset_y * dst_linesize + offset_x;
753 for (y = 0; y < dst_h; y++) {
754 for (x = 0; x < dst_w; x+=step) {
755 for (z = 1; z < step; z++) {
761 }
else if (step > 1) {
762 const int dst_h = s->display ==
PARADE ? out->height / s->acomp : out->height;
763 const int dst_w = 256;
767 dst = out->data[
plane] + offset_y * dst_linesize + offset_x;
768 for (y = 0; y < dst_h; y+=step) {
769 for (z = 1; z < step; z++)
770 memcpy(dst + dst_linesize * z, dst, dst_w);
771 dst += dst_linesize * step;
775 envelope(s, out, plane, plane, column ? offset_x : offset_y);
778 #define LOWPASS_FUNC(name, column, mirror) \
779 static void lowpass_##name(WaveformContext *s, \
780 AVFrame *in, AVFrame *out, \
781 int component, int intensity, \
782 int offset_y, int offset_x, \
783 int unused1, int unused2) \
785 lowpass(s, in, out, component, intensity, \
786 offset_y, offset_x, column, mirror); \
797 int offset_y,
int offset_x,
800 const int plane = s->desc->comp[component].plane;
801 const int c0_linesize = in->linesize[ plane + 0 ] / 2;
802 const int c1_linesize = in->linesize[(plane + 1) % s->ncomp] / 2;
803 const int c2_linesize = in->linesize[(plane + 2) % s->ncomp] / 2;
804 const int c0_shift_w = s->shift_w[ component + 0 ];
805 const int c1_shift_w = s->shift_w[(component + 1) % s->ncomp];
806 const int c2_shift_w = s->shift_w[(component + 2) % s->ncomp];
807 const int c0_shift_h = s->shift_h[ component + 0 ];
808 const int c1_shift_h = s->shift_h[(component + 1) % s->ncomp];
809 const int c2_shift_h = s->shift_h[(component + 2) % s->ncomp];
810 const int d0_linesize = out->linesize[ plane + 0 ] / 2;
811 const int d1_linesize = out->linesize[(plane + 1) % s->ncomp] / 2;
812 const int limit = s->max - 1;
813 const int max = limit - intensity;
814 const int mid = s->max / 2;
815 const int src_h = in->height;
816 const int src_w = in->width;
820 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1);
821 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1);
823 for (x = 0; x < src_w; x++) {
824 const uint16_t *c0_data = (uint16_t *)in->data[plane + 0];
825 const uint16_t *c1_data = (uint16_t *)in->data[(plane + 1) % s->ncomp];
826 const uint16_t *c2_data = (uint16_t *)in->data[(plane + 2) % s->ncomp];
827 uint16_t *d0_data = (uint16_t *)(out->data[
plane]) + offset_y * d0_linesize + offset_x;
828 uint16_t *d1_data = (uint16_t *)(out->data[(plane + 1) % s->ncomp]) + offset_y * d1_linesize + offset_x;
829 uint16_t *
const d0_bottom_line = d0_data + d0_linesize * (s->size - 1);
830 uint16_t *
const d0 = (mirror ? d0_bottom_line : d0_data);
831 uint16_t *
const d1_bottom_line = d1_data + d1_linesize * (s->size - 1);
832 uint16_t *
const d1 = (mirror ? d1_bottom_line : d1_data);
834 for (y = 0; y < src_h; y++) {
835 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit) + s->max;
836 const int c1 =
FFMIN(
FFABS(c1_data[x >> c1_shift_w] - mid) +
FFABS(c2_data[x >> c2_shift_w] - mid), limit);
839 target = d0 + x + d0_signed_linesize * c0;
841 target = d1 + x + d1_signed_linesize * (c0 -
c1);
843 target = d1 + x + d1_signed_linesize * (c0 +
c1);
846 if (!c0_shift_h || (y & c0_shift_h))
847 c0_data += c0_linesize;
848 if (!c1_shift_h || (y & c1_shift_h))
849 c1_data += c1_linesize;
850 if (!c2_shift_h || (y & c2_shift_h))
851 c2_data += c2_linesize;
852 d0_data += d0_linesize;
853 d1_data += d1_linesize;
857 const uint16_t *c0_data = (uint16_t *)in->data[plane];
858 const uint16_t *c1_data = (uint16_t *)in->data[(plane + 1) % s->ncomp];
859 const uint16_t *c2_data = (uint16_t *)in->data[(plane + 2) % s->ncomp];
860 uint16_t *d0_data = (uint16_t *)(out->data[
plane]) + offset_y * d0_linesize + offset_x;
861 uint16_t *d1_data = (uint16_t *)(out->data[(plane + 1) % s->ncomp]) + offset_y * d1_linesize + offset_x;
864 d0_data += s->size - 1;
865 d1_data += s->size - 1;
868 for (y = 0; y < src_h; y++) {
869 for (x = 0; x < src_w; x++) {
870 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit) + s->max;
871 const int c1 =
FFMIN(
FFABS(c1_data[x >> c1_shift_w] - mid) +
FFABS(c2_data[x >> c2_shift_w] - mid), limit);
875 target = d0_data - c0;
877 target = d1_data - (c0 -
c1);
879 target = d1_data - (c0 +
c1);
882 target = d0_data + c0;
884 target = d1_data + (c0 -
c1);
886 target = d1_data + (c0 +
c1);
891 if (!c0_shift_h || (y & c0_shift_h))
892 c0_data += c0_linesize;
893 if (!c1_shift_h || (y & c1_shift_h))
894 c1_data += c1_linesize;
895 if (!c2_shift_h || (y & c2_shift_h))
896 c2_data += c2_linesize;
897 d0_data += d0_linesize;
898 d1_data += d1_linesize;
902 envelope16(s, out, plane, plane, column ? offset_x : offset_y);
903 envelope16(s, out, plane, (plane + 1) % s->ncomp, column ? offset_x : offset_y);
909 int offset_y,
int offset_x,
913 const int c0_linesize = in->
linesize[ plane + 0 ];
914 const int c1_linesize = in->
linesize[(plane + 1) % s->
ncomp];
915 const int c2_linesize = in->
linesize[(plane + 2) % s->
ncomp];
916 const int c0_shift_w = s->
shift_w[ component + 0 ];
917 const int c1_shift_w = s->
shift_w[(component + 1) % s->
ncomp];
918 const int c2_shift_w = s->
shift_w[(component + 2) % s->
ncomp];
919 const int c0_shift_h = s->
shift_h[ component + 0 ];
920 const int c1_shift_h = s->
shift_h[(component + 1) % s->
ncomp];
921 const int c2_shift_h = s->
shift_h[(component + 2) % s->
ncomp];
922 const int d0_linesize = out->
linesize[ plane + 0 ];
923 const int d1_linesize = out->
linesize[(plane + 1) % s->
ncomp];
924 const int max = 255 - intensity;
925 const int src_h = in->
height;
926 const int src_w = in->
width;
930 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1);
931 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1);
933 for (x = 0; x < src_w; x++) {
938 uint8_t *d1_data = out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
939 uint8_t *
const d0_bottom_line = d0_data + d0_linesize * (s->
size - 1);
940 uint8_t *
const d0 = (mirror ? d0_bottom_line : d0_data);
941 uint8_t *
const d1_bottom_line = d1_data + d1_linesize * (s->
size - 1);
942 uint8_t *
const d1 = (mirror ? d1_bottom_line : d1_data);
944 for (y = 0; y < src_h; y++) {
945 const int c0 = c0_data[x >> c0_shift_w] + 256;
946 const int c1 =
FFABS(c1_data[x >> c1_shift_w] - 128) +
FFABS(c2_data[x >> c2_shift_w] - 128);
949 target = d0 + x + d0_signed_linesize * c0;
951 target = d1 + x + d1_signed_linesize * (c0 -
c1);
953 target = d1 + x + d1_signed_linesize * (c0 +
c1);
956 if (!c0_shift_h || (y & c0_shift_h))
957 c0_data += c0_linesize;
958 if (!c1_shift_h || (y & c1_shift_h))
959 c1_data += c1_linesize;
960 if (!c2_shift_h || (y & c2_shift_h))
961 c2_data += c2_linesize;
962 d0_data += d0_linesize;
963 d1_data += d1_linesize;
971 uint8_t *d1_data = out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
974 d0_data += s->
size - 1;
975 d1_data += s->
size - 1;
978 for (y = 0; y < src_h; y++) {
979 for (x = 0; x < src_w; x++) {
980 int c0 = c0_data[x >> c0_shift_w] + 256;
981 const int c1 =
FFABS(c1_data[x >> c1_shift_w] - 128) +
FFABS(c2_data[x >> c2_shift_w] - 128);
985 target = d0_data - c0;
987 target = d1_data - (c0 -
c1);
989 target = d1_data - (c0 +
c1);
992 target = d0_data + c0;
994 target = d1_data + (c0 -
c1);
996 target = d1_data + (c0 +
c1);
1001 if (!c0_shift_h || (y & c0_shift_h))
1002 c0_data += c0_linesize;
1003 if (!c1_shift_h || (y & c1_shift_h))
1004 c1_data += c1_linesize;
1005 if (!c2_shift_h || (y & c2_shift_h))
1006 c2_data += c2_linesize;
1007 d0_data += d0_linesize;
1008 d1_data += d1_linesize;
1012 envelope(s, out, plane, plane, column ? offset_x : offset_y);
1013 envelope(s, out, plane, (plane + 1) % s->
ncomp, column ? offset_x : offset_y);
1019 int offset_y,
int offset_x,
1023 const int c0_linesize = in->
linesize[ plane + 0 ] / 2;
1024 const int c1_linesize = in->
linesize[(plane + 1) % s->
ncomp] / 2;
1025 const int c2_linesize = in->
linesize[(plane + 2) % s->
ncomp] / 2;
1026 const int c0_shift_w = s->
shift_w[ component + 0 ];
1027 const int c1_shift_w = s->
shift_w[(component + 1) % s->
ncomp];
1028 const int c2_shift_w = s->
shift_w[(component + 2) % s->
ncomp];
1029 const int c0_shift_h = s->
shift_h[ component + 0 ];
1030 const int c1_shift_h = s->
shift_h[(component + 1) % s->
ncomp];
1031 const int c2_shift_h = s->
shift_h[(component + 2) % s->
ncomp];
1032 const int d0_linesize = out->
linesize[ plane + 0 ] / 2;
1033 const int d1_linesize = out->
linesize[(plane + 1) % s->
ncomp] / 2;
1034 const int d2_linesize = out->
linesize[(plane + 2) % s->
ncomp] / 2;
1035 const int limit = s->
max - 1;
1037 const int mid = s->
max / 2;
1038 const int src_h = in->
height;
1039 const int src_w = in->
width;
1043 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1);
1044 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1);
1045 const int d2_signed_linesize = d2_linesize * (mirror == 1 ? -1 : 1);
1047 for (x = 0; x < src_w; x++) {
1048 const uint16_t *c0_data = (uint16_t *)in->
data[plane + 0];
1049 const uint16_t *c1_data = (uint16_t *)in->
data[(plane + 1) % s->
ncomp];
1050 const uint16_t *c2_data = (uint16_t *)in->
data[(plane + 2) % s->
ncomp];
1051 uint16_t *d0_data = (uint16_t *)out->
data[
plane] + offset_y * d0_linesize + offset_x;
1052 uint16_t *d1_data = (uint16_t *)out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
1053 uint16_t *d2_data = (uint16_t *)out->
data[(plane + 2) % s->
ncomp] + offset_y * d2_linesize + offset_x;
1054 uint16_t *
const d0_bottom_line = d0_data + d0_linesize * (s->
size - 1);
1055 uint16_t *
const d0 = (mirror ? d0_bottom_line : d0_data);
1056 uint16_t *
const d1_bottom_line = d1_data + d1_linesize * (s->
size - 1);
1057 uint16_t *
const d1 = (mirror ? d1_bottom_line : d1_data);
1058 uint16_t *
const d2_bottom_line = d2_data + d2_linesize * (s->
size - 1);
1059 uint16_t *
const d2 = (mirror ? d2_bottom_line : d2_data);
1061 for (y = 0; y < src_h; y++) {
1062 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit) + mid;
1063 const int c1 =
FFMIN(c1_data[x >> c1_shift_w], limit) - mid;
1064 const int c2 =
FFMIN(c2_data[x >> c2_shift_w], limit) - mid;
1067 target = d0 + x + d0_signed_linesize * c0;
1068 update16(target, max, intensity, limit);
1070 target = d1 + x + d1_signed_linesize * (c0 +
c1);
1071 update16(target, max, intensity, limit);
1073 target = d2 + x + d2_signed_linesize * (c0 +
c2);
1074 update16(target, max, intensity, limit);
1076 if (!c0_shift_h || (y & c0_shift_h))
1077 c0_data += c0_linesize;
1078 if (!c1_shift_h || (y & c1_shift_h))
1079 c1_data += c1_linesize;
1080 if (!c2_shift_h || (y & c2_shift_h))
1081 c2_data += c2_linesize;
1082 d0_data += d0_linesize;
1083 d1_data += d1_linesize;
1084 d2_data += d2_linesize;
1088 const uint16_t *c0_data = (uint16_t *)in->
data[plane];
1089 const uint16_t *c1_data = (uint16_t *)in->
data[(plane + 1) % s->
ncomp];
1090 const uint16_t *c2_data = (uint16_t *)in->
data[(plane + 2) % s->
ncomp];
1091 uint16_t *d0_data = (uint16_t *)out->
data[
plane] + offset_y * d0_linesize + offset_x;
1092 uint16_t *d1_data = (uint16_t *)out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
1093 uint16_t *d2_data = (uint16_t *)out->
data[(plane + 2) % s->
ncomp] + offset_y * d2_linesize + offset_x;
1096 d0_data += s->
size - 1;
1097 d1_data += s->
size - 1;
1098 d2_data += s->
size - 1;
1101 for (y = 0; y < src_h; y++) {
1102 for (x = 0; x < src_w; x++) {
1103 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit) + mid;
1104 const int c1 =
FFMIN(c1_data[x >> c1_shift_w], limit) - mid;
1105 const int c2 =
FFMIN(c2_data[x >> c2_shift_w], limit) - mid;
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);
1116 target = d0_data + c0;
1117 update16(target, max, intensity, limit);
1118 target = d1_data + (c0 +
c1);
1119 update16(target, max, intensity, limit);
1120 target = d2_data + (c0 +
c2);
1121 update16(target, max, intensity, limit);
1125 if (!c0_shift_h || (y & c0_shift_h))
1126 c0_data += c0_linesize;
1127 if (!c1_shift_h || (y & c1_shift_h))
1128 c1_data += c1_linesize;
1129 if (!c2_shift_h || (y & c2_shift_h))
1130 c2_data += c2_linesize;
1131 d0_data += d0_linesize;
1132 d1_data += d1_linesize;
1133 d2_data += d2_linesize;
1137 envelope16(s, out, plane, (plane + 0) % s->
ncomp, column ? offset_x : offset_y);
1138 envelope16(s, out, plane, (plane + 1) % s->
ncomp, column ? offset_x : offset_y);
1139 envelope16(s, out, plane, (plane + 2) % s->
ncomp, column ? offset_x : offset_y);
1145 int offset_y,
int offset_x,
1149 const int c0_linesize = in->
linesize[ plane + 0 ];
1150 const int c1_linesize = in->
linesize[(plane + 1) % s->
ncomp];
1151 const int c2_linesize = in->
linesize[(plane + 2) % s->
ncomp];
1152 const int c0_shift_w = s->
shift_w[ component + 0 ];
1153 const int c1_shift_w = s->
shift_w[(component + 1) % s->
ncomp];
1154 const int c2_shift_w = s->
shift_w[(component + 2) % s->
ncomp];
1155 const int c0_shift_h = s->
shift_h[ component + 0 ];
1156 const int c1_shift_h = s->
shift_h[(component + 1) % s->
ncomp];
1157 const int c2_shift_h = s->
shift_h[(component + 2) % s->
ncomp];
1158 const int d0_linesize = out->
linesize[ plane + 0 ];
1159 const int d1_linesize = out->
linesize[(plane + 1) % s->
ncomp];
1160 const int d2_linesize = out->
linesize[(plane + 2) % s->
ncomp];
1162 const int src_h = in->
height;
1163 const int src_w = in->
width;
1167 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1);
1168 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1);
1169 const int d2_signed_linesize = d2_linesize * (mirror == 1 ? -1 : 1);
1171 for (x = 0; x < src_w; x++) {
1176 uint8_t *d1_data = out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
1177 uint8_t *d2_data = out->
data[(plane + 2) % s->
ncomp] + offset_y * d2_linesize + offset_x;
1178 uint8_t *
const d0_bottom_line = d0_data + d0_linesize * (s->
size - 1);
1179 uint8_t *
const d0 = (mirror ? d0_bottom_line : d0_data);
1180 uint8_t *
const d1_bottom_line = d1_data + d1_linesize * (s->
size - 1);
1181 uint8_t *
const d1 = (mirror ? d1_bottom_line : d1_data);
1182 uint8_t *
const d2_bottom_line = d2_data + d2_linesize * (s->
size - 1);
1183 uint8_t *
const d2 = (mirror ? d2_bottom_line : d2_data);
1185 for (y = 0; y < src_h; y++) {
1186 const int c0 = c0_data[x >> c0_shift_w] + 128;
1187 const int c1 = c1_data[x >> c1_shift_w] - 128;
1188 const int c2 = c2_data[x >> c2_shift_w] - 128;
1191 target = d0 + x + d0_signed_linesize * c0;
1192 update(target, max, intensity);
1194 target = d1 + x + d1_signed_linesize * (c0 +
c1);
1195 update(target, max, intensity);
1197 target = d2 + x + d2_signed_linesize * (c0 +
c2);
1198 update(target, max, intensity);
1200 if (!c0_shift_h || (y & c0_shift_h))
1201 c0_data += c0_linesize;
1202 if (!c1_shift_h || (y & c1_shift_h))
1203 c1_data += c1_linesize;
1204 if (!c1_shift_h || (y & c1_shift_h))
1205 c2_data += c1_linesize;
1206 d0_data += d0_linesize;
1207 d1_data += d1_linesize;
1208 d2_data += d2_linesize;
1216 uint8_t *d1_data = out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
1217 uint8_t *d2_data = out->
data[(plane + 2) % s->
ncomp] + offset_y * d2_linesize + offset_x;
1220 d0_data += s->
size - 1;
1221 d1_data += s->
size - 1;
1222 d2_data += s->
size - 1;
1225 for (y = 0; y < src_h; y++) {
1226 for (x = 0; x < src_w; x++) {
1227 const int c0 = c0_data[x >> c0_shift_w] + 128;
1228 const int c1 = c1_data[x >> c1_shift_w] - 128;
1229 const int c2 = c2_data[x >> c2_shift_w] - 128;
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);
1240 target = d0_data + c0;
1241 update(target, max, intensity);
1242 target = d1_data + (c0 +
c1);
1243 update(target, max, intensity);
1244 target = d2_data + (c0 +
c2);
1245 update(target, max, intensity);
1249 if (!c0_shift_h || (y & c0_shift_h))
1250 c0_data += c0_linesize;
1251 if (!c1_shift_h || (y & c1_shift_h))
1252 c1_data += c1_linesize;
1253 if (!c2_shift_h || (y & c2_shift_h))
1254 c2_data += c2_linesize;
1255 d0_data += d0_linesize;
1256 d1_data += d1_linesize;
1257 d2_data += d2_linesize;
1261 envelope(s, out, plane, (plane + 0) % s->
ncomp, column ? offset_x : offset_y);
1262 envelope(s, out, plane, (plane + 1) % s->
ncomp, column ? offset_x : offset_y);
1263 envelope(s, out, plane, (plane + 2) % s->
ncomp, column ? offset_x : offset_y);
1269 int offset_y,
int offset_x,
1273 const int c0_linesize = in->
linesize[(plane + 1) % s->
ncomp] / 2;
1274 const int c1_linesize = in->
linesize[(plane + 2) % s->
ncomp] / 2;
1276 const int limit = s->
max - 1;
1278 const int mid = s->
max / 2;
1279 const int c0_shift_w = s->
shift_w[(component + 1) % s->
ncomp];
1280 const int c1_shift_w = s->
shift_w[(component + 2) % s->
ncomp];
1281 const int c0_shift_h = s->
shift_h[(component + 1) % s->
ncomp];
1282 const int c1_shift_h = s->
shift_h[(component + 2) % s->
ncomp];
1283 const int src_h = in->
height;
1284 const int src_w = in->
width;
1288 const int dst_signed_linesize = dst_linesize * (mirror == 1 ? -1 : 1);
1290 for (x = 0; x < src_w; x++) {
1291 const uint16_t *c0_data = (uint16_t *)in->
data[(plane + 1) % s->
ncomp];
1292 const uint16_t *c1_data = (uint16_t *)in->
data[(plane + 2) % s->
ncomp];
1293 uint16_t *dst_data = (uint16_t *)out->
data[plane] + offset_y * dst_linesize + offset_x;
1294 uint16_t *
const dst_bottom_line = dst_data + dst_linesize * (s->
size - 1);
1295 uint16_t *
const dst_line = (mirror ? dst_bottom_line : dst_data);
1296 uint16_t *dst = dst_line;
1298 for (y = 0; y < src_h; y++) {
1299 const int sum =
FFMIN(
FFABS(c0_data[x >> c0_shift_w] - mid) +
FFABS(c1_data[x >> c1_shift_w] - mid - 1), limit);
1302 target = dst + x + dst_signed_linesize * sum;
1303 update16(target, max, intensity, limit);
1305 if (!c0_shift_h || (y & c0_shift_h))
1306 c0_data += c0_linesize;
1307 if (!c1_shift_h || (y & c1_shift_h))
1308 c1_data += c1_linesize;
1309 dst_data += dst_linesize;
1313 const uint16_t *c0_data = (uint16_t *)in->
data[(plane + 1) % s->
ncomp];
1314 const uint16_t *c1_data = (uint16_t *)in->
data[(plane + 2) % s->
ncomp];
1315 uint16_t *dst_data = (uint16_t *)out->
data[plane] + offset_y * dst_linesize + offset_x;
1318 dst_data += s->
size - 1;
1319 for (y = 0; y < src_h; y++) {
1320 for (x = 0; x < src_w; x++) {
1321 const int sum =
FFMIN(
FFABS(c0_data[x >> c0_shift_w] - mid) +
FFABS(c1_data[x >> c1_shift_w] - mid - 1), limit);
1325 target = dst_data - sum;
1326 update16(target, max, intensity, limit);
1328 target = dst_data + sum;
1329 update16(target, max, intensity, limit);
1333 if (!c0_shift_h || (y & c0_shift_h))
1334 c0_data += c0_linesize;
1335 if (!c1_shift_h || (y & c1_shift_h))
1336 c1_data += c1_linesize;
1337 dst_data += dst_linesize;
1341 envelope16(s, out, plane, plane, column ? offset_x : offset_y);
1347 int offset_y,
int offset_x,
1351 const int c0_linesize = in->
linesize[(plane + 1) % s->
ncomp];
1352 const int c1_linesize = in->
linesize[(plane + 2) % s->
ncomp];
1355 const int c0_shift_w = s->
shift_w[(component + 1) % s->
ncomp];
1356 const int c1_shift_w = s->
shift_w[(component + 2) % s->
ncomp];
1357 const int c0_shift_h = s->
shift_h[(component + 1) % s->
ncomp];
1358 const int c1_shift_h = s->
shift_h[(component + 2) % s->
ncomp];
1359 const int src_h = in->
height;
1360 const int src_w = in->
width;
1364 const int dst_signed_linesize = dst_linesize * (mirror == 1 ? -1 : 1);
1366 for (x = 0; x < src_w; x++) {
1370 uint8_t *
const dst_bottom_line = dst_data + dst_linesize * (s->
size - 1);
1371 uint8_t *
const dst_line = (mirror ? dst_bottom_line : dst_data);
1374 for (y = 0; y < src_h; y++) {
1375 const int sum =
FFABS(c0_data[x >> c0_shift_w] - 128) +
FFABS(c1_data[x >> c1_shift_w] - 127);
1378 target = dst + x + dst_signed_linesize * sum;
1379 update(target, max, intensity);
1381 if (!c0_shift_h || (y & c0_shift_h))
1382 c0_data += c0_linesize;
1383 if (!c1_shift_h || (y & c1_shift_h))
1384 c1_data += c1_linesize;
1385 dst_data += dst_linesize;
1394 dst_data += s->
size - 1;
1395 for (y = 0; y < src_h; y++) {
1396 for (x = 0; x < src_w; x++) {
1397 const int sum =
FFABS(c0_data[x >> c0_shift_w] - 128) +
FFABS(c1_data[x >> c1_shift_w] - 127);
1401 target = dst_data - sum;
1402 update(target, max, intensity);
1404 target = dst_data + sum;
1405 update(target, max, intensity);
1409 if (!c0_shift_h || (y & c0_shift_h))
1410 c0_data += c0_linesize;
1411 if (!c1_shift_h || (y & c1_shift_h))
1412 c1_data += c1_linesize;
1413 dst_data += dst_linesize;
1417 envelope(s, out, plane, plane, column ? offset_x : offset_y);
1423 int offset_y,
int offset_x,
1427 const int limit = s->
max - 1;
1428 const uint16_t *c0_data = (
const uint16_t *)in->
data[plane + 0];
1429 const uint16_t *c1_data = (
const uint16_t *)in->
data[(plane + 1) % s->
ncomp];
1430 const uint16_t *c2_data = (
const uint16_t *)in->
data[(plane + 2) % s->
ncomp];
1431 const int c0_linesize = in->
linesize[ plane + 0 ] / 2;
1432 const int c1_linesize = in->
linesize[(plane + 1) % s->
ncomp] / 2;
1433 const int c2_linesize = in->
linesize[(plane + 2) % s->
ncomp] / 2;
1434 const int d0_linesize = out->
linesize[ plane + 0 ] / 2;
1435 const int d1_linesize = out->
linesize[(plane + 1) % s->
ncomp] / 2;
1436 const int d2_linesize = out->
linesize[(plane + 2) % s->
ncomp] / 2;
1437 const int c0_shift_w = s->
shift_w[ component + 0 ];
1438 const int c1_shift_w = s->
shift_w[(component + 1) % s->
ncomp];
1439 const int c2_shift_w = s->
shift_w[(component + 2) % s->
ncomp];
1440 const int c0_shift_h = s->
shift_h[ component + 0 ];
1441 const int c1_shift_h = s->
shift_h[(component + 1) % s->
ncomp];
1442 const int c2_shift_h = s->
shift_h[(component + 2) % s->
ncomp];
1443 const int src_h = in->
height;
1444 const int src_w = in->
width;
1448 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1);
1449 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1);
1450 const int d2_signed_linesize = d2_linesize * (mirror == 1 ? -1 : 1);
1451 uint16_t *d0_data = (uint16_t *)out->
data[plane] + offset_y * d0_linesize + offset_x;
1452 uint16_t *d1_data = (uint16_t *)out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
1453 uint16_t *d2_data = (uint16_t *)out->
data[(plane + 2) % s->
ncomp] + offset_y * d2_linesize + offset_x;
1454 uint16_t *
const d0_bottom_line = d0_data + d0_linesize * (s->
size - 1);
1455 uint16_t *
const d0 = (mirror ? d0_bottom_line : d0_data);
1456 uint16_t *
const d1_bottom_line = d1_data + d1_linesize * (s->
size - 1);
1457 uint16_t *
const d1 = (mirror ? d1_bottom_line : d1_data);
1458 uint16_t *
const d2_bottom_line = d2_data + d2_linesize * (s->
size - 1);
1459 uint16_t *
const d2 = (mirror ? d2_bottom_line : d2_data);
1461 for (y = 0; y < src_h; y++) {
1462 for (x = 0; x < src_w; x++) {
1463 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit);
1464 const int c1 = c1_data[x >> c1_shift_w];
1465 const int c2 = c2_data[x >> c2_shift_w];
1467 *(d0 + d0_signed_linesize * c0 + x) = c0;
1468 *(d1 + d1_signed_linesize * c0 + x) = c1;
1469 *(d2 + d2_signed_linesize * c0 + x) = c2;
1472 if (!c0_shift_h || (y & c0_shift_h))
1473 c0_data += c0_linesize;
1474 if (!c1_shift_h || (y & c1_shift_h))
1475 c1_data += c1_linesize;
1476 if (!c2_shift_h || (y & c2_shift_h))
1477 c2_data += c2_linesize;
1478 d0_data += d0_linesize;
1479 d1_data += d1_linesize;
1480 d2_data += d2_linesize;
1483 uint16_t *d0_data = (uint16_t *)out->
data[plane] + offset_y * d0_linesize + offset_x;
1484 uint16_t *d1_data = (uint16_t *)out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
1485 uint16_t *d2_data = (uint16_t *)out->
data[(plane + 2) % s->
ncomp] + offset_y * d2_linesize + offset_x;
1488 d0_data += s->
size - 1;
1489 d1_data += s->
size - 1;
1490 d2_data += s->
size - 1;
1493 for (y = 0; y < src_h; y++) {
1494 for (x = 0; x < src_w; x++) {
1495 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit);
1496 const int c1 = c1_data[x >> c1_shift_w];
1497 const int c2 = c2_data[x >> c2_shift_w];
1500 *(d0_data - c0) = c0;
1501 *(d1_data - c0) = c1;
1502 *(d2_data - c0) = c2;
1504 *(d0_data + c0) = c0;
1505 *(d1_data + c0) = c1;
1506 *(d2_data + c0) = c2;
1510 if (!c0_shift_h || (y & c0_shift_h))
1511 c0_data += c0_linesize;
1512 if (!c1_shift_h || (y & c1_shift_h))
1513 c1_data += c1_linesize;
1514 if (!c2_shift_h || (y & c2_shift_h))
1515 c2_data += c2_linesize;
1516 d0_data += d0_linesize;
1517 d1_data += d1_linesize;
1518 d2_data += d2_linesize;
1522 envelope16(s, out, plane, plane, column ? offset_x : offset_y);
1528 int offset_y,
int offset_x,
1535 const int c0_linesize = in->
linesize[ plane + 0 ];
1536 const int c1_linesize = in->
linesize[(plane + 1) % s->
ncomp];
1537 const int c2_linesize = in->
linesize[(plane + 2) % s->
ncomp];
1538 const int d0_linesize = out->
linesize[ plane + 0 ];
1539 const int d1_linesize = out->
linesize[(plane + 1) % s->
ncomp];
1540 const int d2_linesize = out->
linesize[(plane + 2) % s->
ncomp];
1541 const int c0_shift_w = s->
shift_w[ component + 0 ];
1542 const int c1_shift_w = s->
shift_w[(component + 1) % s->
ncomp];
1543 const int c2_shift_w = s->
shift_w[(component + 2) % s->
ncomp];
1544 const int c0_shift_h = s->
shift_h[ component + 0 ];
1545 const int c1_shift_h = s->
shift_h[(component + 1) % s->
ncomp];
1546 const int c2_shift_h = s->
shift_h[(component + 2) % s->
ncomp];
1547 const int src_h = in->
height;
1548 const int src_w = in->
width;
1552 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1);
1553 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1);
1554 const int d2_signed_linesize = d2_linesize * (mirror == 1 ? -1 : 1);
1556 uint8_t *d1_data = out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
1557 uint8_t *d2_data = out->
data[(plane + 2) % s->
ncomp] + offset_y * d2_linesize + offset_x;
1558 uint8_t *
const d0_bottom_line = d0_data + d0_linesize * (s->
size - 1);
1559 uint8_t *
const d0 = (mirror ? d0_bottom_line : d0_data);
1560 uint8_t *
const d1_bottom_line = d1_data + d1_linesize * (s->
size - 1);
1561 uint8_t *
const d1 = (mirror ? d1_bottom_line : d1_data);
1562 uint8_t *
const d2_bottom_line = d2_data + d2_linesize * (s->
size - 1);
1563 uint8_t *
const d2 = (mirror ? d2_bottom_line : d2_data);
1565 for (y = 0; y < src_h; y++) {
1566 for (x = 0; x < src_w; x++) {
1567 const int c0 = c0_data[x >> c0_shift_w];
1568 const int c1 = c1_data[x >> c1_shift_w];
1569 const int c2 = c2_data[x >> c2_shift_w];
1571 *(d0 + d0_signed_linesize * c0 + x) = c0;
1572 *(d1 + d1_signed_linesize * c0 + x) = c1;
1573 *(d2 + d2_signed_linesize * c0 + x) = c2;
1576 if (!c0_shift_h || (y & c0_shift_h))
1577 c0_data += c0_linesize;
1578 if (!c1_shift_h || (y & c1_shift_h))
1579 c1_data += c1_linesize;
1580 if (!c2_shift_h || (y & c2_shift_h))
1581 c2_data += c2_linesize;
1582 d0_data += d0_linesize;
1583 d1_data += d1_linesize;
1584 d2_data += d2_linesize;
1588 uint8_t *d1_data = out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
1589 uint8_t *d2_data = out->
data[(plane + 2) % s->
ncomp] + offset_y * d2_linesize + offset_x;
1592 d0_data += s->
size - 1;
1593 d1_data += s->
size - 1;
1594 d2_data += s->
size - 1;
1597 for (y = 0; y < src_h; y++) {
1598 for (x = 0; x < src_w; x++) {
1599 const int c0 = c0_data[x >> c0_shift_w];
1600 const int c1 = c1_data[x >> c1_shift_w];
1601 const int c2 = c2_data[x >> c2_shift_w];
1604 *(d0_data - c0) = c0;
1605 *(d1_data - c0) = c1;
1606 *(d2_data - c0) = c2;
1608 *(d0_data + c0) = c0;
1609 *(d1_data + c0) = c1;
1610 *(d2_data + c0) = c2;
1614 if (!c0_shift_h || (y & c0_shift_h))
1615 c0_data += c0_linesize;
1616 if (!c1_shift_h || (y & c1_shift_h))
1617 c1_data += c1_linesize;
1618 if (!c2_shift_h || (y & c2_shift_h))
1619 c2_data += c2_linesize;
1620 d0_data += d0_linesize;
1621 d1_data += d1_linesize;
1622 d2_data += d2_linesize;
1626 envelope(s, out, plane, plane, column ? offset_x : offset_y);
1632 int offset_y,
int offset_x,
1636 const int limit = s->
max - 1;
1638 const uint16_t *c0_data = (
const uint16_t *)in->
data[plane + 0];
1639 const uint16_t *c1_data = (
const uint16_t *)in->
data[(plane + 1) % s->
ncomp];
1640 const uint16_t *c2_data = (
const uint16_t *)in->
data[(plane + 2) % s->
ncomp];
1641 const int c0_linesize = in->
linesize[ plane + 0 ] / 2;
1642 const int c1_linesize = in->
linesize[(plane + 1) % s->
ncomp] / 2;
1643 const int c2_linesize = in->
linesize[(plane + 2) % s->
ncomp] / 2;
1644 const int d0_linesize = out->
linesize[ plane + 0 ] / 2;
1645 const int d1_linesize = out->
linesize[(plane + 1) % s->
ncomp] / 2;
1646 const int d2_linesize = out->
linesize[(plane + 2) % s->
ncomp] / 2;
1647 const int c0_shift_w = s->
shift_w[ component + 0 ];
1648 const int c1_shift_w = s->
shift_w[(component + 1) % s->
ncomp];
1649 const int c2_shift_w = s->
shift_w[(component + 2) % s->
ncomp];
1650 const int c0_shift_h = s->
shift_h[ component + 0 ];
1651 const int c1_shift_h = s->
shift_h[(component + 1) % s->
ncomp];
1652 const int c2_shift_h = s->
shift_h[(component + 2) % s->
ncomp];
1653 const int src_h = in->
height;
1654 const int src_w = in->
width;
1658 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1);
1659 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1);
1660 const int d2_signed_linesize = d2_linesize * (mirror == 1 ? -1 : 1);
1661 uint16_t *d0_data = (uint16_t *)out->
data[plane] + offset_y * d0_linesize + offset_x;
1662 uint16_t *d1_data = (uint16_t *)out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
1663 uint16_t *d2_data = (uint16_t *)out->
data[(plane + 2) % s->
ncomp] + offset_y * d2_linesize + offset_x;
1664 uint16_t *
const d0_bottom_line = d0_data + d0_linesize * (s->
size - 1);
1665 uint16_t *
const d0 = (mirror ? d0_bottom_line : d0_data);
1666 uint16_t *
const d1_bottom_line = d1_data + d1_linesize * (s->
size - 1);
1667 uint16_t *
const d1 = (mirror ? d1_bottom_line : d1_data);
1668 uint16_t *
const d2_bottom_line = d2_data + d2_linesize * (s->
size - 1);
1669 uint16_t *
const d2 = (mirror ? d2_bottom_line : d2_data);
1671 for (y = 0; y < src_h; y++) {
1672 for (x = 0; x < src_w; x++) {
1673 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit);
1674 const int c1 = c1_data[x >> c1_shift_w];
1675 const int c2 = c2_data[x >> c2_shift_w];
1677 update16(d0 + d0_signed_linesize * c0 + x, max, intensity, limit);
1678 *(d1 + d1_signed_linesize * c0 + x) = c1;
1679 *(d2 + d2_signed_linesize * c0 + x) = c2;
1682 if (!c0_shift_h || (y & c0_shift_h))
1683 c0_data += c0_linesize;
1684 if (!c1_shift_h || (y & c1_shift_h))
1685 c1_data += c1_linesize;
1686 if (!c2_shift_h || (y & c2_shift_h))
1687 c2_data += c2_linesize;
1688 d0_data += d0_linesize;
1689 d1_data += d1_linesize;
1690 d2_data += d2_linesize;
1693 uint16_t *d0_data = (uint16_t *)out->
data[plane] + offset_y * d0_linesize + offset_x;
1694 uint16_t *d1_data = (uint16_t *)out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
1695 uint16_t *d2_data = (uint16_t *)out->
data[(plane + 2) % s->
ncomp] + offset_y * d2_linesize + offset_x;
1698 d0_data += s->
size - 1;
1699 d1_data += s->
size - 1;
1700 d2_data += s->
size - 1;
1703 for (y = 0; y < src_h; y++) {
1704 for (x = 0; x < src_w; x++) {
1705 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit);
1706 const int c1 = c1_data[x >> c1_shift_w];
1707 const int c2 = c2_data[x >> c2_shift_w];
1710 update16(d0_data - c0, max, intensity, limit);
1711 *(d1_data - c0) = c1;
1712 *(d2_data - c0) = c2;
1714 update16(d0_data + c0, max, intensity, limit);
1715 *(d1_data + c0) = c1;
1716 *(d2_data + c0) = c2;
1720 if (!c0_shift_h || (y & c0_shift_h))
1721 c0_data += c0_linesize;
1722 if (!c1_shift_h || (y & c1_shift_h))
1723 c1_data += c1_linesize;
1724 if (!c2_shift_h || (y & c2_shift_h))
1725 c2_data += c2_linesize;
1726 d0_data += d0_linesize;
1727 d1_data += d1_linesize;
1728 d2_data += d2_linesize;
1732 envelope16(s, out, plane, plane, column ? offset_x : offset_y);
1738 int offset_y,
int offset_x,
1745 const int c0_linesize = in->
linesize[ plane + 0 ];
1746 const int c1_linesize = in->
linesize[(plane + 1) % s->
ncomp];
1747 const int c2_linesize = in->
linesize[(plane + 2) % s->
ncomp];
1748 const int d0_linesize = out->
linesize[ plane + 0 ];
1749 const int d1_linesize = out->
linesize[(plane + 1) % s->
ncomp];
1750 const int d2_linesize = out->
linesize[(plane + 2) % s->
ncomp];
1751 const int c0_shift_w = s->
shift_w[ component + 0 ];
1752 const int c1_shift_w = s->
shift_w[(component + 1) % s->
ncomp];
1753 const int c2_shift_w = s->
shift_w[(component + 2) % s->
ncomp];
1754 const int c0_shift_h = s->
shift_h[ component + 0 ];
1755 const int c1_shift_h = s->
shift_h[(component + 1) % s->
ncomp];
1756 const int c2_shift_h = s->
shift_h[(component + 2) % s->
ncomp];
1758 const int src_h = in->
height;
1759 const int src_w = in->
width;
1763 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1);
1764 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1);
1765 const int d2_signed_linesize = d2_linesize * (mirror == 1 ? -1 : 1);
1767 uint8_t *d1_data = out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
1768 uint8_t *d2_data = out->
data[(plane + 2) % s->
ncomp] + offset_y * d2_linesize + offset_x;
1769 uint8_t *
const d0_bottom_line = d0_data + d0_linesize * (s->
size - 1);
1770 uint8_t *
const d0 = (mirror ? d0_bottom_line : d0_data);
1771 uint8_t *
const d1_bottom_line = d1_data + d1_linesize * (s->
size - 1);
1772 uint8_t *
const d1 = (mirror ? d1_bottom_line : d1_data);
1773 uint8_t *
const d2_bottom_line = d2_data + d2_linesize * (s->
size - 1);
1774 uint8_t *
const d2 = (mirror ? d2_bottom_line : d2_data);
1776 for (y = 0; y < src_h; y++) {
1777 for (x = 0; x < src_w; x++) {
1778 const int c0 = c0_data[x >> c0_shift_w];
1779 const int c1 = c1_data[x >> c1_shift_w];
1780 const int c2 = c2_data[x >> c2_shift_w];
1782 update(d0 + d0_signed_linesize * c0 + x, max, intensity);
1783 *(d1 + d1_signed_linesize * c0 + x) = c1;
1784 *(d2 + d2_signed_linesize * c0 + x) = c2;
1787 if (!c0_shift_h || (y & c0_shift_h))
1788 c0_data += c0_linesize;
1789 if (!c1_shift_h || (y & c1_shift_h))
1790 c1_data += c1_linesize;
1791 if (!c2_shift_h || (y & c2_shift_h))
1792 c2_data += c2_linesize;
1793 d0_data += d0_linesize;
1794 d1_data += d1_linesize;
1795 d2_data += d2_linesize;
1799 uint8_t *d1_data = out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
1800 uint8_t *d2_data = out->
data[(plane + 2) % s->
ncomp] + offset_y * d2_linesize + offset_x;
1803 d0_data += s->
size - 1;
1804 d1_data += s->
size - 1;
1805 d2_data += s->
size - 1;
1808 for (y = 0; y < src_h; y++) {
1809 for (x = 0; x < src_w; x++) {
1810 const int c0 = c0_data[x >> c0_shift_w];
1811 const int c1 = c1_data[x >> c1_shift_w];
1812 const int c2 = c2_data[x >> c2_shift_w];
1815 update(d0_data - c0, max, intensity);
1816 *(d1_data - c0) = c1;
1817 *(d2_data - c0) = c2;
1819 update(d0_data + c0, max, intensity);
1820 *(d1_data + c0) = c1;
1821 *(d2_data + c0) = c2;
1825 if (!c0_shift_h || (y & c0_shift_h))
1826 c0_data += c0_linesize;
1827 if (!c1_shift_h || (y & c1_shift_h))
1828 c1_data += c1_linesize;
1829 if (!c2_shift_h || (y & c2_shift_h))
1830 c2_data += c2_linesize;
1831 d0_data += d0_linesize;
1832 d1_data += d1_linesize;
1833 d2_data += d2_linesize;
1837 envelope(s, out, plane, plane, column ? offset_x : offset_y);
1845 { { {
"16", 16+128 }, {
"16", 16+128 }, {
"16", 16+128 }, {
"0", 0+128 } } },
1846 { { {
"128", 128+128 }, {
"128", 128+128 }, {
"128", 128+128 }, {
"128", 128+128 } } },
1847 { { {
"235", 235+128 }, {
"240", 240+128 }, {
"240", 240+128 }, {
"255", 255+128 } } },
1851 { { {
"32", 32+256 }, {
"32", 32+256 }, {
"32", 32+256 }, {
"0", 0+256 } } },
1852 { { {
"256", 256+256 }, {
"256", 256+256 }, {
"256", 256+256 }, {
"256", 256+256 } } },
1853 { { {
"470", 470+256 }, {
"480", 480+256 }, {
"480", 480+256 }, {
"511", 511+256 } } },
1857 { { {
"64", 64+512 }, {
"64", 64+512 }, {
"64", 64+512 }, {
"0", 0+512 } } },
1858 { { {
"512", 512+512 }, {
"512", 512+512 }, {
"512", 512+512 }, {
"512", 512+512 } } },
1859 { { {
"940", 940+512 }, {
"960", 960+512 }, {
"960", 960+512 }, {
"1023", 1023+512 } } },
1863 { { {
"256", 256+2048 }, {
"256", 256+2048 }, {
"256", 256+2048 }, {
"0", 0+2048 } } },
1864 { { {
"2048", 2048+2048 }, {
"2048", 2048+2048 }, {
"2048", 2048+2048 }, {
"2048", 2048+2048 } } },
1865 { { {
"3760", 3760+2048 }, {
"3840", 3840+2048 }, {
"3840", 3840+2048 }, {
"4095", 4095+2048 } } },
1869 { { {
"0", 16+128 }, {
"0", 16+128 }, {
"0", 16+128 }, {
"0", 0+128 } } },
1870 { { {
"175", 71+128 }, {
"175", 72+128 }, {
"175", 72+128 }, {
"175", 64+128 } } },
1871 { { {
"350", 126+128 }, {
"350", 128+128 }, {
"350", 128+128 }, {
"350", 128+128 } } },
1872 { { {
"525", 180+128 }, {
"525", 184+128 }, {
"525", 184+128 }, {
"525", 192+128 } } },
1873 { { {
"700", 235+128 }, {
"700", 240+128 }, {
"700", 240+128 }, {
"700", 255+128 } } },
1877 { { {
"0", 32+256 }, {
"0", 32+256 }, {
"0", 32+256 }, {
"0", 0+256 } } },
1878 { { {
"175", 142+256 }, {
"175", 144+256 }, {
"175", 144+256 }, {
"175", 128+256 } } },
1879 { { {
"350", 251+256 }, {
"350", 256+256 }, {
"350", 256+256 }, {
"350", 256+256 } } },
1880 { { {
"525", 361+256 }, {
"525", 368+256 }, {
"525", 368+256 }, {
"525", 384+256 } } },
1881 { { {
"700", 470+256 }, {
"700", 480+256 }, {
"700", 480+256 }, {
"700", 511+256 } } },
1885 { { {
"0", 64+512 }, {
"0", 64+512 }, {
"0", 64+512 }, {
"0", 0+512 } } },
1886 { { {
"175", 283+512 }, {
"175", 288+512 }, {
"175", 288+512 }, {
"175", 256+512 } } },
1887 { { {
"350", 502+512 }, {
"350", 512+512 }, {
"350", 512+512 }, {
"350", 512+512 } } },
1888 { { {
"525", 721+512 }, {
"525", 736+512 }, {
"525", 736+512 }, {
"525", 768+512 } } },
1889 { { {
"700", 940+512 }, {
"700", 960+512 }, {
"700", 960+512 }, {
"700", 1023+512 } } },
1893 { { {
"0", 256+2048 }, {
"0", 256+2048 }, {
"0", 256+2048 }, {
"0", 0+2048 } } },
1894 { { {
"175", 1132+2048 }, {
"175", 1152+2048 }, {
"175", 1152+2048 }, {
"175", 1024+2048 } } },
1895 { { {
"350", 2008+2048 }, {
"350", 2048+2048 }, {
"350", 2048+2048 }, {
"350", 2048+2048 } } },
1896 { { {
"525", 2884+2048 }, {
"525", 2944+2048 }, {
"525", 2944+2048 }, {
"525", 3072+2048 } } },
1897 { { {
"700", 3760+2048 }, {
"700", 3840+2048 }, {
"700", 3840+2048 }, {
"700", 4095+2048 } } },
1901 { { {
"-25", -39+128 }, {
"-25", -40+128 }, {
"-25", -40+128 }, {
"-25", -64+128 } } },
1902 { { {
"0", 16+128 }, {
"0", 16+128 }, {
"0", 16+128 }, {
"0", 0+128 } } },
1903 { { {
"25", 71+128 }, {
"25", 72+128 }, {
"25", 72+128 }, {
"25", 64+128 } } },
1904 { { {
"50", 126+128 }, {
"50", 128+128 }, {
"50", 128+128 }, {
"50", 128+128 } } },
1905 { { {
"75", 180+128 }, {
"75", 184+128 }, {
"75", 184+128 }, {
"75", 192+128 } } },
1906 { { {
"100", 235+128 }, {
"100", 240+128 }, {
"100", 240+128 }, {
"100", 256+128 } } },
1907 { { {
"125", 290+128 }, {
"125", 296+128 }, {
"125", 296+128 }, {
"125", 320+128 } } },
1911 { { {
"-25", -78+256 }, {
"-25", -80+256 }, {
"-25", -80+256 }, {
"-25",-128+256 } } },
1912 { { {
"0", 32+256 }, {
"0", 32+256 }, {
"0", 32+256 }, {
"0", 0+256 } } },
1913 { { {
"25", 142+256 }, {
"25", 144+256 }, {
"25", 144+256 }, {
"25", 128+256 } } },
1914 { { {
"50", 251+256 }, {
"50", 256+256 }, {
"50", 256+256 }, {
"50", 256+256 } } },
1915 { { {
"75", 361+256 }, {
"75", 368+256 }, {
"75", 368+256 }, {
"75", 384+256 } } },
1916 { { {
"100", 470+256 }, {
"100", 480+256 }, {
"100", 480+256 }, {
"100", 512+256 } } },
1917 { { {
"125", 580+256 }, {
"125", 592+256 }, {
"125", 592+256 }, {
"125", 640+256 } } },
1921 { { {
"-25",-156+512 }, {
"-25",-160+512 }, {
"-25",-160+512 }, {
"-25", -256+512 } } },
1922 { { {
"0", 64+512 }, {
"0", 64+512 }, {
"0", 64+512 }, {
"0", 0+512 } } },
1923 { { {
"25", 283+512 }, {
"25", 288+512 }, {
"25", 288+512 }, {
"25", 256+512 } } },
1924 { { {
"50", 502+512 }, {
"50", 512+512 }, {
"50", 512+512 }, {
"50", 512+512 } } },
1925 { { {
"75", 721+512 }, {
"75", 736+512 }, {
"75", 736+512 }, {
"75", 768+512 } } },
1926 { { {
"100", 940+512 }, {
"100", 960+512 }, {
"100", 960+512 }, {
"100", 1024+512 } } },
1927 { { {
"125",1160+512 }, {
"125",1184+512 }, {
"125",1184+512 }, {
"125", 1280+512 } } },
1931 { { {
"-25", -624+2048 }, {
"-25", -640+2048 }, {
"-25", -640+2048 }, {
"-25",-1024+2048 } } },
1932 { { {
"0", 256+2048 }, {
"0", 256+2048 }, {
"0", 256+2048 }, {
"0", 0+2048 } } },
1933 { { {
"25", 1132+2048 }, {
"25", 1152+2048 }, {
"25", 1152+2048 }, {
"25", 1024+2048 } } },
1934 { { {
"50", 2008+2048 }, {
"50", 2048+2048 }, {
"50", 2048+2048 }, {
"50", 2048+2048 } } },
1935 { { {
"75", 2884+2048 }, {
"75", 2944+2048 }, {
"75", 2944+2048 }, {
"75", 3072+2048 } } },
1936 { { {
"100", 3760+2048 }, {
"100", 3840+2048 }, {
"100", 3840+2048 }, {
"100", 4096+2048 } } },
1937 { { {
"125", 4640+2048 }, {
"125", 4736+2048 }, {
"125", 4736+2048 }, {
"125", 5120+2048 } } },
1941 { { {
"16", 16+256 }, {
"16", 16+256 }, {
"16", 16+256 }, {
"0", 0+256 } } },
1942 { { {
"128", 128+256 }, {
"128", 128+256 }, {
"128", 128+256 }, {
"128", 128+256 } } },
1943 { { {
"235", 235+256 }, {
"240", 240+256 }, {
"240", 240+256 }, {
"255", 255+256 } } },
1947 { { {
"32", 32+512 }, {
"32", 32+512 }, {
"32", 32+512 }, {
"0", 0+512 } } },
1948 { { {
"256", 256+512 }, {
"256", 256+512 }, {
"256", 256+512 }, {
"256", 256+512 } } },
1949 { { {
"470", 470+512 }, {
"480", 480+512 }, {
"480", 480+512 }, {
"511", 511+512 } } },
1953 { { {
"64", 64+1024 }, {
"64", 64+1024 }, {
"64", 64+1024 }, {
"0", 0+1024 } } },
1954 { { {
"512", 512+1024 }, {
"512", 512+1024 }, {
"512", 512+1024 }, {
"512", 512+1024 } } },
1955 { { {
"940", 940+1024 }, {
"960", 960+1024 }, {
"960", 960+1024 }, {
"1023", 1023+1024 } } },
1959 { { {
"256", 256+4096 }, {
"256", 256+4096 }, {
"256", 256+4096 }, {
"0", 0+4096 } } },
1960 { { {
"2048", 2048+4096 }, {
"2048", 2048+4096 }, {
"2048", 2048+4096 }, {
"2048", 2048+4096 } } },
1961 { { {
"3760", 3760+4096 }, {
"3840", 3840+4096 }, {
"3840", 3840+4096 }, {
"4095", 4095+4096 } } },
1965 { { {
"0", 16+256 }, {
"0", 16+256 }, {
"0", 16+256 }, {
"0", 0+256 } } },
1966 { { {
"175", 71+256 }, {
"175", 72+256 }, {
"175", 72+256 }, {
"175", 64+256 } } },
1967 { { {
"350", 126+256 }, {
"350", 128+256 }, {
"350", 128+256 }, {
"350", 128+256 } } },
1968 { { {
"525", 180+256 }, {
"525", 184+256 }, {
"525", 184+256 }, {
"525", 192+256 } } },
1969 { { {
"700", 235+256 }, {
"700", 240+256 }, {
"700", 240+256 }, {
"700", 255+256 } } },
1973 { { {
"0", 32+512 }, {
"0", 32+512 }, {
"0", 32+512 }, {
"0", 0+512 } } },
1974 { { {
"175", 142+512 }, {
"175", 144+512 }, {
"175", 144+512 }, {
"175", 128+512 } } },
1975 { { {
"350", 251+512 }, {
"350", 256+512 }, {
"350", 256+512 }, {
"350", 256+512 } } },
1976 { { {
"525", 361+512 }, {
"525", 368+512 }, {
"525", 368+512 }, {
"525", 384+512 } } },
1977 { { {
"700", 470+512 }, {
"700", 480+512 }, {
"700", 480+512 }, {
"700", 511+512 } } },
1981 { { {
"0", 64+1024 }, {
"0", 64+1024 }, {
"0", 64+1024 }, {
"0", 0+1024 } } },
1982 { { {
"175", 283+1024 }, {
"175", 288+1024 }, {
"175", 288+1024 }, {
"175", 256+1024 } } },
1983 { { {
"350", 502+1024 }, {
"350", 512+1024 }, {
"350", 512+1024 }, {
"350", 512+1024 } } },
1984 { { {
"525", 721+1024 }, {
"525", 736+1024 }, {
"525", 736+1024 }, {
"525", 768+1024 } } },
1985 { { {
"700", 940+1024 }, {
"700", 960+1024 }, {
"700", 960+1024 }, {
"700", 1023+1024 } } },
1989 { { {
"0", 256+4096 }, {
"0", 256+4096 }, {
"0", 256+4096 }, {
"0", 0+4096 } } },
1990 { { {
"175", 1132+4096 }, {
"175", 1152+4096 }, {
"175", 1152+4096 }, {
"175", 1024+4096 } } },
1991 { { {
"350", 2008+4096 }, {
"350", 2048+4096 }, {
"350", 2048+4096 }, {
"350", 2048+4096 } } },
1992 { { {
"525", 2884+4096 }, {
"525", 2944+4096 }, {
"525", 2944+4096 }, {
"525", 3072+4096 } } },
1993 { { {
"700", 3760+4096 }, {
"700", 3840+4096 }, {
"700", 3840+4096 }, {
"700", 4095+4096 } } },
1997 { { {
"-25", -39+256 }, {
"-25", -40+256 }, {
"-25", -40+256 }, {
"-25", -64+256 } } },
1998 { { {
"0", 16+256 }, {
"0", 16+256 }, {
"0", 16+256 }, {
"0", 0+256 } } },
1999 { { {
"25", 71+256 }, {
"25", 72+256 }, {
"25", 72+256 }, {
"25", 64+256 } } },
2000 { { {
"50", 126+256 }, {
"50", 128+256 }, {
"50", 128+256 }, {
"50", 128+256 } } },
2001 { { {
"75", 180+256 }, {
"75", 184+256 }, {
"75", 184+256 }, {
"75", 192+256 } } },
2002 { { {
"100", 235+256 }, {
"100", 240+256 }, {
"100", 240+256 }, {
"100", 256+256 } } },
2003 { { {
"125", 290+256 }, {
"125", 296+256 }, {
"125", 296+256 }, {
"125", 320+256 } } },
2007 { { {
"-25", -78+512 }, {
"-25", -80+512 }, {
"-25", -80+512 }, {
"-25",-128+512 } } },
2008 { { {
"0", 32+512 }, {
"0", 32+512 }, {
"0", 32+512 }, {
"0", 0+512 } } },
2009 { { {
"25", 142+512 }, {
"25", 144+512 }, {
"25", 144+512 }, {
"25", 128+512 } } },
2010 { { {
"50", 251+512 }, {
"50", 256+512 }, {
"50", 256+512 }, {
"50", 256+512 } } },
2011 { { {
"75", 361+512 }, {
"75", 368+512 }, {
"75", 368+512 }, {
"75", 384+512 } } },
2012 { { {
"100", 470+512 }, {
"100", 480+512 }, {
"100", 480+512 }, {
"100", 512+512 } } },
2013 { { {
"125", 580+512 }, {
"125", 592+512 }, {
"125", 592+512 }, {
"125", 640+512 } } },
2017 { { {
"-25",-156+1024 }, {
"-25",-160+1024 }, {
"-25",-160+1024 }, {
"-25", -256+1024 } } },
2018 { { {
"0", 64+1024 }, {
"0", 64+1024 }, {
"0", 64+1024 }, {
"0", 0+1024 } } },
2019 { { {
"25", 283+1024 }, {
"25", 288+1024 }, {
"25", 288+1024 }, {
"25", 256+1024 } } },
2020 { { {
"50", 502+1024 }, {
"50", 512+1024 }, {
"50", 512+1024 }, {
"50", 512+1024 } } },
2021 { { {
"75", 721+1024 }, {
"75", 736+1024 }, {
"75", 736+1024 }, {
"75", 768+1024 } } },
2022 { { {
"100", 940+1024 }, {
"100", 960+1024 }, {
"100", 960+1024 }, {
"100", 1024+1024 } } },
2023 { { {
"125",1160+1024 }, {
"125",1184+1024 }, {
"125",1184+1024 }, {
"125", 1280+1024 } } },
2027 { { {
"-25", -624+4096 }, {
"-25", -640+4096 }, {
"-25", -640+4096 }, {
"-25",-1024+4096 } } },
2028 { { {
"0", 256+4096 }, {
"0", 256+4096 }, {
"0", 256+4096 }, {
"0", 0+4096 } } },
2029 { { {
"25", 1132+4096 }, {
"25", 1152+4096 }, {
"25", 1152+4096 }, {
"25", 1024+4096 } } },
2030 { { {
"50", 2008+4096 }, {
"50", 2048+4096 }, {
"50", 2048+4096 }, {
"50", 2048+4096 } } },
2031 { { {
"75", 2884+4096 }, {
"75", 2944+4096 }, {
"75", 2944+4096 }, {
"75", 3072+4096 } } },
2032 { { {
"100", 3760+4096 }, {
"100", 3840+4096 }, {
"100", 3840+4096 }, {
"100", 4096+4096 } } },
2033 { { {
"125", 4640+4096 }, {
"125", 4736+4096 }, {
"125", 4736+4096 }, {
"125", 5120+4096 } } },
2037 { { {
"16", 16 }, {
"16", 16 }, {
"16", 16 }, {
"0", 0 } } },
2038 { { {
"128", 128 }, {
"128", 128 }, {
"128", 128 }, {
"128", 128 } } },
2039 { { {
"235", 235 }, {
"240", 240 }, {
"240", 240 }, {
"255", 255 } } },
2043 { { {
"32", 32 }, {
"32", 32 }, {
"32", 32 }, {
"0", 0 } } },
2044 { { {
"256", 256 }, {
"256", 256 }, {
"256", 256 }, {
"256", 256 } } },
2045 { { {
"470", 470 }, {
"480", 480 }, {
"480", 480 }, {
"511", 511 } } },
2049 { { {
"64", 64 }, {
"64", 64 }, {
"64", 64 }, {
"0", 0 } } },
2050 { { {
"512", 512 }, {
"512", 512 }, {
"512", 512 }, {
"512", 512 } } },
2051 { { {
"940", 940 }, {
"960", 960 }, {
"960", 960 }, {
"1023", 1023 } } },
2055 { { {
"256", 256 }, {
"256", 256 }, {
"256", 256 }, {
"0", 0 } } },
2056 { { {
"2048", 2048 }, {
"2048", 2048 }, {
"2048", 2048 }, {
"2048", 2048 } } },
2057 { { {
"3760", 3760 }, {
"3840", 3840 }, {
"3840", 3840 }, {
"4095", 4095 } } },
2061 { { {
"0", 16 }, {
"0", 16 }, {
"0", 16 }, {
"0", 0 } } },
2062 { { {
"175", 71 }, {
"175", 72 }, {
"175", 72 }, {
"175", 64 } } },
2063 { { {
"350", 126 }, {
"350", 128 }, {
"350", 128 }, {
"350", 128 } } },
2064 { { {
"525", 180 }, {
"525", 184 }, {
"525", 184 }, {
"525", 192 } } },
2065 { { {
"700", 235 }, {
"700", 240 }, {
"700", 240 }, {
"700", 255 } } },
2069 { { {
"0", 32 }, {
"0", 32 }, {
"0", 32 }, {
"0", 0 } } },
2070 { { {
"175", 142 }, {
"175", 144 }, {
"175", 144 }, {
"175", 128 } } },
2071 { { {
"350", 251 }, {
"350", 256 }, {
"350", 256 }, {
"350", 256 } } },
2072 { { {
"525", 361 }, {
"525", 368 }, {
"525", 368 }, {
"525", 384 } } },
2073 { { {
"700", 470 }, {
"700", 480 }, {
"700", 480 }, {
"700", 511 } } },
2077 { { {
"0", 64 }, {
"0", 64 }, {
"0", 64 }, {
"0", 0 } } },
2078 { { {
"175", 283 }, {
"175", 288 }, {
"175", 288 }, {
"175", 256 } } },
2079 { { {
"350", 502 }, {
"350", 512 }, {
"350", 512 }, {
"350", 512 } } },
2080 { { {
"525", 721 }, {
"525", 736 }, {
"525", 736 }, {
"525", 768 } } },
2081 { { {
"700", 940 }, {
"700", 960 }, {
"700", 960 }, {
"700", 1023 } } },
2085 { { {
"0", 256 }, {
"0", 256 }, {
"0", 256 }, {
"0", 0 } } },
2086 { { {
"175", 1132 }, {
"175", 1152 }, {
"175", 1152 }, {
"175", 1024 } } },
2087 { { {
"350", 2008 }, {
"350", 2048 }, {
"350", 2048 }, {
"350", 2048 } } },
2088 { { {
"525", 2884 }, {
"525", 2944 }, {
"525", 2944 }, {
"525", 3072 } } },
2089 { { {
"700", 3760 }, {
"700", 3840 }, {
"700", 3840 }, {
"700", 4095 } } },
2093 { { {
"0", 16 }, {
"0", 16 }, {
"0", 16 }, {
"0", 0 } } },
2094 { { {
"25", 71 }, {
"25", 72 }, {
"25", 72 }, {
"25", 64 } } },
2095 { { {
"50", 126 }, {
"50", 128 }, {
"50", 128 }, {
"50", 128 } } },
2096 { { {
"75", 180 }, {
"75", 184 }, {
"75", 184 }, {
"75", 192 } } },
2097 { { {
"100", 235 }, {
"100", 240 }, {
"100", 240 }, {
"100", 255 } } },
2101 { { {
"0", 32 }, {
"0", 32 }, {
"0", 32 }, {
"0", 0 } } },
2102 { { {
"25", 142 }, {
"25", 144 }, {
"25", 144 }, {
"25", 128 } } },
2103 { { {
"50", 251 }, {
"50", 256 }, {
"50", 256 }, {
"50", 256 } } },
2104 { { {
"75", 361 }, {
"75", 368 }, {
"75", 368 }, {
"75", 384 } } },
2105 { { {
"100", 470 }, {
"100", 480 }, {
"100", 480 }, {
"100", 511 } } },
2109 { { {
"0", 64 }, {
"0", 64 }, {
"0", 64 }, {
"0", 0 } } },
2110 { { {
"25", 283 }, {
"25", 288 }, {
"25", 288 }, {
"25", 256 } } },
2111 { { {
"50", 502 }, {
"50", 512 }, {
"50", 512 }, {
"50", 512 } } },
2112 { { {
"75", 721 }, {
"75", 736 }, {
"75", 736 }, {
"75", 768 } } },
2113 { { {
"100", 940 }, {
"100", 960 }, {
"100", 960 }, {
"100", 1023 } } },
2117 { { {
"0", 256 }, {
"0", 256 }, {
"0", 256 }, {
"0", 0 } } },
2118 { { {
"25", 1132 }, {
"25", 1152 }, {
"25", 1152 }, {
"25", 1024 } } },
2119 { { {
"50", 2008 }, {
"50", 2048 }, {
"50", 2048 }, {
"50", 2048 } } },
2120 { { {
"75", 2884 }, {
"75", 2944 }, {
"75", 2944 }, {
"75", 3072 } } },
2121 { { {
"100", 3760 }, {
"100", 3840 }, {
"100", 3840 }, {
"100", 4095 } } },
2125 { { {
"50", 50 }, {
"50", 50 }, {
"50", 50 }, {
"50", 50 } } },
2126 { { {
"100", 100 }, {
"100", 100 }, {
"100", 100 }, {
"100", 100 } } },
2127 { { {
"150", 150 }, {
"150", 150 }, {
"150", 150 }, {
"150", 150 } } },
2128 { { {
"200", 200 }, {
"200", 200 }, {
"200", 200 }, {
"200", 200 } } },
2129 { { {
"255", 255 }, {
"255", 255 }, {
"255", 255 }, {
"255", 255 } } },
2133 { { {
"100", 100 }, {
"100", 100 }, {
"100", 100 }, {
"100", 100 } } },
2134 { { {
"200", 200 }, {
"200", 200 }, {
"200", 200 }, {
"200", 200 } } },
2135 { { {
"300", 300 }, {
"300", 300 }, {
"300", 300 }, {
"300", 300 } } },
2136 { { {
"400", 400 }, {
"400", 400 }, {
"400", 400 }, {
"400", 400 } } },
2137 { { {
"500", 500 }, {
"500", 500 }, {
"500", 500 }, {
"500", 500 } } },
2141 { { {
"200", 200 }, {
"200", 200 }, {
"200", 200 }, {
"200", 200 } } },
2142 { { {
"400", 400 }, {
"400", 400 }, {
"400", 400 }, {
"400", 400 } } },
2143 { { {
"600", 600 }, {
"600", 600 }, {
"600", 600 }, {
"600", 600 } } },
2144 { { {
"800", 800 }, {
"800", 800 }, {
"800", 800 }, {
"800", 800 } } },
2145 { { {
"1000",1000 }, {
"1000",1000 }, {
"1000",1000 }, {
"1000",1000 } } },
2149 { { {
"800", 800 }, {
"800", 800 }, {
"800", 800 }, {
"800", 800 } } },
2150 { { {
"1600", 1600 }, {
"1600", 1600 }, {
"1600", 1600 }, {
"1600", 1600 } } },
2151 { { {
"2400", 2400 }, {
"2400", 2400 }, {
"2400", 2400 }, {
"2400", 2400 } } },
2152 { { {
"3200", 3200 }, {
"3200", 3200 }, {
"3200", 3200 }, {
"3200", 3200 } } },
2153 { { {
"4000", 4000 }, {
"4000", 4000 }, {
"4000", 4000 }, {
"4000", 4000 } } },
2160 for (y = 0; y <
height; y += step) {
2161 dst[0] = v * o1 + dst[0] * o2;
2163 dst += linesize * step;
2171 for (y = 0; y <
height; y += step) {
2172 dst[0] = v * o1 + dst[0] * o2;
2174 dst += (linesize / 2) * step;
2182 for (x = 0; x <
width; x += step) {
2183 dst[x] = v * o1 + dst[x] * o2;
2191 for (x = 0; x <
width; x += step) {
2192 dst[x] = v * o1 + dst[x] * o2;
2204 for (plane = 0; plane < 4 && out->
data[
plane]; plane++) {
2205 for (i = 0; txt[i]; i++) {
2207 int v = color[
plane];
2210 for (char_y = 0; char_y < font_height; char_y++) {
2211 for (mask = 0x80;
mask; mask >>= 1) {
2212 if (font[txt[i] * font_height + char_y] & mask)
2213 p[0] = p[0] * o2 + v * o1;
2230 for (plane = 0; plane < 4 && out->
data[
plane]; plane++) {
2231 for (i = 0; txt[i]; i++) {
2235 uint16_t *p = (uint16_t *)(out->
data[plane] + y * out->
linesize[plane]) + (x + i * 8);
2236 for (char_y = 0; char_y < font_height; char_y++) {
2237 for (mask = 0x80;
mask; mask >>= 1) {
2238 if (font[txt[i] * font_height + char_y] & mask)
2239 p[0] = p[0] * o2 + v * o1;
2256 for (plane = 0; plane < 4 && out->
data[
plane]; plane++) {
2257 for (i = 0; txt[i]; i++) {
2259 int v = color[
plane];
2261 for (char_y = font_height - 1; char_y >= 0; char_y--) {
2263 for (mask = 0x80;
mask; mask >>= 1) {
2264 if (font[txt[i] * font_height + font_height - 1 - char_y] & mask)
2265 p[char_y] = p[char_y] * o2 + v * o1;
2281 for (plane = 0; plane < 4 && out->
data[
plane]; plane++) {
2282 for (i = 0; txt[i]; i++) {
2286 for (char_y = 0; char_y < font_height; char_y++) {
2287 uint16_t *p = (uint16_t *)(out->
data[plane] + (y + i * 10) * out->
linesize[
plane]) + x;
2288 for (mask = 0x80;
mask; mask >>= 1) {
2289 if (font[txt[i] * font_height + font_height - 1 - char_y] & mask)
2290 p[char_y] = p[char_y] * o2 + v * o1;
2304 const int step = (s->
flags & 2) + 1;
2306 const float o2 = 1. - o1;
2308 int k = 0,
c, p, l, offset_x = 0, offset_y = 0;
2315 for (p = 0; p < s->
ncomp; p++) {
2319 int x = offset_x + (s->
mirror ? s->
size - 1 - pos : pos);
2329 int x = offset_x + (s->
mirror ? s->
size - 1 - pos : pos) - 10;
2344 const int step = (s->
flags & 2) + 1;
2346 const float o2 = 1. - o1;
2349 int k = 0,
c, p, l, offset_x = 0, offset_y = 0;
2356 for (p = 0; p < s->
ncomp; p++) {
2360 int x = offset_x + (s->
mirror ? s->
size - 1 - pos : pos);
2361 uint16_t *dst = (uint16_t *)(out->
data[p] + offset_y * out->
linesize[p]) + x;
2370 int x = offset_x + (s->
mirror ? s->
size - 1 - pos : pos) - 10;
2385 const int step = (s->
flags & 2) + 1;
2387 const float o2 = 1. - o1;
2389 int k = 0,
c, p, l, offset_y = 0, offset_x = 0;
2396 for (p = 0; p < s->
ncomp; p++) {
2400 int y = offset_y + (s->
mirror ? s->
size - 1 - pos : pos);
2410 int y = offset_y + (s->
mirror ? s->
size - 1 - pos : pos) - 10;
2425 const int step = (s->
flags & 2) + 1;
2427 const float o2 = 1. - o1;
2430 int k = 0,
c, p, l, offset_x = 0, offset_y = 0;
2437 for (p = 0; p < s->
ncomp; p++) {
2441 int y = offset_y + (s->
mirror ? s->
size - 1 - pos : pos);
2442 uint16_t *dst = (uint16_t *)(out->
data[p] + y * out->
linesize[p]) + offset_x;
2451 int y = offset_y + (s->
mirror ? s->
size - 1 - pos: pos) - 10;
2484 case FLAT: s->
size = 256 * 3;
break;
2485 default: s->
size = 256;
break;
2490 case 0x1100: s->
waveform = lowpass_column_mirror;
break;
2491 case 0x1000: s->
waveform = lowpass_row_mirror;
break;
2492 case 0x0100: s->
waveform = lowpass_column;
break;
2493 case 0x0000: s->
waveform = lowpass_row;
break;
2494 case 0x1110: s->
waveform = lowpass16_column_mirror;
break;
2495 case 0x1010: s->
waveform = lowpass16_row_mirror;
break;
2496 case 0x0110: s->
waveform = lowpass16_column;
break;
2497 case 0x0010: s->
waveform = lowpass16_row;
break;
2673 switch (inlink->
format) {
2696 int comp = 0, i, j = 0, k, p,
size;
2698 for (i = 0; i < s->
ncomp; i++) {
2699 if ((1 << i) & s->
pcomp)
2722 for (p = 0; p < s->
ncomp; p++) {
2726 if (!((1 << p) & s->
pcomp))
2729 for (k = 0; k < 4; k++) {
2737 for (i = 0; i <
size; i++) {
2738 for (k = 0; k < 4; k++) {
2766 for (k = 0; k < s->
dcomp; k++) {
2768 for (i = 0; i < outlink->
h ; i++)
2773 const int mult = s->
max / 256;
2776 for (i = 0; i < outlink->
h ; i++) {
2777 for (j = 0; j < outlink->
w; j++)
2784 for (k = 0, i = 0; k < s->
ncomp; k++) {
2785 if ((1 << k) & s->
pcomp) {
2790 offset_x = s->
mode ? i++ * inlink->
w : 0;
2791 offset_y = s->
mode ? 0 : i++ * inlink->
h;
2835 .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_GBRAP10
#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
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)
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
enum AVColorRange color_range
MPEG vs JPEG YUV range.
#define AV_PIX_FMT_GBRAP12
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)
static int16_t mult(Float11 *f1, Float11 *f2)
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
#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)