108 int jobnr,
int nb_jobs);
114 #define OFFSET(x) offsetof(WaveformContext, x)
115 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
297 if (!
ctx->inputs[0]->in_formats ||
298 !
ctx->inputs[0]->in_formats->nb_formats) {
313 if (!
ctx->inputs[0]->out_formats) {
318 avff =
ctx->inputs[0]->in_formats;
322 depth =
desc->comp[0].depth;
326 depth !=
desc->comp[0].depth)
338 else if (
rgb && depth == 8 &&
ncomp > 2)
340 else if (
rgb && depth == 9 &&
ncomp > 2)
342 else if (
rgb && depth == 10 &&
ncomp > 2)
344 else if (
rgb && depth == 12 &&
ncomp > 2)
346 else if (depth == 8 &&
ncomp > 2)
348 else if (depth == 9 &&
ncomp > 2)
350 else if (depth == 10 &&
ncomp > 2)
352 else if (depth == 12 &&
ncomp > 2)
364 const int dst_linesize =
out->linesize[component] / 2;
365 const int bg =
s->bg_color[component] * (
s->max / 256);
366 const int limit =
s->max - 1;
367 const int dst_h =
s->display ==
PARADE ?
out->height /
s->acomp :
out->height;
368 const int dst_w =
s->display ==
PARADE ?
out->width /
s->acomp :
out->width;
377 dst = (uint16_t *)
out->data[component] + y * dst_linesize + x;
383 for (y =
end - 1; y >=
start; y--) {
384 dst = (uint16_t *)
out->data[component] + y * dst_linesize + x;
393 dst = (uint16_t *)
out->data[component] + y * dst_linesize;
400 for (x =
end - 1; x >=
start; x--) {
412 const int dst_linesize =
out->linesize[component];
413 const uint8_t bg =
s->bg_color[component];
414 const int dst_h =
s->display ==
PARADE ?
out->height /
s->acomp :
out->height;
415 const int dst_w =
s->display ==
PARADE ?
out->width /
s->acomp :
out->width;
424 dst =
out->data[component] + y * dst_linesize + x;
430 for (y =
end - 1; y >=
start; y--) {
431 dst =
out->data[component] + y * dst_linesize + x;
440 dst =
out->data[component] + y * dst_linesize;
447 for (x =
end - 1; x >=
start; x--) {
459 const int dst_linesize =
out->linesize[component] / 2;
460 const int bg =
s->bg_color[component] * (
s->max / 256);
461 const int limit =
s->max - 1;
462 const int dst_h =
s->display ==
PARADE ?
out->height /
s->acomp :
out->height;
463 const int dst_w =
s->display ==
PARADE ?
out->width /
s->acomp :
out->width;
474 dst = (uint16_t *)
out->data[component] + y * dst_linesize + x;
481 dst = (uint16_t *)
out->data[component] + y * dst_linesize + x;
489 if (
s->envelope == 3)
493 dst = (uint16_t *)
out->data[component] +
emin[x -
offset] * dst_linesize + x;
495 dst = (uint16_t *)
out->data[component] +
emax[x -
offset] * dst_linesize + x;
500 dst = (uint16_t *)
out->data[component] + y * dst_linesize;
515 if (
s->envelope == 3)
519 dst = (uint16_t *)
out->data[component] + y * dst_linesize +
emin[y -
offset];
521 dst = (uint16_t *)
out->data[component] + y * dst_linesize +
emax[y -
offset];
529 const int dst_linesize =
out->linesize[component];
530 const int bg =
s->bg_color[component];
531 const int dst_h =
s->display ==
PARADE ?
out->height /
s->acomp :
out->height;
532 const int dst_w =
s->display ==
PARADE ?
out->width /
s->acomp :
out->width;
543 dst =
out->data[component] + y * dst_linesize + x;
550 dst =
out->data[component] + y * dst_linesize + x;
558 if (
s->envelope == 3)
562 dst =
out->data[component] +
emin[x -
offset] * dst_linesize + x;
564 dst =
out->data[component] +
emax[x -
offset] * dst_linesize + x;
569 dst =
out->data[component] + y * dst_linesize;
584 if (
s->envelope == 3)
588 dst =
out->data[component] + y * dst_linesize +
emin[y -
offset];
590 dst =
out->data[component] + y * dst_linesize +
emax[y -
offset];
598 if (
s->envelope == 0) {
600 }
else if (
s->envelope == 1) {
609 if (
s->envelope == 0) {
611 }
else if (
s->envelope == 1) {
653 int offset_y,
int offset_x,
655 int jobnr,
int nb_jobs)
657 const int plane =
s->desc->comp[component].plane;
658 const int shift_w =
s->shift_w[component];
659 const int shift_h =
s->shift_h[component];
660 const int src_linesize =
in->linesize[
plane] / 2;
661 const int dst_linesize =
out->linesize[
plane] / 2;
662 const int dst_signed_linesize = dst_linesize * (
mirror == 1 ? -1 : 1);
663 const int limit =
s->max - 1;
667 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
668 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
669 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
670 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
672 const uint16_t *src_data = (
const uint16_t *)
in->data[
plane] + sliceh_start * src_linesize;
673 uint16_t *dst_data = (uint16_t *)
out->data[
plane] + (offset_y + sliceh_start *
step) * dst_linesize + offset_x;
674 uint16_t *
const dst_bottom_line = dst_data + dst_linesize * (
s->size - 1);
675 uint16_t *
const dst_line = (
mirror ? dst_bottom_line : dst_data);
682 for (y = sliceh_start; y < sliceh_end; y++) {
683 const uint16_t *src_data_end = src_data + slicew_end;
684 uint16_t *dst = dst_line + slicew_start *
step;
686 for (p = src_data + slicew_start; p < src_data_end; p++) {
688 int i = 0, v =
FFMIN(*p, limit);
692 target = dst++ + dst_signed_linesize * v;
694 }
while (++
i <
step);
696 uint16_t *row = dst_data;
699 target = row - v - 1;
704 }
while (++
i <
step);
707 src_data += src_linesize;
708 dst_data += dst_linesize *
step;
712 #define LOWPASS16_FUNC(name, column, mirror) \
713 static int lowpass16_##name(AVFilterContext *ctx, \
714 void *arg, int jobnr, \
717 WaveformContext *s = ctx->priv; \
718 ThreadData *td = arg; \
719 AVFrame *in = td->in; \
720 AVFrame *out = td->out; \
721 int component = td->component; \
722 int offset_y = td->offset_y; \
723 int offset_x = td->offset_x; \
725 lowpass16(s, in, out, component, s->intensity, \
726 offset_y, offset_x, column, mirror, \
740 int offset_y,
int offset_x,
742 int jobnr,
int nb_jobs)
744 const int plane =
s->desc->comp[component].plane;
745 const int shift_w =
s->shift_w[component];
746 const int shift_h =
s->shift_h[component];
747 const int src_linesize =
in->linesize[
plane];
748 const int dst_linesize =
out->linesize[
plane];
749 const int dst_signed_linesize = dst_linesize * (
mirror == 1 ? -1 : 1);
753 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
754 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
755 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
756 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
758 const uint8_t *src_data =
in->data[
plane] + sliceh_start * src_linesize;
759 uint8_t *dst_data =
out->data[
plane] + (offset_y + sliceh_start *
step) * dst_linesize + offset_x;
760 uint8_t *
const dst_bottom_line = dst_data + dst_linesize * (
s->size - 1);
761 uint8_t *
const dst_line = (
mirror ? dst_bottom_line : dst_data);
768 for (y = sliceh_start; y < sliceh_end; y++) {
769 const uint8_t *src_data_end = src_data + slicew_end;
772 for (p = src_data + slicew_start; p < src_data_end; p++) {
775 target = dst + dst_signed_linesize * *p;
781 target = row - *p - 1;
788 src_data += src_linesize;
789 dst_data += dst_linesize *
step;
792 if (column &&
step > 1) {
793 const int dst_h = 256;
797 dst =
out->data[
plane] + offset_y * dst_linesize + offset_x;
798 for (y = 0; y < dst_h; y++) {
799 for (x = slicew_start *
step; x < slicew_end *
step; x+=
step) {
800 for (z = 1; z <
step; z++) {
806 }
else if (
step > 1) {
807 const int dst_w = 256;
811 dst =
out->data[
plane] + (offset_y + sliceh_start *
step) * dst_linesize + offset_x;
812 for (y = sliceh_start *
step; y < sliceh_end *
step; y+=
step) {
813 for (z = 1; z <
step; z++)
814 memcpy(dst + dst_linesize * z, dst, dst_w);
815 dst += dst_linesize *
step;
820 #define LOWPASS_FUNC(name, column, mirror) \
821 static int lowpass_##name(AVFilterContext *ctx, \
822 void *arg, int jobnr, \
825 WaveformContext *s = ctx->priv; \
826 ThreadData *td = arg; \
827 AVFrame *in = td->in; \
828 AVFrame *out = td->out; \
829 int component = td->component; \
830 int offset_y = td->offset_y; \
831 int offset_x = td->offset_x; \
833 lowpass(s, in, out, component, s->intensity, \
834 offset_y, offset_x, column, mirror, \
848 int offset_y,
int offset_x,
850 int jobnr,
int nb_jobs)
852 const int plane =
s->desc->comp[component].plane;
853 const int c0_linesize =
in->linesize[
plane + 0 ] / 2;
854 const int c1_linesize =
in->linesize[(
plane + 1) %
s->ncomp] / 2;
855 const int c2_linesize =
in->linesize[(
plane + 2) %
s->ncomp] / 2;
856 const int c0_shift_w =
s->shift_w[ component + 0 ];
857 const int c1_shift_w =
s->shift_w[(component + 1) %
s->ncomp];
858 const int c2_shift_w =
s->shift_w[(component + 2) %
s->ncomp];
859 const int c0_shift_h =
s->shift_h[ component + 0 ];
860 const int c1_shift_h =
s->shift_h[(component + 1) %
s->ncomp];
861 const int c2_shift_h =
s->shift_h[(component + 2) %
s->ncomp];
862 const int d0_linesize =
out->linesize[
plane + 0 ] / 2;
863 const int d1_linesize =
out->linesize[(
plane + 1) %
s->ncomp] / 2;
864 const int limit =
s->max - 1;
866 const int mid =
s->max / 2;
867 const int src_h =
in->height;
868 const int src_w =
in->width;
869 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
870 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
871 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
872 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
876 const int d0_signed_linesize = d0_linesize * (
mirror == 1 ? -1 : 1);
877 const int d1_signed_linesize = d1_linesize * (
mirror == 1 ? -1 : 1);
879 for (x = slicew_start; x < slicew_end; x++) {
880 const uint16_t *c0_data = (uint16_t *)
in->data[
plane + 0];
881 const uint16_t *c1_data = (uint16_t *)
in->data[(
plane + 1) %
s->ncomp];
882 const uint16_t *c2_data = (uint16_t *)
in->data[(
plane + 2) %
s->ncomp];
883 uint16_t *d0_data = (uint16_t *)(
out->data[
plane]) + offset_y * d0_linesize + offset_x;
884 uint16_t *d1_data = (uint16_t *)(
out->data[(
plane + 1) %
s->ncomp]) + offset_y * d1_linesize + offset_x;
885 uint16_t *
const d0_bottom_line = d0_data + d0_linesize * (
s->size - 1);
886 uint16_t *
const d0 = (
mirror ? d0_bottom_line : d0_data);
887 uint16_t *
const d1_bottom_line = d1_data + d1_linesize * (
s->size - 1);
888 uint16_t *
const d1 = (
mirror ? d1_bottom_line : d1_data);
890 for (y = 0; y < src_h; y++) {
891 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit) +
s->max;
892 const int c1 =
FFMIN(
FFABS(c1_data[x >> c1_shift_w] - mid) +
FFABS(c2_data[x >> c2_shift_w] - mid), limit);
895 target = d0 + x + d0_signed_linesize * c0;
897 target = d1 + x + d1_signed_linesize * (c0 -
c1);
899 target = d1 + x + d1_signed_linesize * (c0 +
c1);
902 if (!c0_shift_h || (y & c0_shift_h))
903 c0_data += c0_linesize;
904 if (!c1_shift_h || (y & c1_shift_h))
905 c1_data += c1_linesize;
906 if (!c2_shift_h || (y & c2_shift_h))
907 c2_data += c2_linesize;
908 d0_data += d0_linesize;
909 d1_data += d1_linesize;
913 const uint16_t *c0_data = (uint16_t *)(
in->data[
plane]) + (sliceh_start >> c0_shift_h) * c0_linesize;
914 const uint16_t *c1_data = (uint16_t *)(
in->data[(
plane + 1) %
s->ncomp]) + (sliceh_start >> c1_shift_h) * c1_linesize;
915 const uint16_t *c2_data = (uint16_t *)(
in->data[(
plane + 2) %
s->ncomp]) + (sliceh_start >> c2_shift_h) * c2_linesize;
916 uint16_t *d0_data = (uint16_t *)(
out->data[
plane]) + (offset_y + sliceh_start) * d0_linesize + offset_x;
917 uint16_t *d1_data = (uint16_t *)(
out->data[(
plane + 1) %
s->ncomp]) + (offset_y + sliceh_start) * d1_linesize + offset_x;
920 d0_data +=
s->size - 1;
921 d1_data +=
s->size - 1;
924 for (y = sliceh_start; y < sliceh_end; y++) {
925 for (x = 0; x < src_w; x++) {
926 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit) +
s->max;
927 const int c1 =
FFMIN(
FFABS(c1_data[x >> c1_shift_w] - mid) +
FFABS(c2_data[x >> c2_shift_w] - mid), limit);
931 target = d0_data - c0;
933 target = d1_data - (c0 -
c1);
935 target = d1_data - (c0 +
c1);
938 target = d0_data + c0;
940 target = d1_data + (c0 -
c1);
942 target = d1_data + (c0 +
c1);
947 if (!c0_shift_h || (y & c0_shift_h))
948 c0_data += c0_linesize;
949 if (!c1_shift_h || (y & c1_shift_h))
950 c1_data += c1_linesize;
951 if (!c2_shift_h || (y & c2_shift_h))
952 c2_data += c2_linesize;
953 d0_data += d0_linesize;
954 d1_data += d1_linesize;
959 #define FLAT16_FUNC(name, column, mirror) \
960 static int flat16_##name(AVFilterContext *ctx, \
961 void *arg, int jobnr, \
964 WaveformContext *s = ctx->priv; \
965 ThreadData *td = arg; \
966 AVFrame *in = td->in; \
967 AVFrame *out = td->out; \
968 int component = td->component; \
969 int offset_y = td->offset_y; \
970 int offset_x = td->offset_x; \
972 flat16(s, in, out, component, s->intensity, \
973 offset_y, offset_x, column, mirror, \
987 int offset_y,
int offset_x,
989 int jobnr,
int nb_jobs)
991 const int plane =
s->desc->comp[component].plane;
992 const int c0_linesize =
in->linesize[
plane + 0 ];
993 const int c1_linesize =
in->linesize[(
plane + 1) %
s->ncomp];
994 const int c2_linesize =
in->linesize[(
plane + 2) %
s->ncomp];
995 const int c0_shift_w =
s->shift_w[ component + 0 ];
996 const int c1_shift_w =
s->shift_w[(component + 1) %
s->ncomp];
997 const int c2_shift_w =
s->shift_w[(component + 2) %
s->ncomp];
998 const int c0_shift_h =
s->shift_h[ component + 0 ];
999 const int c1_shift_h =
s->shift_h[(component + 1) %
s->ncomp];
1000 const int c2_shift_h =
s->shift_h[(component + 2) %
s->ncomp];
1001 const int d0_linesize =
out->linesize[
plane + 0 ];
1002 const int d1_linesize =
out->linesize[(
plane + 1) %
s->ncomp];
1004 const int src_h =
in->height;
1005 const int src_w =
in->width;
1006 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
1007 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
1008 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
1009 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
1013 const int d0_signed_linesize = d0_linesize * (
mirror == 1 ? -1 : 1);
1014 const int d1_signed_linesize = d1_linesize * (
mirror == 1 ? -1 : 1);
1016 for (x = slicew_start; x < slicew_end; x++) {
1020 uint8_t *d0_data =
out->data[
plane] + offset_y * d0_linesize + offset_x;
1021 uint8_t *d1_data =
out->data[(
plane + 1) %
s->ncomp] + offset_y * d1_linesize + offset_x;
1022 uint8_t *
const d0_bottom_line = d0_data + d0_linesize * (
s->size - 1);
1024 uint8_t *
const d1_bottom_line = d1_data + d1_linesize * (
s->size - 1);
1027 for (y = 0; y < src_h; y++) {
1028 const int c0 = c0_data[x >> c0_shift_w] + 256;
1029 const int c1 =
FFABS(c1_data[x >> c1_shift_w] - 128) +
FFABS(c2_data[x >> c2_shift_w] - 128);
1032 target = d0 + x + d0_signed_linesize * c0;
1034 target = d1 + x + d1_signed_linesize * (c0 -
c1);
1036 target = d1 + x + d1_signed_linesize * (c0 +
c1);
1039 if (!c0_shift_h || (y & c0_shift_h))
1040 c0_data += c0_linesize;
1041 if (!c1_shift_h || (y & c1_shift_h))
1042 c1_data += c1_linesize;
1043 if (!c2_shift_h || (y & c2_shift_h))
1044 c2_data += c2_linesize;
1045 d0_data += d0_linesize;
1046 d1_data += d1_linesize;
1050 const uint8_t *c0_data =
in->data[
plane] + (sliceh_start >> c0_shift_h) * c0_linesize;
1051 const uint8_t *c1_data =
in->data[(
plane + 1) %
s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize;
1052 const uint8_t *c2_data =
in->data[(
plane + 2) %
s->ncomp] + (sliceh_start >> c2_shift_h) * c2_linesize;
1053 uint8_t *d0_data =
out->data[
plane] + (offset_y + sliceh_start) * d0_linesize + offset_x;
1054 uint8_t *d1_data =
out->data[(
plane + 1) %
s->ncomp] + (offset_y + sliceh_start) * d1_linesize + offset_x;
1057 d0_data +=
s->size - 1;
1058 d1_data +=
s->size - 1;
1061 for (y = sliceh_start; y < sliceh_end; y++) {
1062 for (x = 0; x < src_w; x++) {
1063 const int c0 = c0_data[x >> c0_shift_w] + 256;
1064 const int c1 =
FFABS(c1_data[x >> c1_shift_w] - 128) +
FFABS(c2_data[x >> c2_shift_w] - 128);
1068 target = d0_data - c0;
1070 target = d1_data - (c0 -
c1);
1072 target = d1_data - (c0 +
c1);
1075 target = d0_data + c0;
1077 target = d1_data + (c0 -
c1);
1079 target = d1_data + (c0 +
c1);
1084 if (!c0_shift_h || (y & c0_shift_h))
1085 c0_data += c0_linesize;
1086 if (!c1_shift_h || (y & c1_shift_h))
1087 c1_data += c1_linesize;
1088 if (!c2_shift_h || (y & c2_shift_h))
1089 c2_data += c2_linesize;
1090 d0_data += d0_linesize;
1091 d1_data += d1_linesize;
1096 #define FLAT_FUNC(name, column, mirror) \
1097 static int flat_##name(AVFilterContext *ctx, \
1098 void *arg, int jobnr, \
1101 WaveformContext *s = ctx->priv; \
1102 ThreadData *td = arg; \
1103 AVFrame *in = td->in; \
1104 AVFrame *out = td->out; \
1105 int component = td->component; \
1106 int offset_y = td->offset_y; \
1107 int offset_x = td->offset_x; \
1109 flat(s, in, out, component, s->intensity, \
1110 offset_y, offset_x, column, mirror, \
1121 #define AFLAT16(name, update_cr, column, mirror) \
1122 static int name(AVFilterContext *ctx, \
1123 void *arg, int jobnr, \
1126 WaveformContext *s = ctx->priv; \
1127 ThreadData *td = arg; \
1128 AVFrame *in = td->in; \
1129 AVFrame *out = td->out; \
1130 int component = td->component; \
1131 int offset_y = td->offset_y; \
1132 int offset_x = td->offset_x; \
1133 const int intensity = s->intensity; \
1134 const int plane = s->desc->comp[component].plane; \
1135 const int c0_linesize = in->linesize[ plane + 0 ] / 2; \
1136 const int c1_linesize = in->linesize[(plane + 1) % s->ncomp] / 2; \
1137 const int c2_linesize = in->linesize[(plane + 2) % s->ncomp] / 2; \
1138 const int c0_shift_w = s->shift_w[ component + 0 ]; \
1139 const int c1_shift_w = s->shift_w[(component + 1) % s->ncomp]; \
1140 const int c2_shift_w = s->shift_w[(component + 2) % s->ncomp]; \
1141 const int c0_shift_h = s->shift_h[ component + 0 ]; \
1142 const int c1_shift_h = s->shift_h[(component + 1) % s->ncomp]; \
1143 const int c2_shift_h = s->shift_h[(component + 2) % s->ncomp]; \
1144 const int d0_linesize = out->linesize[ plane + 0 ] / 2; \
1145 const int d1_linesize = out->linesize[(plane + 1) % s->ncomp] / 2; \
1146 const int d2_linesize = out->linesize[(plane + 2) % s->ncomp] / 2; \
1147 const int limit = s->max - 1; \
1148 const int max = limit - intensity; \
1149 const int mid = s->max / 2; \
1150 const int src_h = in->height; \
1151 const int src_w = in->width; \
1152 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0; \
1153 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h; \
1154 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0; \
1155 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w; \
1159 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1); \
1160 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1); \
1161 const int d2_signed_linesize = d2_linesize * (mirror == 1 ? -1 : 1); \
1163 for (x = slicew_start; x < slicew_end; x++) { \
1164 const uint16_t *c0_data = (uint16_t *)in->data[plane + 0]; \
1165 const uint16_t *c1_data = (uint16_t *)in->data[(plane + 1) % s->ncomp]; \
1166 const uint16_t *c2_data = (uint16_t *)in->data[(plane + 2) % s->ncomp]; \
1167 uint16_t *d0_data = (uint16_t *)out->data[plane] + offset_y * d0_linesize + offset_x; \
1168 uint16_t *d1_data = (uint16_t *)out->data[(plane + 1) % s->ncomp] + offset_y * d1_linesize + offset_x; \
1169 uint16_t *d2_data = (uint16_t *)out->data[(plane + 2) % s->ncomp] + offset_y * d2_linesize + offset_x; \
1170 uint16_t * const d0_bottom_line = d0_data + d0_linesize * (s->size - 1); \
1171 uint16_t * const d0 = (mirror ? d0_bottom_line : d0_data); \
1172 uint16_t * const d1_bottom_line = d1_data + d1_linesize * (s->size - 1); \
1173 uint16_t * const d1 = (mirror ? d1_bottom_line : d1_data); \
1174 uint16_t * const d2_bottom_line = d2_data + d2_linesize * (s->size - 1); \
1175 uint16_t * const d2 = (mirror ? d2_bottom_line : d2_data); \
1177 for (y = 0; y < src_h; y++) { \
1178 const int c0 = FFMIN(c0_data[x >> c0_shift_w], limit) + mid; \
1179 const int c1 = FFMIN(c1_data[x >> c1_shift_w], limit) - mid; \
1180 const int c2 = FFMIN(c2_data[x >> c2_shift_w], limit) - mid; \
1183 target = d0 + x + d0_signed_linesize * c0; \
1184 update16(target, max, intensity, limit); \
1186 target = d1 + x + d1_signed_linesize * (c0 + c1); \
1187 update16(target, max, intensity, limit); \
1189 target = d2 + x + d2_signed_linesize * (c0 + c2); \
1190 update_cr(target, max, intensity, limit); \
1192 if (!c0_shift_h || (y & c0_shift_h)) \
1193 c0_data += c0_linesize; \
1194 if (!c1_shift_h || (y & c1_shift_h)) \
1195 c1_data += c1_linesize; \
1196 if (!c2_shift_h || (y & c2_shift_h)) \
1197 c2_data += c2_linesize; \
1198 d0_data += d0_linesize; \
1199 d1_data += d1_linesize; \
1200 d2_data += d2_linesize; \
1204 const uint16_t *c0_data = (uint16_t *)in->data[plane] + (sliceh_start >> c0_shift_h) * c0_linesize; \
1205 const uint16_t *c1_data = (uint16_t *)in->data[(plane + 1) % s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize; \
1206 const uint16_t *c2_data = (uint16_t *)in->data[(plane + 2) % s->ncomp] + (sliceh_start >> c2_shift_h) * c2_linesize; \
1207 uint16_t *d0_data = (uint16_t *)out->data[plane] + (offset_y + sliceh_start) * d0_linesize + offset_x; \
1208 uint16_t *d1_data = (uint16_t *)out->data[(plane + 1) % s->ncomp] + (offset_y + sliceh_start) * d1_linesize + offset_x; \
1209 uint16_t *d2_data = (uint16_t *)out->data[(plane + 2) % s->ncomp] + (offset_y + sliceh_start) * d2_linesize + offset_x; \
1212 d0_data += s->size - 1; \
1213 d1_data += s->size - 1; \
1214 d2_data += s->size - 1; \
1217 for (y = sliceh_start; y < sliceh_end; y++) { \
1218 for (x = 0; x < src_w; x++) { \
1219 const int c0 = FFMIN(c0_data[x >> c0_shift_w], limit) + mid; \
1220 const int c1 = FFMIN(c1_data[x >> c1_shift_w], limit) - mid; \
1221 const int c2 = FFMIN(c2_data[x >> c2_shift_w], limit) - mid; \
1225 target = d0_data - c0; \
1226 update16(target, max, intensity, limit); \
1227 target = d1_data - (c0 + c1); \
1228 update16(target, max, intensity, limit); \
1229 target = d2_data - (c0 + c2); \
1230 update_cr(target, max, intensity, limit); \
1232 target = d0_data + c0; \
1233 update16(target, max, intensity, limit); \
1234 target = d1_data + (c0 + c1); \
1235 update16(target, max, intensity, limit); \
1236 target = d2_data + (c0 + c2); \
1237 update_cr(target, max, intensity, limit); \
1241 if (!c0_shift_h || (y & c0_shift_h)) \
1242 c0_data += c0_linesize; \
1243 if (!c1_shift_h || (y & c1_shift_h)) \
1244 c1_data += c1_linesize; \
1245 if (!c2_shift_h || (y & c2_shift_h)) \
1246 c2_data += c2_linesize; \
1247 d0_data += d0_linesize; \
1248 d1_data += d1_linesize; \
1249 d2_data += d2_linesize; \
1255 #define AFLAT(name, update_cr, column, mirror) \
1256 static int name(AVFilterContext *ctx, \
1257 void *arg, int jobnr, \
1260 WaveformContext *s = ctx->priv; \
1261 ThreadData *td = arg; \
1262 AVFrame *in = td->in; \
1263 AVFrame *out = td->out; \
1264 int component = td->component; \
1265 int offset_y = td->offset_y; \
1266 int offset_x = td->offset_x; \
1267 const int src_h = in->height; \
1268 const int src_w = in->width; \
1269 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0; \
1270 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h; \
1271 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0; \
1272 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w; \
1273 const int intensity = s->intensity; \
1274 const int plane = s->desc->comp[component].plane; \
1275 const int c0_linesize = in->linesize[ plane + 0 ]; \
1276 const int c1_linesize = in->linesize[(plane + 1) % s->ncomp]; \
1277 const int c2_linesize = in->linesize[(plane + 2) % s->ncomp]; \
1278 const int c0_shift_w = s->shift_w[ component + 0 ]; \
1279 const int c1_shift_w = s->shift_w[(component + 1) % s->ncomp]; \
1280 const int c2_shift_w = s->shift_w[(component + 2) % s->ncomp]; \
1281 const int c0_shift_h = s->shift_h[ component + 0 ]; \
1282 const int c1_shift_h = s->shift_h[(component + 1) % s->ncomp]; \
1283 const int c2_shift_h = s->shift_h[(component + 2) % s->ncomp]; \
1284 const int d0_linesize = out->linesize[ plane + 0 ]; \
1285 const int d1_linesize = out->linesize[(plane + 1) % s->ncomp]; \
1286 const int d2_linesize = out->linesize[(plane + 2) % s->ncomp]; \
1287 const int max = 255 - intensity; \
1291 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1); \
1292 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1); \
1293 const int d2_signed_linesize = d2_linesize * (mirror == 1 ? -1 : 1); \
1295 for (x = slicew_start; x < slicew_end; x++) { \
1296 const uint8_t *c0_data = in->data[plane + 0]; \
1297 const uint8_t *c1_data = in->data[(plane + 1) % s->ncomp]; \
1298 const uint8_t *c2_data = in->data[(plane + 2) % s->ncomp]; \
1299 uint8_t *d0_data = out->data[plane] + offset_y * d0_linesize + offset_x; \
1300 uint8_t *d1_data = out->data[(plane + 1) % s->ncomp] + offset_y * d1_linesize + offset_x; \
1301 uint8_t *d2_data = out->data[(plane + 2) % s->ncomp] + offset_y * d2_linesize + offset_x; \
1302 uint8_t * const d0_bottom_line = d0_data + d0_linesize * (s->size - 1); \
1303 uint8_t * const d0 = (mirror ? d0_bottom_line : d0_data); \
1304 uint8_t * const d1_bottom_line = d1_data + d1_linesize * (s->size - 1); \
1305 uint8_t * const d1 = (mirror ? d1_bottom_line : d1_data); \
1306 uint8_t * const d2_bottom_line = d2_data + d2_linesize * (s->size - 1); \
1307 uint8_t * const d2 = (mirror ? d2_bottom_line : d2_data); \
1309 for (y = 0; y < src_h; y++) { \
1310 const int c0 = c0_data[x >> c0_shift_w] + 128; \
1311 const int c1 = c1_data[x >> c1_shift_w] - 128; \
1312 const int c2 = c2_data[x >> c2_shift_w] - 128; \
1315 target = d0 + x + d0_signed_linesize * c0; \
1316 update(target, max, intensity); \
1318 target = d1 + x + d1_signed_linesize * (c0 + c1); \
1319 update(target, max, intensity); \
1321 target = d2 + x + d2_signed_linesize * (c0 + c2); \
1322 update_cr(target, max, intensity); \
1324 if (!c0_shift_h || (y & c0_shift_h)) \
1325 c0_data += c0_linesize; \
1326 if (!c1_shift_h || (y & c1_shift_h)) \
1327 c1_data += c1_linesize; \
1328 if (!c1_shift_h || (y & c1_shift_h)) \
1329 c2_data += c1_linesize; \
1330 d0_data += d0_linesize; \
1331 d1_data += d1_linesize; \
1332 d2_data += d2_linesize; \
1336 const uint8_t *c0_data = in->data[plane] + (sliceh_start >> c0_shift_h) * c0_linesize; \
1337 const uint8_t *c1_data = in->data[(plane + 1) % s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize; \
1338 const uint8_t *c2_data = in->data[(plane + 2) % s->ncomp] + (sliceh_start >> c2_shift_h) * c2_linesize; \
1339 uint8_t *d0_data = out->data[plane] + (offset_y + sliceh_start) * d0_linesize + offset_x; \
1340 uint8_t *d1_data = out->data[(plane + 1) % s->ncomp] + (offset_y + sliceh_start) * d1_linesize + offset_x; \
1341 uint8_t *d2_data = out->data[(plane + 2) % s->ncomp] + (offset_y + sliceh_start) * d2_linesize + offset_x; \
1344 d0_data += s->size - 1; \
1345 d1_data += s->size - 1; \
1346 d2_data += s->size - 1; \
1349 for (y = sliceh_start; y < sliceh_end; y++) { \
1350 for (x = 0; x < src_w; x++) { \
1351 const int c0 = c0_data[x >> c0_shift_w] + 128; \
1352 const int c1 = c1_data[x >> c1_shift_w] - 128; \
1353 const int c2 = c2_data[x >> c2_shift_w] - 128; \
1357 target = d0_data - c0; \
1358 update(target, max, intensity); \
1359 target = d1_data - (c0 + c1); \
1360 update(target, max, intensity); \
1361 target = d2_data - (c0 + c2); \
1362 update_cr(target, max, intensity); \
1364 target = d0_data + c0; \
1365 update(target, max, intensity); \
1366 target = d1_data + (c0 + c1); \
1367 update(target, max, intensity); \
1368 target = d2_data + (c0 + c2); \
1369 update_cr(target, max, intensity); \
1373 if (!c0_shift_h || (y & c0_shift_h)) \
1374 c0_data += c0_linesize; \
1375 if (!c1_shift_h || (y & c1_shift_h)) \
1376 c1_data += c1_linesize; \
1377 if (!c2_shift_h || (y & c2_shift_h)) \
1378 c2_data += c2_linesize; \
1379 d0_data += d0_linesize; \
1380 d1_data += d1_linesize; \
1381 d2_data += d2_linesize; \
1408 int offset_y,
int offset_x,
1410 int jobnr,
int nb_jobs)
1412 const int plane =
s->desc->comp[component].plane;
1413 const int c0_linesize =
in->linesize[(
plane + 1) %
s->ncomp] / 2;
1414 const int c1_linesize =
in->linesize[(
plane + 2) %
s->ncomp] / 2;
1415 const int dst_linesize =
out->linesize[
plane] / 2;
1416 const int limit =
s->max - 1;
1418 const int mid =
s->max / 2;
1419 const int c0_shift_w =
s->shift_w[(component + 1) %
s->ncomp];
1420 const int c1_shift_w =
s->shift_w[(component + 2) %
s->ncomp];
1421 const int c0_shift_h =
s->shift_h[(component + 1) %
s->ncomp];
1422 const int c1_shift_h =
s->shift_h[(component + 2) %
s->ncomp];
1423 const int src_h =
in->height;
1424 const int src_w =
in->width;
1425 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
1426 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
1427 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
1428 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
1432 const int dst_signed_linesize = dst_linesize * (
mirror == 1 ? -1 : 1);
1434 for (x = slicew_start; x < slicew_end; x++) {
1435 const uint16_t *c0_data = (uint16_t *)
in->data[(
plane + 1) %
s->ncomp];
1436 const uint16_t *c1_data = (uint16_t *)
in->data[(
plane + 2) %
s->ncomp];
1437 uint16_t *dst_data = (uint16_t *)
out->data[
plane] + offset_y * dst_linesize + offset_x;
1438 uint16_t *
const dst_bottom_line = dst_data + dst_linesize * (
s->size - 1);
1439 uint16_t *
const dst_line = (
mirror ? dst_bottom_line : dst_data);
1440 uint16_t *dst = dst_line;
1442 for (y = 0; y < src_h; y++) {
1443 const int sum =
FFMIN(
FFABS(c0_data[x >> c0_shift_w] - mid) +
FFABS(c1_data[x >> c1_shift_w] - mid - 1), limit);
1446 target = dst + x + dst_signed_linesize * sum;
1449 if (!c0_shift_h || (y & c0_shift_h))
1450 c0_data += c0_linesize;
1451 if (!c1_shift_h || (y & c1_shift_h))
1452 c1_data += c1_linesize;
1453 dst_data += dst_linesize;
1457 const uint16_t *c0_data = (uint16_t *)
in->data[(
plane + 1) %
s->ncomp] + (sliceh_start >> c0_shift_h) * c0_linesize;
1458 const uint16_t *c1_data = (uint16_t *)
in->data[(
plane + 2) %
s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize;
1459 uint16_t *dst_data = (uint16_t *)
out->data[
plane] + (offset_y + sliceh_start) * dst_linesize + offset_x;
1462 dst_data +=
s->size - 1;
1463 for (y = sliceh_start; y < sliceh_end; y++) {
1464 for (x = 0; x < src_w; x++) {
1465 const int sum =
FFMIN(
FFABS(c0_data[x >> c0_shift_w] - mid) +
FFABS(c1_data[x >> c1_shift_w] - mid - 1), limit);
1469 target = dst_data - sum;
1472 target = dst_data + sum;
1477 if (!c0_shift_h || (y & c0_shift_h))
1478 c0_data += c0_linesize;
1479 if (!c1_shift_h || (y & c1_shift_h))
1480 c1_data += c1_linesize;
1481 dst_data += dst_linesize;
1486 #define CHROMA16_FUNC(name, column, mirror) \
1487 static int chroma16_##name(AVFilterContext *ctx, \
1488 void *arg, int jobnr, \
1491 WaveformContext *s = ctx->priv; \
1492 ThreadData *td = arg; \
1493 AVFrame *in = td->in; \
1494 AVFrame *out = td->out; \
1495 int component = td->component; \
1496 int offset_y = td->offset_y; \
1497 int offset_x = td->offset_x; \
1499 chroma16(s, in, out, component, s->intensity,\
1500 offset_y, offset_x, column, mirror, \
1514 int offset_y,
int offset_x,
1516 int jobnr,
int nb_jobs)
1518 const int plane =
s->desc->comp[component].plane;
1519 const int src_h =
in->height;
1520 const int src_w =
in->width;
1521 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
1522 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
1523 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
1524 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
1525 const int c0_linesize =
in->linesize[(
plane + 1) %
s->ncomp];
1526 const int c1_linesize =
in->linesize[(
plane + 2) %
s->ncomp];
1527 const int dst_linesize =
out->linesize[
plane];
1529 const int c0_shift_w =
s->shift_w[(component + 1) %
s->ncomp];
1530 const int c1_shift_w =
s->shift_w[(component + 2) %
s->ncomp];
1531 const int c0_shift_h =
s->shift_h[(component + 1) %
s->ncomp];
1532 const int c1_shift_h =
s->shift_h[(component + 2) %
s->ncomp];
1536 const int dst_signed_linesize = dst_linesize * (
mirror == 1 ? -1 : 1);
1538 for (x = slicew_start; x < slicew_end; x++) {
1541 uint8_t *dst_data =
out->data[
plane] + offset_y * dst_linesize + offset_x;
1542 uint8_t *
const dst_bottom_line = dst_data + dst_linesize * (
s->size - 1);
1543 uint8_t *
const dst_line = (
mirror ? dst_bottom_line : dst_data);
1546 for (y = 0; y < src_h; y++) {
1547 const int sum =
FFABS(c0_data[x >> c0_shift_w] - 128) +
FFABS(c1_data[x >> c1_shift_w] - 127);
1550 target = dst + x + dst_signed_linesize * sum;
1553 if (!c0_shift_h || (y & c0_shift_h))
1554 c0_data += c0_linesize;
1555 if (!c1_shift_h || (y & c1_shift_h))
1556 c1_data += c1_linesize;
1557 dst_data += dst_linesize;
1561 const uint8_t *c0_data =
in->data[(
plane + 1) %
s->ncomp] + (sliceh_start >> c0_shift_h) * c0_linesize;
1562 const uint8_t *c1_data =
in->data[(
plane + 2) %
s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize;
1563 uint8_t *dst_data =
out->data[
plane] + (offset_y + sliceh_start) * dst_linesize + offset_x;
1566 dst_data +=
s->size - 1;
1567 for (y = sliceh_start; y < sliceh_end; y++) {
1568 for (x = 0; x < src_w; x++) {
1569 const int sum =
FFABS(c0_data[x >> c0_shift_w] - 128) +
FFABS(c1_data[x >> c1_shift_w] - 127);
1573 target = dst_data - sum;
1576 target = dst_data + sum;
1581 if (!c0_shift_h || (y & c0_shift_h))
1582 c0_data += c0_linesize;
1583 if (!c1_shift_h || (y & c1_shift_h))
1584 c1_data += c1_linesize;
1585 dst_data += dst_linesize;
1590 #define CHROMA_FUNC(name, column, mirror) \
1591 static int chroma_##name(AVFilterContext *ctx, \
1592 void *arg, int jobnr, \
1595 WaveformContext *s = ctx->priv; \
1596 ThreadData *td = arg; \
1597 AVFrame *in = td->in; \
1598 AVFrame *out = td->out; \
1599 int component = td->component; \
1600 int offset_y = td->offset_y; \
1601 int offset_x = td->offset_x; \
1603 chroma(s, in, out, component, s->intensity, \
1604 offset_y, offset_x, column, mirror, \
1618 int offset_y,
int offset_x,
1620 int jobnr,
int nb_jobs)
1622 const int plane =
s->desc->comp[component].plane;
1623 const int limit =
s->max - 1;
1624 const int src_h =
in->height;
1625 const int src_w =
in->width;
1626 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
1627 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
1628 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
1629 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
1630 const int c0_linesize =
in->linesize[
plane + 0 ] / 2;
1631 const int c1_linesize =
in->linesize[(
plane + 1) %
s->ncomp] / 2;
1632 const int c2_linesize =
in->linesize[(
plane + 2) %
s->ncomp] / 2;
1633 const int c0_shift_h =
s->shift_h[ component + 0 ];
1634 const int c1_shift_h =
s->shift_h[(component + 1) %
s->ncomp];
1635 const int c2_shift_h =
s->shift_h[(component + 2) %
s->ncomp];
1636 const uint16_t *c0_data = (
const uint16_t *)
in->data[
plane + 0] + (sliceh_start >> c0_shift_h) * c0_linesize;
1637 const uint16_t *c1_data = (
const uint16_t *)
in->data[(
plane + 1) %
s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize;
1638 const uint16_t *c2_data = (
const uint16_t *)
in->data[(
plane + 2) %
s->ncomp] + (sliceh_start >> c2_shift_h) * c2_linesize;
1639 const int d0_linesize =
out->linesize[
plane + 0 ] / 2;
1640 const int d1_linesize =
out->linesize[(
plane + 1) %
s->ncomp] / 2;
1641 const int d2_linesize =
out->linesize[(
plane + 2) %
s->ncomp] / 2;
1642 const int c0_shift_w =
s->shift_w[ component + 0 ];
1643 const int c1_shift_w =
s->shift_w[(component + 1) %
s->ncomp];
1644 const int c2_shift_w =
s->shift_w[(component + 2) %
s->ncomp];
1648 const int d0_signed_linesize = d0_linesize * (
mirror == 1 ? -1 : 1);
1649 const int d1_signed_linesize = d1_linesize * (
mirror == 1 ? -1 : 1);
1650 const int d2_signed_linesize = d2_linesize * (
mirror == 1 ? -1 : 1);
1651 uint16_t *d0_data = (uint16_t *)
out->data[
plane] + offset_y * d0_linesize + offset_x;
1652 uint16_t *d1_data = (uint16_t *)
out->data[(
plane + 1) %
s->ncomp] + offset_y * d1_linesize + offset_x;
1653 uint16_t *d2_data = (uint16_t *)
out->data[(
plane + 2) %
s->ncomp] + offset_y * d2_linesize + offset_x;
1654 uint16_t *
const d0_bottom_line = d0_data + d0_linesize * (
s->size - 1);
1655 uint16_t *
const d0 = (
mirror ? d0_bottom_line : d0_data);
1656 uint16_t *
const d1_bottom_line = d1_data + d1_linesize * (
s->size - 1);
1657 uint16_t *
const d1 = (
mirror ? d1_bottom_line : d1_data);
1658 uint16_t *
const d2_bottom_line = d2_data + d2_linesize * (
s->size - 1);
1659 uint16_t *
const d2 = (
mirror ? d2_bottom_line : d2_data);
1661 for (y = 0; y < src_h; y++) {
1662 for (x = slicew_start; x < slicew_end; x++) {
1663 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit);
1664 const int c1 = c1_data[x >> c1_shift_w];
1665 const int c2 = c2_data[x >> c2_shift_w];
1667 *(d0 + d0_signed_linesize * c0 + x) = c0;
1668 *(d1 + d1_signed_linesize * c0 + x) =
c1;
1669 *(d2 + d2_signed_linesize * c0 + x) =
c2;
1672 if (!c0_shift_h || (y & c0_shift_h))
1673 c0_data += c0_linesize;
1674 if (!c1_shift_h || (y & c1_shift_h))
1675 c1_data += c1_linesize;
1676 if (!c2_shift_h || (y & c2_shift_h))
1677 c2_data += c2_linesize;
1678 d0_data += d0_linesize;
1679 d1_data += d1_linesize;
1680 d2_data += d2_linesize;
1683 uint16_t *d0_data = (uint16_t *)
out->data[
plane] + (offset_y + sliceh_start) * d0_linesize + offset_x;
1684 uint16_t *d1_data = (uint16_t *)
out->data[(
plane + 1) %
s->ncomp] + (offset_y + sliceh_start) * d1_linesize + offset_x;
1685 uint16_t *d2_data = (uint16_t *)
out->data[(
plane + 2) %
s->ncomp] + (offset_y + sliceh_start) * d2_linesize + offset_x;
1688 d0_data +=
s->size - 1;
1689 d1_data +=
s->size - 1;
1690 d2_data +=
s->size - 1;
1693 for (y = sliceh_start; y < sliceh_end; y++) {
1694 for (x = 0; x < src_w; x++) {
1695 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit);
1696 const int c1 = c1_data[x >> c1_shift_w];
1697 const int c2 = c2_data[x >> c2_shift_w];
1700 *(d0_data - c0) = c0;
1701 *(d1_data - c0) =
c1;
1702 *(d2_data - c0) =
c2;
1704 *(d0_data + c0) = c0;
1705 *(d1_data + c0) =
c1;
1706 *(d2_data + c0) =
c2;
1710 if (!c0_shift_h || (y & c0_shift_h))
1711 c0_data += c0_linesize;
1712 if (!c1_shift_h || (y & c1_shift_h))
1713 c1_data += c1_linesize;
1714 if (!c2_shift_h || (y & c2_shift_h))
1715 c2_data += c2_linesize;
1716 d0_data += d0_linesize;
1717 d1_data += d1_linesize;
1718 d2_data += d2_linesize;
1723 #define COLOR16_FUNC(name, column, mirror) \
1724 static int color16_##name(AVFilterContext *ctx, \
1725 void *arg, int jobnr, \
1728 WaveformContext *s = ctx->priv; \
1729 ThreadData *td = arg; \
1730 AVFrame *in = td->in; \
1731 AVFrame *out = td->out; \
1732 int component = td->component; \
1733 int offset_y = td->offset_y; \
1734 int offset_x = td->offset_x; \
1736 color16(s, in, out, component, s->intensity, \
1737 offset_y, offset_x, column, mirror, \
1751 int offset_y,
int offset_x,
1753 int jobnr,
int nb_jobs)
1755 const int plane =
s->desc->comp[component].plane;
1756 const int src_h =
in->height;
1757 const int src_w =
in->width;
1758 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
1759 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
1760 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
1761 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
1762 const int c0_linesize =
in->linesize[
plane + 0 ];
1763 const int c1_linesize =
in->linesize[(
plane + 1) %
s->ncomp];
1764 const int c2_linesize =
in->linesize[(
plane + 2) %
s->ncomp];
1765 const int c0_shift_h =
s->shift_h[ component + 0 ];
1766 const int c1_shift_h =
s->shift_h[(component + 1) %
s->ncomp];
1767 const int c2_shift_h =
s->shift_h[(component + 2) %
s->ncomp];
1768 const uint8_t *c0_data =
in->data[
plane] + (sliceh_start >> c0_shift_h) * c0_linesize;
1769 const uint8_t *c1_data =
in->data[(
plane + 1) %
s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize;
1770 const uint8_t *c2_data =
in->data[(
plane + 2) %
s->ncomp] + (sliceh_start >> c2_shift_h) * c2_linesize;
1771 const int d0_linesize =
out->linesize[
plane + 0 ];
1772 const int d1_linesize =
out->linesize[(
plane + 1) %
s->ncomp];
1773 const int d2_linesize =
out->linesize[(
plane + 2) %
s->ncomp];
1774 const int c0_shift_w =
s->shift_w[ component + 0 ];
1775 const int c1_shift_w =
s->shift_w[(component + 1) %
s->ncomp];
1776 const int c2_shift_w =
s->shift_w[(component + 2) %
s->ncomp];
1780 const int d0_signed_linesize = d0_linesize * (
mirror == 1 ? -1 : 1);
1781 const int d1_signed_linesize = d1_linesize * (
mirror == 1 ? -1 : 1);
1782 const int d2_signed_linesize = d2_linesize * (
mirror == 1 ? -1 : 1);
1783 uint8_t *d0_data =
out->data[
plane] + offset_y * d0_linesize + offset_x;
1784 uint8_t *d1_data =
out->data[(
plane + 1) %
s->ncomp] + offset_y * d1_linesize + offset_x;
1785 uint8_t *d2_data =
out->data[(
plane + 2) %
s->ncomp] + offset_y * d2_linesize + offset_x;
1786 uint8_t *
const d0_bottom_line = d0_data + d0_linesize * (
s->size - 1);
1788 uint8_t *
const d1_bottom_line = d1_data + d1_linesize * (
s->size - 1);
1790 uint8_t *
const d2_bottom_line = d2_data + d2_linesize * (
s->size - 1);
1793 for (y = 0; y < src_h; y++) {
1794 for (x = slicew_start; x < slicew_end; x++) {
1795 const int c0 = c0_data[x >> c0_shift_w];
1796 const int c1 = c1_data[x >> c1_shift_w];
1797 const int c2 = c2_data[x >> c2_shift_w];
1799 *(d0 + d0_signed_linesize * c0 + x) = c0;
1800 *(d1 + d1_signed_linesize * c0 + x) =
c1;
1801 *(d2 + d2_signed_linesize * c0 + x) =
c2;
1804 if (!c0_shift_h || (y & c0_shift_h))
1805 c0_data += c0_linesize;
1806 if (!c1_shift_h || (y & c1_shift_h))
1807 c1_data += c1_linesize;
1808 if (!c2_shift_h || (y & c2_shift_h))
1809 c2_data += c2_linesize;
1810 d0_data += d0_linesize;
1811 d1_data += d1_linesize;
1812 d2_data += d2_linesize;
1815 uint8_t *d0_data =
out->data[
plane] + (offset_y + sliceh_start) * d0_linesize + offset_x;
1816 uint8_t *d1_data =
out->data[(
plane + 1) %
s->ncomp] + (offset_y + sliceh_start) * d1_linesize + offset_x;
1817 uint8_t *d2_data =
out->data[(
plane + 2) %
s->ncomp] + (offset_y + sliceh_start) * d2_linesize + offset_x;
1820 d0_data +=
s->size - 1;
1821 d1_data +=
s->size - 1;
1822 d2_data +=
s->size - 1;
1825 for (y = sliceh_start; y < sliceh_end; y++) {
1826 for (x = 0; x < src_w; x++) {
1827 const int c0 = c0_data[x >> c0_shift_w];
1828 const int c1 = c1_data[x >> c1_shift_w];
1829 const int c2 = c2_data[x >> c2_shift_w];
1832 *(d0_data - c0) = c0;
1833 *(d1_data - c0) =
c1;
1834 *(d2_data - c0) =
c2;
1836 *(d0_data + c0) = c0;
1837 *(d1_data + c0) =
c1;
1838 *(d2_data + c0) =
c2;
1842 if (!c0_shift_h || (y & c0_shift_h))
1843 c0_data += c0_linesize;
1844 if (!c1_shift_h || (y & c1_shift_h))
1845 c1_data += c1_linesize;
1846 if (!c2_shift_h || (y & c2_shift_h))
1847 c2_data += c2_linesize;
1848 d0_data += d0_linesize;
1849 d1_data += d1_linesize;
1850 d2_data += d2_linesize;
1855 #define COLOR_FUNC(name, column, mirror) \
1856 static int color_##name(AVFilterContext *ctx, \
1857 void *arg, int jobnr, \
1860 WaveformContext *s = ctx->priv; \
1861 ThreadData *td = arg; \
1862 AVFrame *in = td->in; \
1863 AVFrame *out = td->out; \
1864 int component = td->component; \
1865 int offset_y = td->offset_y; \
1866 int offset_x = td->offset_x; \
1868 color(s, in, out, component, s->intensity, \
1869 offset_y, offset_x, column, mirror, \
1883 int offset_y,
int offset_x,
1885 int jobnr,
int nb_jobs)
1887 const int plane =
s->desc->comp[component].plane;
1888 const int limit =
s->max - 1;
1890 const int src_h =
in->height;
1891 const int src_w =
in->width;
1892 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
1893 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
1894 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
1895 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
1896 const int c0_shift_h =
s->shift_h[ component + 0 ];
1897 const int c1_shift_h =
s->shift_h[(component + 1) %
s->ncomp];
1898 const int c2_shift_h =
s->shift_h[(component + 2) %
s->ncomp];
1899 const int c0_linesize =
in->linesize[
plane + 0 ] / 2;
1900 const int c1_linesize =
in->linesize[(
plane + 1) %
s->ncomp] / 2;
1901 const int c2_linesize =
in->linesize[(
plane + 2) %
s->ncomp] / 2;
1902 const uint16_t *c0_data = (
const uint16_t *)
in->data[
plane + 0] + (sliceh_start >> c0_shift_h) * c0_linesize;
1903 const uint16_t *c1_data = (
const uint16_t *)
in->data[(
plane + 1) %
s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize;
1904 const uint16_t *c2_data = (
const uint16_t *)
in->data[(
plane + 2) %
s->ncomp] + (sliceh_start >> c2_shift_h) * c2_linesize;
1905 const int d0_linesize =
out->linesize[
plane + 0 ] / 2;
1906 const int d1_linesize =
out->linesize[(
plane + 1) %
s->ncomp] / 2;
1907 const int d2_linesize =
out->linesize[(
plane + 2) %
s->ncomp] / 2;
1908 const int c0_shift_w =
s->shift_w[ component + 0 ];
1909 const int c1_shift_w =
s->shift_w[(component + 1) %
s->ncomp];
1910 const int c2_shift_w =
s->shift_w[(component + 2) %
s->ncomp];
1914 const int d0_signed_linesize = d0_linesize * (
mirror == 1 ? -1 : 1);
1915 const int d1_signed_linesize = d1_linesize * (
mirror == 1 ? -1 : 1);
1916 const int d2_signed_linesize = d2_linesize * (
mirror == 1 ? -1 : 1);
1917 uint16_t *d0_data = (uint16_t *)
out->data[
plane] + offset_y * d0_linesize + offset_x;
1918 uint16_t *d1_data = (uint16_t *)
out->data[(
plane + 1) %
s->ncomp] + offset_y * d1_linesize + offset_x;
1919 uint16_t *d2_data = (uint16_t *)
out->data[(
plane + 2) %
s->ncomp] + offset_y * d2_linesize + offset_x;
1920 uint16_t *
const d0_bottom_line = d0_data + d0_linesize * (
s->size - 1);
1921 uint16_t *
const d0 = (
mirror ? d0_bottom_line : d0_data);
1922 uint16_t *
const d1_bottom_line = d1_data + d1_linesize * (
s->size - 1);
1923 uint16_t *
const d1 = (
mirror ? d1_bottom_line : d1_data);
1924 uint16_t *
const d2_bottom_line = d2_data + d2_linesize * (
s->size - 1);
1925 uint16_t *
const d2 = (
mirror ? d2_bottom_line : d2_data);
1927 for (y = 0; y < src_h; y++) {
1928 for (x = slicew_start; x < slicew_end; x++) {
1929 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit);
1930 const int c1 = c1_data[x >> c1_shift_w];
1931 const int c2 = c2_data[x >> c2_shift_w];
1934 *(d1 + d1_signed_linesize * c0 + x) =
c1;
1935 *(d2 + d2_signed_linesize * c0 + x) =
c2;
1938 if (!c0_shift_h || (y & c0_shift_h))
1939 c0_data += c0_linesize;
1940 if (!c1_shift_h || (y & c1_shift_h))
1941 c1_data += c1_linesize;
1942 if (!c2_shift_h || (y & c2_shift_h))
1943 c2_data += c2_linesize;
1944 d0_data += d0_linesize;
1945 d1_data += d1_linesize;
1946 d2_data += d2_linesize;
1949 uint16_t *d0_data = (uint16_t *)
out->data[
plane] + (offset_y + sliceh_start) * d0_linesize + offset_x;
1950 uint16_t *d1_data = (uint16_t *)
out->data[(
plane + 1) %
s->ncomp] + (offset_y + sliceh_start) * d1_linesize + offset_x;
1951 uint16_t *d2_data = (uint16_t *)
out->data[(
plane + 2) %
s->ncomp] + (offset_y + sliceh_start) * d2_linesize + offset_x;
1954 d0_data +=
s->size - 1;
1955 d1_data +=
s->size - 1;
1956 d2_data +=
s->size - 1;
1959 for (y = sliceh_start; y < sliceh_end; y++) {
1960 for (x = 0; x < src_w; x++) {
1961 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit);
1962 const int c1 = c1_data[x >> c1_shift_w];
1963 const int c2 = c2_data[x >> c2_shift_w];
1967 *(d1_data - c0) =
c1;
1968 *(d2_data - c0) =
c2;
1971 *(d1_data + c0) =
c1;
1972 *(d2_data + c0) =
c2;
1976 if (!c0_shift_h || (y & c0_shift_h))
1977 c0_data += c0_linesize;
1978 if (!c1_shift_h || (y & c1_shift_h))
1979 c1_data += c1_linesize;
1980 if (!c2_shift_h || (y & c2_shift_h))
1981 c2_data += c2_linesize;
1982 d0_data += d0_linesize;
1983 d1_data += d1_linesize;
1984 d2_data += d2_linesize;
1989 #define ACOLOR16_FUNC(name, column, mirror) \
1990 static int acolor16_##name(AVFilterContext *ctx, \
1991 void *arg, int jobnr, \
1994 WaveformContext *s = ctx->priv; \
1995 ThreadData *td = arg; \
1996 AVFrame *in = td->in; \
1997 AVFrame *out = td->out; \
1998 int component = td->component; \
1999 int offset_y = td->offset_y; \
2000 int offset_x = td->offset_x; \
2002 acolor16(s, in, out, component, s->intensity,\
2003 offset_y, offset_x, column, mirror, \
2017 int offset_y,
int offset_x,
2019 int jobnr,
int nb_jobs)
2021 const int plane =
s->desc->comp[component].plane;
2022 const int src_h =
in->height;
2023 const int src_w =
in->width;
2024 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
2025 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
2026 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
2027 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
2028 const int c0_shift_w =
s->shift_w[ component + 0 ];
2029 const int c1_shift_w =
s->shift_w[(component + 1) %
s->ncomp];
2030 const int c2_shift_w =
s->shift_w[(component + 2) %
s->ncomp];
2031 const int c0_shift_h =
s->shift_h[ component + 0 ];
2032 const int c1_shift_h =
s->shift_h[(component + 1) %
s->ncomp];
2033 const int c2_shift_h =
s->shift_h[(component + 2) %
s->ncomp];
2034 const int c0_linesize =
in->linesize[
plane + 0 ];
2035 const int c1_linesize =
in->linesize[(
plane + 1) %
s->ncomp];
2036 const int c2_linesize =
in->linesize[(
plane + 2) %
s->ncomp];
2037 const uint8_t *c0_data =
in->data[
plane + 0] + (sliceh_start >> c0_shift_h) * c0_linesize;
2038 const uint8_t *c1_data =
in->data[(
plane + 1) %
s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize;
2039 const uint8_t *c2_data =
in->data[(
plane + 2) %
s->ncomp] + (sliceh_start >> c2_shift_h) * c2_linesize;
2040 const int d0_linesize =
out->linesize[
plane + 0 ];
2041 const int d1_linesize =
out->linesize[(
plane + 1) %
s->ncomp];
2042 const int d2_linesize =
out->linesize[(
plane + 2) %
s->ncomp];
2047 const int d0_signed_linesize = d0_linesize * (
mirror == 1 ? -1 : 1);
2048 const int d1_signed_linesize = d1_linesize * (
mirror == 1 ? -1 : 1);
2049 const int d2_signed_linesize = d2_linesize * (
mirror == 1 ? -1 : 1);
2050 uint8_t *d0_data =
out->data[
plane] + offset_y * d0_linesize + offset_x;
2051 uint8_t *d1_data =
out->data[(
plane + 1) %
s->ncomp] + offset_y * d1_linesize + offset_x;
2052 uint8_t *d2_data =
out->data[(
plane + 2) %
s->ncomp] + offset_y * d2_linesize + offset_x;
2053 uint8_t *
const d0_bottom_line = d0_data + d0_linesize * (
s->size - 1);
2055 uint8_t *
const d1_bottom_line = d1_data + d1_linesize * (
s->size - 1);
2057 uint8_t *
const d2_bottom_line = d2_data + d2_linesize * (
s->size - 1);
2060 for (y = 0; y < src_h; y++) {
2061 for (x = slicew_start; x < slicew_end; x++) {
2062 const int c0 = c0_data[x >> c0_shift_w];
2063 const int c1 = c1_data[x >> c1_shift_w];
2064 const int c2 = c2_data[x >> c2_shift_w];
2067 *(d1 + d1_signed_linesize * c0 + x) =
c1;
2068 *(d2 + d2_signed_linesize * c0 + x) =
c2;
2071 if (!c0_shift_h || (y & c0_shift_h))
2072 c0_data += c0_linesize;
2073 if (!c1_shift_h || (y & c1_shift_h))
2074 c1_data += c1_linesize;
2075 if (!c2_shift_h || (y & c2_shift_h))
2076 c2_data += c2_linesize;
2077 d0_data += d0_linesize;
2078 d1_data += d1_linesize;
2079 d2_data += d2_linesize;
2082 uint8_t *d0_data =
out->data[
plane] + (offset_y + sliceh_start) * d0_linesize + offset_x;
2083 uint8_t *d1_data =
out->data[(
plane + 1) %
s->ncomp] + (offset_y + sliceh_start) * d1_linesize + offset_x;
2084 uint8_t *d2_data =
out->data[(
plane + 2) %
s->ncomp] + (offset_y + sliceh_start) * d2_linesize + offset_x;
2087 d0_data +=
s->size - 1;
2088 d1_data +=
s->size - 1;
2089 d2_data +=
s->size - 1;
2092 for (y = sliceh_start; y < sliceh_end; y++) {
2093 for (x = 0; x < src_w; x++) {
2094 const int c0 = c0_data[x >> c0_shift_w];
2095 const int c1 = c1_data[x >> c1_shift_w];
2096 const int c2 = c2_data[x >> c2_shift_w];
2100 *(d1_data - c0) =
c1;
2101 *(d2_data - c0) =
c2;
2104 *(d1_data + c0) =
c1;
2105 *(d2_data + c0) =
c2;
2109 if (!c0_shift_h || (y & c0_shift_h))
2110 c0_data += c0_linesize;
2111 if (!c1_shift_h || (y & c1_shift_h))
2112 c1_data += c1_linesize;
2113 if (!c2_shift_h || (y & c2_shift_h))
2114 c2_data += c2_linesize;
2115 d0_data += d0_linesize;
2116 d1_data += d1_linesize;
2117 d2_data += d2_linesize;
2122 #define ACOLOR_FUNC(name, column, mirror) \
2123 static int acolor_##name(AVFilterContext *ctx, \
2124 void *arg, int jobnr, \
2127 WaveformContext *s = ctx->priv; \
2128 ThreadData *td = arg; \
2129 AVFrame *in = td->in; \
2130 AVFrame *out = td->out; \
2131 int component = td->component; \
2132 int offset_y = td->offset_y; \
2133 int offset_x = td->offset_x; \
2135 acolor(s, in, out, component, s->intensity, \
2136 offset_y, offset_x, column, mirror, \
2151 { { {
"16", 16+128 }, {
"16", 16+128 }, {
"16", 16+128 }, {
"0", 0+128 } } },
2152 { { {
"128", 128+128 }, {
"128", 128+128 }, {
"128", 128+128 }, {
"128", 128+128 } } },
2153 { { {
"235", 235+128 }, {
"240", 240+128 }, {
"240", 240+128 }, {
"255", 255+128 } } },
2157 { { {
"32", 32+256 }, {
"32", 32+256 }, {
"32", 32+256 }, {
"0", 0+256 } } },
2158 { { {
"256", 256+256 }, {
"256", 256+256 }, {
"256", 256+256 }, {
"256", 256+256 } } },
2159 { { {
"470", 470+256 }, {
"480", 480+256 }, {
"480", 480+256 }, {
"511", 511+256 } } },
2163 { { {
"64", 64+512 }, {
"64", 64+512 }, {
"64", 64+512 }, {
"0", 0+512 } } },
2164 { { {
"512", 512+512 }, {
"512", 512+512 }, {
"512", 512+512 }, {
"512", 512+512 } } },
2165 { { {
"940", 940+512 }, {
"960", 960+512 }, {
"960", 960+512 }, {
"1023", 1023+512 } } },
2169 { { {
"256", 256+2048 }, {
"256", 256+2048 }, {
"256", 256+2048 }, {
"0", 0+2048 } } },
2170 { { {
"2048", 2048+2048 }, {
"2048", 2048+2048 }, {
"2048", 2048+2048 }, {
"2048", 2048+2048 } } },
2171 { { {
"3760", 3760+2048 }, {
"3840", 3840+2048 }, {
"3840", 3840+2048 }, {
"4095", 4095+2048 } } },
2175 { { {
"0", 16+128 }, {
"0", 16+128 }, {
"0", 16+128 }, {
"0", 0+128 } } },
2176 { { {
"175", 71+128 }, {
"175", 72+128 }, {
"175", 72+128 }, {
"175", 64+128 } } },
2177 { { {
"350", 126+128 }, {
"350", 128+128 }, {
"350", 128+128 }, {
"350", 128+128 } } },
2178 { { {
"525", 180+128 }, {
"525", 184+128 }, {
"525", 184+128 }, {
"525", 192+128 } } },
2179 { { {
"700", 235+128 }, {
"700", 240+128 }, {
"700", 240+128 }, {
"700", 255+128 } } },
2183 { { {
"0", 32+256 }, {
"0", 32+256 }, {
"0", 32+256 }, {
"0", 0+256 } } },
2184 { { {
"175", 142+256 }, {
"175", 144+256 }, {
"175", 144+256 }, {
"175", 128+256 } } },
2185 { { {
"350", 251+256 }, {
"350", 256+256 }, {
"350", 256+256 }, {
"350", 256+256 } } },
2186 { { {
"525", 361+256 }, {
"525", 368+256 }, {
"525", 368+256 }, {
"525", 384+256 } } },
2187 { { {
"700", 470+256 }, {
"700", 480+256 }, {
"700", 480+256 }, {
"700", 511+256 } } },
2191 { { {
"0", 64+512 }, {
"0", 64+512 }, {
"0", 64+512 }, {
"0", 0+512 } } },
2192 { { {
"175", 283+512 }, {
"175", 288+512 }, {
"175", 288+512 }, {
"175", 256+512 } } },
2193 { { {
"350", 502+512 }, {
"350", 512+512 }, {
"350", 512+512 }, {
"350", 512+512 } } },
2194 { { {
"525", 721+512 }, {
"525", 736+512 }, {
"525", 736+512 }, {
"525", 768+512 } } },
2195 { { {
"700", 940+512 }, {
"700", 960+512 }, {
"700", 960+512 }, {
"700", 1023+512 } } },
2199 { { {
"0", 256+2048 }, {
"0", 256+2048 }, {
"0", 256+2048 }, {
"0", 0+2048 } } },
2200 { { {
"175", 1132+2048 }, {
"175", 1152+2048 }, {
"175", 1152+2048 }, {
"175", 1024+2048 } } },
2201 { { {
"350", 2008+2048 }, {
"350", 2048+2048 }, {
"350", 2048+2048 }, {
"350", 2048+2048 } } },
2202 { { {
"525", 2884+2048 }, {
"525", 2944+2048 }, {
"525", 2944+2048 }, {
"525", 3072+2048 } } },
2203 { { {
"700", 3760+2048 }, {
"700", 3840+2048 }, {
"700", 3840+2048 }, {
"700", 4095+2048 } } },
2207 { { {
"-25", -39+128 }, {
"-25", -40+128 }, {
"-25", -40+128 }, {
"-25", -64+128 } } },
2208 { { {
"0", 16+128 }, {
"0", 16+128 }, {
"0", 16+128 }, {
"0", 0+128 } } },
2209 { { {
"25", 71+128 }, {
"25", 72+128 }, {
"25", 72+128 }, {
"25", 64+128 } } },
2210 { { {
"50", 126+128 }, {
"50", 128+128 }, {
"50", 128+128 }, {
"50", 128+128 } } },
2211 { { {
"75", 180+128 }, {
"75", 184+128 }, {
"75", 184+128 }, {
"75", 192+128 } } },
2212 { { {
"100", 235+128 }, {
"100", 240+128 }, {
"100", 240+128 }, {
"100", 256+128 } } },
2213 { { {
"125", 290+128 }, {
"125", 296+128 }, {
"125", 296+128 }, {
"125", 320+128 } } },
2217 { { {
"-25", -78+256 }, {
"-25", -80+256 }, {
"-25", -80+256 }, {
"-25",-128+256 } } },
2218 { { {
"0", 32+256 }, {
"0", 32+256 }, {
"0", 32+256 }, {
"0", 0+256 } } },
2219 { { {
"25", 142+256 }, {
"25", 144+256 }, {
"25", 144+256 }, {
"25", 128+256 } } },
2220 { { {
"50", 251+256 }, {
"50", 256+256 }, {
"50", 256+256 }, {
"50", 256+256 } } },
2221 { { {
"75", 361+256 }, {
"75", 368+256 }, {
"75", 368+256 }, {
"75", 384+256 } } },
2222 { { {
"100", 470+256 }, {
"100", 480+256 }, {
"100", 480+256 }, {
"100", 512+256 } } },
2223 { { {
"125", 580+256 }, {
"125", 592+256 }, {
"125", 592+256 }, {
"125", 640+256 } } },
2227 { { {
"-25",-156+512 }, {
"-25",-160+512 }, {
"-25",-160+512 }, {
"-25", -256+512 } } },
2228 { { {
"0", 64+512 }, {
"0", 64+512 }, {
"0", 64+512 }, {
"0", 0+512 } } },
2229 { { {
"25", 283+512 }, {
"25", 288+512 }, {
"25", 288+512 }, {
"25", 256+512 } } },
2230 { { {
"50", 502+512 }, {
"50", 512+512 }, {
"50", 512+512 }, {
"50", 512+512 } } },
2231 { { {
"75", 721+512 }, {
"75", 736+512 }, {
"75", 736+512 }, {
"75", 768+512 } } },
2232 { { {
"100", 940+512 }, {
"100", 960+512 }, {
"100", 960+512 }, {
"100", 1024+512 } } },
2233 { { {
"125",1160+512 }, {
"125",1184+512 }, {
"125",1184+512 }, {
"125", 1280+512 } } },
2237 { { {
"-25", -624+2048 }, {
"-25", -640+2048 }, {
"-25", -640+2048 }, {
"-25",-1024+2048 } } },
2238 { { {
"0", 256+2048 }, {
"0", 256+2048 }, {
"0", 256+2048 }, {
"0", 0+2048 } } },
2239 { { {
"25", 1132+2048 }, {
"25", 1152+2048 }, {
"25", 1152+2048 }, {
"25", 1024+2048 } } },
2240 { { {
"50", 2008+2048 }, {
"50", 2048+2048 }, {
"50", 2048+2048 }, {
"50", 2048+2048 } } },
2241 { { {
"75", 2884+2048 }, {
"75", 2944+2048 }, {
"75", 2944+2048 }, {
"75", 3072+2048 } } },
2242 { { {
"100", 3760+2048 }, {
"100", 3840+2048 }, {
"100", 3840+2048 }, {
"100", 4096+2048 } } },
2243 { { {
"125", 4640+2048 }, {
"125", 4736+2048 }, {
"125", 4736+2048 }, {
"125", 5120+2048 } } },
2247 { { {
"16", 16+256 }, {
"16", 16+256 }, {
"16", 16+256 }, {
"0", 0+256 } } },
2248 { { {
"128", 128+256 }, {
"128", 128+256 }, {
"128", 128+256 }, {
"128", 128+256 } } },
2249 { { {
"235", 235+256 }, {
"240", 240+256 }, {
"240", 240+256 }, {
"255", 255+256 } } },
2253 { { {
"32", 32+512 }, {
"32", 32+512 }, {
"32", 32+512 }, {
"0", 0+512 } } },
2254 { { {
"256", 256+512 }, {
"256", 256+512 }, {
"256", 256+512 }, {
"256", 256+512 } } },
2255 { { {
"470", 470+512 }, {
"480", 480+512 }, {
"480", 480+512 }, {
"511", 511+512 } } },
2259 { { {
"64", 64+1024 }, {
"64", 64+1024 }, {
"64", 64+1024 }, {
"0", 0+1024 } } },
2260 { { {
"512", 512+1024 }, {
"512", 512+1024 }, {
"512", 512+1024 }, {
"512", 512+1024 } } },
2261 { { {
"940", 940+1024 }, {
"960", 960+1024 }, {
"960", 960+1024 }, {
"1023", 1023+1024 } } },
2265 { { {
"256", 256+4096 }, {
"256", 256+4096 }, {
"256", 256+4096 }, {
"0", 0+4096 } } },
2266 { { {
"2048", 2048+4096 }, {
"2048", 2048+4096 }, {
"2048", 2048+4096 }, {
"2048", 2048+4096 } } },
2267 { { {
"3760", 3760+4096 }, {
"3840", 3840+4096 }, {
"3840", 3840+4096 }, {
"4095", 4095+4096 } } },
2271 { { {
"0", 16+256 }, {
"0", 16+256 }, {
"0", 16+256 }, {
"0", 0+256 } } },
2272 { { {
"175", 71+256 }, {
"175", 72+256 }, {
"175", 72+256 }, {
"175", 64+256 } } },
2273 { { {
"350", 126+256 }, {
"350", 128+256 }, {
"350", 128+256 }, {
"350", 128+256 } } },
2274 { { {
"525", 180+256 }, {
"525", 184+256 }, {
"525", 184+256 }, {
"525", 192+256 } } },
2275 { { {
"700", 235+256 }, {
"700", 240+256 }, {
"700", 240+256 }, {
"700", 255+256 } } },
2279 { { {
"0", 32+512 }, {
"0", 32+512 }, {
"0", 32+512 }, {
"0", 0+512 } } },
2280 { { {
"175", 142+512 }, {
"175", 144+512 }, {
"175", 144+512 }, {
"175", 128+512 } } },
2281 { { {
"350", 251+512 }, {
"350", 256+512 }, {
"350", 256+512 }, {
"350", 256+512 } } },
2282 { { {
"525", 361+512 }, {
"525", 368+512 }, {
"525", 368+512 }, {
"525", 384+512 } } },
2283 { { {
"700", 470+512 }, {
"700", 480+512 }, {
"700", 480+512 }, {
"700", 511+512 } } },
2287 { { {
"0", 64+1024 }, {
"0", 64+1024 }, {
"0", 64+1024 }, {
"0", 0+1024 } } },
2288 { { {
"175", 283+1024 }, {
"175", 288+1024 }, {
"175", 288+1024 }, {
"175", 256+1024 } } },
2289 { { {
"350", 502+1024 }, {
"350", 512+1024 }, {
"350", 512+1024 }, {
"350", 512+1024 } } },
2290 { { {
"525", 721+1024 }, {
"525", 736+1024 }, {
"525", 736+1024 }, {
"525", 768+1024 } } },
2291 { { {
"700", 940+1024 }, {
"700", 960+1024 }, {
"700", 960+1024 }, {
"700", 1023+1024 } } },
2295 { { {
"0", 256+4096 }, {
"0", 256+4096 }, {
"0", 256+4096 }, {
"0", 0+4096 } } },
2296 { { {
"175", 1132+4096 }, {
"175", 1152+4096 }, {
"175", 1152+4096 }, {
"175", 1024+4096 } } },
2297 { { {
"350", 2008+4096 }, {
"350", 2048+4096 }, {
"350", 2048+4096 }, {
"350", 2048+4096 } } },
2298 { { {
"525", 2884+4096 }, {
"525", 2944+4096 }, {
"525", 2944+4096 }, {
"525", 3072+4096 } } },
2299 { { {
"700", 3760+4096 }, {
"700", 3840+4096 }, {
"700", 3840+4096 }, {
"700", 4095+4096 } } },
2303 { { {
"-25", -39+256 }, {
"-25", -40+256 }, {
"-25", -40+256 }, {
"-25", -64+256 } } },
2304 { { {
"0", 16+256 }, {
"0", 16+256 }, {
"0", 16+256 }, {
"0", 0+256 } } },
2305 { { {
"25", 71+256 }, {
"25", 72+256 }, {
"25", 72+256 }, {
"25", 64+256 } } },
2306 { { {
"50", 126+256 }, {
"50", 128+256 }, {
"50", 128+256 }, {
"50", 128+256 } } },
2307 { { {
"75", 180+256 }, {
"75", 184+256 }, {
"75", 184+256 }, {
"75", 192+256 } } },
2308 { { {
"100", 235+256 }, {
"100", 240+256 }, {
"100", 240+256 }, {
"100", 256+256 } } },
2309 { { {
"125", 290+256 }, {
"125", 296+256 }, {
"125", 296+256 }, {
"125", 320+256 } } },
2313 { { {
"-25", -78+512 }, {
"-25", -80+512 }, {
"-25", -80+512 }, {
"-25",-128+512 } } },
2314 { { {
"0", 32+512 }, {
"0", 32+512 }, {
"0", 32+512 }, {
"0", 0+512 } } },
2315 { { {
"25", 142+512 }, {
"25", 144+512 }, {
"25", 144+512 }, {
"25", 128+512 } } },
2316 { { {
"50", 251+512 }, {
"50", 256+512 }, {
"50", 256+512 }, {
"50", 256+512 } } },
2317 { { {
"75", 361+512 }, {
"75", 368+512 }, {
"75", 368+512 }, {
"75", 384+512 } } },
2318 { { {
"100", 470+512 }, {
"100", 480+512 }, {
"100", 480+512 }, {
"100", 512+512 } } },
2319 { { {
"125", 580+512 }, {
"125", 592+512 }, {
"125", 592+512 }, {
"125", 640+512 } } },
2323 { { {
"-25",-156+1024 }, {
"-25",-160+1024 }, {
"-25",-160+1024 }, {
"-25", -256+1024 } } },
2324 { { {
"0", 64+1024 }, {
"0", 64+1024 }, {
"0", 64+1024 }, {
"0", 0+1024 } } },
2325 { { {
"25", 283+1024 }, {
"25", 288+1024 }, {
"25", 288+1024 }, {
"25", 256+1024 } } },
2326 { { {
"50", 502+1024 }, {
"50", 512+1024 }, {
"50", 512+1024 }, {
"50", 512+1024 } } },
2327 { { {
"75", 721+1024 }, {
"75", 736+1024 }, {
"75", 736+1024 }, {
"75", 768+1024 } } },
2328 { { {
"100", 940+1024 }, {
"100", 960+1024 }, {
"100", 960+1024 }, {
"100", 1024+1024 } } },
2329 { { {
"125",1160+1024 }, {
"125",1184+1024 }, {
"125",1184+1024 }, {
"125", 1280+1024 } } },
2333 { { {
"-25", -624+4096 }, {
"-25", -640+4096 }, {
"-25", -640+4096 }, {
"-25",-1024+4096 } } },
2334 { { {
"0", 256+4096 }, {
"0", 256+4096 }, {
"0", 256+4096 }, {
"0", 0+4096 } } },
2335 { { {
"25", 1132+4096 }, {
"25", 1152+4096 }, {
"25", 1152+4096 }, {
"25", 1024+4096 } } },
2336 { { {
"50", 2008+4096 }, {
"50", 2048+4096 }, {
"50", 2048+4096 }, {
"50", 2048+4096 } } },
2337 { { {
"75", 2884+4096 }, {
"75", 2944+4096 }, {
"75", 2944+4096 }, {
"75", 3072+4096 } } },
2338 { { {
"100", 3760+4096 }, {
"100", 3840+4096 }, {
"100", 3840+4096 }, {
"100", 4096+4096 } } },
2339 { { {
"125", 4640+4096 }, {
"125", 4736+4096 }, {
"125", 4736+4096 }, {
"125", 5120+4096 } } },
2343 { { {
"16", 16 }, {
"16", 16 }, {
"16", 16 }, {
"0", 0 } } },
2344 { { {
"128", 128 }, {
"128", 128 }, {
"128", 128 }, {
"128", 128 } } },
2345 { { {
"235", 235 }, {
"240", 240 }, {
"240", 240 }, {
"255", 255 } } },
2349 { { {
"32", 32 }, {
"32", 32 }, {
"32", 32 }, {
"0", 0 } } },
2350 { { {
"256", 256 }, {
"256", 256 }, {
"256", 256 }, {
"256", 256 } } },
2351 { { {
"470", 470 }, {
"480", 480 }, {
"480", 480 }, {
"511", 511 } } },
2355 { { {
"64", 64 }, {
"64", 64 }, {
"64", 64 }, {
"0", 0 } } },
2356 { { {
"512", 512 }, {
"512", 512 }, {
"512", 512 }, {
"512", 512 } } },
2357 { { {
"940", 940 }, {
"960", 960 }, {
"960", 960 }, {
"1023", 1023 } } },
2361 { { {
"256", 256 }, {
"256", 256 }, {
"256", 256 }, {
"0", 0 } } },
2362 { { {
"2048", 2048 }, {
"2048", 2048 }, {
"2048", 2048 }, {
"2048", 2048 } } },
2363 { { {
"3760", 3760 }, {
"3840", 3840 }, {
"3840", 3840 }, {
"4095", 4095 } } },
2367 { { {
"0", 16 }, {
"0", 16 }, {
"0", 16 }, {
"0", 0 } } },
2368 { { {
"175", 71 }, {
"175", 72 }, {
"175", 72 }, {
"175", 64 } } },
2369 { { {
"350", 126 }, {
"350", 128 }, {
"350", 128 }, {
"350", 128 } } },
2370 { { {
"525", 180 }, {
"525", 184 }, {
"525", 184 }, {
"525", 192 } } },
2371 { { {
"700", 235 }, {
"700", 240 }, {
"700", 240 }, {
"700", 255 } } },
2375 { { {
"0", 32 }, {
"0", 32 }, {
"0", 32 }, {
"0", 0 } } },
2376 { { {
"175", 142 }, {
"175", 144 }, {
"175", 144 }, {
"175", 128 } } },
2377 { { {
"350", 251 }, {
"350", 256 }, {
"350", 256 }, {
"350", 256 } } },
2378 { { {
"525", 361 }, {
"525", 368 }, {
"525", 368 }, {
"525", 384 } } },
2379 { { {
"700", 470 }, {
"700", 480 }, {
"700", 480 }, {
"700", 511 } } },
2383 { { {
"0", 64 }, {
"0", 64 }, {
"0", 64 }, {
"0", 0 } } },
2384 { { {
"175", 283 }, {
"175", 288 }, {
"175", 288 }, {
"175", 256 } } },
2385 { { {
"350", 502 }, {
"350", 512 }, {
"350", 512 }, {
"350", 512 } } },
2386 { { {
"525", 721 }, {
"525", 736 }, {
"525", 736 }, {
"525", 768 } } },
2387 { { {
"700", 940 }, {
"700", 960 }, {
"700", 960 }, {
"700", 1023 } } },
2391 { { {
"0", 256 }, {
"0", 256 }, {
"0", 256 }, {
"0", 0 } } },
2392 { { {
"175", 1132 }, {
"175", 1152 }, {
"175", 1152 }, {
"175", 1024 } } },
2393 { { {
"350", 2008 }, {
"350", 2048 }, {
"350", 2048 }, {
"350", 2048 } } },
2394 { { {
"525", 2884 }, {
"525", 2944 }, {
"525", 2944 }, {
"525", 3072 } } },
2395 { { {
"700", 3760 }, {
"700", 3840 }, {
"700", 3840 }, {
"700", 4095 } } },
2399 { { {
"0", 16 }, {
"0", 16 }, {
"0", 16 }, {
"0", 0 } } },
2400 { { {
"25", 71 }, {
"25", 72 }, {
"25", 72 }, {
"25", 64 } } },
2401 { { {
"50", 126 }, {
"50", 128 }, {
"50", 128 }, {
"50", 128 } } },
2402 { { {
"75", 180 }, {
"75", 184 }, {
"75", 184 }, {
"75", 192 } } },
2403 { { {
"100", 235 }, {
"100", 240 }, {
"100", 240 }, {
"100", 255 } } },
2407 { { {
"0", 32 }, {
"0", 32 }, {
"0", 32 }, {
"0", 0 } } },
2408 { { {
"25", 142 }, {
"25", 144 }, {
"25", 144 }, {
"25", 128 } } },
2409 { { {
"50", 251 }, {
"50", 256 }, {
"50", 256 }, {
"50", 256 } } },
2410 { { {
"75", 361 }, {
"75", 368 }, {
"75", 368 }, {
"75", 384 } } },
2411 { { {
"100", 470 }, {
"100", 480 }, {
"100", 480 }, {
"100", 511 } } },
2415 { { {
"0", 64 }, {
"0", 64 }, {
"0", 64 }, {
"0", 0 } } },
2416 { { {
"25", 283 }, {
"25", 288 }, {
"25", 288 }, {
"25", 256 } } },
2417 { { {
"50", 502 }, {
"50", 512 }, {
"50", 512 }, {
"50", 512 } } },
2418 { { {
"75", 721 }, {
"75", 736 }, {
"75", 736 }, {
"75", 768 } } },
2419 { { {
"100", 940 }, {
"100", 960 }, {
"100", 960 }, {
"100", 1023 } } },
2423 { { {
"0", 256 }, {
"0", 256 }, {
"0", 256 }, {
"0", 0 } } },
2424 { { {
"25", 1132 }, {
"25", 1152 }, {
"25", 1152 }, {
"25", 1024 } } },
2425 { { {
"50", 2008 }, {
"50", 2048 }, {
"50", 2048 }, {
"50", 2048 } } },
2426 { { {
"75", 2884 }, {
"75", 2944 }, {
"75", 2944 }, {
"75", 3072 } } },
2427 { { {
"100", 3760 }, {
"100", 3840 }, {
"100", 3840 }, {
"100", 4095 } } },
2431 { { {
"50", 50 }, {
"50", 50 }, {
"50", 50 }, {
"50", 50 } } },
2432 { { {
"100", 100 }, {
"100", 100 }, {
"100", 100 }, {
"100", 100 } } },
2433 { { {
"150", 150 }, {
"150", 150 }, {
"150", 150 }, {
"150", 150 } } },
2434 { { {
"200", 200 }, {
"200", 200 }, {
"200", 200 }, {
"200", 200 } } },
2435 { { {
"255", 255 }, {
"255", 255 }, {
"255", 255 }, {
"255", 255 } } },
2439 { { {
"100", 100 }, {
"100", 100 }, {
"100", 100 }, {
"100", 100 } } },
2440 { { {
"200", 200 }, {
"200", 200 }, {
"200", 200 }, {
"200", 200 } } },
2441 { { {
"300", 300 }, {
"300", 300 }, {
"300", 300 }, {
"300", 300 } } },
2442 { { {
"400", 400 }, {
"400", 400 }, {
"400", 400 }, {
"400", 400 } } },
2443 { { {
"500", 500 }, {
"500", 500 }, {
"500", 500 }, {
"500", 500 } } },
2447 { { {
"200", 200 }, {
"200", 200 }, {
"200", 200 }, {
"200", 200 } } },
2448 { { {
"400", 400 }, {
"400", 400 }, {
"400", 400 }, {
"400", 400 } } },
2449 { { {
"600", 600 }, {
"600", 600 }, {
"600", 600 }, {
"600", 600 } } },
2450 { { {
"800", 800 }, {
"800", 800 }, {
"800", 800 }, {
"800", 800 } } },
2451 { { {
"1000",1000 }, {
"1000",1000 }, {
"1000",1000 }, {
"1000",1000 } } },
2455 { { {
"800", 800 }, {
"800", 800 }, {
"800", 800 }, {
"800", 800 } } },
2456 { { {
"1600", 1600 }, {
"1600", 1600 }, {
"1600", 1600 }, {
"1600", 1600 } } },
2457 { { {
"2400", 2400 }, {
"2400", 2400 }, {
"2400", 2400 }, {
"2400", 2400 } } },
2458 { { {
"3200", 3200 }, {
"3200", 3200 }, {
"3200", 3200 }, {
"3200", 3200 } } },
2459 { { {
"4000", 4000 }, {
"4000", 4000 }, {
"4000", 4000 }, {
"4000", 4000 } } },
2467 dst[0] = v * o1 + dst[0] * o2;
2469 dst += linesize *
step;
2478 dst[0] = v * o1 + dst[0] * o2;
2480 dst += (linesize / 2) *
step;
2489 dst[x] = v * o1 + dst[x] * o2;
2498 dst[x] = v * o1 + dst[x] * o2;
2511 for (
i = 0; txt[
i];
i++) {
2516 for (char_y = 0; char_y < font_height; char_y++) {
2518 if (font[txt[
i] * font_height + char_y] &
mask)
2519 p[0] = p[0] * o2 + v * o1;
2537 for (
i = 0; txt[
i];
i++) {
2541 uint16_t *p = (uint16_t *)(
out->data[
plane] + y *
out->linesize[
plane]) + (x +
i * 8);
2542 for (char_y = 0; char_y < font_height; char_y++) {
2544 if (font[txt[
i] * font_height + char_y] &
mask)
2545 p[0] = p[0] * o2 + v * o1;
2563 for (
i = 0; txt[
i];
i++) {
2567 for (char_y = font_height - 1; char_y >= 0; char_y--) {
2570 if (font[txt[
i] * font_height + font_height - 1 - char_y] &
mask)
2571 p[char_y] = p[char_y] * o2 + v * o1;
2588 for (
i = 0; txt[
i];
i++) {
2592 for (char_y = 0; char_y < font_height; char_y++) {
2593 uint16_t *p = (uint16_t *)(
out->data[
plane] + (y +
i * 10) *
out->linesize[
plane]) + x;
2595 if (font[txt[
i] * font_height + font_height - 1 - char_y] &
mask)
2596 p[char_y] = p[char_y] * o2 + v * o1;
2610 const int step = (
s->flags & 2) + 1;
2611 const float o1 =
s->opacity;
2612 const float o2 = 1. - o1;
2614 int C, k = 0,
c, p, l, offset_x = 0, offset_y = 0;
2616 for (
c = 0;
c <
s->ncomp;
c++) {
2617 if (!((1 <<
c) &
s->pcomp) || (!
s->display && k > 0))
2622 for (p = 0; p <
s->ncomp; p++) {
2623 const int v =
s->grat_yuva_color[p];
2624 for (l = 0; l <
s->nb_glines; l++) {
2625 const uint16_t pos =
s->glines[l].line[
C].pos;
2626 int x = offset_x + (
s->mirror ?
s->size - 1 - pos : pos);
2627 uint8_t *dst =
out->data[p] + offset_y *
out->linesize[p] + x;
2633 for (l = 0; l <
s->nb_glines && (
s->flags & 1); l++) {
2634 const char *
name =
s->glines[l].line[
C].name;
2635 const uint16_t pos =
s->glines[l].line[
C].pos;
2636 int x = offset_x + (
s->mirror ?
s->size - 1 - pos : pos) - 10;
2644 offset_x +=
s->size * (
s->display ==
STACK);
2651 const int step = (
s->flags & 2) + 1;
2652 const float o1 =
s->opacity;
2653 const float o2 = 1. - o1;
2654 const int mult =
s->max / 256;
2656 int C, k = 0,
c, p, l, offset_x = 0, offset_y = 0;
2658 for (
c = 0;
c <
s->ncomp;
c++) {
2659 if (!((1 <<
c) &
s->pcomp) || (!
s->display && k > 0))
2664 for (p = 0; p <
s->ncomp; p++) {
2665 const int v =
s->grat_yuva_color[p] *
mult;
2666 for (l = 0; l <
s->nb_glines ; l++) {
2667 const uint16_t pos =
s->glines[l].line[
C].pos;
2668 int x = offset_x + (
s->mirror ?
s->size - 1 - pos : pos);
2669 uint16_t *dst = (uint16_t *)(
out->data[p] + offset_y *
out->linesize[p]) + x;
2675 for (l = 0; l <
s->nb_glines && (
s->flags & 1); l++) {
2676 const char *
name =
s->glines[l].line[
C].name;
2677 const uint16_t pos =
s->glines[l].line[
C].pos;
2678 int x = offset_x + (
s->mirror ?
s->size - 1 - pos : pos) - 10;
2686 offset_x +=
s->size * (
s->display ==
STACK);
2693 const int step = (
s->flags & 2) + 1;
2694 const float o1 =
s->opacity;
2695 const float o2 = 1. - o1;
2697 int C, k = 0,
c, p, l, offset_y = 0, offset_x = 0;
2699 for (
c = 0;
c <
s->ncomp;
c++) {
2700 if ((!((1 <<
c) &
s->pcomp) || (!
s->display && k > 0)))
2705 for (p = 0; p <
s->ncomp; p++) {
2706 const int v =
s->grat_yuva_color[p];
2707 for (l = 0; l <
s->nb_glines ; l++) {
2708 const uint16_t pos =
s->glines[l].line[
C].pos;
2709 int y = offset_y + (
s->mirror ?
s->size - 1 - pos : pos);
2710 uint8_t *dst =
out->data[p] + y *
out->linesize[p] + offset_x;
2716 for (l = 0; l <
s->nb_glines && (
s->flags & 1); l++) {
2717 const char *
name =
s->glines[l].line[
C].name;
2718 const uint16_t pos =
s->glines[l].line[
C].pos;
2719 int y = offset_y + (
s->mirror ?
s->size - 1 - pos : pos) - 10;
2727 offset_y +=
s->size * (
s->display ==
STACK);
2734 const int step = (
s->flags & 2) + 1;
2735 const float o1 =
s->opacity;
2736 const float o2 = 1. - o1;
2737 const int mult =
s->max / 256;
2739 int C, k = 0,
c, p, l, offset_x = 0, offset_y = 0;
2741 for (
c = 0;
c <
s->ncomp;
c++) {
2742 if ((!((1 <<
c) &
s->pcomp) || (!
s->display && k > 0)))
2747 for (p = 0; p <
s->ncomp; p++) {
2748 const int v =
s->grat_yuva_color[p] *
mult;
2749 for (l = 0; l <
s->nb_glines ; l++) {
2750 const uint16_t pos =
s->glines[l].line[
C].pos;
2751 int y = offset_y + (
s->mirror ?
s->size - 1 - pos : pos);
2752 uint16_t *dst = (uint16_t *)(
out->data[p] + y *
out->linesize[p]) + offset_x;
2758 for (l = 0; l <
s->nb_glines && (
s->flags & 1); l++) {
2759 const char *
name =
s->glines[l].line[
C].name;
2760 const uint16_t pos =
s->glines[l].line[
C].pos;
2761 int y = offset_y + (
s->mirror ?
s->size - 1 - pos: pos) - 10;
2769 offset_y +=
s->size * (
s->display ==
STACK);
2780 s->ncomp =
s->desc->nb_components;
2781 s->bits =
s->desc->comp[0].depth;
2782 s->max = 1 <<
s->bits;
2783 s->intensity =
s->fintensity * (
s->max - 1);
2785 s->shift_w[0] =
s->shift_w[3] = 0;
2786 s->shift_h[0] =
s->shift_h[3] = 0;
2787 s->shift_w[1] =
s->shift_w[2] =
s->desc->log2_chroma_w;
2788 s->shift_h[1] =
s->shift_h[2] =
s->desc->log2_chroma_h;
2792 switch (
s->filter) {
2794 case AFLAT:
s->size = 256 * 2;
break;
2795 case FLAT:
s->size = 256 * 3;
break;
2796 default:
s->size = 256;
break;
2799 switch (
s->filter | ((
s->bits > 8) << 4) |
2800 (
s->mode << 8) | (
s->mirror << 12)) {
2801 case 0x1100:
s->waveform_slice = lowpass_column_mirror;
break;
2802 case 0x1000:
s->waveform_slice = lowpass_row_mirror;
break;
2803 case 0x0100:
s->waveform_slice = lowpass_column;
break;
2804 case 0x0000:
s->waveform_slice = lowpass_row;
break;
2805 case 0x1110:
s->waveform_slice = lowpass16_column_mirror;
break;
2806 case 0x1010:
s->waveform_slice = lowpass16_row_mirror;
break;
2807 case 0x0110:
s->waveform_slice = lowpass16_column;
break;
2808 case 0x0010:
s->waveform_slice = lowpass16_row;
break;
2809 case 0x1101:
s->waveform_slice = flat_column_mirror;
break;
2810 case 0x1001:
s->waveform_slice = flat_row_mirror;
break;
2811 case 0x0101:
s->waveform_slice = flat_column;
break;
2812 case 0x0001:
s->waveform_slice = flat_row;
break;
2813 case 0x1111:
s->waveform_slice = flat16_column_mirror;
break;
2814 case 0x1011:
s->waveform_slice = flat16_row_mirror;
break;
2815 case 0x0111:
s->waveform_slice = flat16_column;
break;
2816 case 0x0011:
s->waveform_slice = flat16_row;
break;
2817 case 0x1102:
s->waveform_slice = aflat_column_mirror;
break;
2818 case 0x1002:
s->waveform_slice = aflat_row_mirror;
break;
2819 case 0x0102:
s->waveform_slice = aflat_column;
break;
2820 case 0x0002:
s->waveform_slice = aflat_row;
break;
2821 case 0x1112:
s->waveform_slice = aflat16_column_mirror;
break;
2822 case 0x1012:
s->waveform_slice = aflat16_row_mirror;
break;
2823 case 0x0112:
s->waveform_slice = aflat16_column;
break;
2824 case 0x0012:
s->waveform_slice = aflat16_row;
break;
2825 case 0x1103:
s->waveform_slice = chroma_column_mirror;
break;
2826 case 0x1003:
s->waveform_slice = chroma_row_mirror;
break;
2827 case 0x0103:
s->waveform_slice = chroma_column;
break;
2828 case 0x0003:
s->waveform_slice = chroma_row;
break;
2829 case 0x1113:
s->waveform_slice = chroma16_column_mirror;
break;
2830 case 0x1013:
s->waveform_slice = chroma16_row_mirror;
break;
2831 case 0x0113:
s->waveform_slice = chroma16_column;
break;
2832 case 0x0013:
s->waveform_slice = chroma16_row;
break;
2833 case 0x1104:
s->waveform_slice = color_column_mirror;
break;
2834 case 0x1004:
s->waveform_slice = color_row_mirror;
break;
2835 case 0x0104:
s->waveform_slice = color_column;
break;
2836 case 0x0004:
s->waveform_slice = color_row;
break;
2837 case 0x1114:
s->waveform_slice = color16_column_mirror;
break;
2838 case 0x1014:
s->waveform_slice = color16_row_mirror;
break;
2839 case 0x0114:
s->waveform_slice = color16_column;
break;
2840 case 0x0014:
s->waveform_slice = color16_row;
break;
2841 case 0x1105:
s->waveform_slice = acolor_column_mirror;
break;
2842 case 0x1005:
s->waveform_slice = acolor_row_mirror;
break;
2843 case 0x0105:
s->waveform_slice = acolor_column;
break;
2844 case 0x0005:
s->waveform_slice = acolor_row;
break;
2845 case 0x1115:
s->waveform_slice = acolor16_column_mirror;
break;
2846 case 0x1015:
s->waveform_slice = acolor16_row_mirror;
break;
2847 case 0x0115:
s->waveform_slice = acolor16_column;
break;
2848 case 0x0015:
s->waveform_slice = acolor16_row;
break;
2849 case 0x1106:
s->waveform_slice = xflat_column_mirror;
break;
2850 case 0x1006:
s->waveform_slice = xflat_row_mirror;
break;
2851 case 0x0106:
s->waveform_slice = xflat_column;
break;
2852 case 0x0006:
s->waveform_slice = xflat_row;
break;
2853 case 0x1116:
s->waveform_slice = xflat16_column_mirror;
break;
2854 case 0x1016:
s->waveform_slice = xflat16_row_mirror;
break;
2855 case 0x0116:
s->waveform_slice = xflat16_column;
break;
2856 case 0x0016:
s->waveform_slice = xflat16_row;
break;
2859 s->grat_yuva_color[0] = 255;
2860 s->grat_yuva_color[2] =
s->graticule == 2 ? 255 : 0;
2861 s->grat_yuva_color[3] = 255;
2863 switch (
s->filter) {
2871 if (
s->graticule &&
s->mode == 1)
2873 else if (
s->graticule &&
s->mode == 0)
2878 switch (
s->filter) {
2996 s->size =
s->size << (
s->bits - 8);
2998 switch (
inlink->format) {
3011 s->bg_color[3] *=
s->bgopacity;
3023 for (
i = 0;
i <
s->ncomp;
i++) {
3024 if ((1 <<
i) &
s->pcomp)
3032 s->dcomp =
s->odesc->nb_components;
3050 for (p = 0; p <
s->ncomp; p++) {
3051 const int plane =
s->desc->comp[p].plane;
3054 if (!((1 << p) &
s->pcomp))
3057 for (k = 0; k < 4; k++) {
3066 for (k = 0; k < 4; k++) {
3094 for (k = 0; k <
s->dcomp; k++) {
3096 for (
i = 0;
i < outlink->
h ;
i++)
3097 memset(
out->data[
s->odesc->comp[k].plane] +
3098 i *
out->linesize[
s->odesc->comp[k].plane],
3099 s->bg_color[k], outlink->
w);
3101 const int mult =
s->max / 256;
3102 uint16_t *dst = (uint16_t *)
out->data[
s->odesc->comp[k].plane];
3104 for (
i = 0;
i < outlink->
h ;
i++) {
3105 for (j = 0; j < outlink->
w; j++)
3106 dst[j] =
s->bg_color[k] *
mult;
3107 dst +=
out->linesize[
s->odesc->comp[k].plane] / 2;
3112 for (k = 0,
i = 0; k <
s->ncomp; k++) {
3113 if ((1 << k) &
s->pcomp) {
3114 const int plane =
s->desc->comp[k].plane;
3120 offset_x =
s->mode ?
i++ *
inlink->w : 0;
3121 offset_y =
s->mode ? 0 :
i++ *
inlink->h;
3123 offset_y =
s->mode ?
i++ *
s->size * !!
s->display : 0;
3124 offset_x =
s->mode ? 0 :
i++ *
s->size * !!
s->display;
3130 td.offset_y = offset_y;
3131 td.offset_x = offset_x;
3133 switch (
s->filter) {
3167 s->graticulef(
s,
out);
3203 .priv_class = &waveform_class,