96 int offset_y,
int offset_x,
102 #define OFFSET(x) offsetof(WaveformContext, x)
103 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
299 else if (rgb && depth == 8 && ncomp > 2)
301 else if (rgb && depth == 9 && ncomp > 2)
303 else if (rgb && depth == 10 && ncomp > 2)
305 else if (rgb && depth == 12 && ncomp > 2)
307 else if (depth == 8 && ncomp > 2)
309 else if (depth == 9 && ncomp > 2)
311 else if (depth == 10 && ncomp > 2)
313 else if (depth == 12 && ncomp > 2)
325 const int dst_linesize = out->
linesize[component] / 2;
326 const int bg = s->
bg_color[component] * (s->
max / 256);
327 const int limit = s->
max - 1;
336 for (x = offset; x < offset + dst_w; x++) {
337 for (y = start; y <
end; y++) {
338 dst = (uint16_t *)out->
data[component] + y * dst_linesize + x;
344 for (y = end - 1; y >=
start; y--) {
345 dst = (uint16_t *)out->
data[component] + y * dst_linesize + x;
353 for (y = offset; y < offset + dst_h; y++) {
354 dst = (uint16_t *)out->
data[component] + y * dst_linesize;
355 for (x = start; x <
end; x++) {
361 for (x = end - 1; x >=
start; x--) {
373 const int dst_linesize = out->
linesize[component];
383 for (x = offset; x < offset + dst_w; x++) {
384 for (y = start; y <
end; y++) {
385 dst = out->
data[component] + y * dst_linesize + x;
391 for (y = end - 1; y >=
start; y--) {
392 dst = out->
data[component] + y * dst_linesize + x;
400 for (y = offset; y < offset + dst_h; y++) {
401 dst = out->
data[component] + y * dst_linesize;
402 for (x = start; x <
end; x++) {
408 for (x = end - 1; x >=
start; x--) {
420 const int dst_linesize = out->
linesize[component] / 2;
421 const int bg = s->
bg_color[component] * (s->
max / 256);
422 const int limit = s->
max - 1;
433 for (x = offset; x < offset + dst_w; x++) {
434 for (y = start; y < end && y < emin[x -
offset]; y++) {
435 dst = (uint16_t *)out->
data[component] + y * dst_linesize + x;
441 for (y = end - 1; y >= start && y >= emax[x -
offset]; y--) {
442 dst = (uint16_t *)out->
data[component] + y * dst_linesize + x;
453 for (x = offset; x < offset + dst_w; x++) {
454 dst = (uint16_t *)out->
data[component] + emin[x - offset] * dst_linesize + x;
456 dst = (uint16_t *)out->
data[component] + emax[x -
offset] * dst_linesize + x;
460 for (y = offset; y < offset + dst_h; y++) {
461 dst = (uint16_t *)out->
data[component] + y * dst_linesize;
462 for (x = start; x < end && x < emin[y -
offset]; x++) {
468 for (x = end - 1; x >= start && x >= emax[y -
offset]; x--) {
479 for (y = offset; y < offset + dst_h; y++) {
480 dst = (uint16_t *)out->
data[component] + y * dst_linesize + emin[y - offset];
482 dst = (uint16_t *)out->
data[component] + y * dst_linesize + emax[y -
offset];
490 const int dst_linesize = out->
linesize[component];
491 const int bg = s->
bg_color[component];
502 for (x = offset; x < offset + dst_w; x++) {
503 for (y = start; y < end && y < emin[x -
offset]; y++) {
504 dst = out->
data[component] + y * dst_linesize + x;
510 for (y = end - 1; y >= start && y >= emax[x -
offset]; y--) {
511 dst = out->
data[component] + y * dst_linesize + x;
522 for (x = offset; x < offset + dst_w; x++) {
523 dst = out->
data[component] + emin[x -
offset] * dst_linesize + x;
525 dst = out->
data[component] + emax[x -
offset] * dst_linesize + x;
529 for (y = offset; y < offset + dst_h; y++) {
530 dst = out->
data[component] + y * dst_linesize;
531 for (x = start; x < end && x < emin[y -
offset]; x++) {
537 for (x = end - 1; x >= start && x >= emax[y -
offset]; x--) {
548 for (y = offset; y < offset + dst_h; y++) {
549 dst = out->
data[component] + y * dst_linesize + emin[y -
offset];
551 dst = out->
data[component] + y * dst_linesize + emax[y -
offset];
598 int offset_y,
int offset_x,
606 const int dst_signed_linesize = dst_linesize * (mirror == 1 ? -1 : 1);
607 const int limit = s->
max - 1;
611 const uint16_t *src_data = (
const uint16_t *)in->
data[plane];
612 uint16_t *dst_data = (uint16_t *)out->
data[
plane] + offset_y * dst_linesize + offset_x;
613 uint16_t *
const dst_bottom_line = dst_data + dst_linesize * (s->
size - 1);
614 uint16_t *
const dst_line = (mirror ? dst_bottom_line : dst_data);
615 const int step = column ? 1 << shift_w : 1 <<
shift_h;
619 if (!column && mirror)
622 for (y = 0; y < src_h; y++) {
623 const uint16_t *src_data_end = src_data + src_w;
624 uint16_t *dst = dst_line;
626 for (p = src_data; p < src_data_end; p++) {
628 int i = 0, v =
FFMIN(*p, limit);
632 target = dst++ + dst_signed_linesize * v;
633 update16(target, max, intensity, limit);
634 }
while (++i < step);
636 uint16_t *row = dst_data;
639 target = row - v - 1;
642 update16(target, max, intensity, limit);
644 }
while (++i < step);
647 src_data += src_linesize;
648 dst_data += dst_linesize * step;
651 envelope16(s, out, plane, plane, column ? offset_x : offset_y);
654 #define LOWPASS16_FUNC(name, column, mirror) \
655 static void lowpass16_##name(WaveformContext *s, \
656 AVFrame *in, AVFrame *out, \
657 int component, int intensity, \
658 int offset_y, int offset_x, \
659 int unused1, int unused2) \
661 lowpass16(s, in, out, component, intensity, \
662 offset_y, offset_x, column, mirror); \
673 int offset_y,
int offset_x,
676 const int plane = s->desc->comp[component].plane;
677 const int shift_w = s->shift_w[component];
678 const int shift_h = s->shift_h[component];
679 const int src_linesize = in->linesize[
plane];
680 const int dst_linesize = out->linesize[
plane];
681 const int dst_signed_linesize = dst_linesize * (mirror == 1 ? -1 : 1);
686 uint8_t *dst_data = out->data[
plane] + offset_y * dst_linesize + offset_x;
687 uint8_t *
const dst_bottom_line = dst_data + dst_linesize * (s->size - 1);
688 uint8_t *
const dst_line = (mirror ? dst_bottom_line : dst_data);
689 const int step = column ? 1 << shift_w : 1 <<
shift_h;
693 if (!column && mirror)
696 for (y = 0; y < src_h; y++) {
697 const uint8_t *src_data_end = src_data + src_w;
700 for (p = src_data; p < src_data_end; p++) {
703 target = dst + dst_signed_linesize * *p;
705 update(target, max, intensity);
709 target = row - *p - 1;
712 update(target, max, intensity);
716 src_data += src_linesize;
717 dst_data += dst_linesize * step;
720 if (column && step > 1) {
721 const int dst_w = s->display ==
PARADE ? out->width / s->acomp : out->width;
722 const int dst_h = 256;
726 dst = out->data[
plane] + offset_y * dst_linesize + offset_x;
727 for (y = 0; y < dst_h; y++) {
728 for (x = 0; x < dst_w; x+=step) {
729 for (z = 1; z < step; z++) {
735 }
else if (step > 1) {
736 const int dst_h = s->display ==
PARADE ? out->height / s->acomp : out->height;
737 const int dst_w = 256;
741 dst = out->data[
plane] + offset_y * dst_linesize + offset_x;
742 for (y = 0; y < dst_h; y+=step) {
743 for (z = 1; z < step; z++)
744 memcpy(dst + dst_linesize * z, dst, dst_w);
745 dst += dst_linesize * step;
749 envelope(s, out, plane, plane, column ? offset_x : offset_y);
752 #define LOWPASS_FUNC(name, column, mirror) \
753 static void lowpass_##name(WaveformContext *s, \
754 AVFrame *in, AVFrame *out, \
755 int component, int intensity, \
756 int offset_y, int offset_x, \
757 int unused1, int unused2) \
759 lowpass(s, in, out, component, intensity, \
760 offset_y, offset_x, column, mirror); \
771 int offset_y,
int offset_x,
774 const int plane = s->desc->comp[component].plane;
775 const int c0_linesize = in->linesize[ plane + 0 ] / 2;
776 const int c1_linesize = in->linesize[(plane + 1) % s->ncomp] / 2;
777 const int c2_linesize = in->linesize[(plane + 2) % s->ncomp] / 2;
778 const int c0_shift_w = s->shift_w[ component + 0 ];
779 const int c1_shift_w = s->shift_w[(component + 1) % s->ncomp];
780 const int c2_shift_w = s->shift_w[(component + 2) % s->ncomp];
781 const int c0_shift_h = s->shift_h[ component + 0 ];
782 const int c1_shift_h = s->shift_h[(component + 1) % s->ncomp];
783 const int c2_shift_h = s->shift_h[(component + 2) % s->ncomp];
784 const int d0_linesize = out->linesize[ plane + 0 ] / 2;
785 const int d1_linesize = out->linesize[(plane + 1) % s->ncomp] / 2;
786 const int limit = s->max - 1;
787 const int max = limit - intensity;
788 const int mid = s->max / 2;
789 const int src_h = in->height;
790 const int src_w = in->width;
794 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1);
795 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1);
797 for (x = 0; x < src_w; x++) {
798 const uint16_t *c0_data = (uint16_t *)in->data[plane + 0];
799 const uint16_t *c1_data = (uint16_t *)in->data[(plane + 1) % s->ncomp];
800 const uint16_t *c2_data = (uint16_t *)in->data[(plane + 2) % s->ncomp];
801 uint16_t *d0_data = (uint16_t *)(out->data[
plane]) + offset_y * d0_linesize + offset_x;
802 uint16_t *d1_data = (uint16_t *)(out->data[(plane + 1) % s->ncomp]) + offset_y * d1_linesize + offset_x;
803 uint16_t *
const d0_bottom_line = d0_data + d0_linesize * (s->size - 1);
804 uint16_t *
const d0 = (mirror ? d0_bottom_line : d0_data);
805 uint16_t *
const d1_bottom_line = d1_data + d1_linesize * (s->size - 1);
806 uint16_t *
const d1 = (mirror ? d1_bottom_line : d1_data);
808 for (y = 0; y < src_h; y++) {
809 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit) + s->max;
810 const int c1 =
FFMIN(
FFABS(c1_data[x >> c1_shift_w] - mid) +
FFABS(c2_data[x >> c2_shift_w] - mid), limit);
813 target = d0 + x + d0_signed_linesize * c0;
815 target = d1 + x + d1_signed_linesize * (c0 -
c1);
817 target = d1 + x + d1_signed_linesize * (c0 +
c1);
820 if (!c0_shift_h || (y & c0_shift_h))
821 c0_data += c0_linesize;
822 if (!c1_shift_h || (y & c1_shift_h))
823 c1_data += c1_linesize;
824 if (!c2_shift_h || (y & c2_shift_h))
825 c2_data += c2_linesize;
826 d0_data += d0_linesize;
827 d1_data += d1_linesize;
831 const uint16_t *c0_data = (uint16_t *)in->data[plane];
832 const uint16_t *c1_data = (uint16_t *)in->data[(plane + 1) % s->ncomp];
833 const uint16_t *c2_data = (uint16_t *)in->data[(plane + 2) % s->ncomp];
834 uint16_t *d0_data = (uint16_t *)(out->data[
plane]) + offset_y * d0_linesize + offset_x;
835 uint16_t *d1_data = (uint16_t *)(out->data[(plane + 1) % s->ncomp]) + offset_y * d1_linesize + offset_x;
838 d0_data += s->size - 1;
839 d1_data += s->size - 1;
842 for (y = 0; y < src_h; y++) {
843 for (x = 0; x < src_w; x++) {
844 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit) + s->max;
845 const int c1 =
FFMIN(
FFABS(c1_data[x >> c1_shift_w] - mid) +
FFABS(c2_data[x >> c2_shift_w] - mid), limit);
849 target = d0_data - c0;
851 target = d1_data - (c0 -
c1);
853 target = d1_data - (c0 +
c1);
856 target = d0_data + c0;
858 target = d1_data + (c0 -
c1);
860 target = d1_data + (c0 +
c1);
865 if (!c0_shift_h || (y & c0_shift_h))
866 c0_data += c0_linesize;
867 if (!c1_shift_h || (y & c1_shift_h))
868 c1_data += c1_linesize;
869 if (!c2_shift_h || (y & c2_shift_h))
870 c2_data += c2_linesize;
871 d0_data += d0_linesize;
872 d1_data += d1_linesize;
876 envelope16(s, out, plane, plane, column ? offset_x : offset_y);
877 envelope16(s, out, plane, (plane + 1) % s->ncomp, column ? offset_x : offset_y);
883 int offset_y,
int offset_x,
887 const int c0_linesize = in->
linesize[ plane + 0 ];
888 const int c1_linesize = in->
linesize[(plane + 1) % s->
ncomp];
889 const int c2_linesize = in->
linesize[(plane + 2) % s->
ncomp];
890 const int c0_shift_w = s->
shift_w[ component + 0 ];
891 const int c1_shift_w = s->
shift_w[(component + 1) % s->
ncomp];
892 const int c2_shift_w = s->
shift_w[(component + 2) % s->
ncomp];
893 const int c0_shift_h = s->
shift_h[ component + 0 ];
894 const int c1_shift_h = s->
shift_h[(component + 1) % s->
ncomp];
895 const int c2_shift_h = s->
shift_h[(component + 2) % s->
ncomp];
896 const int d0_linesize = out->
linesize[ plane + 0 ];
897 const int d1_linesize = out->
linesize[(plane + 1) % s->
ncomp];
898 const int max = 255 - intensity;
899 const int src_h = in->
height;
900 const int src_w = in->
width;
904 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1);
905 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1);
907 for (x = 0; x < src_w; x++) {
912 uint8_t *d1_data = out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
913 uint8_t *
const d0_bottom_line = d0_data + d0_linesize * (s->
size - 1);
914 uint8_t *
const d0 = (mirror ? d0_bottom_line : d0_data);
915 uint8_t *
const d1_bottom_line = d1_data + d1_linesize * (s->
size - 1);
916 uint8_t *
const d1 = (mirror ? d1_bottom_line : d1_data);
918 for (y = 0; y < src_h; y++) {
919 const int c0 = c0_data[x >> c0_shift_w] + 256;
920 const int c1 =
FFABS(c1_data[x >> c1_shift_w] - 128) +
FFABS(c2_data[x >> c2_shift_w] - 128);
923 target = d0 + x + d0_signed_linesize * c0;
925 target = d1 + x + d1_signed_linesize * (c0 -
c1);
927 target = d1 + x + d1_signed_linesize * (c0 +
c1);
930 if (!c0_shift_h || (y & c0_shift_h))
931 c0_data += c0_linesize;
932 if (!c1_shift_h || (y & c1_shift_h))
933 c1_data += c1_linesize;
934 if (!c2_shift_h || (y & c2_shift_h))
935 c2_data += c2_linesize;
936 d0_data += d0_linesize;
937 d1_data += d1_linesize;
945 uint8_t *d1_data = out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
948 d0_data += s->
size - 1;
949 d1_data += s->
size - 1;
952 for (y = 0; y < src_h; y++) {
953 for (x = 0; x < src_w; x++) {
954 int c0 = c0_data[x >> c0_shift_w] + 256;
955 const int c1 =
FFABS(c1_data[x >> c1_shift_w] - 128) +
FFABS(c2_data[x >> c2_shift_w] - 128);
959 target = d0_data - c0;
961 target = d1_data - (c0 -
c1);
963 target = d1_data - (c0 +
c1);
966 target = d0_data + c0;
968 target = d1_data + (c0 -
c1);
970 target = d1_data + (c0 +
c1);
975 if (!c0_shift_h || (y & c0_shift_h))
976 c0_data += c0_linesize;
977 if (!c1_shift_h || (y & c1_shift_h))
978 c1_data += c1_linesize;
979 if (!c2_shift_h || (y & c2_shift_h))
980 c2_data += c2_linesize;
981 d0_data += d0_linesize;
982 d1_data += d1_linesize;
986 envelope(s, out, plane, plane, column ? offset_x : offset_y);
987 envelope(s, out, plane, (plane + 1) % s->
ncomp, column ? offset_x : offset_y);
993 int offset_y,
int offset_x,
997 const int c0_linesize = in->
linesize[ plane + 0 ] / 2;
998 const int c1_linesize = in->
linesize[(plane + 1) % s->
ncomp] / 2;
999 const int c2_linesize = in->
linesize[(plane + 2) % s->
ncomp] / 2;
1000 const int c0_shift_w = s->
shift_w[ component + 0 ];
1001 const int c1_shift_w = s->
shift_w[(component + 1) % s->
ncomp];
1002 const int c2_shift_w = s->
shift_w[(component + 2) % s->
ncomp];
1003 const int c0_shift_h = s->
shift_h[ component + 0 ];
1004 const int c1_shift_h = s->
shift_h[(component + 1) % s->
ncomp];
1005 const int c2_shift_h = s->
shift_h[(component + 2) % s->
ncomp];
1006 const int d0_linesize = out->
linesize[ plane + 0 ] / 2;
1007 const int d1_linesize = out->
linesize[(plane + 1) % s->
ncomp] / 2;
1008 const int d2_linesize = out->
linesize[(plane + 2) % s->
ncomp] / 2;
1009 const int limit = s->
max - 1;
1011 const int mid = s->
max / 2;
1012 const int src_h = in->
height;
1013 const int src_w = in->
width;
1017 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1);
1018 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1);
1019 const int d2_signed_linesize = d2_linesize * (mirror == 1 ? -1 : 1);
1021 for (x = 0; x < src_w; x++) {
1022 const uint16_t *c0_data = (uint16_t *)in->
data[plane + 0];
1023 const uint16_t *c1_data = (uint16_t *)in->
data[(plane + 1) % s->
ncomp];
1024 const uint16_t *c2_data = (uint16_t *)in->
data[(plane + 2) % s->
ncomp];
1025 uint16_t *d0_data = (uint16_t *)out->
data[
plane] + offset_y * d0_linesize + offset_x;
1026 uint16_t *d1_data = (uint16_t *)out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
1027 uint16_t *d2_data = (uint16_t *)out->
data[(plane + 2) % s->
ncomp] + offset_y * d2_linesize + offset_x;
1028 uint16_t *
const d0_bottom_line = d0_data + d0_linesize * (s->
size - 1);
1029 uint16_t *
const d0 = (mirror ? d0_bottom_line : d0_data);
1030 uint16_t *
const d1_bottom_line = d1_data + d1_linesize * (s->
size - 1);
1031 uint16_t *
const d1 = (mirror ? d1_bottom_line : d1_data);
1032 uint16_t *
const d2_bottom_line = d2_data + d2_linesize * (s->
size - 1);
1033 uint16_t *
const d2 = (mirror ? d2_bottom_line : d2_data);
1035 for (y = 0; y < src_h; y++) {
1036 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit) + mid;
1037 const int c1 =
FFMIN(c1_data[x >> c1_shift_w], limit) - mid;
1038 const int c2 =
FFMIN(c2_data[x >> c2_shift_w], limit) - mid;
1041 target = d0 + x + d0_signed_linesize * c0;
1042 update16(target, max, intensity, limit);
1044 target = d1 + x + d1_signed_linesize * (c0 +
c1);
1045 update16(target, max, intensity, limit);
1047 target = d2 + x + d2_signed_linesize * (c0 +
c2);
1048 update16(target, max, intensity, limit);
1050 if (!c0_shift_h || (y & c0_shift_h))
1051 c0_data += c0_linesize;
1052 if (!c1_shift_h || (y & c1_shift_h))
1053 c1_data += c1_linesize;
1054 if (!c2_shift_h || (y & c2_shift_h))
1055 c2_data += c2_linesize;
1056 d0_data += d0_linesize;
1057 d1_data += d1_linesize;
1058 d2_data += d2_linesize;
1062 const uint16_t *c0_data = (uint16_t *)in->
data[plane];
1063 const uint16_t *c1_data = (uint16_t *)in->
data[(plane + 1) % s->
ncomp];
1064 const uint16_t *c2_data = (uint16_t *)in->
data[(plane + 2) % s->
ncomp];
1065 uint16_t *d0_data = (uint16_t *)out->
data[
plane] + offset_y * d0_linesize + offset_x;
1066 uint16_t *d1_data = (uint16_t *)out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
1067 uint16_t *d2_data = (uint16_t *)out->
data[(plane + 2) % s->
ncomp] + offset_y * d2_linesize + offset_x;
1070 d0_data += s->
size - 1;
1071 d1_data += s->
size - 1;
1072 d2_data += s->
size - 1;
1075 for (y = 0; y < src_h; y++) {
1076 for (x = 0; x < src_w; x++) {
1077 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit) + mid;
1078 const int c1 =
FFMIN(c1_data[x >> c1_shift_w], limit) - mid;
1079 const int c2 =
FFMIN(c2_data[x >> c2_shift_w], limit) - mid;
1083 target = d0_data - c0;
1084 update16(target, max, intensity, limit);
1085 target = d1_data - (c0 +
c1);
1086 update16(target, max, intensity, limit);
1087 target = d2_data - (c0 +
c2);
1088 update16(target, max, intensity, limit);
1090 target = d0_data + c0;
1091 update16(target, max, intensity, limit);
1092 target = d1_data + (c0 +
c1);
1093 update16(target, max, intensity, limit);
1094 target = d2_data + (c0 +
c2);
1095 update16(target, max, intensity, limit);
1099 if (!c0_shift_h || (y & c0_shift_h))
1100 c0_data += c0_linesize;
1101 if (!c1_shift_h || (y & c1_shift_h))
1102 c1_data += c1_linesize;
1103 if (!c2_shift_h || (y & c2_shift_h))
1104 c2_data += c2_linesize;
1105 d0_data += d0_linesize;
1106 d1_data += d1_linesize;
1107 d2_data += d2_linesize;
1111 envelope16(s, out, plane, (plane + 0) % s->
ncomp, column ? offset_x : offset_y);
1112 envelope16(s, out, plane, (plane + 1) % s->
ncomp, column ? offset_x : offset_y);
1113 envelope16(s, out, plane, (plane + 2) % s->
ncomp, column ? offset_x : offset_y);
1119 int offset_y,
int offset_x,
1123 const int c0_linesize = in->
linesize[ plane + 0 ];
1124 const int c1_linesize = in->
linesize[(plane + 1) % s->
ncomp];
1125 const int c2_linesize = in->
linesize[(plane + 2) % s->
ncomp];
1126 const int c0_shift_w = s->
shift_w[ component + 0 ];
1127 const int c1_shift_w = s->
shift_w[(component + 1) % s->
ncomp];
1128 const int c2_shift_w = s->
shift_w[(component + 2) % s->
ncomp];
1129 const int c0_shift_h = s->
shift_h[ component + 0 ];
1130 const int c1_shift_h = s->
shift_h[(component + 1) % s->
ncomp];
1131 const int c2_shift_h = s->
shift_h[(component + 2) % s->
ncomp];
1132 const int d0_linesize = out->
linesize[ plane + 0 ];
1133 const int d1_linesize = out->
linesize[(plane + 1) % s->
ncomp];
1134 const int d2_linesize = out->
linesize[(plane + 2) % s->
ncomp];
1136 const int src_h = in->
height;
1137 const int src_w = in->
width;
1141 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1);
1142 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1);
1143 const int d2_signed_linesize = d2_linesize * (mirror == 1 ? -1 : 1);
1145 for (x = 0; x < src_w; x++) {
1150 uint8_t *d1_data = out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
1151 uint8_t *d2_data = out->
data[(plane + 2) % s->
ncomp] + offset_y * d2_linesize + offset_x;
1152 uint8_t *
const d0_bottom_line = d0_data + d0_linesize * (s->
size - 1);
1153 uint8_t *
const d0 = (mirror ? d0_bottom_line : d0_data);
1154 uint8_t *
const d1_bottom_line = d1_data + d1_linesize * (s->
size - 1);
1155 uint8_t *
const d1 = (mirror ? d1_bottom_line : d1_data);
1156 uint8_t *
const d2_bottom_line = d2_data + d2_linesize * (s->
size - 1);
1157 uint8_t *
const d2 = (mirror ? d2_bottom_line : d2_data);
1159 for (y = 0; y < src_h; y++) {
1160 const int c0 = c0_data[x >> c0_shift_w] + 128;
1161 const int c1 = c1_data[x >> c1_shift_w] - 128;
1162 const int c2 = c2_data[x >> c2_shift_w] - 128;
1165 target = d0 + x + d0_signed_linesize * c0;
1166 update(target, max, intensity);
1168 target = d1 + x + d1_signed_linesize * (c0 +
c1);
1169 update(target, max, intensity);
1171 target = d2 + x + d2_signed_linesize * (c0 +
c2);
1172 update(target, max, intensity);
1174 if (!c0_shift_h || (y & c0_shift_h))
1175 c0_data += c0_linesize;
1176 if (!c1_shift_h || (y & c1_shift_h))
1177 c1_data += c1_linesize;
1178 if (!c1_shift_h || (y & c1_shift_h))
1179 c2_data += c1_linesize;
1180 d0_data += d0_linesize;
1181 d1_data += d1_linesize;
1182 d2_data += d2_linesize;
1190 uint8_t *d1_data = out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
1191 uint8_t *d2_data = out->
data[(plane + 2) % s->
ncomp] + offset_y * d2_linesize + offset_x;
1194 d0_data += s->
size - 1;
1195 d1_data += s->
size - 1;
1196 d2_data += s->
size - 1;
1199 for (y = 0; y < src_h; y++) {
1200 for (x = 0; x < src_w; x++) {
1201 const int c0 = c0_data[x >> c0_shift_w] + 128;
1202 const int c1 = c1_data[x >> c1_shift_w] - 128;
1203 const int c2 = c2_data[x >> c2_shift_w] - 128;
1207 target = d0_data - c0;
1208 update(target, max, intensity);
1209 target = d1_data - (c0 +
c1);
1210 update(target, max, intensity);
1211 target = d2_data - (c0 +
c2);
1212 update(target, max, intensity);
1214 target = d0_data + c0;
1215 update(target, max, intensity);
1216 target = d1_data + (c0 +
c1);
1217 update(target, max, intensity);
1218 target = d2_data + (c0 +
c2);
1219 update(target, max, intensity);
1223 if (!c0_shift_h || (y & c0_shift_h))
1224 c0_data += c0_linesize;
1225 if (!c1_shift_h || (y & c1_shift_h))
1226 c1_data += c1_linesize;
1227 if (!c2_shift_h || (y & c2_shift_h))
1228 c2_data += c2_linesize;
1229 d0_data += d0_linesize;
1230 d1_data += d1_linesize;
1231 d2_data += d2_linesize;
1235 envelope(s, out, plane, (plane + 0) % s->
ncomp, column ? offset_x : offset_y);
1236 envelope(s, out, plane, (plane + 1) % s->
ncomp, column ? offset_x : offset_y);
1237 envelope(s, out, plane, (plane + 2) % s->
ncomp, column ? offset_x : offset_y);
1243 int offset_y,
int offset_x,
1247 const int c0_linesize = in->
linesize[(plane + 1) % s->
ncomp] / 2;
1248 const int c1_linesize = in->
linesize[(plane + 2) % s->
ncomp] / 2;
1250 const int limit = s->
max - 1;
1252 const int mid = s->
max / 2;
1253 const int c0_shift_w = s->
shift_w[(component + 1) % s->
ncomp];
1254 const int c1_shift_w = s->
shift_w[(component + 2) % s->
ncomp];
1255 const int c0_shift_h = s->
shift_h[(component + 1) % s->
ncomp];
1256 const int c1_shift_h = s->
shift_h[(component + 2) % s->
ncomp];
1257 const int src_h = in->
height;
1258 const int src_w = in->
width;
1262 const int dst_signed_linesize = dst_linesize * (mirror == 1 ? -1 : 1);
1264 for (x = 0; x < src_w; x++) {
1265 const uint16_t *c0_data = (uint16_t *)in->
data[(plane + 1) % s->
ncomp];
1266 const uint16_t *c1_data = (uint16_t *)in->
data[(plane + 2) % s->
ncomp];
1267 uint16_t *dst_data = (uint16_t *)out->
data[plane] + offset_y * dst_linesize + offset_x;
1268 uint16_t *
const dst_bottom_line = dst_data + dst_linesize * (s->
size - 1);
1269 uint16_t *
const dst_line = (mirror ? dst_bottom_line : dst_data);
1270 uint16_t *dst = dst_line;
1272 for (y = 0; y < src_h; y++) {
1273 const int sum =
FFMIN(
FFABS(c0_data[x >> c0_shift_w] - mid) +
FFABS(c1_data[x >> c1_shift_w] - mid - 1), limit);
1276 target = dst + x + dst_signed_linesize * sum;
1277 update16(target, max, intensity, limit);
1279 if (!c0_shift_h || (y & c0_shift_h))
1280 c0_data += c0_linesize;
1281 if (!c1_shift_h || (y & c1_shift_h))
1282 c1_data += c1_linesize;
1283 dst_data += dst_linesize;
1287 const uint16_t *c0_data = (uint16_t *)in->
data[(plane + 1) % s->
ncomp];
1288 const uint16_t *c1_data = (uint16_t *)in->
data[(plane + 2) % s->
ncomp];
1289 uint16_t *dst_data = (uint16_t *)out->
data[plane] + offset_y * dst_linesize + offset_x;
1292 dst_data += s->
size - 1;
1293 for (y = 0; y < src_h; y++) {
1294 for (x = 0; x < src_w; x++) {
1295 const int sum =
FFMIN(
FFABS(c0_data[x >> c0_shift_w] - mid) +
FFABS(c1_data[x >> c1_shift_w] - mid - 1), limit);
1299 target = dst_data - sum;
1300 update16(target, max, intensity, limit);
1302 target = dst_data + sum;
1303 update16(target, max, intensity, limit);
1307 if (!c0_shift_h || (y & c0_shift_h))
1308 c0_data += c0_linesize;
1309 if (!c1_shift_h || (y & c1_shift_h))
1310 c1_data += c1_linesize;
1311 dst_data += dst_linesize;
1315 envelope16(s, out, plane, plane, column ? offset_x : offset_y);
1321 int offset_y,
int offset_x,
1325 const int c0_linesize = in->
linesize[(plane + 1) % s->
ncomp];
1326 const int c1_linesize = in->
linesize[(plane + 2) % s->
ncomp];
1329 const int c0_shift_w = s->
shift_w[(component + 1) % s->
ncomp];
1330 const int c1_shift_w = s->
shift_w[(component + 2) % s->
ncomp];
1331 const int c0_shift_h = s->
shift_h[(component + 1) % s->
ncomp];
1332 const int c1_shift_h = s->
shift_h[(component + 2) % s->
ncomp];
1333 const int src_h = in->
height;
1334 const int src_w = in->
width;
1338 const int dst_signed_linesize = dst_linesize * (mirror == 1 ? -1 : 1);
1340 for (x = 0; x < src_w; x++) {
1344 uint8_t *
const dst_bottom_line = dst_data + dst_linesize * (s->
size - 1);
1345 uint8_t *
const dst_line = (mirror ? dst_bottom_line : dst_data);
1348 for (y = 0; y < src_h; y++) {
1349 const int sum =
FFABS(c0_data[x >> c0_shift_w] - 128) +
FFABS(c1_data[x >> c1_shift_w] - 127);
1352 target = dst + x + dst_signed_linesize * sum;
1353 update(target, max, intensity);
1355 if (!c0_shift_h || (y & c0_shift_h))
1356 c0_data += c0_linesize;
1357 if (!c1_shift_h || (y & c1_shift_h))
1358 c1_data += c1_linesize;
1359 dst_data += dst_linesize;
1368 dst_data += s->
size - 1;
1369 for (y = 0; y < src_h; y++) {
1370 for (x = 0; x < src_w; x++) {
1371 const int sum =
FFABS(c0_data[x >> c0_shift_w] - 128) +
FFABS(c1_data[x >> c1_shift_w] - 127);
1375 target = dst_data - sum;
1376 update(target, max, intensity);
1378 target = dst_data + sum;
1379 update(target, max, intensity);
1383 if (!c0_shift_h || (y & c0_shift_h))
1384 c0_data += c0_linesize;
1385 if (!c1_shift_h || (y & c1_shift_h))
1386 c1_data += c1_linesize;
1387 dst_data += dst_linesize;
1391 envelope(s, out, plane, plane, column ? offset_x : offset_y);
1397 int offset_y,
int offset_x,
1401 const int limit = s->
max - 1;
1402 const uint16_t *c0_data = (
const uint16_t *)in->
data[plane + 0];
1403 const uint16_t *c1_data = (
const uint16_t *)in->
data[(plane + 1) % s->
ncomp];
1404 const uint16_t *c2_data = (
const uint16_t *)in->
data[(plane + 2) % s->
ncomp];
1405 const int c0_linesize = in->
linesize[ plane + 0 ] / 2;
1406 const int c1_linesize = in->
linesize[(plane + 1) % s->
ncomp] / 2;
1407 const int c2_linesize = in->
linesize[(plane + 2) % s->
ncomp] / 2;
1408 const int d0_linesize = out->
linesize[ plane + 0 ] / 2;
1409 const int d1_linesize = out->
linesize[(plane + 1) % s->
ncomp] / 2;
1410 const int d2_linesize = out->
linesize[(plane + 2) % s->
ncomp] / 2;
1411 const int c0_shift_w = s->
shift_w[ component + 0 ];
1412 const int c1_shift_w = s->
shift_w[(component + 1) % s->
ncomp];
1413 const int c2_shift_w = s->
shift_w[(component + 2) % s->
ncomp];
1414 const int c0_shift_h = s->
shift_h[ component + 0 ];
1415 const int c1_shift_h = s->
shift_h[(component + 1) % s->
ncomp];
1416 const int c2_shift_h = s->
shift_h[(component + 2) % s->
ncomp];
1417 const int src_h = in->
height;
1418 const int src_w = in->
width;
1422 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1);
1423 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1);
1424 const int d2_signed_linesize = d2_linesize * (mirror == 1 ? -1 : 1);
1425 uint16_t *d0_data = (uint16_t *)out->
data[plane] + offset_y * d0_linesize + offset_x;
1426 uint16_t *d1_data = (uint16_t *)out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
1427 uint16_t *d2_data = (uint16_t *)out->
data[(plane + 2) % s->
ncomp] + offset_y * d2_linesize + offset_x;
1428 uint16_t *
const d0_bottom_line = d0_data + d0_linesize * (s->
size - 1);
1429 uint16_t *
const d0 = (mirror ? d0_bottom_line : d0_data);
1430 uint16_t *
const d1_bottom_line = d1_data + d1_linesize * (s->
size - 1);
1431 uint16_t *
const d1 = (mirror ? d1_bottom_line : d1_data);
1432 uint16_t *
const d2_bottom_line = d2_data + d2_linesize * (s->
size - 1);
1433 uint16_t *
const d2 = (mirror ? d2_bottom_line : d2_data);
1435 for (y = 0; y < src_h; y++) {
1436 for (x = 0; x < src_w; x++) {
1437 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit);
1438 const int c1 = c1_data[x >> c1_shift_w];
1439 const int c2 = c2_data[x >> c2_shift_w];
1441 *(d0 + d0_signed_linesize * c0 + x) = c0;
1442 *(d1 + d1_signed_linesize * c0 + x) = c1;
1443 *(d2 + d2_signed_linesize * c0 + x) = c2;
1446 if (!c0_shift_h || (y & c0_shift_h))
1447 c0_data += c0_linesize;
1448 if (!c1_shift_h || (y & c1_shift_h))
1449 c1_data += c1_linesize;
1450 if (!c2_shift_h || (y & c2_shift_h))
1451 c2_data += c2_linesize;
1452 d0_data += d0_linesize;
1453 d1_data += d1_linesize;
1454 d2_data += d2_linesize;
1457 uint16_t *d0_data = (uint16_t *)out->
data[plane] + offset_y * d0_linesize + offset_x;
1458 uint16_t *d1_data = (uint16_t *)out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
1459 uint16_t *d2_data = (uint16_t *)out->
data[(plane + 2) % s->
ncomp] + offset_y * d2_linesize + offset_x;
1462 d0_data += s->
size - 1;
1463 d1_data += s->
size - 1;
1464 d2_data += s->
size - 1;
1467 for (y = 0; y < src_h; y++) {
1468 for (x = 0; x < src_w; x++) {
1469 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit);
1470 const int c1 = c1_data[x >> c1_shift_w];
1471 const int c2 = c2_data[x >> c2_shift_w];
1474 *(d0_data - c0) = c0;
1475 *(d1_data - c0) = c1;
1476 *(d2_data - c0) = c2;
1478 *(d0_data + c0) = c0;
1479 *(d1_data + c0) = c1;
1480 *(d2_data + c0) = c2;
1484 if (!c0_shift_h || (y & c0_shift_h))
1485 c0_data += c0_linesize;
1486 if (!c1_shift_h || (y & c1_shift_h))
1487 c1_data += c1_linesize;
1488 if (!c2_shift_h || (y & c2_shift_h))
1489 c2_data += c2_linesize;
1490 d0_data += d0_linesize;
1491 d1_data += d1_linesize;
1492 d2_data += d2_linesize;
1496 envelope16(s, out, plane, plane, column ? offset_x : offset_y);
1502 int offset_y,
int offset_x,
1509 const int c0_linesize = in->
linesize[ plane + 0 ];
1510 const int c1_linesize = in->
linesize[(plane + 1) % s->
ncomp];
1511 const int c2_linesize = in->
linesize[(plane + 2) % s->
ncomp];
1512 const int d0_linesize = out->
linesize[ plane + 0 ];
1513 const int d1_linesize = out->
linesize[(plane + 1) % s->
ncomp];
1514 const int d2_linesize = out->
linesize[(plane + 2) % s->
ncomp];
1515 const int c0_shift_w = s->
shift_w[ component + 0 ];
1516 const int c1_shift_w = s->
shift_w[(component + 1) % s->
ncomp];
1517 const int c2_shift_w = s->
shift_w[(component + 2) % s->
ncomp];
1518 const int c0_shift_h = s->
shift_h[ component + 0 ];
1519 const int c1_shift_h = s->
shift_h[(component + 1) % s->
ncomp];
1520 const int c2_shift_h = s->
shift_h[(component + 2) % s->
ncomp];
1521 const int src_h = in->
height;
1522 const int src_w = in->
width;
1526 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1);
1527 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1);
1528 const int d2_signed_linesize = d2_linesize * (mirror == 1 ? -1 : 1);
1530 uint8_t *d1_data = out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
1531 uint8_t *d2_data = out->
data[(plane + 2) % s->
ncomp] + offset_y * d2_linesize + offset_x;
1532 uint8_t *
const d0_bottom_line = d0_data + d0_linesize * (s->
size - 1);
1533 uint8_t *
const d0 = (mirror ? d0_bottom_line : d0_data);
1534 uint8_t *
const d1_bottom_line = d1_data + d1_linesize * (s->
size - 1);
1535 uint8_t *
const d1 = (mirror ? d1_bottom_line : d1_data);
1536 uint8_t *
const d2_bottom_line = d2_data + d2_linesize * (s->
size - 1);
1537 uint8_t *
const d2 = (mirror ? d2_bottom_line : d2_data);
1539 for (y = 0; y < src_h; y++) {
1540 for (x = 0; x < src_w; x++) {
1541 const int c0 = c0_data[x >> c0_shift_w];
1542 const int c1 = c1_data[x >> c1_shift_w];
1543 const int c2 = c2_data[x >> c2_shift_w];
1545 *(d0 + d0_signed_linesize * c0 + x) = c0;
1546 *(d1 + d1_signed_linesize * c0 + x) = c1;
1547 *(d2 + d2_signed_linesize * c0 + x) = c2;
1550 if (!c0_shift_h || (y & c0_shift_h))
1551 c0_data += c0_linesize;
1552 if (!c1_shift_h || (y & c1_shift_h))
1553 c1_data += c1_linesize;
1554 if (!c2_shift_h || (y & c2_shift_h))
1555 c2_data += c2_linesize;
1556 d0_data += d0_linesize;
1557 d1_data += d1_linesize;
1558 d2_data += d2_linesize;
1562 uint8_t *d1_data = out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
1563 uint8_t *d2_data = out->
data[(plane + 2) % s->
ncomp] + offset_y * d2_linesize + offset_x;
1566 d0_data += s->
size - 1;
1567 d1_data += s->
size - 1;
1568 d2_data += s->
size - 1;
1571 for (y = 0; y < src_h; y++) {
1572 for (x = 0; x < src_w; x++) {
1573 const int c0 = c0_data[x >> c0_shift_w];
1574 const int c1 = c1_data[x >> c1_shift_w];
1575 const int c2 = c2_data[x >> c2_shift_w];
1578 *(d0_data - c0) = c0;
1579 *(d1_data - c0) = c1;
1580 *(d2_data - c0) = c2;
1582 *(d0_data + c0) = c0;
1583 *(d1_data + c0) = c1;
1584 *(d2_data + c0) = c2;
1588 if (!c0_shift_h || (y & c0_shift_h))
1589 c0_data += c0_linesize;
1590 if (!c1_shift_h || (y & c1_shift_h))
1591 c1_data += c1_linesize;
1592 if (!c2_shift_h || (y & c2_shift_h))
1593 c2_data += c2_linesize;
1594 d0_data += d0_linesize;
1595 d1_data += d1_linesize;
1596 d2_data += d2_linesize;
1600 envelope(s, out, plane, plane, column ? offset_x : offset_y);
1606 int offset_y,
int offset_x,
1610 const int limit = s->
max - 1;
1612 const uint16_t *c0_data = (
const uint16_t *)in->
data[plane + 0];
1613 const uint16_t *c1_data = (
const uint16_t *)in->
data[(plane + 1) % s->
ncomp];
1614 const uint16_t *c2_data = (
const uint16_t *)in->
data[(plane + 2) % s->
ncomp];
1615 const int c0_linesize = in->
linesize[ plane + 0 ] / 2;
1616 const int c1_linesize = in->
linesize[(plane + 1) % s->
ncomp] / 2;
1617 const int c2_linesize = in->
linesize[(plane + 2) % s->
ncomp] / 2;
1618 const int d0_linesize = out->
linesize[ plane + 0 ] / 2;
1619 const int d1_linesize = out->
linesize[(plane + 1) % s->
ncomp] / 2;
1620 const int d2_linesize = out->
linesize[(plane + 2) % s->
ncomp] / 2;
1621 const int c0_shift_w = s->
shift_w[ component + 0 ];
1622 const int c1_shift_w = s->
shift_w[(component + 1) % s->
ncomp];
1623 const int c2_shift_w = s->
shift_w[(component + 2) % s->
ncomp];
1624 const int c0_shift_h = s->
shift_h[ component + 0 ];
1625 const int c1_shift_h = s->
shift_h[(component + 1) % s->
ncomp];
1626 const int c2_shift_h = s->
shift_h[(component + 2) % s->
ncomp];
1627 const int src_h = in->
height;
1628 const int src_w = in->
width;
1632 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1);
1633 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1);
1634 const int d2_signed_linesize = d2_linesize * (mirror == 1 ? -1 : 1);
1635 uint16_t *d0_data = (uint16_t *)out->
data[plane] + offset_y * d0_linesize + offset_x;
1636 uint16_t *d1_data = (uint16_t *)out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
1637 uint16_t *d2_data = (uint16_t *)out->
data[(plane + 2) % s->
ncomp] + offset_y * d2_linesize + offset_x;
1638 uint16_t *
const d0_bottom_line = d0_data + d0_linesize * (s->
size - 1);
1639 uint16_t *
const d0 = (mirror ? d0_bottom_line : d0_data);
1640 uint16_t *
const d1_bottom_line = d1_data + d1_linesize * (s->
size - 1);
1641 uint16_t *
const d1 = (mirror ? d1_bottom_line : d1_data);
1642 uint16_t *
const d2_bottom_line = d2_data + d2_linesize * (s->
size - 1);
1643 uint16_t *
const d2 = (mirror ? d2_bottom_line : d2_data);
1645 for (y = 0; y < src_h; y++) {
1646 for (x = 0; x < src_w; x++) {
1647 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit);
1648 const int c1 = c1_data[x >> c1_shift_w];
1649 const int c2 = c2_data[x >> c2_shift_w];
1651 update16(d0 + d0_signed_linesize * c0 + x, max, intensity, limit);
1652 *(d1 + d1_signed_linesize * c0 + x) = c1;
1653 *(d2 + d2_signed_linesize * c0 + x) = c2;
1656 if (!c0_shift_h || (y & c0_shift_h))
1657 c0_data += c0_linesize;
1658 if (!c1_shift_h || (y & c1_shift_h))
1659 c1_data += c1_linesize;
1660 if (!c2_shift_h || (y & c2_shift_h))
1661 c2_data += c2_linesize;
1662 d0_data += d0_linesize;
1663 d1_data += d1_linesize;
1664 d2_data += d2_linesize;
1667 uint16_t *d0_data = (uint16_t *)out->
data[plane] + offset_y * d0_linesize + offset_x;
1668 uint16_t *d1_data = (uint16_t *)out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
1669 uint16_t *d2_data = (uint16_t *)out->
data[(plane + 2) % s->
ncomp] + offset_y * d2_linesize + offset_x;
1672 d0_data += s->
size - 1;
1673 d1_data += s->
size - 1;
1674 d2_data += s->
size - 1;
1677 for (y = 0; y < src_h; y++) {
1678 for (x = 0; x < src_w; x++) {
1679 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit);
1680 const int c1 = c1_data[x >> c1_shift_w];
1681 const int c2 = c2_data[x >> c2_shift_w];
1684 update16(d0_data - c0, max, intensity, limit);
1685 *(d1_data - c0) = c1;
1686 *(d2_data - c0) = c2;
1688 update16(d0_data + c0, max, intensity, limit);
1689 *(d1_data + c0) = c1;
1690 *(d2_data + c0) = c2;
1694 if (!c0_shift_h || (y & c0_shift_h))
1695 c0_data += c0_linesize;
1696 if (!c1_shift_h || (y & c1_shift_h))
1697 c1_data += c1_linesize;
1698 if (!c2_shift_h || (y & c2_shift_h))
1699 c2_data += c2_linesize;
1700 d0_data += d0_linesize;
1701 d1_data += d1_linesize;
1702 d2_data += d2_linesize;
1706 envelope16(s, out, plane, plane, column ? offset_x : offset_y);
1712 int offset_y,
int offset_x,
1719 const int c0_linesize = in->
linesize[ plane + 0 ];
1720 const int c1_linesize = in->
linesize[(plane + 1) % s->
ncomp];
1721 const int c2_linesize = in->
linesize[(plane + 2) % s->
ncomp];
1722 const int d0_linesize = out->
linesize[ plane + 0 ];
1723 const int d1_linesize = out->
linesize[(plane + 1) % s->
ncomp];
1724 const int d2_linesize = out->
linesize[(plane + 2) % s->
ncomp];
1725 const int c0_shift_w = s->
shift_w[ component + 0 ];
1726 const int c1_shift_w = s->
shift_w[(component + 1) % s->
ncomp];
1727 const int c2_shift_w = s->
shift_w[(component + 2) % s->
ncomp];
1728 const int c0_shift_h = s->
shift_h[ component + 0 ];
1729 const int c1_shift_h = s->
shift_h[(component + 1) % s->
ncomp];
1730 const int c2_shift_h = s->
shift_h[(component + 2) % s->
ncomp];
1732 const int src_h = in->
height;
1733 const int src_w = in->
width;
1737 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1);
1738 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1);
1739 const int d2_signed_linesize = d2_linesize * (mirror == 1 ? -1 : 1);
1741 uint8_t *d1_data = out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
1742 uint8_t *d2_data = out->
data[(plane + 2) % s->
ncomp] + offset_y * d2_linesize + offset_x;
1743 uint8_t *
const d0_bottom_line = d0_data + d0_linesize * (s->
size - 1);
1744 uint8_t *
const d0 = (mirror ? d0_bottom_line : d0_data);
1745 uint8_t *
const d1_bottom_line = d1_data + d1_linesize * (s->
size - 1);
1746 uint8_t *
const d1 = (mirror ? d1_bottom_line : d1_data);
1747 uint8_t *
const d2_bottom_line = d2_data + d2_linesize * (s->
size - 1);
1748 uint8_t *
const d2 = (mirror ? d2_bottom_line : d2_data);
1750 for (y = 0; y < src_h; y++) {
1751 for (x = 0; x < src_w; x++) {
1752 const int c0 = c0_data[x >> c0_shift_w];
1753 const int c1 = c1_data[x >> c1_shift_w];
1754 const int c2 = c2_data[x >> c2_shift_w];
1756 update(d0 + d0_signed_linesize * c0 + x, max, intensity);
1757 *(d1 + d1_signed_linesize * c0 + x) = c1;
1758 *(d2 + d2_signed_linesize * c0 + x) = c2;
1761 if (!c0_shift_h || (y & c0_shift_h))
1762 c0_data += c0_linesize;
1763 if (!c1_shift_h || (y & c1_shift_h))
1764 c1_data += c1_linesize;
1765 if (!c2_shift_h || (y & c2_shift_h))
1766 c2_data += c2_linesize;
1767 d0_data += d0_linesize;
1768 d1_data += d1_linesize;
1769 d2_data += d2_linesize;
1773 uint8_t *d1_data = out->
data[(plane + 1) % s->
ncomp] + offset_y * d1_linesize + offset_x;
1774 uint8_t *d2_data = out->
data[(plane + 2) % s->
ncomp] + offset_y * d2_linesize + offset_x;
1777 d0_data += s->
size - 1;
1778 d1_data += s->
size - 1;
1779 d2_data += s->
size - 1;
1782 for (y = 0; y < src_h; y++) {
1783 for (x = 0; x < src_w; x++) {
1784 const int c0 = c0_data[x >> c0_shift_w];
1785 const int c1 = c1_data[x >> c1_shift_w];
1786 const int c2 = c2_data[x >> c2_shift_w];
1789 update(d0_data - c0, max, intensity);
1790 *(d1_data - c0) = c1;
1791 *(d2_data - c0) = c2;
1793 update(d0_data + c0, max, intensity);
1794 *(d1_data + c0) = c1;
1795 *(d2_data + c0) = c2;
1799 if (!c0_shift_h || (y & c0_shift_h))
1800 c0_data += c0_linesize;
1801 if (!c1_shift_h || (y & c1_shift_h))
1802 c1_data += c1_linesize;
1803 if (!c2_shift_h || (y & c2_shift_h))
1804 c2_data += c2_linesize;
1805 d0_data += d0_linesize;
1806 d1_data += d1_linesize;
1807 d2_data += d2_linesize;
1811 envelope(s, out, plane, plane, column ? offset_x : offset_y);
1819 { { {
"16", 16+128 }, {
"16", 16+128 }, {
"16", 16+128 }, {
"0", 0+128 } } },
1820 { { {
"128", 128+128 }, {
"128", 128+128 }, {
"128", 128+128 }, {
"128", 128+128 } } },
1821 { { {
"235", 235+128 }, {
"240", 240+128 }, {
"240", 240+128 }, {
"255", 255+128 } } },
1825 { { {
"32", 32+256 }, {
"32", 32+256 }, {
"32", 32+256 }, {
"0", 0+256 } } },
1826 { { {
"256", 256+256 }, {
"256", 256+256 }, {
"256", 256+256 }, {
"256", 256+256 } } },
1827 { { {
"470", 470+256 }, {
"480", 480+256 }, {
"480", 480+256 }, {
"511", 511+256 } } },
1831 { { {
"64", 64+512 }, {
"64", 64+512 }, {
"64", 64+512 }, {
"0", 0+512 } } },
1832 { { {
"512", 512+512 }, {
"512", 512+512 }, {
"512", 512+512 }, {
"512", 512+512 } } },
1833 { { {
"940", 940+512 }, {
"960", 960+512 }, {
"960", 960+512 }, {
"1023", 1023+512 } } },
1837 { { {
"256", 256+2048 }, {
"256", 256+2048 }, {
"256", 256+2048 }, {
"0", 0+2048 } } },
1838 { { {
"2048", 2048+2048 }, {
"2048", 2048+2048 }, {
"2048", 2048+2048 }, {
"2048", 2048+2048 } } },
1839 { { {
"3760", 3760+2048 }, {
"3840", 3840+2048 }, {
"3840", 3840+2048 }, {
"4095", 4095+2048 } } },
1843 { { {
"0", 16+128 }, {
"0", 16+128 }, {
"0", 16+128 }, {
"0", 0+128 } } },
1844 { { {
"175", 71+128 }, {
"175", 72+128 }, {
"175", 72+128 }, {
"175", 64+128 } } },
1845 { { {
"350", 126+128 }, {
"350", 128+128 }, {
"350", 128+128 }, {
"350", 128+128 } } },
1846 { { {
"525", 180+128 }, {
"525", 184+128 }, {
"525", 184+128 }, {
"525", 192+128 } } },
1847 { { {
"700", 235+128 }, {
"700", 240+128 }, {
"700", 240+128 }, {
"700", 255+128 } } },
1851 { { {
"0", 32+256 }, {
"0", 32+256 }, {
"0", 32+256 }, {
"0", 0+256 } } },
1852 { { {
"175", 142+256 }, {
"175", 144+256 }, {
"175", 144+256 }, {
"175", 128+256 } } },
1853 { { {
"350", 251+256 }, {
"350", 256+256 }, {
"350", 256+256 }, {
"350", 256+256 } } },
1854 { { {
"525", 361+256 }, {
"525", 368+256 }, {
"525", 368+256 }, {
"525", 384+256 } } },
1855 { { {
"700", 470+256 }, {
"700", 480+256 }, {
"700", 480+256 }, {
"700", 511+256 } } },
1859 { { {
"0", 64+512 }, {
"0", 64+512 }, {
"0", 64+512 }, {
"0", 0+512 } } },
1860 { { {
"175", 283+512 }, {
"175", 288+512 }, {
"175", 288+512 }, {
"175", 256+512 } } },
1861 { { {
"350", 502+512 }, {
"350", 512+512 }, {
"350", 512+512 }, {
"350", 512+512 } } },
1862 { { {
"525", 721+512 }, {
"525", 736+512 }, {
"525", 736+512 }, {
"525", 768+512 } } },
1863 { { {
"700", 940+512 }, {
"700", 960+512 }, {
"700", 960+512 }, {
"700", 1023+512 } } },
1867 { { {
"0", 256+2048 }, {
"0", 256+2048 }, {
"0", 256+2048 }, {
"0", 0+2048 } } },
1868 { { {
"175", 1132+2048 }, {
"175", 1152+2048 }, {
"175", 1152+2048 }, {
"175", 1024+2048 } } },
1869 { { {
"350", 2008+2048 }, {
"350", 2048+2048 }, {
"350", 2048+2048 }, {
"350", 2048+2048 } } },
1870 { { {
"525", 2884+2048 }, {
"525", 2944+2048 }, {
"525", 2944+2048 }, {
"525", 3072+2048 } } },
1871 { { {
"700", 3760+2048 }, {
"700", 3840+2048 }, {
"700", 3840+2048 }, {
"700", 4095+2048 } } },
1875 { { {
"-25", -39+128 }, {
"-25", -40+128 }, {
"-25", -40+128 }, {
"-25", -64+128 } } },
1876 { { {
"0", 16+128 }, {
"0", 16+128 }, {
"0", 16+128 }, {
"0", 0+128 } } },
1877 { { {
"25", 71+128 }, {
"25", 72+128 }, {
"25", 72+128 }, {
"25", 64+128 } } },
1878 { { {
"50", 126+128 }, {
"50", 128+128 }, {
"50", 128+128 }, {
"50", 128+128 } } },
1879 { { {
"75", 180+128 }, {
"75", 184+128 }, {
"75", 184+128 }, {
"75", 192+128 } } },
1880 { { {
"100", 235+128 }, {
"100", 240+128 }, {
"100", 240+128 }, {
"100", 256+128 } } },
1881 { { {
"125", 290+128 }, {
"125", 296+128 }, {
"125", 296+128 }, {
"125", 320+128 } } },
1885 { { {
"-25", -78+256 }, {
"-25", -80+256 }, {
"-25", -80+256 }, {
"-25",-128+256 } } },
1886 { { {
"0", 32+256 }, {
"0", 32+256 }, {
"0", 32+256 }, {
"0", 0+256 } } },
1887 { { {
"25", 142+256 }, {
"25", 144+256 }, {
"25", 144+256 }, {
"25", 128+256 } } },
1888 { { {
"50", 251+256 }, {
"50", 256+256 }, {
"50", 256+256 }, {
"50", 256+256 } } },
1889 { { {
"75", 361+256 }, {
"75", 368+256 }, {
"75", 368+256 }, {
"75", 384+256 } } },
1890 { { {
"100", 470+256 }, {
"100", 480+256 }, {
"100", 480+256 }, {
"100", 512+256 } } },
1891 { { {
"125", 580+256 }, {
"125", 592+256 }, {
"125", 592+256 }, {
"125", 640+256 } } },
1895 { { {
"-25",-156+512 }, {
"-25",-160+512 }, {
"-25",-160+512 }, {
"-25", -256+512 } } },
1896 { { {
"0", 64+512 }, {
"0", 64+512 }, {
"0", 64+512 }, {
"0", 0+512 } } },
1897 { { {
"25", 283+512 }, {
"25", 288+512 }, {
"25", 288+512 }, {
"25", 256+512 } } },
1898 { { {
"50", 502+512 }, {
"50", 512+512 }, {
"50", 512+512 }, {
"50", 512+512 } } },
1899 { { {
"75", 721+512 }, {
"75", 736+512 }, {
"75", 736+512 }, {
"75", 768+512 } } },
1900 { { {
"100", 940+512 }, {
"100", 960+512 }, {
"100", 960+512 }, {
"100", 1024+512 } } },
1901 { { {
"125",1160+512 }, {
"125",1184+512 }, {
"125",1184+512 }, {
"125", 1280+512 } } },
1905 { { {
"-25", -624+2048 }, {
"-25", -640+2048 }, {
"-25", -640+2048 }, {
"-25",-1024+2048 } } },
1906 { { {
"0", 256+2048 }, {
"0", 256+2048 }, {
"0", 256+2048 }, {
"0", 0+2048 } } },
1907 { { {
"25", 1132+2048 }, {
"25", 1152+2048 }, {
"25", 1152+2048 }, {
"25", 1024+2048 } } },
1908 { { {
"50", 2008+2048 }, {
"50", 2048+2048 }, {
"50", 2048+2048 }, {
"50", 2048+2048 } } },
1909 { { {
"75", 2884+2048 }, {
"75", 2944+2048 }, {
"75", 2944+2048 }, {
"75", 3072+2048 } } },
1910 { { {
"100", 3760+2048 }, {
"100", 3840+2048 }, {
"100", 3840+2048 }, {
"100", 4096+2048 } } },
1911 { { {
"125", 4640+2048 }, {
"125", 4736+2048 }, {
"125", 4736+2048 }, {
"125", 5120+2048 } } },
1915 { { {
"16", 16+256 }, {
"16", 16+256 }, {
"16", 16+256 }, {
"0", 0+256 } } },
1916 { { {
"128", 128+256 }, {
"128", 128+256 }, {
"128", 128+256 }, {
"128", 128+256 } } },
1917 { { {
"235", 235+256 }, {
"240", 240+256 }, {
"240", 240+256 }, {
"255", 255+256 } } },
1921 { { {
"32", 32+512 }, {
"32", 32+512 }, {
"32", 32+512 }, {
"0", 0+512 } } },
1922 { { {
"256", 256+512 }, {
"256", 256+512 }, {
"256", 256+512 }, {
"256", 256+512 } } },
1923 { { {
"470", 470+512 }, {
"480", 480+512 }, {
"480", 480+512 }, {
"511", 511+512 } } },
1927 { { {
"64", 64+1024 }, {
"64", 64+1024 }, {
"64", 64+1024 }, {
"0", 0+1024 } } },
1928 { { {
"512", 512+1024 }, {
"512", 512+1024 }, {
"512", 512+1024 }, {
"512", 512+1024 } } },
1929 { { {
"940", 940+1024 }, {
"960", 960+1024 }, {
"960", 960+1024 }, {
"1023", 1023+1024 } } },
1933 { { {
"256", 256+4096 }, {
"256", 256+4096 }, {
"256", 256+4096 }, {
"0", 0+4096 } } },
1934 { { {
"2048", 2048+4096 }, {
"2048", 2048+4096 }, {
"2048", 2048+4096 }, {
"2048", 2048+4096 } } },
1935 { { {
"3760", 3760+4096 }, {
"3840", 3840+4096 }, {
"3840", 3840+4096 }, {
"4095", 4095+4096 } } },
1939 { { {
"0", 16+256 }, {
"0", 16+256 }, {
"0", 16+256 }, {
"0", 0+256 } } },
1940 { { {
"175", 71+256 }, {
"175", 72+256 }, {
"175", 72+256 }, {
"175", 64+256 } } },
1941 { { {
"350", 126+256 }, {
"350", 128+256 }, {
"350", 128+256 }, {
"350", 128+256 } } },
1942 { { {
"525", 180+256 }, {
"525", 184+256 }, {
"525", 184+256 }, {
"525", 192+256 } } },
1943 { { {
"700", 235+256 }, {
"700", 240+256 }, {
"700", 240+256 }, {
"700", 255+256 } } },
1947 { { {
"0", 32+512 }, {
"0", 32+512 }, {
"0", 32+512 }, {
"0", 0+512 } } },
1948 { { {
"175", 142+512 }, {
"175", 144+512 }, {
"175", 144+512 }, {
"175", 128+512 } } },
1949 { { {
"350", 251+512 }, {
"350", 256+512 }, {
"350", 256+512 }, {
"350", 256+512 } } },
1950 { { {
"525", 361+512 }, {
"525", 368+512 }, {
"525", 368+512 }, {
"525", 384+512 } } },
1951 { { {
"700", 470+512 }, {
"700", 480+512 }, {
"700", 480+512 }, {
"700", 511+512 } } },
1955 { { {
"0", 64+1024 }, {
"0", 64+1024 }, {
"0", 64+1024 }, {
"0", 0+1024 } } },
1956 { { {
"175", 283+1024 }, {
"175", 288+1024 }, {
"175", 288+1024 }, {
"175", 256+1024 } } },
1957 { { {
"350", 502+1024 }, {
"350", 512+1024 }, {
"350", 512+1024 }, {
"350", 512+1024 } } },
1958 { { {
"525", 721+1024 }, {
"525", 736+1024 }, {
"525", 736+1024 }, {
"525", 768+1024 } } },
1959 { { {
"700", 940+1024 }, {
"700", 960+1024 }, {
"700", 960+1024 }, {
"700", 1023+1024 } } },
1963 { { {
"0", 256+4096 }, {
"0", 256+4096 }, {
"0", 256+4096 }, {
"0", 0+4096 } } },
1964 { { {
"175", 1132+4096 }, {
"175", 1152+4096 }, {
"175", 1152+4096 }, {
"175", 1024+4096 } } },
1965 { { {
"350", 2008+4096 }, {
"350", 2048+4096 }, {
"350", 2048+4096 }, {
"350", 2048+4096 } } },
1966 { { {
"525", 2884+4096 }, {
"525", 2944+4096 }, {
"525", 2944+4096 }, {
"525", 3072+4096 } } },
1967 { { {
"700", 3760+4096 }, {
"700", 3840+4096 }, {
"700", 3840+4096 }, {
"700", 4095+4096 } } },
1971 { { {
"-25", -39+256 }, {
"-25", -40+256 }, {
"-25", -40+256 }, {
"-25", -64+256 } } },
1972 { { {
"0", 16+256 }, {
"0", 16+256 }, {
"0", 16+256 }, {
"0", 0+256 } } },
1973 { { {
"25", 71+256 }, {
"25", 72+256 }, {
"25", 72+256 }, {
"25", 64+256 } } },
1974 { { {
"50", 126+256 }, {
"50", 128+256 }, {
"50", 128+256 }, {
"50", 128+256 } } },
1975 { { {
"75", 180+256 }, {
"75", 184+256 }, {
"75", 184+256 }, {
"75", 192+256 } } },
1976 { { {
"100", 235+256 }, {
"100", 240+256 }, {
"100", 240+256 }, {
"100", 256+256 } } },
1977 { { {
"125", 290+256 }, {
"125", 296+256 }, {
"125", 296+256 }, {
"125", 320+256 } } },
1981 { { {
"-25", -78+512 }, {
"-25", -80+512 }, {
"-25", -80+512 }, {
"-25",-128+512 } } },
1982 { { {
"0", 32+512 }, {
"0", 32+512 }, {
"0", 32+512 }, {
"0", 0+512 } } },
1983 { { {
"25", 142+512 }, {
"25", 144+512 }, {
"25", 144+512 }, {
"25", 128+512 } } },
1984 { { {
"50", 251+512 }, {
"50", 256+512 }, {
"50", 256+512 }, {
"50", 256+512 } } },
1985 { { {
"75", 361+512 }, {
"75", 368+512 }, {
"75", 368+512 }, {
"75", 384+512 } } },
1986 { { {
"100", 470+512 }, {
"100", 480+512 }, {
"100", 480+512 }, {
"100", 512+512 } } },
1987 { { {
"125", 580+512 }, {
"125", 592+512 }, {
"125", 592+512 }, {
"125", 640+512 } } },
1991 { { {
"-25",-156+1024 }, {
"-25",-160+1024 }, {
"-25",-160+1024 }, {
"-25", -256+1024 } } },
1992 { { {
"0", 64+1024 }, {
"0", 64+1024 }, {
"0", 64+1024 }, {
"0", 0+1024 } } },
1993 { { {
"25", 283+1024 }, {
"25", 288+1024 }, {
"25", 288+1024 }, {
"25", 256+1024 } } },
1994 { { {
"50", 502+1024 }, {
"50", 512+1024 }, {
"50", 512+1024 }, {
"50", 512+1024 } } },
1995 { { {
"75", 721+1024 }, {
"75", 736+1024 }, {
"75", 736+1024 }, {
"75", 768+1024 } } },
1996 { { {
"100", 940+1024 }, {
"100", 960+1024 }, {
"100", 960+1024 }, {
"100", 1024+1024 } } },
1997 { { {
"125",1160+1024 }, {
"125",1184+1024 }, {
"125",1184+1024 }, {
"125", 1280+1024 } } },
2001 { { {
"-25", -624+4096 }, {
"-25", -640+4096 }, {
"-25", -640+4096 }, {
"-25",-1024+4096 } } },
2002 { { {
"0", 256+4096 }, {
"0", 256+4096 }, {
"0", 256+4096 }, {
"0", 0+4096 } } },
2003 { { {
"25", 1132+4096 }, {
"25", 1152+4096 }, {
"25", 1152+4096 }, {
"25", 1024+4096 } } },
2004 { { {
"50", 2008+4096 }, {
"50", 2048+4096 }, {
"50", 2048+4096 }, {
"50", 2048+4096 } } },
2005 { { {
"75", 2884+4096 }, {
"75", 2944+4096 }, {
"75", 2944+4096 }, {
"75", 3072+4096 } } },
2006 { { {
"100", 3760+4096 }, {
"100", 3840+4096 }, {
"100", 3840+4096 }, {
"100", 4096+4096 } } },
2007 { { {
"125", 4640+4096 }, {
"125", 4736+4096 }, {
"125", 4736+4096 }, {
"125", 5120+4096 } } },
2011 { { {
"16", 16 }, {
"16", 16 }, {
"16", 16 }, {
"0", 0 } } },
2012 { { {
"128", 128 }, {
"128", 128 }, {
"128", 128 }, {
"128", 128 } } },
2013 { { {
"235", 235 }, {
"240", 240 }, {
"240", 240 }, {
"255", 255 } } },
2017 { { {
"32", 32 }, {
"32", 32 }, {
"32", 32 }, {
"0", 0 } } },
2018 { { {
"256", 256 }, {
"256", 256 }, {
"256", 256 }, {
"256", 256 } } },
2019 { { {
"470", 470 }, {
"480", 480 }, {
"480", 480 }, {
"511", 511 } } },
2023 { { {
"64", 64 }, {
"64", 64 }, {
"64", 64 }, {
"0", 0 } } },
2024 { { {
"512", 512 }, {
"512", 512 }, {
"512", 512 }, {
"512", 512 } } },
2025 { { {
"940", 940 }, {
"960", 960 }, {
"960", 960 }, {
"1023", 1023 } } },
2029 { { {
"256", 256 }, {
"256", 256 }, {
"256", 256 }, {
"0", 0 } } },
2030 { { {
"2048", 2048 }, {
"2048", 2048 }, {
"2048", 2048 }, {
"2048", 2048 } } },
2031 { { {
"3760", 3760 }, {
"3840", 3840 }, {
"3840", 3840 }, {
"4095", 4095 } } },
2035 { { {
"0", 16 }, {
"0", 16 }, {
"0", 16 }, {
"0", 0 } } },
2036 { { {
"175", 71 }, {
"175", 72 }, {
"175", 72 }, {
"175", 64 } } },
2037 { { {
"350", 126 }, {
"350", 128 }, {
"350", 128 }, {
"350", 128 } } },
2038 { { {
"525", 180 }, {
"525", 184 }, {
"525", 184 }, {
"525", 192 } } },
2039 { { {
"700", 235 }, {
"700", 240 }, {
"700", 240 }, {
"700", 255 } } },
2043 { { {
"0", 32 }, {
"0", 32 }, {
"0", 32 }, {
"0", 0 } } },
2044 { { {
"175", 142 }, {
"175", 144 }, {
"175", 144 }, {
"175", 128 } } },
2045 { { {
"350", 251 }, {
"350", 256 }, {
"350", 256 }, {
"350", 256 } } },
2046 { { {
"525", 361 }, {
"525", 368 }, {
"525", 368 }, {
"525", 384 } } },
2047 { { {
"700", 470 }, {
"700", 480 }, {
"700", 480 }, {
"700", 511 } } },
2051 { { {
"0", 64 }, {
"0", 64 }, {
"0", 64 }, {
"0", 0 } } },
2052 { { {
"175", 283 }, {
"175", 288 }, {
"175", 288 }, {
"175", 256 } } },
2053 { { {
"350", 502 }, {
"350", 512 }, {
"350", 512 }, {
"350", 512 } } },
2054 { { {
"525", 721 }, {
"525", 736 }, {
"525", 736 }, {
"525", 768 } } },
2055 { { {
"700", 940 }, {
"700", 960 }, {
"700", 960 }, {
"700", 1023 } } },
2059 { { {
"0", 256 }, {
"0", 256 }, {
"0", 256 }, {
"0", 0 } } },
2060 { { {
"175", 1132 }, {
"175", 1152 }, {
"175", 1152 }, {
"175", 1024 } } },
2061 { { {
"350", 2008 }, {
"350", 2048 }, {
"350", 2048 }, {
"350", 2048 } } },
2062 { { {
"525", 2884 }, {
"525", 2944 }, {
"525", 2944 }, {
"525", 3072 } } },
2063 { { {
"700", 3760 }, {
"700", 3840 }, {
"700", 3840 }, {
"700", 4095 } } },
2067 { { {
"0", 16 }, {
"0", 16 }, {
"0", 16 }, {
"0", 0 } } },
2068 { { {
"25", 71 }, {
"25", 72 }, {
"25", 72 }, {
"25", 64 } } },
2069 { { {
"50", 126 }, {
"50", 128 }, {
"50", 128 }, {
"50", 128 } } },
2070 { { {
"75", 180 }, {
"75", 184 }, {
"75", 184 }, {
"75", 192 } } },
2071 { { {
"100", 235 }, {
"100", 240 }, {
"100", 240 }, {
"100", 255 } } },
2075 { { {
"0", 32 }, {
"0", 32 }, {
"0", 32 }, {
"0", 0 } } },
2076 { { {
"25", 142 }, {
"25", 144 }, {
"25", 144 }, {
"25", 128 } } },
2077 { { {
"50", 251 }, {
"50", 256 }, {
"50", 256 }, {
"50", 256 } } },
2078 { { {
"75", 361 }, {
"75", 368 }, {
"75", 368 }, {
"75", 384 } } },
2079 { { {
"100", 470 }, {
"100", 480 }, {
"100", 480 }, {
"100", 511 } } },
2083 { { {
"0", 64 }, {
"0", 64 }, {
"0", 64 }, {
"0", 0 } } },
2084 { { {
"25", 283 }, {
"25", 288 }, {
"25", 288 }, {
"25", 256 } } },
2085 { { {
"50", 502 }, {
"50", 512 }, {
"50", 512 }, {
"50", 512 } } },
2086 { { {
"75", 721 }, {
"75", 736 }, {
"75", 736 }, {
"75", 768 } } },
2087 { { {
"100", 940 }, {
"100", 960 }, {
"100", 960 }, {
"100", 1023 } } },
2091 { { {
"0", 256 }, {
"0", 256 }, {
"0", 256 }, {
"0", 0 } } },
2092 { { {
"25", 1132 }, {
"25", 1152 }, {
"25", 1152 }, {
"25", 1024 } } },
2093 { { {
"50", 2008 }, {
"50", 2048 }, {
"50", 2048 }, {
"50", 2048 } } },
2094 { { {
"75", 2884 }, {
"75", 2944 }, {
"75", 2944 }, {
"75", 3072 } } },
2095 { { {
"100", 3760 }, {
"100", 3840 }, {
"100", 3840 }, {
"100", 4095 } } },
2099 { { {
"50", 50 }, {
"50", 50 }, {
"50", 50 }, {
"50", 50 } } },
2100 { { {
"100", 100 }, {
"100", 100 }, {
"100", 100 }, {
"100", 100 } } },
2101 { { {
"150", 150 }, {
"150", 150 }, {
"150", 150 }, {
"150", 150 } } },
2102 { { {
"200", 200 }, {
"200", 200 }, {
"200", 200 }, {
"200", 200 } } },
2103 { { {
"255", 255 }, {
"255", 255 }, {
"255", 255 }, {
"255", 255 } } },
2107 { { {
"100", 100 }, {
"100", 100 }, {
"100", 100 }, {
"100", 100 } } },
2108 { { {
"200", 200 }, {
"200", 200 }, {
"200", 200 }, {
"200", 200 } } },
2109 { { {
"300", 300 }, {
"300", 300 }, {
"300", 300 }, {
"300", 300 } } },
2110 { { {
"400", 400 }, {
"400", 400 }, {
"400", 400 }, {
"400", 400 } } },
2111 { { {
"500", 500 }, {
"500", 500 }, {
"500", 500 }, {
"500", 500 } } },
2115 { { {
"200", 200 }, {
"200", 200 }, {
"200", 200 }, {
"200", 200 } } },
2116 { { {
"400", 400 }, {
"400", 400 }, {
"400", 400 }, {
"400", 400 } } },
2117 { { {
"600", 600 }, {
"600", 600 }, {
"600", 600 }, {
"600", 600 } } },
2118 { { {
"800", 800 }, {
"800", 800 }, {
"800", 800 }, {
"800", 800 } } },
2119 { { {
"1000",1000 }, {
"1000",1000 }, {
"1000",1000 }, {
"1000",1000 } } },
2123 { { {
"800", 800 }, {
"800", 800 }, {
"800", 800 }, {
"800", 800 } } },
2124 { { {
"1600", 1600 }, {
"1600", 1600 }, {
"1600", 1600 }, {
"1600", 1600 } } },
2125 { { {
"2400", 2400 }, {
"2400", 2400 }, {
"2400", 2400 }, {
"2400", 2400 } } },
2126 { { {
"3200", 3200 }, {
"3200", 3200 }, {
"3200", 3200 }, {
"3200", 3200 } } },
2127 { { {
"4000", 4000 }, {
"4000", 4000 }, {
"4000", 4000 }, {
"4000", 4000 } } },
2134 for (y = 0; y <
height; y += step) {
2135 dst[0] = v * o1 + dst[0] * o2;
2137 dst += linesize * step;
2145 for (y = 0; y <
height; y += step) {
2146 dst[0] = v * o1 + dst[0] * o2;
2148 dst += (linesize / 2) * step;
2156 for (x = 0; x <
width; x += step) {
2157 dst[x] = v * o1 + dst[x] * o2;
2165 for (x = 0; x <
width; x += step) {
2166 dst[x] = v * o1 + dst[x] * o2;
2178 for (plane = 0; plane < 4 && out->
data[
plane]; plane++) {
2179 for (i = 0; txt[i]; i++) {
2181 int v = color[
plane];
2184 for (char_y = 0; char_y < font_height; char_y++) {
2185 for (mask = 0x80;
mask; mask >>= 1) {
2186 if (font[txt[i] * font_height + char_y] & mask)
2187 p[0] = p[0] * o2 + v * o1;
2204 for (plane = 0; plane < 4 && out->
data[
plane]; plane++) {
2205 for (i = 0; txt[i]; i++) {
2209 uint16_t *p = (uint16_t *)(out->
data[plane] + y * out->
linesize[plane]) + (x + i * 8);
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++) {
2233 int v = color[
plane];
2235 for (char_y = font_height - 1; char_y >= 0; char_y--) {
2237 for (mask = 0x80;
mask; mask >>= 1) {
2238 if (font[txt[i] * font_height + font_height - 1 - char_y] & mask)
2239 p[char_y] = p[char_y] * o2 + v * o1;
2255 for (plane = 0; plane < 4 && out->
data[
plane]; plane++) {
2256 for (i = 0; txt[i]; i++) {
2260 for (char_y = 0; char_y < font_height; char_y++) {
2261 uint16_t *p = (uint16_t *)(out->
data[plane] + (y + i * 10) * out->
linesize[
plane]) + x;
2262 for (mask = 0x80;
mask; mask >>= 1) {
2263 if (font[txt[i] * font_height + font_height - 1 - char_y] & mask)
2264 p[char_y] = p[char_y] * o2 + v * o1;
2278 const int step = (s->
flags & 2) + 1;
2280 const float o2 = 1. - o1;
2282 int k = 0,
c, p, l, offset_x = 0, offset_y = 0;
2289 for (p = 0; p < s->
ncomp; p++) {
2293 int x = offset_x + (s->
mirror ? s->
size - 1 - pos : pos);
2303 int x = offset_x + (s->
mirror ? s->
size - 1 - pos : pos) - 10;
2318 const int step = (s->
flags & 2) + 1;
2320 const float o2 = 1. - o1;
2323 int k = 0,
c, p, l, offset_x = 0, offset_y = 0;
2330 for (p = 0; p < s->
ncomp; p++) {
2334 int x = offset_x + (s->
mirror ? s->
size - 1 - pos : pos);
2335 uint16_t *dst = (uint16_t *)(out->
data[p] + offset_y * out->
linesize[p]) + x;
2344 int x = offset_x + (s->
mirror ? s->
size - 1 - pos : pos) - 10;
2359 const int step = (s->
flags & 2) + 1;
2361 const float o2 = 1. - o1;
2363 int k = 0,
c, p, l, offset_y = 0, offset_x = 0;
2370 for (p = 0; p < s->
ncomp; p++) {
2374 int y = offset_y + (s->
mirror ? s->
size - 1 - pos : pos);
2384 int y = offset_y + (s->
mirror ? s->
size - 1 - pos : pos) - 10;
2399 const int step = (s->
flags & 2) + 1;
2401 const float o2 = 1. - o1;
2404 int k = 0,
c, p, l, offset_x = 0, offset_y = 0;
2411 for (p = 0; p < s->
ncomp; p++) {
2415 int y = offset_y + (s->
mirror ? s->
size - 1 - pos : pos);
2416 uint16_t *dst = (uint16_t *)(out->
data[p] + y * out->
linesize[p]) + offset_x;
2425 int y = offset_y + (s->
mirror ? s->
size - 1 - pos: pos) - 10;
2458 case FLAT: s->
size = 256 * 3;
break;
2459 default: s->
size = 256;
break;
2464 case 0x1100: s->
waveform = lowpass_column_mirror;
break;
2465 case 0x1000: s->
waveform = lowpass_row_mirror;
break;
2466 case 0x0100: s->
waveform = lowpass_column;
break;
2467 case 0x0000: s->
waveform = lowpass_row;
break;
2468 case 0x1110: s->
waveform = lowpass16_column_mirror;
break;
2469 case 0x1010: s->
waveform = lowpass16_row_mirror;
break;
2470 case 0x0110: s->
waveform = lowpass16_column;
break;
2471 case 0x0010: s->
waveform = lowpass16_row;
break;
2647 switch (inlink->
format) {
2668 int comp = 0, i, j = 0, k, p,
size;
2670 for (i = 0; i < s->
ncomp; i++) {
2671 if ((1 << i) & s->
pcomp)
2692 for (p = 0; p < s->
ncomp; p++) {
2696 if (!((1 << p) & s->
pcomp))
2699 for (k = 0; k < 4; k++) {
2707 for (i = 0; i <
size; i++) {
2708 for (k = 0; k < 4; k++) {
2736 for (k = 0; k < s->
ncomp; k++) {
2738 for (i = 0; i < outlink->
h ; i++)
2743 const int mult = s->
max / 256;
2746 for (i = 0; i < outlink->
h ; i++) {
2747 for (j = 0; j < outlink->
w; j++)
2754 for (k = 0, i = 0; k < s->
ncomp; k++) {
2755 if ((1 << k) & s->
pcomp) {
2760 offset_x = s->
mode ? i++ * inlink->
w : 0;
2761 offset_y = s->
mode ? 0 : i++ * inlink->
h;
2805 .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 numerator/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
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)