119 int jobnr,
int nb_jobs);
124 float o1,
float o2,
const char *txt,
130 #define OFFSET(x) offsetof(WaveformContext, x)
131 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
322 if (!
ctx->inputs[0]->in_formats ||
323 !
ctx->inputs[0]->in_formats->nb_formats) {
339 if (!
ctx->inputs[0]->out_formats) {
344 avff =
ctx->inputs[0]->in_formats;
345 avff2 =
ctx->inputs[0]->out_formats;
351 depth =
desc->comp[0].depth;
353 if (
ncomp != ncomp2 || depth != depth2)
358 depth !=
desc->comp[0].depth)
370 else if (
rgb && depth == 8 &&
ncomp > 2)
372 else if (
rgb && depth == 9 &&
ncomp > 2)
374 else if (
rgb && depth == 10 &&
ncomp > 2)
376 else if (
rgb && depth == 12 &&
ncomp > 2)
378 else if (depth == 8 &&
ncomp > 2)
380 else if (depth == 9 &&
ncomp > 2)
382 else if (depth == 10 &&
ncomp > 2)
384 else if (depth == 12 &&
ncomp > 2)
396 const int dst_linesize =
out->linesize[component] / 2;
397 const int bg =
s->bg_color[component] * (
s->max / 256);
398 const int limit =
s->max - 1;
399 const int dst_h =
s->display ==
PARADE ?
out->height /
s->acomp :
out->height;
400 const int dst_w =
s->display ==
PARADE ?
out->width /
s->acomp :
out->width;
401 const int start =
s->estart[plane];
402 const int end =
s->eend[plane];
408 for (y = start; y <
end; y++) {
409 dst = (uint16_t *)
out->data[component] + y * dst_linesize + x;
415 for (y =
end - 1; y >= start; y--) {
416 dst = (uint16_t *)
out->data[component] + y * dst_linesize + x;
425 dst = (uint16_t *)
out->data[component] + y * dst_linesize;
426 for (x = start; x <
end; x++) {
432 for (x =
end - 1; x >= start; x--) {
444 const int dst_linesize =
out->linesize[component];
445 const uint8_t bg =
s->bg_color[component];
446 const int dst_h =
s->display ==
PARADE ?
out->height /
s->acomp :
out->height;
447 const int dst_w =
s->display ==
PARADE ?
out->width /
s->acomp :
out->width;
448 const int start =
s->estart[plane];
449 const int end =
s->eend[plane];
455 for (y = start; y <
end; y++) {
456 dst =
out->data[component] + y * dst_linesize + x;
462 for (y =
end - 1; y >= start; y--) {
463 dst =
out->data[component] + y * dst_linesize + x;
472 dst =
out->data[component] + y * dst_linesize;
473 for (x = start; x <
end; x++) {
479 for (x =
end - 1; x >= start; x--) {
491 const int dst_linesize =
out->linesize[component] / 2;
492 const int bg =
s->bg_color[component] * (
s->max / 256);
493 const int limit =
s->max - 1;
494 const int dst_h =
s->display ==
PARADE ?
out->height /
s->acomp :
out->height;
495 const int dst_w =
s->display ==
PARADE ?
out->width /
s->acomp :
out->width;
496 const int start =
s->estart[plane];
497 const int end =
s->eend[plane];
498 int *
emax =
s->emax[plane][component];
499 int *
emin =
s->emin[plane][component];
506 dst = (uint16_t *)
out->data[component] + y * dst_linesize + x;
512 for (y =
end - 1; y >= start && y >=
emax[x -
offset]; y--) {
513 dst = (uint16_t *)
out->data[component] + y * dst_linesize + x;
521 if (
s->envelope == 3)
525 dst = (uint16_t *)
out->data[component] +
emin[x -
offset] * dst_linesize + x;
527 dst = (uint16_t *)
out->data[component] +
emax[x -
offset] * dst_linesize + x;
532 dst = (uint16_t *)
out->data[component] + y * dst_linesize;
539 for (x =
end - 1; x >= start && x >=
emax[y -
offset]; x--) {
547 if (
s->envelope == 3)
551 dst = (uint16_t *)
out->data[component] + y * dst_linesize +
emin[y -
offset];
553 dst = (uint16_t *)
out->data[component] + y * dst_linesize +
emax[y -
offset];
561 const int dst_linesize =
out->linesize[component];
562 const int bg =
s->bg_color[component];
563 const int dst_h =
s->display ==
PARADE ?
out->height /
s->acomp :
out->height;
564 const int dst_w =
s->display ==
PARADE ?
out->width /
s->acomp :
out->width;
565 const int start =
s->estart[plane];
566 const int end =
s->eend[plane];
567 int *
emax =
s->emax[plane][component];
568 int *
emin =
s->emin[plane][component];
575 dst =
out->data[component] + y * dst_linesize + x;
581 for (y =
end - 1; y >= start && y >=
emax[x -
offset]; y--) {
582 dst =
out->data[component] + y * dst_linesize + x;
590 if (
s->envelope == 3)
594 dst =
out->data[component] +
emin[x -
offset] * dst_linesize + x;
596 dst =
out->data[component] +
emax[x -
offset] * dst_linesize + x;
601 dst =
out->data[component] + y * dst_linesize;
608 for (x =
end - 1; x >= start && x >=
emax[y -
offset]; x--) {
616 if (
s->envelope == 3)
620 dst =
out->data[component] + y * dst_linesize +
emin[y -
offset];
622 dst =
out->data[component] + y * dst_linesize +
emax[y -
offset];
630 if (
s->envelope == 0) {
632 }
else if (
s->envelope == 1) {
641 if (
s->envelope == 0) {
643 }
else if (
s->envelope == 1) {
685 int offset_y,
int offset_x,
687 int jobnr,
int nb_jobs)
689 const int plane =
s->desc->comp[component].plane;
690 const int dplane = (
s->rgb ||
s->display ==
OVERLAY) ? plane : 0;
691 const int shift_w =
s->shift_w[component];
692 const int shift_h =
s->shift_h[component];
693 const int src_linesize =
in->linesize[plane] / 2;
694 const int dst_linesize =
out->linesize[dplane] / 2;
695 const int dst_signed_linesize = dst_linesize * (
mirror == 1 ? -1 : 1);
696 const int limit =
s->max - 1;
700 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
701 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
702 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
703 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
705 const uint16_t *src_data = (
const uint16_t *)
in->data[plane] + sliceh_start * src_linesize;
706 uint16_t *dst_data = (uint16_t *)
out->data[dplane] + (offset_y + sliceh_start *
step) * dst_linesize + offset_x;
707 uint16_t *
const dst_bottom_line = dst_data + dst_linesize * (
s->size - 1);
708 uint16_t *
const dst_line = (
mirror ? dst_bottom_line : dst_data);
715 for (y = sliceh_start; y < sliceh_end; y++) {
716 const uint16_t *src_data_end = src_data + slicew_end;
717 uint16_t *dst = dst_line + slicew_start *
step;
719 for (p = src_data + slicew_start; p < src_data_end; p++) {
721 int i = 0, v =
FFMIN(*p, limit);
725 target = dst++ + dst_signed_linesize * v;
727 }
while (++
i <
step);
729 uint16_t *row = dst_data;
732 target = row - v - 1;
737 }
while (++
i <
step);
740 src_data += src_linesize;
741 dst_data += dst_linesize *
step;
744 if (
s->display !=
OVERLAY && column && !
s->rgb) {
745 const int mult =
s->max / 256;
746 const int bg =
s->bg_color[0] *
mult;
747 const int t0 =
s->tint[0];
748 const int t1 =
s->tint[1];
749 uint16_t *dst0, *dst1;
753 src = (
const uint16_t *)(
out->data[0]) + offset_y * dst_linesize + offset_x;
754 dst0 = (uint16_t *)(
out->data[1]) + offset_y * dst_linesize + offset_x;
755 dst1 = (uint16_t *)(
out->data[2]) + offset_y * dst_linesize + offset_x;
756 for (y = 0; y <
s->max; y++) {
757 for (x = slicew_start *
step; x < slicew_end *
step; x++) {
765 dst0 += dst_linesize;
766 dst1 += dst_linesize;
768 }
else if (
s->display !=
OVERLAY && !
s->rgb) {
769 const int mult =
s->max / 256;
770 const int bg =
s->bg_color[0] *
mult;
771 const int t0 =
s->tint[0];
772 const int t1 =
s->tint[1];
773 uint16_t *dst0, *dst1;
777 src = (
const uint16_t *)
out->data[0] + (offset_y + sliceh_start *
step) * dst_linesize + offset_x;
778 dst0 = (uint16_t *)(
out->data[1]) + (offset_y + sliceh_start *
step) * dst_linesize + offset_x;
779 dst1 = (uint16_t *)(
out->data[2]) + (offset_y + sliceh_start *
step) * dst_linesize + offset_x;
780 for (y = sliceh_start *
step; y < sliceh_end *
step; y++) {
781 for (x = 0; x <
s->max; x++) {
789 dst0 += dst_linesize;
790 dst1 += dst_linesize;
795 #define LOWPASS16_FUNC(name, column, mirror) \
796 static int lowpass16_##name(AVFilterContext *ctx, \
797 void *arg, int jobnr, \
800 WaveformContext *s = ctx->priv; \
801 ThreadData *td = arg; \
802 AVFrame *in = td->in; \
803 AVFrame *out = td->out; \
804 int component = td->component; \
805 int offset_y = td->offset_y; \
806 int offset_x = td->offset_x; \
808 lowpass16(s, in, out, component, s->intensity, \
809 offset_y, offset_x, column, mirror, \
823 int offset_y,
int offset_x,
825 int jobnr,
int nb_jobs)
827 const int plane =
s->desc->comp[component].plane;
828 const int dplane = (
s->rgb ||
s->display ==
OVERLAY) ? plane : 0;
829 const int shift_w =
s->shift_w[component];
830 const int shift_h =
s->shift_h[component];
831 const int src_linesize =
in->linesize[plane];
832 const int dst_linesize =
out->linesize[dplane];
833 const int dst_signed_linesize = dst_linesize * (
mirror == 1 ? -1 : 1);
837 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
838 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
839 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
840 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
842 const uint8_t *src_data =
in->data[plane] + sliceh_start * src_linesize;
843 uint8_t *dst_data =
out->data[dplane] + (offset_y + sliceh_start *
step) * dst_linesize + offset_x;
844 uint8_t *
const dst_bottom_line = dst_data + dst_linesize * (
s->size - 1);
845 uint8_t *
const dst_line = (
mirror ? dst_bottom_line : dst_data);
852 for (y = sliceh_start; y < sliceh_end; y++) {
853 const uint8_t *src_data_end = src_data + slicew_end;
856 for (p = src_data + slicew_start; p < src_data_end; p++) {
862 target = dst++ + dst_signed_linesize * *p;
864 }
while (++
i <
step);
869 target = row - *p - 1;
874 }
while (++
i <
step);
877 src_data += src_linesize;
878 dst_data += dst_linesize *
step;
881 if (
s->display !=
OVERLAY && column && !
s->rgb) {
882 const int bg =
s->bg_color[0];
883 const int dst_h = 256;
884 const int t0 =
s->tint[0];
885 const int t1 =
s->tint[1];
890 src =
out->data[0] + offset_y * dst_linesize + offset_x;
891 dst0 =
out->data[1] + offset_y * dst_linesize + offset_x;
892 dst1 =
out->data[2] + offset_y * dst_linesize + offset_x;
893 for (y = 0; y < dst_h; y++) {
894 for (x = slicew_start *
step; x < slicew_end *
step; x++) {
902 dst0 += dst_linesize;
903 dst1 += dst_linesize;
905 }
else if (
s->display !=
OVERLAY && !
s->rgb) {
906 const int bg =
s->bg_color[0];
907 const int dst_w = 256;
908 const int t0 =
s->tint[0];
909 const int t1 =
s->tint[1];
914 src =
out->data[0] + (offset_y + sliceh_start *
step) * dst_linesize + offset_x;
915 dst0 =
out->data[1] + (offset_y + sliceh_start *
step) * dst_linesize + offset_x;
916 dst1 =
out->data[2] + (offset_y + sliceh_start *
step) * dst_linesize + offset_x;
917 for (y = sliceh_start *
step; y < sliceh_end *
step; y++) {
918 for (x = 0; x < dst_w; x++) {
926 dst0 += dst_linesize;
927 dst1 += dst_linesize;
932 #define LOWPASS_FUNC(name, column, mirror) \
933 static int lowpass_##name(AVFilterContext *ctx, \
934 void *arg, int jobnr, \
937 WaveformContext *s = ctx->priv; \
938 ThreadData *td = arg; \
939 AVFrame *in = td->in; \
940 AVFrame *out = td->out; \
941 int component = td->component; \
942 int offset_y = td->offset_y; \
943 int offset_x = td->offset_x; \
945 lowpass(s, in, out, component, s->intensity, \
946 offset_y, offset_x, column, mirror, \
960 int offset_y,
int offset_x,
962 int jobnr,
int nb_jobs)
964 const int plane =
s->desc->comp[component].plane;
965 const int c0_linesize =
in->linesize[ plane + 0 ] / 2;
966 const int c1_linesize =
in->linesize[(plane + 1) %
s->ncomp] / 2;
967 const int c2_linesize =
in->linesize[(plane + 2) %
s->ncomp] / 2;
968 const int c0_shift_w =
s->shift_w[ component + 0 ];
969 const int c1_shift_w =
s->shift_w[(component + 1) %
s->ncomp];
970 const int c2_shift_w =
s->shift_w[(component + 2) %
s->ncomp];
971 const int c0_shift_h =
s->shift_h[ component + 0 ];
972 const int c1_shift_h =
s->shift_h[(component + 1) %
s->ncomp];
973 const int c2_shift_h =
s->shift_h[(component + 2) %
s->ncomp];
974 const int d0_linesize =
out->linesize[ plane + 0 ] / 2;
975 const int d1_linesize =
out->linesize[(plane + 1) %
s->ncomp] / 2;
976 const int limit =
s->max - 1;
978 const int mid =
s->max / 2;
979 const int src_h =
in->height;
980 const int src_w =
in->width;
981 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
982 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
983 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
984 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
988 const int d0_signed_linesize = d0_linesize * (
mirror == 1 ? -1 : 1);
989 const int d1_signed_linesize = d1_linesize * (
mirror == 1 ? -1 : 1);
991 for (x = slicew_start; x < slicew_end; x++) {
992 const uint16_t *c0_data = (uint16_t *)
in->data[plane + 0];
993 const uint16_t *c1_data = (uint16_t *)
in->data[(plane + 1) %
s->ncomp];
994 const uint16_t *c2_data = (uint16_t *)
in->data[(plane + 2) %
s->ncomp];
995 uint16_t *d0_data = (uint16_t *)(
out->data[plane]) + offset_y * d0_linesize + offset_x;
996 uint16_t *d1_data = (uint16_t *)(
out->data[(plane + 1) %
s->ncomp]) + offset_y * d1_linesize + offset_x;
997 uint16_t *
const d0_bottom_line = d0_data + d0_linesize * (
s->size - 1);
998 uint16_t *
const d0 = (
mirror ? d0_bottom_line : d0_data);
999 uint16_t *
const d1_bottom_line = d1_data + d1_linesize * (
s->size - 1);
1000 uint16_t *
const d1 = (
mirror ? d1_bottom_line : d1_data);
1002 for (y = 0; y < src_h; y++) {
1003 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit) +
s->max;
1004 const int c1 =
FFMIN(
FFABS(c1_data[x >> c1_shift_w] - mid) +
FFABS(c2_data[x >> c2_shift_w] - mid), limit);
1007 target = d0 + x + d0_signed_linesize * c0;
1009 target = d1 + x + d1_signed_linesize * (c0 -
c1);
1011 target = d1 + x + d1_signed_linesize * (c0 +
c1);
1014 if (!c0_shift_h || (y & c0_shift_h))
1015 c0_data += c0_linesize;
1016 if (!c1_shift_h || (y & c1_shift_h))
1017 c1_data += c1_linesize;
1018 if (!c2_shift_h || (y & c2_shift_h))
1019 c2_data += c2_linesize;
1020 d0_data += d0_linesize;
1021 d1_data += d1_linesize;
1025 const uint16_t *c0_data = (uint16_t *)(
in->data[plane]) + (sliceh_start >> c0_shift_h) * c0_linesize;
1026 const uint16_t *c1_data = (uint16_t *)(
in->data[(plane + 1) %
s->ncomp]) + (sliceh_start >> c1_shift_h) * c1_linesize;
1027 const uint16_t *c2_data = (uint16_t *)(
in->data[(plane + 2) %
s->ncomp]) + (sliceh_start >> c2_shift_h) * c2_linesize;
1028 uint16_t *d0_data = (uint16_t *)(
out->data[plane]) + (offset_y + sliceh_start) * d0_linesize + offset_x;
1029 uint16_t *d1_data = (uint16_t *)(
out->data[(plane + 1) %
s->ncomp]) + (offset_y + sliceh_start) * d1_linesize + offset_x;
1032 d0_data +=
s->size - 1;
1033 d1_data +=
s->size - 1;
1036 for (y = sliceh_start; y < sliceh_end; y++) {
1037 for (x = 0; x < src_w; x++) {
1038 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit) +
s->max;
1039 const int c1 =
FFMIN(
FFABS(c1_data[x >> c1_shift_w] - mid) +
FFABS(c2_data[x >> c2_shift_w] - mid), limit);
1043 target = d0_data - c0;
1045 target = d1_data - (c0 -
c1);
1047 target = d1_data - (c0 +
c1);
1050 target = d0_data + c0;
1052 target = d1_data + (c0 -
c1);
1054 target = d1_data + (c0 +
c1);
1059 if (!c0_shift_h || (y & c0_shift_h))
1060 c0_data += c0_linesize;
1061 if (!c1_shift_h || (y & c1_shift_h))
1062 c1_data += c1_linesize;
1063 if (!c2_shift_h || (y & c2_shift_h))
1064 c2_data += c2_linesize;
1065 d0_data += d0_linesize;
1066 d1_data += d1_linesize;
1071 #define FLAT16_FUNC(name, column, mirror) \
1072 static int flat16_##name(AVFilterContext *ctx, \
1073 void *arg, int jobnr, \
1076 WaveformContext *s = ctx->priv; \
1077 ThreadData *td = arg; \
1078 AVFrame *in = td->in; \
1079 AVFrame *out = td->out; \
1080 int component = td->component; \
1081 int offset_y = td->offset_y; \
1082 int offset_x = td->offset_x; \
1084 flat16(s, in, out, component, s->intensity, \
1085 offset_y, offset_x, column, mirror, \
1099 int offset_y,
int offset_x,
1101 int jobnr,
int nb_jobs)
1103 const int plane =
s->desc->comp[component].plane;
1104 const int c0_linesize =
in->linesize[ plane + 0 ];
1105 const int c1_linesize =
in->linesize[(plane + 1) %
s->ncomp];
1106 const int c2_linesize =
in->linesize[(plane + 2) %
s->ncomp];
1107 const int c0_shift_w =
s->shift_w[ component + 0 ];
1108 const int c1_shift_w =
s->shift_w[(component + 1) %
s->ncomp];
1109 const int c2_shift_w =
s->shift_w[(component + 2) %
s->ncomp];
1110 const int c0_shift_h =
s->shift_h[ component + 0 ];
1111 const int c1_shift_h =
s->shift_h[(component + 1) %
s->ncomp];
1112 const int c2_shift_h =
s->shift_h[(component + 2) %
s->ncomp];
1113 const int d0_linesize =
out->linesize[ plane + 0 ];
1114 const int d1_linesize =
out->linesize[(plane + 1) %
s->ncomp];
1116 const int src_h =
in->height;
1117 const int src_w =
in->width;
1118 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
1119 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
1120 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
1121 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
1125 const int d0_signed_linesize = d0_linesize * (
mirror == 1 ? -1 : 1);
1126 const int d1_signed_linesize = d1_linesize * (
mirror == 1 ? -1 : 1);
1128 for (x = slicew_start; x < slicew_end; x++) {
1129 const uint8_t *c0_data =
in->data[plane + 0];
1130 const uint8_t *c1_data =
in->data[(plane + 1) %
s->ncomp];
1131 const uint8_t *c2_data =
in->data[(plane + 2) %
s->ncomp];
1132 uint8_t *d0_data =
out->data[plane] + offset_y * d0_linesize + offset_x;
1133 uint8_t *d1_data =
out->data[(plane + 1) %
s->ncomp] + offset_y * d1_linesize + offset_x;
1134 uint8_t *
const d0_bottom_line = d0_data + d0_linesize * (
s->size - 1);
1136 uint8_t *
const d1_bottom_line = d1_data + d1_linesize * (
s->size - 1);
1139 for (y = 0; y < src_h; y++) {
1140 const int c0 = c0_data[x >> c0_shift_w] + 256;
1141 const int c1 =
FFABS(c1_data[x >> c1_shift_w] - 128) +
FFABS(c2_data[x >> c2_shift_w] - 128);
1144 target = d0 + x + d0_signed_linesize * c0;
1146 target = d1 + x + d1_signed_linesize * (c0 -
c1);
1148 target = d1 + x + d1_signed_linesize * (c0 +
c1);
1151 if (!c0_shift_h || (y & c0_shift_h))
1152 c0_data += c0_linesize;
1153 if (!c1_shift_h || (y & c1_shift_h))
1154 c1_data += c1_linesize;
1155 if (!c2_shift_h || (y & c2_shift_h))
1156 c2_data += c2_linesize;
1157 d0_data += d0_linesize;
1158 d1_data += d1_linesize;
1162 const uint8_t *c0_data =
in->data[plane] + (sliceh_start >> c0_shift_h) * c0_linesize;
1163 const uint8_t *c1_data =
in->data[(plane + 1) %
s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize;
1164 const uint8_t *c2_data =
in->data[(plane + 2) %
s->ncomp] + (sliceh_start >> c2_shift_h) * c2_linesize;
1165 uint8_t *d0_data =
out->data[plane] + (offset_y + sliceh_start) * d0_linesize + offset_x;
1166 uint8_t *d1_data =
out->data[(plane + 1) %
s->ncomp] + (offset_y + sliceh_start) * d1_linesize + offset_x;
1169 d0_data +=
s->size - 1;
1170 d1_data +=
s->size - 1;
1173 for (y = sliceh_start; y < sliceh_end; y++) {
1174 for (x = 0; x < src_w; x++) {
1175 const int c0 = c0_data[x >> c0_shift_w] + 256;
1176 const int c1 =
FFABS(c1_data[x >> c1_shift_w] - 128) +
FFABS(c2_data[x >> c2_shift_w] - 128);
1180 target = d0_data - c0;
1182 target = d1_data - (c0 -
c1);
1184 target = d1_data - (c0 +
c1);
1187 target = d0_data + c0;
1189 target = d1_data + (c0 -
c1);
1191 target = d1_data + (c0 +
c1);
1196 if (!c0_shift_h || (y & c0_shift_h))
1197 c0_data += c0_linesize;
1198 if (!c1_shift_h || (y & c1_shift_h))
1199 c1_data += c1_linesize;
1200 if (!c2_shift_h || (y & c2_shift_h))
1201 c2_data += c2_linesize;
1202 d0_data += d0_linesize;
1203 d1_data += d1_linesize;
1208 #define FLAT_FUNC(name, column, mirror) \
1209 static int flat_##name(AVFilterContext *ctx, \
1210 void *arg, int jobnr, \
1213 WaveformContext *s = ctx->priv; \
1214 ThreadData *td = arg; \
1215 AVFrame *in = td->in; \
1216 AVFrame *out = td->out; \
1217 int component = td->component; \
1218 int offset_y = td->offset_y; \
1219 int offset_x = td->offset_x; \
1221 flat(s, in, out, component, s->intensity, \
1222 offset_y, offset_x, column, mirror, \
1233 #define AFLAT16(name, update_cb, update_cr, column, mirror) \
1234 static int name(AVFilterContext *ctx, \
1235 void *arg, int jobnr, \
1238 WaveformContext *s = ctx->priv; \
1239 ThreadData *td = arg; \
1240 AVFrame *in = td->in; \
1241 AVFrame *out = td->out; \
1242 int component = td->component; \
1243 int offset_y = td->offset_y; \
1244 int offset_x = td->offset_x; \
1245 const int intensity = s->intensity; \
1246 const int plane = s->desc->comp[component].plane; \
1247 const int c0_linesize = in->linesize[ plane + 0 ] / 2; \
1248 const int c1_linesize = in->linesize[(plane + 1) % s->ncomp] / 2; \
1249 const int c2_linesize = in->linesize[(plane + 2) % s->ncomp] / 2; \
1250 const int c0_shift_w = s->shift_w[ component + 0 ]; \
1251 const int c1_shift_w = s->shift_w[(component + 1) % s->ncomp]; \
1252 const int c2_shift_w = s->shift_w[(component + 2) % s->ncomp]; \
1253 const int c0_shift_h = s->shift_h[ component + 0 ]; \
1254 const int c1_shift_h = s->shift_h[(component + 1) % s->ncomp]; \
1255 const int c2_shift_h = s->shift_h[(component + 2) % s->ncomp]; \
1256 const int d0_linesize = out->linesize[ plane + 0 ] / 2; \
1257 const int d1_linesize = out->linesize[(plane + 1) % s->ncomp] / 2; \
1258 const int d2_linesize = out->linesize[(plane + 2) % s->ncomp] / 2; \
1259 const int limit = s->max - 1; \
1260 const int max = limit - intensity; \
1261 const int mid = s->max / 2; \
1262 const int src_h = in->height; \
1263 const int src_w = in->width; \
1264 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0; \
1265 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h; \
1266 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0; \
1267 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w; \
1271 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1); \
1272 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1); \
1273 const int d2_signed_linesize = d2_linesize * (mirror == 1 ? -1 : 1); \
1275 for (x = slicew_start; x < slicew_end; x++) { \
1276 const uint16_t *c0_data = (uint16_t *)in->data[plane + 0]; \
1277 const uint16_t *c1_data = (uint16_t *)in->data[(plane + 1) % s->ncomp]; \
1278 const uint16_t *c2_data = (uint16_t *)in->data[(plane + 2) % s->ncomp]; \
1279 uint16_t *d0_data = (uint16_t *)out->data[plane] + offset_y * d0_linesize + offset_x; \
1280 uint16_t *d1_data = (uint16_t *)out->data[(plane + 1) % s->ncomp] + offset_y * d1_linesize + offset_x; \
1281 uint16_t *d2_data = (uint16_t *)out->data[(plane + 2) % s->ncomp] + offset_y * d2_linesize + offset_x; \
1282 uint16_t * const d0_bottom_line = d0_data + d0_linesize * (s->size - 1); \
1283 uint16_t * const d0 = (mirror ? d0_bottom_line : d0_data); \
1284 uint16_t * const d1_bottom_line = d1_data + d1_linesize * (s->size - 1); \
1285 uint16_t * const d1 = (mirror ? d1_bottom_line : d1_data); \
1286 uint16_t * const d2_bottom_line = d2_data + d2_linesize * (s->size - 1); \
1287 uint16_t * const d2 = (mirror ? d2_bottom_line : d2_data); \
1289 for (y = 0; y < src_h; y++) { \
1290 const int c0 = FFMIN(c0_data[x >> c0_shift_w], limit) + mid; \
1291 const int c1 = FFMIN(c1_data[x >> c1_shift_w], limit) - mid; \
1292 const int c2 = FFMIN(c2_data[x >> c2_shift_w], limit) - mid; \
1295 target = d0 + x + d0_signed_linesize * c0; \
1296 update16(target, max, intensity, limit); \
1298 target = d1 + x + d1_signed_linesize * (c0 + c1); \
1299 update_cb(target, max, intensity, limit); \
1301 target = d2 + x + d2_signed_linesize * (c0 + c2); \
1302 update_cr(target, max, intensity, limit); \
1304 if (!c0_shift_h || (y & c0_shift_h)) \
1305 c0_data += c0_linesize; \
1306 if (!c1_shift_h || (y & c1_shift_h)) \
1307 c1_data += c1_linesize; \
1308 if (!c2_shift_h || (y & c2_shift_h)) \
1309 c2_data += c2_linesize; \
1310 d0_data += d0_linesize; \
1311 d1_data += d1_linesize; \
1312 d2_data += d2_linesize; \
1316 const uint16_t *c0_data = (uint16_t *)in->data[plane] + (sliceh_start >> c0_shift_h) * c0_linesize; \
1317 const uint16_t *c1_data = (uint16_t *)in->data[(plane + 1) % s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize; \
1318 const uint16_t *c2_data = (uint16_t *)in->data[(plane + 2) % s->ncomp] + (sliceh_start >> c2_shift_h) * c2_linesize; \
1319 uint16_t *d0_data = (uint16_t *)out->data[plane] + (offset_y + sliceh_start) * d0_linesize + offset_x; \
1320 uint16_t *d1_data = (uint16_t *)out->data[(plane + 1) % s->ncomp] + (offset_y + sliceh_start) * d1_linesize + offset_x; \
1321 uint16_t *d2_data = (uint16_t *)out->data[(plane + 2) % s->ncomp] + (offset_y + sliceh_start) * d2_linesize + offset_x; \
1324 d0_data += s->size - 1; \
1325 d1_data += s->size - 1; \
1326 d2_data += s->size - 1; \
1329 for (y = sliceh_start; y < sliceh_end; y++) { \
1330 for (x = 0; x < src_w; x++) { \
1331 const int c0 = FFMIN(c0_data[x >> c0_shift_w], limit) + mid; \
1332 const int c1 = FFMIN(c1_data[x >> c1_shift_w], limit) - mid; \
1333 const int c2 = FFMIN(c2_data[x >> c2_shift_w], limit) - mid; \
1337 target = d0_data - c0; \
1338 update16(target, max, intensity, limit); \
1339 target = d1_data - (c0 + c1); \
1340 update_cb(target, max, intensity, limit); \
1341 target = d2_data - (c0 + c2); \
1342 update_cr(target, max, intensity, limit); \
1344 target = d0_data + c0; \
1345 update16(target, max, intensity, limit); \
1346 target = d1_data + (c0 + c1); \
1347 update_cb(target, max, intensity, limit); \
1348 target = d2_data + (c0 + c2); \
1349 update_cr(target, max, intensity, limit); \
1353 if (!c0_shift_h || (y & c0_shift_h)) \
1354 c0_data += c0_linesize; \
1355 if (!c1_shift_h || (y & c1_shift_h)) \
1356 c1_data += c1_linesize; \
1357 if (!c2_shift_h || (y & c2_shift_h)) \
1358 c2_data += c2_linesize; \
1359 d0_data += d0_linesize; \
1360 d1_data += d1_linesize; \
1361 d2_data += d2_linesize; \
1367 #define AFLAT(name, update_cb, update_cr, column, mirror) \
1368 static int name(AVFilterContext *ctx, \
1369 void *arg, int jobnr, \
1372 WaveformContext *s = ctx->priv; \
1373 ThreadData *td = arg; \
1374 AVFrame *in = td->in; \
1375 AVFrame *out = td->out; \
1376 int component = td->component; \
1377 int offset_y = td->offset_y; \
1378 int offset_x = td->offset_x; \
1379 const int src_h = in->height; \
1380 const int src_w = in->width; \
1381 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0; \
1382 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h; \
1383 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0; \
1384 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w; \
1385 const int intensity = s->intensity; \
1386 const int plane = s->desc->comp[component].plane; \
1387 const int c0_linesize = in->linesize[ plane + 0 ]; \
1388 const int c1_linesize = in->linesize[(plane + 1) % s->ncomp]; \
1389 const int c2_linesize = in->linesize[(plane + 2) % s->ncomp]; \
1390 const int c0_shift_w = s->shift_w[ component + 0 ]; \
1391 const int c1_shift_w = s->shift_w[(component + 1) % s->ncomp]; \
1392 const int c2_shift_w = s->shift_w[(component + 2) % s->ncomp]; \
1393 const int c0_shift_h = s->shift_h[ component + 0 ]; \
1394 const int c1_shift_h = s->shift_h[(component + 1) % s->ncomp]; \
1395 const int c2_shift_h = s->shift_h[(component + 2) % s->ncomp]; \
1396 const int d0_linesize = out->linesize[ plane + 0 ]; \
1397 const int d1_linesize = out->linesize[(plane + 1) % s->ncomp]; \
1398 const int d2_linesize = out->linesize[(plane + 2) % s->ncomp]; \
1399 const int max = 255 - intensity; \
1403 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1); \
1404 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1); \
1405 const int d2_signed_linesize = d2_linesize * (mirror == 1 ? -1 : 1); \
1407 for (x = slicew_start; x < slicew_end; x++) { \
1408 const uint8_t *c0_data = in->data[plane + 0]; \
1409 const uint8_t *c1_data = in->data[(plane + 1) % s->ncomp]; \
1410 const uint8_t *c2_data = in->data[(plane + 2) % s->ncomp]; \
1411 uint8_t *d0_data = out->data[plane] + offset_y * d0_linesize + offset_x; \
1412 uint8_t *d1_data = out->data[(plane + 1) % s->ncomp] + offset_y * d1_linesize + offset_x; \
1413 uint8_t *d2_data = out->data[(plane + 2) % s->ncomp] + offset_y * d2_linesize + offset_x; \
1414 uint8_t * const d0_bottom_line = d0_data + d0_linesize * (s->size - 1); \
1415 uint8_t * const d0 = (mirror ? d0_bottom_line : d0_data); \
1416 uint8_t * const d1_bottom_line = d1_data + d1_linesize * (s->size - 1); \
1417 uint8_t * const d1 = (mirror ? d1_bottom_line : d1_data); \
1418 uint8_t * const d2_bottom_line = d2_data + d2_linesize * (s->size - 1); \
1419 uint8_t * const d2 = (mirror ? d2_bottom_line : d2_data); \
1421 for (y = 0; y < src_h; y++) { \
1422 const int c0 = c0_data[x >> c0_shift_w] + 128; \
1423 const int c1 = c1_data[x >> c1_shift_w] - 128; \
1424 const int c2 = c2_data[x >> c2_shift_w] - 128; \
1427 target = d0 + x + d0_signed_linesize * c0; \
1428 update(target, max, intensity); \
1430 target = d1 + x + d1_signed_linesize * (c0 + c1); \
1431 update_cb(target, max, intensity); \
1433 target = d2 + x + d2_signed_linesize * (c0 + c2); \
1434 update_cr(target, max, intensity); \
1436 if (!c0_shift_h || (y & c0_shift_h)) \
1437 c0_data += c0_linesize; \
1438 if (!c1_shift_h || (y & c1_shift_h)) \
1439 c1_data += c1_linesize; \
1440 if (!c2_shift_h || (y & c2_shift_h)) \
1441 c2_data += c2_linesize; \
1442 d0_data += d0_linesize; \
1443 d1_data += d1_linesize; \
1444 d2_data += d2_linesize; \
1448 const uint8_t *c0_data = in->data[plane] + (sliceh_start >> c0_shift_h) * c0_linesize; \
1449 const uint8_t *c1_data = in->data[(plane + 1) % s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize; \
1450 const uint8_t *c2_data = in->data[(plane + 2) % s->ncomp] + (sliceh_start >> c2_shift_h) * c2_linesize; \
1451 uint8_t *d0_data = out->data[plane] + (offset_y + sliceh_start) * d0_linesize + offset_x; \
1452 uint8_t *d1_data = out->data[(plane + 1) % s->ncomp] + (offset_y + sliceh_start) * d1_linesize + offset_x; \
1453 uint8_t *d2_data = out->data[(plane + 2) % s->ncomp] + (offset_y + sliceh_start) * d2_linesize + offset_x; \
1456 d0_data += s->size - 1; \
1457 d1_data += s->size - 1; \
1458 d2_data += s->size - 1; \
1461 for (y = sliceh_start; y < sliceh_end; y++) { \
1462 for (x = 0; x < src_w; x++) { \
1463 const int c0 = c0_data[x >> c0_shift_w] + 128; \
1464 const int c1 = c1_data[x >> c1_shift_w] - 128; \
1465 const int c2 = c2_data[x >> c2_shift_w] - 128; \
1469 target = d0_data - c0; \
1470 update(target, max, intensity); \
1471 target = d1_data - (c0 + c1); \
1472 update_cb(target, max, intensity); \
1473 target = d2_data - (c0 + c2); \
1474 update_cr(target, max, intensity); \
1476 target = d0_data + c0; \
1477 update(target, max, intensity); \
1478 target = d1_data + (c0 + c1); \
1479 update_cb(target, max, intensity); \
1480 target = d2_data + (c0 + c2); \
1481 update_cr(target, max, intensity); \
1485 if (!c0_shift_h || (y & c0_shift_h)) \
1486 c0_data += c0_linesize; \
1487 if (!c1_shift_h || (y & c1_shift_h)) \
1488 c1_data += c1_linesize; \
1489 if (!c2_shift_h || (y & c2_shift_h)) \
1490 c2_data += c2_linesize; \
1491 d0_data += d0_linesize; \
1492 d1_data += d1_linesize; \
1493 d2_data += d2_linesize; \
1528 int offset_y,
int offset_x,
1530 int jobnr,
int nb_jobs)
1532 const int plane =
s->desc->comp[component].plane;
1533 const int c0_linesize =
in->linesize[(plane + 1) %
s->ncomp] / 2;
1534 const int c1_linesize =
in->linesize[(plane + 2) %
s->ncomp] / 2;
1535 const int dst_linesize =
out->linesize[plane] / 2;
1536 const int limit =
s->max - 1;
1538 const int mid =
s->max / 2;
1539 const int c0_shift_w =
s->shift_w[(component + 1) %
s->ncomp];
1540 const int c1_shift_w =
s->shift_w[(component + 2) %
s->ncomp];
1541 const int c0_shift_h =
s->shift_h[(component + 1) %
s->ncomp];
1542 const int c1_shift_h =
s->shift_h[(component + 2) %
s->ncomp];
1543 const int src_h =
in->height;
1544 const int src_w =
in->width;
1545 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
1546 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
1547 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
1548 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
1552 const int dst_signed_linesize = dst_linesize * (
mirror == 1 ? -1 : 1);
1554 for (x = slicew_start; x < slicew_end; x++) {
1555 const uint16_t *c0_data = (uint16_t *)
in->data[(plane + 1) %
s->ncomp];
1556 const uint16_t *c1_data = (uint16_t *)
in->data[(plane + 2) %
s->ncomp];
1557 uint16_t *dst_data = (uint16_t *)
out->data[plane] + offset_y * dst_linesize + offset_x;
1558 uint16_t *
const dst_bottom_line = dst_data + dst_linesize * (
s->size - 1);
1559 uint16_t *
const dst_line = (
mirror ? dst_bottom_line : dst_data);
1560 uint16_t *dst = dst_line;
1562 for (y = 0; y < src_h; y++) {
1563 const int sum =
FFMIN(
FFABS(c0_data[x >> c0_shift_w] - mid) +
FFABS(c1_data[x >> c1_shift_w] - mid - 1), limit);
1566 target = dst + x + dst_signed_linesize * sum;
1569 if (!c0_shift_h || (y & c0_shift_h))
1570 c0_data += c0_linesize;
1571 if (!c1_shift_h || (y & c1_shift_h))
1572 c1_data += c1_linesize;
1573 dst_data += dst_linesize;
1577 const uint16_t *c0_data = (uint16_t *)
in->data[(plane + 1) %
s->ncomp] + (sliceh_start >> c0_shift_h) * c0_linesize;
1578 const uint16_t *c1_data = (uint16_t *)
in->data[(plane + 2) %
s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize;
1579 uint16_t *dst_data = (uint16_t *)
out->data[plane] + (offset_y + sliceh_start) * dst_linesize + offset_x;
1582 dst_data +=
s->size - 1;
1583 for (y = sliceh_start; y < sliceh_end; y++) {
1584 for (x = 0; x < src_w; x++) {
1585 const int sum =
FFMIN(
FFABS(c0_data[x >> c0_shift_w] - mid) +
FFABS(c1_data[x >> c1_shift_w] - mid - 1), limit);
1589 target = dst_data - sum;
1592 target = dst_data + sum;
1597 if (!c0_shift_h || (y & c0_shift_h))
1598 c0_data += c0_linesize;
1599 if (!c1_shift_h || (y & c1_shift_h))
1600 c1_data += c1_linesize;
1601 dst_data += dst_linesize;
1606 #define CHROMA16_FUNC(name, column, mirror) \
1607 static int chroma16_##name(AVFilterContext *ctx, \
1608 void *arg, int jobnr, \
1611 WaveformContext *s = ctx->priv; \
1612 ThreadData *td = arg; \
1613 AVFrame *in = td->in; \
1614 AVFrame *out = td->out; \
1615 int component = td->component; \
1616 int offset_y = td->offset_y; \
1617 int offset_x = td->offset_x; \
1619 chroma16(s, in, out, component, s->intensity,\
1620 offset_y, offset_x, column, mirror, \
1634 int offset_y,
int offset_x,
1636 int jobnr,
int nb_jobs)
1638 const int plane =
s->desc->comp[component].plane;
1639 const int src_h =
in->height;
1640 const int src_w =
in->width;
1641 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
1642 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
1643 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
1644 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
1645 const int c0_linesize =
in->linesize[(plane + 1) %
s->ncomp];
1646 const int c1_linesize =
in->linesize[(plane + 2) %
s->ncomp];
1647 const int dst_linesize =
out->linesize[plane];
1649 const int c0_shift_w =
s->shift_w[(component + 1) %
s->ncomp];
1650 const int c1_shift_w =
s->shift_w[(component + 2) %
s->ncomp];
1651 const int c0_shift_h =
s->shift_h[(component + 1) %
s->ncomp];
1652 const int c1_shift_h =
s->shift_h[(component + 2) %
s->ncomp];
1656 const int dst_signed_linesize = dst_linesize * (
mirror == 1 ? -1 : 1);
1658 for (x = slicew_start; x < slicew_end; x++) {
1659 const uint8_t *c0_data =
in->data[(plane + 1) %
s->ncomp];
1660 const uint8_t *c1_data =
in->data[(plane + 2) %
s->ncomp];
1661 uint8_t *dst_data =
out->data[plane] + offset_y * dst_linesize + offset_x;
1662 uint8_t *
const dst_bottom_line = dst_data + dst_linesize * (
s->size - 1);
1663 uint8_t *
const dst_line = (
mirror ? dst_bottom_line : dst_data);
1666 for (y = 0; y < src_h; y++) {
1667 const int sum =
FFABS(c0_data[x >> c0_shift_w] - 128) +
FFABS(c1_data[x >> c1_shift_w] - 127);
1670 target = dst + x + dst_signed_linesize * sum;
1673 if (!c0_shift_h || (y & c0_shift_h))
1674 c0_data += c0_linesize;
1675 if (!c1_shift_h || (y & c1_shift_h))
1676 c1_data += c1_linesize;
1677 dst_data += dst_linesize;
1681 const uint8_t *c0_data =
in->data[(plane + 1) %
s->ncomp] + (sliceh_start >> c0_shift_h) * c0_linesize;
1682 const uint8_t *c1_data =
in->data[(plane + 2) %
s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize;
1683 uint8_t *dst_data =
out->data[plane] + (offset_y + sliceh_start) * dst_linesize + offset_x;
1686 dst_data +=
s->size - 1;
1687 for (y = sliceh_start; y < sliceh_end; y++) {
1688 for (x = 0; x < src_w; x++) {
1689 const int sum =
FFABS(c0_data[x >> c0_shift_w] - 128) +
FFABS(c1_data[x >> c1_shift_w] - 127);
1693 target = dst_data - sum;
1696 target = dst_data + sum;
1701 if (!c0_shift_h || (y & c0_shift_h))
1702 c0_data += c0_linesize;
1703 if (!c1_shift_h || (y & c1_shift_h))
1704 c1_data += c1_linesize;
1705 dst_data += dst_linesize;
1710 #define CHROMA_FUNC(name, column, mirror) \
1711 static int chroma_##name(AVFilterContext *ctx, \
1712 void *arg, int jobnr, \
1715 WaveformContext *s = ctx->priv; \
1716 ThreadData *td = arg; \
1717 AVFrame *in = td->in; \
1718 AVFrame *out = td->out; \
1719 int component = td->component; \
1720 int offset_y = td->offset_y; \
1721 int offset_x = td->offset_x; \
1723 chroma(s, in, out, component, s->intensity, \
1724 offset_y, offset_x, column, mirror, \
1738 int offset_y,
int offset_x,
1740 int jobnr,
int nb_jobs)
1742 const int plane =
s->desc->comp[component].plane;
1743 const int limit =
s->max - 1;
1744 const int src_h =
in->height;
1745 const int src_w =
in->width;
1746 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
1747 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
1748 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
1749 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
1750 const int c0_linesize =
in->linesize[ plane + 0 ] / 2;
1751 const int c1_linesize =
in->linesize[(plane + 1) %
s->ncomp] / 2;
1752 const int c2_linesize =
in->linesize[(plane + 2) %
s->ncomp] / 2;
1753 const int c0_shift_h =
s->shift_h[ component + 0 ];
1754 const int c1_shift_h =
s->shift_h[(component + 1) %
s->ncomp];
1755 const int c2_shift_h =
s->shift_h[(component + 2) %
s->ncomp];
1756 const uint16_t *c0_data = (
const uint16_t *)
in->data[plane + 0] + (sliceh_start >> c0_shift_h) * c0_linesize;
1757 const uint16_t *c1_data = (
const uint16_t *)
in->data[(plane + 1) %
s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize;
1758 const uint16_t *c2_data = (
const uint16_t *)
in->data[(plane + 2) %
s->ncomp] + (sliceh_start >> c2_shift_h) * c2_linesize;
1759 const int d0_linesize =
out->linesize[ plane + 0 ] / 2;
1760 const int d1_linesize =
out->linesize[(plane + 1) %
s->ncomp] / 2;
1761 const int d2_linesize =
out->linesize[(plane + 2) %
s->ncomp] / 2;
1762 const int c0_shift_w =
s->shift_w[ component + 0 ];
1763 const int c1_shift_w =
s->shift_w[(component + 1) %
s->ncomp];
1764 const int c2_shift_w =
s->shift_w[(component + 2) %
s->ncomp];
1768 const int d0_signed_linesize = d0_linesize * (
mirror == 1 ? -1 : 1);
1769 const int d1_signed_linesize = d1_linesize * (
mirror == 1 ? -1 : 1);
1770 const int d2_signed_linesize = d2_linesize * (
mirror == 1 ? -1 : 1);
1771 uint16_t *d0_data = (uint16_t *)
out->data[plane] + offset_y * d0_linesize + offset_x;
1772 uint16_t *d1_data = (uint16_t *)
out->data[(plane + 1) %
s->ncomp] + offset_y * d1_linesize + offset_x;
1773 uint16_t *d2_data = (uint16_t *)
out->data[(plane + 2) %
s->ncomp] + offset_y * d2_linesize + offset_x;
1774 uint16_t *
const d0_bottom_line = d0_data + d0_linesize * (
s->size - 1);
1775 uint16_t *
const d0 = (
mirror ? d0_bottom_line : d0_data);
1776 uint16_t *
const d1_bottom_line = d1_data + d1_linesize * (
s->size - 1);
1777 uint16_t *
const d1 = (
mirror ? d1_bottom_line : d1_data);
1778 uint16_t *
const d2_bottom_line = d2_data + d2_linesize * (
s->size - 1);
1779 uint16_t *
const d2 = (
mirror ? d2_bottom_line : d2_data);
1781 for (y = 0; y < src_h; y++) {
1782 for (x = slicew_start; x < slicew_end; x++) {
1783 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit);
1784 const int c1 = c1_data[x >> c1_shift_w];
1785 const int c2 = c2_data[x >> c2_shift_w];
1787 *(d0 + d0_signed_linesize * c0 + x) = c0;
1788 *(d1 + d1_signed_linesize * c0 + x) =
c1;
1789 *(d2 + d2_signed_linesize * c0 + x) =
c2;
1792 if (!c0_shift_h || (y & c0_shift_h))
1793 c0_data += c0_linesize;
1794 if (!c1_shift_h || (y & c1_shift_h))
1795 c1_data += c1_linesize;
1796 if (!c2_shift_h || (y & c2_shift_h))
1797 c2_data += c2_linesize;
1798 d0_data += d0_linesize;
1799 d1_data += d1_linesize;
1800 d2_data += d2_linesize;
1803 uint16_t *d0_data = (uint16_t *)
out->data[plane] + (offset_y + sliceh_start) * d0_linesize + offset_x;
1804 uint16_t *d1_data = (uint16_t *)
out->data[(plane + 1) %
s->ncomp] + (offset_y + sliceh_start) * d1_linesize + offset_x;
1805 uint16_t *d2_data = (uint16_t *)
out->data[(plane + 2) %
s->ncomp] + (offset_y + sliceh_start) * d2_linesize + offset_x;
1808 d0_data +=
s->size - 1;
1809 d1_data +=
s->size - 1;
1810 d2_data +=
s->size - 1;
1813 for (y = sliceh_start; y < sliceh_end; y++) {
1814 for (x = 0; x < src_w; x++) {
1815 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit);
1816 const int c1 = c1_data[x >> c1_shift_w];
1817 const int c2 = c2_data[x >> c2_shift_w];
1820 *(d0_data - c0) = c0;
1821 *(d1_data - c0) =
c1;
1822 *(d2_data - c0) =
c2;
1824 *(d0_data + c0) = c0;
1825 *(d1_data + c0) =
c1;
1826 *(d2_data + c0) =
c2;
1830 if (!c0_shift_h || (y & c0_shift_h))
1831 c0_data += c0_linesize;
1832 if (!c1_shift_h || (y & c1_shift_h))
1833 c1_data += c1_linesize;
1834 if (!c2_shift_h || (y & c2_shift_h))
1835 c2_data += c2_linesize;
1836 d0_data += d0_linesize;
1837 d1_data += d1_linesize;
1838 d2_data += d2_linesize;
1843 #define COLOR16_FUNC(name, column, mirror) \
1844 static int color16_##name(AVFilterContext *ctx, \
1845 void *arg, int jobnr, \
1848 WaveformContext *s = ctx->priv; \
1849 ThreadData *td = arg; \
1850 AVFrame *in = td->in; \
1851 AVFrame *out = td->out; \
1852 int component = td->component; \
1853 int offset_y = td->offset_y; \
1854 int offset_x = td->offset_x; \
1856 color16(s, in, out, component, s->intensity, \
1857 offset_y, offset_x, column, mirror, \
1871 int offset_y,
int offset_x,
1873 int jobnr,
int nb_jobs)
1875 const int plane =
s->desc->comp[component].plane;
1876 const int src_h =
in->height;
1877 const int src_w =
in->width;
1878 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
1879 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
1880 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
1881 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
1882 const int c0_linesize =
in->linesize[ plane + 0 ];
1883 const int c1_linesize =
in->linesize[(plane + 1) %
s->ncomp];
1884 const int c2_linesize =
in->linesize[(plane + 2) %
s->ncomp];
1885 const int c0_shift_h =
s->shift_h[ component + 0 ];
1886 const int c1_shift_h =
s->shift_h[(component + 1) %
s->ncomp];
1887 const int c2_shift_h =
s->shift_h[(component + 2) %
s->ncomp];
1888 const uint8_t *c0_data =
in->data[plane] + (sliceh_start >> c0_shift_h) * c0_linesize;
1889 const uint8_t *c1_data =
in->data[(plane + 1) %
s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize;
1890 const uint8_t *c2_data =
in->data[(plane + 2) %
s->ncomp] + (sliceh_start >> c2_shift_h) * c2_linesize;
1891 const int d0_linesize =
out->linesize[ plane + 0 ];
1892 const int d1_linesize =
out->linesize[(plane + 1) %
s->ncomp];
1893 const int d2_linesize =
out->linesize[(plane + 2) %
s->ncomp];
1894 const int c0_shift_w =
s->shift_w[ component + 0 ];
1895 const int c1_shift_w =
s->shift_w[(component + 1) %
s->ncomp];
1896 const int c2_shift_w =
s->shift_w[(component + 2) %
s->ncomp];
1900 const int d0_signed_linesize = d0_linesize * (
mirror == 1 ? -1 : 1);
1901 const int d1_signed_linesize = d1_linesize * (
mirror == 1 ? -1 : 1);
1902 const int d2_signed_linesize = d2_linesize * (
mirror == 1 ? -1 : 1);
1903 uint8_t *d0_data =
out->data[plane] + offset_y * d0_linesize + offset_x;
1904 uint8_t *d1_data =
out->data[(plane + 1) %
s->ncomp] + offset_y * d1_linesize + offset_x;
1905 uint8_t *d2_data =
out->data[(plane + 2) %
s->ncomp] + offset_y * d2_linesize + offset_x;
1906 uint8_t *
const d0_bottom_line = d0_data + d0_linesize * (
s->size - 1);
1908 uint8_t *
const d1_bottom_line = d1_data + d1_linesize * (
s->size - 1);
1910 uint8_t *
const d2_bottom_line = d2_data + d2_linesize * (
s->size - 1);
1913 for (y = 0; y < src_h; y++) {
1914 for (x = slicew_start; x < slicew_end; x++) {
1915 const int c0 = c0_data[x >> c0_shift_w];
1916 const int c1 = c1_data[x >> c1_shift_w];
1917 const int c2 = c2_data[x >> c2_shift_w];
1919 *(d0 + d0_signed_linesize * c0 + x) = c0;
1920 *(d1 + d1_signed_linesize * c0 + x) =
c1;
1921 *(d2 + d2_signed_linesize * c0 + x) =
c2;
1924 if (!c0_shift_h || (y & c0_shift_h))
1925 c0_data += c0_linesize;
1926 if (!c1_shift_h || (y & c1_shift_h))
1927 c1_data += c1_linesize;
1928 if (!c2_shift_h || (y & c2_shift_h))
1929 c2_data += c2_linesize;
1930 d0_data += d0_linesize;
1931 d1_data += d1_linesize;
1932 d2_data += d2_linesize;
1935 uint8_t *d0_data =
out->data[plane] + (offset_y + sliceh_start) * d0_linesize + offset_x;
1936 uint8_t *d1_data =
out->data[(plane + 1) %
s->ncomp] + (offset_y + sliceh_start) * d1_linesize + offset_x;
1937 uint8_t *d2_data =
out->data[(plane + 2) %
s->ncomp] + (offset_y + sliceh_start) * d2_linesize + offset_x;
1940 d0_data +=
s->size - 1;
1941 d1_data +=
s->size - 1;
1942 d2_data +=
s->size - 1;
1945 for (y = sliceh_start; y < sliceh_end; y++) {
1946 for (x = 0; x < src_w; x++) {
1947 const int c0 = c0_data[x >> c0_shift_w];
1948 const int c1 = c1_data[x >> c1_shift_w];
1949 const int c2 = c2_data[x >> c2_shift_w];
1952 *(d0_data - c0) = c0;
1953 *(d1_data - c0) =
c1;
1954 *(d2_data - c0) =
c2;
1956 *(d0_data + c0) = c0;
1957 *(d1_data + c0) =
c1;
1958 *(d2_data + c0) =
c2;
1962 if (!c0_shift_h || (y & c0_shift_h))
1963 c0_data += c0_linesize;
1964 if (!c1_shift_h || (y & c1_shift_h))
1965 c1_data += c1_linesize;
1966 if (!c2_shift_h || (y & c2_shift_h))
1967 c2_data += c2_linesize;
1968 d0_data += d0_linesize;
1969 d1_data += d1_linesize;
1970 d2_data += d2_linesize;
1975 #define COLOR_FUNC(name, column, mirror) \
1976 static int color_##name(AVFilterContext *ctx, \
1977 void *arg, int jobnr, \
1980 WaveformContext *s = ctx->priv; \
1981 ThreadData *td = arg; \
1982 AVFrame *in = td->in; \
1983 AVFrame *out = td->out; \
1984 int component = td->component; \
1985 int offset_y = td->offset_y; \
1986 int offset_x = td->offset_x; \
1988 color(s, in, out, component, s->intensity, \
1989 offset_y, offset_x, column, mirror, \
2003 int offset_y,
int offset_x,
2005 int jobnr,
int nb_jobs)
2007 const int plane =
s->desc->comp[component].plane;
2008 const int limit =
s->max - 1;
2010 const int src_h =
in->height;
2011 const int src_w =
in->width;
2012 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
2013 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
2014 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
2015 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
2016 const int c0_shift_h =
s->shift_h[ component + 0 ];
2017 const int c1_shift_h =
s->shift_h[(component + 1) %
s->ncomp];
2018 const int c2_shift_h =
s->shift_h[(component + 2) %
s->ncomp];
2019 const int c0_linesize =
in->linesize[ plane + 0 ] / 2;
2020 const int c1_linesize =
in->linesize[(plane + 1) %
s->ncomp] / 2;
2021 const int c2_linesize =
in->linesize[(plane + 2) %
s->ncomp] / 2;
2022 const uint16_t *c0_data = (
const uint16_t *)
in->data[plane + 0] + (sliceh_start >> c0_shift_h) * c0_linesize;
2023 const uint16_t *c1_data = (
const uint16_t *)
in->data[(plane + 1) %
s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize;
2024 const uint16_t *c2_data = (
const uint16_t *)
in->data[(plane + 2) %
s->ncomp] + (sliceh_start >> c2_shift_h) * c2_linesize;
2025 const int d0_linesize =
out->linesize[ plane + 0 ] / 2;
2026 const int d1_linesize =
out->linesize[(plane + 1) %
s->ncomp] / 2;
2027 const int d2_linesize =
out->linesize[(plane + 2) %
s->ncomp] / 2;
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];
2034 const int d0_signed_linesize = d0_linesize * (
mirror == 1 ? -1 : 1);
2035 const int d1_signed_linesize = d1_linesize * (
mirror == 1 ? -1 : 1);
2036 const int d2_signed_linesize = d2_linesize * (
mirror == 1 ? -1 : 1);
2037 uint16_t *d0_data = (uint16_t *)
out->data[plane] + offset_y * d0_linesize + offset_x;
2038 uint16_t *d1_data = (uint16_t *)
out->data[(plane + 1) %
s->ncomp] + offset_y * d1_linesize + offset_x;
2039 uint16_t *d2_data = (uint16_t *)
out->data[(plane + 2) %
s->ncomp] + offset_y * d2_linesize + offset_x;
2040 uint16_t *
const d0_bottom_line = d0_data + d0_linesize * (
s->size - 1);
2041 uint16_t *
const d0 = (
mirror ? d0_bottom_line : d0_data);
2042 uint16_t *
const d1_bottom_line = d1_data + d1_linesize * (
s->size - 1);
2043 uint16_t *
const d1 = (
mirror ? d1_bottom_line : d1_data);
2044 uint16_t *
const d2_bottom_line = d2_data + d2_linesize * (
s->size - 1);
2045 uint16_t *
const d2 = (
mirror ? d2_bottom_line : d2_data);
2047 for (y = 0; y < src_h; y++) {
2048 for (x = slicew_start; x < slicew_end; x++) {
2049 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit);
2050 const int c1 = c1_data[x >> c1_shift_w];
2051 const int c2 = c2_data[x >> c2_shift_w];
2054 *(d1 + d1_signed_linesize * c0 + x) =
c1;
2055 *(d2 + d2_signed_linesize * c0 + x) =
c2;
2058 if (!c0_shift_h || (y & c0_shift_h))
2059 c0_data += c0_linesize;
2060 if (!c1_shift_h || (y & c1_shift_h))
2061 c1_data += c1_linesize;
2062 if (!c2_shift_h || (y & c2_shift_h))
2063 c2_data += c2_linesize;
2064 d0_data += d0_linesize;
2065 d1_data += d1_linesize;
2066 d2_data += d2_linesize;
2069 uint16_t *d0_data = (uint16_t *)
out->data[plane] + (offset_y + sliceh_start) * d0_linesize + offset_x;
2070 uint16_t *d1_data = (uint16_t *)
out->data[(plane + 1) %
s->ncomp] + (offset_y + sliceh_start) * d1_linesize + offset_x;
2071 uint16_t *d2_data = (uint16_t *)
out->data[(plane + 2) %
s->ncomp] + (offset_y + sliceh_start) * d2_linesize + offset_x;
2074 d0_data +=
s->size - 1;
2075 d1_data +=
s->size - 1;
2076 d2_data +=
s->size - 1;
2079 for (y = sliceh_start; y < sliceh_end; y++) {
2080 for (x = 0; x < src_w; x++) {
2081 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit);
2082 const int c1 = c1_data[x >> c1_shift_w];
2083 const int c2 = c2_data[x >> c2_shift_w];
2087 *(d1_data - c0) =
c1;
2088 *(d2_data - c0) =
c2;
2091 *(d1_data + c0) =
c1;
2092 *(d2_data + c0) =
c2;
2096 if (!c0_shift_h || (y & c0_shift_h))
2097 c0_data += c0_linesize;
2098 if (!c1_shift_h || (y & c1_shift_h))
2099 c1_data += c1_linesize;
2100 if (!c2_shift_h || (y & c2_shift_h))
2101 c2_data += c2_linesize;
2102 d0_data += d0_linesize;
2103 d1_data += d1_linesize;
2104 d2_data += d2_linesize;
2109 #define ACOLOR16_FUNC(name, column, mirror) \
2110 static int acolor16_##name(AVFilterContext *ctx, \
2111 void *arg, int jobnr, \
2114 WaveformContext *s = ctx->priv; \
2115 ThreadData *td = arg; \
2116 AVFrame *in = td->in; \
2117 AVFrame *out = td->out; \
2118 int component = td->component; \
2119 int offset_y = td->offset_y; \
2120 int offset_x = td->offset_x; \
2122 acolor16(s, in, out, component, s->intensity,\
2123 offset_y, offset_x, column, mirror, \
2137 int offset_y,
int offset_x,
2139 int jobnr,
int nb_jobs)
2141 const int plane =
s->desc->comp[component].plane;
2142 const int src_h =
in->height;
2143 const int src_w =
in->width;
2144 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
2145 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
2146 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
2147 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
2148 const int c0_shift_w =
s->shift_w[ component + 0 ];
2149 const int c1_shift_w =
s->shift_w[(component + 1) %
s->ncomp];
2150 const int c2_shift_w =
s->shift_w[(component + 2) %
s->ncomp];
2151 const int c0_shift_h =
s->shift_h[ component + 0 ];
2152 const int c1_shift_h =
s->shift_h[(component + 1) %
s->ncomp];
2153 const int c2_shift_h =
s->shift_h[(component + 2) %
s->ncomp];
2154 const int c0_linesize =
in->linesize[ plane + 0 ];
2155 const int c1_linesize =
in->linesize[(plane + 1) %
s->ncomp];
2156 const int c2_linesize =
in->linesize[(plane + 2) %
s->ncomp];
2157 const uint8_t *c0_data =
in->data[plane + 0] + (sliceh_start >> c0_shift_h) * c0_linesize;
2158 const uint8_t *c1_data =
in->data[(plane + 1) %
s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize;
2159 const uint8_t *c2_data =
in->data[(plane + 2) %
s->ncomp] + (sliceh_start >> c2_shift_h) * c2_linesize;
2160 const int d0_linesize =
out->linesize[ plane + 0 ];
2161 const int d1_linesize =
out->linesize[(plane + 1) %
s->ncomp];
2162 const int d2_linesize =
out->linesize[(plane + 2) %
s->ncomp];
2167 const int d0_signed_linesize = d0_linesize * (
mirror == 1 ? -1 : 1);
2168 const int d1_signed_linesize = d1_linesize * (
mirror == 1 ? -1 : 1);
2169 const int d2_signed_linesize = d2_linesize * (
mirror == 1 ? -1 : 1);
2170 uint8_t *d0_data =
out->data[plane] + offset_y * d0_linesize + offset_x;
2171 uint8_t *d1_data =
out->data[(plane + 1) %
s->ncomp] + offset_y * d1_linesize + offset_x;
2172 uint8_t *d2_data =
out->data[(plane + 2) %
s->ncomp] + offset_y * d2_linesize + offset_x;
2173 uint8_t *
const d0_bottom_line = d0_data + d0_linesize * (
s->size - 1);
2175 uint8_t *
const d1_bottom_line = d1_data + d1_linesize * (
s->size - 1);
2177 uint8_t *
const d2_bottom_line = d2_data + d2_linesize * (
s->size - 1);
2180 for (y = 0; y < src_h; y++) {
2181 for (x = slicew_start; x < slicew_end; x++) {
2182 const int c0 = c0_data[x >> c0_shift_w];
2183 const int c1 = c1_data[x >> c1_shift_w];
2184 const int c2 = c2_data[x >> c2_shift_w];
2187 *(d1 + d1_signed_linesize * c0 + x) =
c1;
2188 *(d2 + d2_signed_linesize * c0 + x) =
c2;
2191 if (!c0_shift_h || (y & c0_shift_h))
2192 c0_data += c0_linesize;
2193 if (!c1_shift_h || (y & c1_shift_h))
2194 c1_data += c1_linesize;
2195 if (!c2_shift_h || (y & c2_shift_h))
2196 c2_data += c2_linesize;
2197 d0_data += d0_linesize;
2198 d1_data += d1_linesize;
2199 d2_data += d2_linesize;
2202 uint8_t *d0_data =
out->data[plane] + (offset_y + sliceh_start) * d0_linesize + offset_x;
2203 uint8_t *d1_data =
out->data[(plane + 1) %
s->ncomp] + (offset_y + sliceh_start) * d1_linesize + offset_x;
2204 uint8_t *d2_data =
out->data[(plane + 2) %
s->ncomp] + (offset_y + sliceh_start) * d2_linesize + offset_x;
2207 d0_data +=
s->size - 1;
2208 d1_data +=
s->size - 1;
2209 d2_data +=
s->size - 1;
2212 for (y = sliceh_start; y < sliceh_end; y++) {
2213 for (x = 0; x < src_w; x++) {
2214 const int c0 = c0_data[x >> c0_shift_w];
2215 const int c1 = c1_data[x >> c1_shift_w];
2216 const int c2 = c2_data[x >> c2_shift_w];
2220 *(d1_data - c0) =
c1;
2221 *(d2_data - c0) =
c2;
2224 *(d1_data + c0) =
c1;
2225 *(d2_data + c0) =
c2;
2229 if (!c0_shift_h || (y & c0_shift_h))
2230 c0_data += c0_linesize;
2231 if (!c1_shift_h || (y & c1_shift_h))
2232 c1_data += c1_linesize;
2233 if (!c2_shift_h || (y & c2_shift_h))
2234 c2_data += c2_linesize;
2235 d0_data += d0_linesize;
2236 d1_data += d1_linesize;
2237 d2_data += d2_linesize;
2242 #define ACOLOR_FUNC(name, column, mirror) \
2243 static int acolor_##name(AVFilterContext *ctx, \
2244 void *arg, int jobnr, \
2247 WaveformContext *s = ctx->priv; \
2248 ThreadData *td = arg; \
2249 AVFrame *in = td->in; \
2250 AVFrame *out = td->out; \
2251 int component = td->component; \
2252 int offset_y = td->offset_y; \
2253 int offset_x = td->offset_x; \
2255 acolor(s, in, out, component, s->intensity, \
2256 offset_y, offset_x, column, mirror, \
2271 { { {
"16", 16+128 }, {
"16", 16+128 }, {
"16", 16+128 }, {
"0", 0+128 } } },
2272 { { {
"128", 128+128 }, {
"128", 128+128 }, {
"128", 128+128 }, {
"128", 128+128 } } },
2273 { { {
"235", 235+128 }, {
"240", 240+128 }, {
"240", 240+128 }, {
"255", 255+128 } } },
2277 { { {
"32", 32+256 }, {
"32", 32+256 }, {
"32", 32+256 }, {
"0", 0+256 } } },
2278 { { {
"256", 256+256 }, {
"256", 256+256 }, {
"256", 256+256 }, {
"256", 256+256 } } },
2279 { { {
"470", 470+256 }, {
"480", 480+256 }, {
"480", 480+256 }, {
"511", 511+256 } } },
2283 { { {
"64", 64+512 }, {
"64", 64+512 }, {
"64", 64+512 }, {
"0", 0+512 } } },
2284 { { {
"512", 512+512 }, {
"512", 512+512 }, {
"512", 512+512 }, {
"512", 512+512 } } },
2285 { { {
"940", 940+512 }, {
"960", 960+512 }, {
"960", 960+512 }, {
"1023", 1023+512 } } },
2289 { { {
"256", 256+2048 }, {
"256", 256+2048 }, {
"256", 256+2048 }, {
"0", 0+2048 } } },
2290 { { {
"2048", 2048+2048 }, {
"2048", 2048+2048 }, {
"2048", 2048+2048 }, {
"2048", 2048+2048 } } },
2291 { { {
"3760", 3760+2048 }, {
"3840", 3840+2048 }, {
"3840", 3840+2048 }, {
"4095", 4095+2048 } } },
2295 { { {
"0", 16+128 }, {
"0", 16+128 }, {
"0", 16+128 }, {
"0", 0+128 } } },
2296 { { {
"175", 71+128 }, {
"175", 72+128 }, {
"175", 72+128 }, {
"175", 64+128 } } },
2297 { { {
"350", 126+128 }, {
"350", 128+128 }, {
"350", 128+128 }, {
"350", 128+128 } } },
2298 { { {
"525", 180+128 }, {
"525", 184+128 }, {
"525", 184+128 }, {
"525", 192+128 } } },
2299 { { {
"700", 235+128 }, {
"700", 240+128 }, {
"700", 240+128 }, {
"700", 255+128 } } },
2303 { { {
"0", 32+256 }, {
"0", 32+256 }, {
"0", 32+256 }, {
"0", 0+256 } } },
2304 { { {
"175", 142+256 }, {
"175", 144+256 }, {
"175", 144+256 }, {
"175", 128+256 } } },
2305 { { {
"350", 251+256 }, {
"350", 256+256 }, {
"350", 256+256 }, {
"350", 256+256 } } },
2306 { { {
"525", 361+256 }, {
"525", 368+256 }, {
"525", 368+256 }, {
"525", 384+256 } } },
2307 { { {
"700", 470+256 }, {
"700", 480+256 }, {
"700", 480+256 }, {
"700", 511+256 } } },
2311 { { {
"0", 64+512 }, {
"0", 64+512 }, {
"0", 64+512 }, {
"0", 0+512 } } },
2312 { { {
"175", 283+512 }, {
"175", 288+512 }, {
"175", 288+512 }, {
"175", 256+512 } } },
2313 { { {
"350", 502+512 }, {
"350", 512+512 }, {
"350", 512+512 }, {
"350", 512+512 } } },
2314 { { {
"525", 721+512 }, {
"525", 736+512 }, {
"525", 736+512 }, {
"525", 768+512 } } },
2315 { { {
"700", 940+512 }, {
"700", 960+512 }, {
"700", 960+512 }, {
"700", 1023+512 } } },
2319 { { {
"0", 256+2048 }, {
"0", 256+2048 }, {
"0", 256+2048 }, {
"0", 0+2048 } } },
2320 { { {
"175", 1132+2048 }, {
"175", 1152+2048 }, {
"175", 1152+2048 }, {
"175", 1024+2048 } } },
2321 { { {
"350", 2008+2048 }, {
"350", 2048+2048 }, {
"350", 2048+2048 }, {
"350", 2048+2048 } } },
2322 { { {
"525", 2884+2048 }, {
"525", 2944+2048 }, {
"525", 2944+2048 }, {
"525", 3072+2048 } } },
2323 { { {
"700", 3760+2048 }, {
"700", 3840+2048 }, {
"700", 3840+2048 }, {
"700", 4095+2048 } } },
2327 { { {
"-25", -39+128 }, {
"-25", -40+128 }, {
"-25", -40+128 }, {
"-25", -64+128 } } },
2328 { { {
"0", 16+128 }, {
"0", 16+128 }, {
"0", 16+128 }, {
"0", 0+128 } } },
2329 { { {
"25", 71+128 }, {
"25", 72+128 }, {
"25", 72+128 }, {
"25", 64+128 } } },
2330 { { {
"50", 126+128 }, {
"50", 128+128 }, {
"50", 128+128 }, {
"50", 128+128 } } },
2331 { { {
"75", 180+128 }, {
"75", 184+128 }, {
"75", 184+128 }, {
"75", 192+128 } } },
2332 { { {
"100", 235+128 }, {
"100", 240+128 }, {
"100", 240+128 }, {
"100", 256+128 } } },
2333 { { {
"125", 290+128 }, {
"125", 296+128 }, {
"125", 296+128 }, {
"125", 320+128 } } },
2337 { { {
"-25", -78+256 }, {
"-25", -80+256 }, {
"-25", -80+256 }, {
"-25",-128+256 } } },
2338 { { {
"0", 32+256 }, {
"0", 32+256 }, {
"0", 32+256 }, {
"0", 0+256 } } },
2339 { { {
"25", 142+256 }, {
"25", 144+256 }, {
"25", 144+256 }, {
"25", 128+256 } } },
2340 { { {
"50", 251+256 }, {
"50", 256+256 }, {
"50", 256+256 }, {
"50", 256+256 } } },
2341 { { {
"75", 361+256 }, {
"75", 368+256 }, {
"75", 368+256 }, {
"75", 384+256 } } },
2342 { { {
"100", 470+256 }, {
"100", 480+256 }, {
"100", 480+256 }, {
"100", 512+256 } } },
2343 { { {
"125", 580+256 }, {
"125", 592+256 }, {
"125", 592+256 }, {
"125", 640+256 } } },
2347 { { {
"-25",-156+512 }, {
"-25",-160+512 }, {
"-25",-160+512 }, {
"-25", -256+512 } } },
2348 { { {
"0", 64+512 }, {
"0", 64+512 }, {
"0", 64+512 }, {
"0", 0+512 } } },
2349 { { {
"25", 283+512 }, {
"25", 288+512 }, {
"25", 288+512 }, {
"25", 256+512 } } },
2350 { { {
"50", 502+512 }, {
"50", 512+512 }, {
"50", 512+512 }, {
"50", 512+512 } } },
2351 { { {
"75", 721+512 }, {
"75", 736+512 }, {
"75", 736+512 }, {
"75", 768+512 } } },
2352 { { {
"100", 940+512 }, {
"100", 960+512 }, {
"100", 960+512 }, {
"100", 1024+512 } } },
2353 { { {
"125",1160+512 }, {
"125",1184+512 }, {
"125",1184+512 }, {
"125", 1280+512 } } },
2357 { { {
"-25", -624+2048 }, {
"-25", -640+2048 }, {
"-25", -640+2048 }, {
"-25",-1024+2048 } } },
2358 { { {
"0", 256+2048 }, {
"0", 256+2048 }, {
"0", 256+2048 }, {
"0", 0+2048 } } },
2359 { { {
"25", 1132+2048 }, {
"25", 1152+2048 }, {
"25", 1152+2048 }, {
"25", 1024+2048 } } },
2360 { { {
"50", 2008+2048 }, {
"50", 2048+2048 }, {
"50", 2048+2048 }, {
"50", 2048+2048 } } },
2361 { { {
"75", 2884+2048 }, {
"75", 2944+2048 }, {
"75", 2944+2048 }, {
"75", 3072+2048 } } },
2362 { { {
"100", 3760+2048 }, {
"100", 3840+2048 }, {
"100", 3840+2048 }, {
"100", 4096+2048 } } },
2363 { { {
"125", 4640+2048 }, {
"125", 4736+2048 }, {
"125", 4736+2048 }, {
"125", 5120+2048 } } },
2367 { { {
"16", 16+256 }, {
"16", 16+256 }, {
"16", 16+256 }, {
"0", 0+256 } } },
2368 { { {
"128", 128+256 }, {
"128", 128+256 }, {
"128", 128+256 }, {
"128", 128+256 } } },
2369 { { {
"235", 235+256 }, {
"240", 240+256 }, {
"240", 240+256 }, {
"255", 255+256 } } },
2373 { { {
"32", 32+512 }, {
"32", 32+512 }, {
"32", 32+512 }, {
"0", 0+512 } } },
2374 { { {
"256", 256+512 }, {
"256", 256+512 }, {
"256", 256+512 }, {
"256", 256+512 } } },
2375 { { {
"470", 470+512 }, {
"480", 480+512 }, {
"480", 480+512 }, {
"511", 511+512 } } },
2379 { { {
"64", 64+1024 }, {
"64", 64+1024 }, {
"64", 64+1024 }, {
"0", 0+1024 } } },
2380 { { {
"512", 512+1024 }, {
"512", 512+1024 }, {
"512", 512+1024 }, {
"512", 512+1024 } } },
2381 { { {
"940", 940+1024 }, {
"960", 960+1024 }, {
"960", 960+1024 }, {
"1023", 1023+1024 } } },
2385 { { {
"256", 256+4096 }, {
"256", 256+4096 }, {
"256", 256+4096 }, {
"0", 0+4096 } } },
2386 { { {
"2048", 2048+4096 }, {
"2048", 2048+4096 }, {
"2048", 2048+4096 }, {
"2048", 2048+4096 } } },
2387 { { {
"3760", 3760+4096 }, {
"3840", 3840+4096 }, {
"3840", 3840+4096 }, {
"4095", 4095+4096 } } },
2391 { { {
"0", 16+256 }, {
"0", 16+256 }, {
"0", 16+256 }, {
"0", 0+256 } } },
2392 { { {
"175", 71+256 }, {
"175", 72+256 }, {
"175", 72+256 }, {
"175", 64+256 } } },
2393 { { {
"350", 126+256 }, {
"350", 128+256 }, {
"350", 128+256 }, {
"350", 128+256 } } },
2394 { { {
"525", 180+256 }, {
"525", 184+256 }, {
"525", 184+256 }, {
"525", 192+256 } } },
2395 { { {
"700", 235+256 }, {
"700", 240+256 }, {
"700", 240+256 }, {
"700", 255+256 } } },
2399 { { {
"0", 32+512 }, {
"0", 32+512 }, {
"0", 32+512 }, {
"0", 0+512 } } },
2400 { { {
"175", 142+512 }, {
"175", 144+512 }, {
"175", 144+512 }, {
"175", 128+512 } } },
2401 { { {
"350", 251+512 }, {
"350", 256+512 }, {
"350", 256+512 }, {
"350", 256+512 } } },
2402 { { {
"525", 361+512 }, {
"525", 368+512 }, {
"525", 368+512 }, {
"525", 384+512 } } },
2403 { { {
"700", 470+512 }, {
"700", 480+512 }, {
"700", 480+512 }, {
"700", 511+512 } } },
2407 { { {
"0", 64+1024 }, {
"0", 64+1024 }, {
"0", 64+1024 }, {
"0", 0+1024 } } },
2408 { { {
"175", 283+1024 }, {
"175", 288+1024 }, {
"175", 288+1024 }, {
"175", 256+1024 } } },
2409 { { {
"350", 502+1024 }, {
"350", 512+1024 }, {
"350", 512+1024 }, {
"350", 512+1024 } } },
2410 { { {
"525", 721+1024 }, {
"525", 736+1024 }, {
"525", 736+1024 }, {
"525", 768+1024 } } },
2411 { { {
"700", 940+1024 }, {
"700", 960+1024 }, {
"700", 960+1024 }, {
"700", 1023+1024 } } },
2415 { { {
"0", 256+4096 }, {
"0", 256+4096 }, {
"0", 256+4096 }, {
"0", 0+4096 } } },
2416 { { {
"175", 1132+4096 }, {
"175", 1152+4096 }, {
"175", 1152+4096 }, {
"175", 1024+4096 } } },
2417 { { {
"350", 2008+4096 }, {
"350", 2048+4096 }, {
"350", 2048+4096 }, {
"350", 2048+4096 } } },
2418 { { {
"525", 2884+4096 }, {
"525", 2944+4096 }, {
"525", 2944+4096 }, {
"525", 3072+4096 } } },
2419 { { {
"700", 3760+4096 }, {
"700", 3840+4096 }, {
"700", 3840+4096 }, {
"700", 4095+4096 } } },
2423 { { {
"-25", -39+256 }, {
"-25", -40+256 }, {
"-25", -40+256 }, {
"-25", -64+256 } } },
2424 { { {
"0", 16+256 }, {
"0", 16+256 }, {
"0", 16+256 }, {
"0", 0+256 } } },
2425 { { {
"25", 71+256 }, {
"25", 72+256 }, {
"25", 72+256 }, {
"25", 64+256 } } },
2426 { { {
"50", 126+256 }, {
"50", 128+256 }, {
"50", 128+256 }, {
"50", 128+256 } } },
2427 { { {
"75", 180+256 }, {
"75", 184+256 }, {
"75", 184+256 }, {
"75", 192+256 } } },
2428 { { {
"100", 235+256 }, {
"100", 240+256 }, {
"100", 240+256 }, {
"100", 256+256 } } },
2429 { { {
"125", 290+256 }, {
"125", 296+256 }, {
"125", 296+256 }, {
"125", 320+256 } } },
2433 { { {
"-25", -78+512 }, {
"-25", -80+512 }, {
"-25", -80+512 }, {
"-25",-128+512 } } },
2434 { { {
"0", 32+512 }, {
"0", 32+512 }, {
"0", 32+512 }, {
"0", 0+512 } } },
2435 { { {
"25", 142+512 }, {
"25", 144+512 }, {
"25", 144+512 }, {
"25", 128+512 } } },
2436 { { {
"50", 251+512 }, {
"50", 256+512 }, {
"50", 256+512 }, {
"50", 256+512 } } },
2437 { { {
"75", 361+512 }, {
"75", 368+512 }, {
"75", 368+512 }, {
"75", 384+512 } } },
2438 { { {
"100", 470+512 }, {
"100", 480+512 }, {
"100", 480+512 }, {
"100", 512+512 } } },
2439 { { {
"125", 580+512 }, {
"125", 592+512 }, {
"125", 592+512 }, {
"125", 640+512 } } },
2443 { { {
"-25",-156+1024 }, {
"-25",-160+1024 }, {
"-25",-160+1024 }, {
"-25", -256+1024 } } },
2444 { { {
"0", 64+1024 }, {
"0", 64+1024 }, {
"0", 64+1024 }, {
"0", 0+1024 } } },
2445 { { {
"25", 283+1024 }, {
"25", 288+1024 }, {
"25", 288+1024 }, {
"25", 256+1024 } } },
2446 { { {
"50", 502+1024 }, {
"50", 512+1024 }, {
"50", 512+1024 }, {
"50", 512+1024 } } },
2447 { { {
"75", 721+1024 }, {
"75", 736+1024 }, {
"75", 736+1024 }, {
"75", 768+1024 } } },
2448 { { {
"100", 940+1024 }, {
"100", 960+1024 }, {
"100", 960+1024 }, {
"100", 1024+1024 } } },
2449 { { {
"125",1160+1024 }, {
"125",1184+1024 }, {
"125",1184+1024 }, {
"125", 1280+1024 } } },
2453 { { {
"-25", -624+4096 }, {
"-25", -640+4096 }, {
"-25", -640+4096 }, {
"-25",-1024+4096 } } },
2454 { { {
"0", 256+4096 }, {
"0", 256+4096 }, {
"0", 256+4096 }, {
"0", 0+4096 } } },
2455 { { {
"25", 1132+4096 }, {
"25", 1152+4096 }, {
"25", 1152+4096 }, {
"25", 1024+4096 } } },
2456 { { {
"50", 2008+4096 }, {
"50", 2048+4096 }, {
"50", 2048+4096 }, {
"50", 2048+4096 } } },
2457 { { {
"75", 2884+4096 }, {
"75", 2944+4096 }, {
"75", 2944+4096 }, {
"75", 3072+4096 } } },
2458 { { {
"100", 3760+4096 }, {
"100", 3840+4096 }, {
"100", 3840+4096 }, {
"100", 4096+4096 } } },
2459 { { {
"125", 4640+4096 }, {
"125", 4736+4096 }, {
"125", 4736+4096 }, {
"125", 5120+4096 } } },
2463 { { {
"16", 16 }, {
"16", 16 }, {
"16", 16 }, {
"0", 0 } } },
2464 { { {
"128", 128 }, {
"128", 128 }, {
"128", 128 }, {
"128", 128 } } },
2465 { { {
"235", 235 }, {
"240", 240 }, {
"240", 240 }, {
"255", 255 } } },
2469 { { {
"32", 32 }, {
"32", 32 }, {
"32", 32 }, {
"0", 0 } } },
2470 { { {
"256", 256 }, {
"256", 256 }, {
"256", 256 }, {
"256", 256 } } },
2471 { { {
"470", 470 }, {
"480", 480 }, {
"480", 480 }, {
"511", 511 } } },
2475 { { {
"64", 64 }, {
"64", 64 }, {
"64", 64 }, {
"0", 0 } } },
2476 { { {
"512", 512 }, {
"512", 512 }, {
"512", 512 }, {
"512", 512 } } },
2477 { { {
"940", 940 }, {
"960", 960 }, {
"960", 960 }, {
"1023", 1023 } } },
2481 { { {
"256", 256 }, {
"256", 256 }, {
"256", 256 }, {
"0", 0 } } },
2482 { { {
"2048", 2048 }, {
"2048", 2048 }, {
"2048", 2048 }, {
"2048", 2048 } } },
2483 { { {
"3760", 3760 }, {
"3840", 3840 }, {
"3840", 3840 }, {
"4095", 4095 } } },
2487 { { {
"0", 16 }, {
"0", 16 }, {
"0", 16 }, {
"0", 0 } } },
2488 { { {
"175", 71 }, {
"175", 72 }, {
"175", 72 }, {
"175", 64 } } },
2489 { { {
"350", 126 }, {
"350", 128 }, {
"350", 128 }, {
"350", 128 } } },
2490 { { {
"525", 180 }, {
"525", 184 }, {
"525", 184 }, {
"525", 192 } } },
2491 { { {
"700", 235 }, {
"700", 240 }, {
"700", 240 }, {
"700", 255 } } },
2495 { { {
"0", 32 }, {
"0", 32 }, {
"0", 32 }, {
"0", 0 } } },
2496 { { {
"175", 142 }, {
"175", 144 }, {
"175", 144 }, {
"175", 128 } } },
2497 { { {
"350", 251 }, {
"350", 256 }, {
"350", 256 }, {
"350", 256 } } },
2498 { { {
"525", 361 }, {
"525", 368 }, {
"525", 368 }, {
"525", 384 } } },
2499 { { {
"700", 470 }, {
"700", 480 }, {
"700", 480 }, {
"700", 511 } } },
2503 { { {
"0", 64 }, {
"0", 64 }, {
"0", 64 }, {
"0", 0 } } },
2504 { { {
"175", 283 }, {
"175", 288 }, {
"175", 288 }, {
"175", 256 } } },
2505 { { {
"350", 502 }, {
"350", 512 }, {
"350", 512 }, {
"350", 512 } } },
2506 { { {
"525", 721 }, {
"525", 736 }, {
"525", 736 }, {
"525", 768 } } },
2507 { { {
"700", 940 }, {
"700", 960 }, {
"700", 960 }, {
"700", 1023 } } },
2511 { { {
"0", 256 }, {
"0", 256 }, {
"0", 256 }, {
"0", 0 } } },
2512 { { {
"175", 1132 }, {
"175", 1152 }, {
"175", 1152 }, {
"175", 1024 } } },
2513 { { {
"350", 2008 }, {
"350", 2048 }, {
"350", 2048 }, {
"350", 2048 } } },
2514 { { {
"525", 2884 }, {
"525", 2944 }, {
"525", 2944 }, {
"525", 3072 } } },
2515 { { {
"700", 3760 }, {
"700", 3840 }, {
"700", 3840 }, {
"700", 4095 } } },
2519 { { {
"0", 16 }, {
"0", 16 }, {
"0", 16 }, {
"0", 0 } } },
2520 { { {
"25", 71 }, {
"25", 72 }, {
"25", 72 }, {
"25", 64 } } },
2521 { { {
"50", 126 }, {
"50", 128 }, {
"50", 128 }, {
"50", 128 } } },
2522 { { {
"75", 180 }, {
"75", 184 }, {
"75", 184 }, {
"75", 192 } } },
2523 { { {
"100", 235 }, {
"100", 240 }, {
"100", 240 }, {
"100", 255 } } },
2527 { { {
"0", 32 }, {
"0", 32 }, {
"0", 32 }, {
"0", 0 } } },
2528 { { {
"25", 142 }, {
"25", 144 }, {
"25", 144 }, {
"25", 128 } } },
2529 { { {
"50", 251 }, {
"50", 256 }, {
"50", 256 }, {
"50", 256 } } },
2530 { { {
"75", 361 }, {
"75", 368 }, {
"75", 368 }, {
"75", 384 } } },
2531 { { {
"100", 470 }, {
"100", 480 }, {
"100", 480 }, {
"100", 511 } } },
2535 { { {
"0", 64 }, {
"0", 64 }, {
"0", 64 }, {
"0", 0 } } },
2536 { { {
"25", 283 }, {
"25", 288 }, {
"25", 288 }, {
"25", 256 } } },
2537 { { {
"50", 502 }, {
"50", 512 }, {
"50", 512 }, {
"50", 512 } } },
2538 { { {
"75", 721 }, {
"75", 736 }, {
"75", 736 }, {
"75", 768 } } },
2539 { { {
"100", 940 }, {
"100", 960 }, {
"100", 960 }, {
"100", 1023 } } },
2543 { { {
"0", 256 }, {
"0", 256 }, {
"0", 256 }, {
"0", 0 } } },
2544 { { {
"25", 1132 }, {
"25", 1152 }, {
"25", 1152 }, {
"25", 1024 } } },
2545 { { {
"50", 2008 }, {
"50", 2048 }, {
"50", 2048 }, {
"50", 2048 } } },
2546 { { {
"75", 2884 }, {
"75", 2944 }, {
"75", 2944 }, {
"75", 3072 } } },
2547 { { {
"100", 3760 }, {
"100", 3840 }, {
"100", 3840 }, {
"100", 4095 } } },
2551 { { {
"50", 50 }, {
"50", 50 }, {
"50", 50 }, {
"50", 50 } } },
2552 { { {
"100", 100 }, {
"100", 100 }, {
"100", 100 }, {
"100", 100 } } },
2553 { { {
"150", 150 }, {
"150", 150 }, {
"150", 150 }, {
"150", 150 } } },
2554 { { {
"200", 200 }, {
"200", 200 }, {
"200", 200 }, {
"200", 200 } } },
2555 { { {
"255", 255 }, {
"255", 255 }, {
"255", 255 }, {
"255", 255 } } },
2559 { { {
"100", 100 }, {
"100", 100 }, {
"100", 100 }, {
"100", 100 } } },
2560 { { {
"200", 200 }, {
"200", 200 }, {
"200", 200 }, {
"200", 200 } } },
2561 { { {
"300", 300 }, {
"300", 300 }, {
"300", 300 }, {
"300", 300 } } },
2562 { { {
"400", 400 }, {
"400", 400 }, {
"400", 400 }, {
"400", 400 } } },
2563 { { {
"500", 500 }, {
"500", 500 }, {
"500", 500 }, {
"500", 500 } } },
2567 { { {
"200", 200 }, {
"200", 200 }, {
"200", 200 }, {
"200", 200 } } },
2568 { { {
"400", 400 }, {
"400", 400 }, {
"400", 400 }, {
"400", 400 } } },
2569 { { {
"600", 600 }, {
"600", 600 }, {
"600", 600 }, {
"600", 600 } } },
2570 { { {
"800", 800 }, {
"800", 800 }, {
"800", 800 }, {
"800", 800 } } },
2571 { { {
"1000",1000 }, {
"1000",1000 }, {
"1000",1000 }, {
"1000",1000 } } },
2575 { { {
"800", 800 }, {
"800", 800 }, {
"800", 800 }, {
"800", 800 } } },
2576 { { {
"1600", 1600 }, {
"1600", 1600 }, {
"1600", 1600 }, {
"1600", 1600 } } },
2577 { { {
"2400", 2400 }, {
"2400", 2400 }, {
"2400", 2400 }, {
"2400", 2400 } } },
2578 { { {
"3200", 3200 }, {
"3200", 3200 }, {
"3200", 3200 }, {
"3200", 3200 } } },
2579 { { {
"4000", 4000 }, {
"4000", 4000 }, {
"4000", 4000 }, {
"4000", 4000 } } },
2587 dst[0] = v * o1 + dst[0] * o2;
2589 dst += linesize *
step;
2595 uint16_t *dst = (uint16_t *)ddst;
2599 dst[0] = v * o1 + dst[0] * o2;
2601 dst += (linesize / 2) *
step;
2610 dst[x] = v * o1 + dst[x] * o2;
2616 uint16_t *dst = (uint16_t *)ddst;
2620 dst[x] = v * o1 + dst[x] * o2;
2632 for (plane = 0; plane < 4 &&
out->data[plane]; plane++) {
2633 for (
i = 0; txt[
i];
i++) {
2635 int v =
color[plane];
2637 uint8_t *p =
out->data[plane] + y *
out->linesize[plane] + (x +
i * 8);
2638 for (char_y = 0; char_y < font_height; char_y++) {
2640 if (font[txt[
i] * font_height + char_y] &
mask)
2641 p[0] = p[0] * o2 + v * o1;
2644 p +=
out->linesize[plane] - 8;
2658 for (plane = 0; plane < 4 &&
out->data[plane]; plane++) {
2659 for (
i = 0; txt[
i];
i++) {
2663 uint16_t *p = (uint16_t *)(
out->data[plane] + y *
out->linesize[plane]) + (x +
i * 8);
2664 for (char_y = 0; char_y < font_height; char_y++) {
2666 if (font[txt[
i] * font_height + char_y] &
mask)
2667 p[0] = p[0] * o2 + v * o1;
2670 p +=
out->linesize[plane] / 2 - 8;
2684 for (plane = 0; plane < 4 &&
out->data[plane]; plane++) {
2685 for (
i = 0; txt[
i];
i++) {
2687 int v =
color[plane];
2689 for (char_y = font_height - 1; char_y >= 0; char_y--) {
2690 uint8_t *p =
out->data[plane] + (y +
i * 10) *
out->linesize[plane] + x;
2692 if (font[txt[
i] * font_height + font_height - 1 - char_y] &
mask)
2693 p[char_y] = p[char_y] * o2 + v * o1;
2694 p +=
out->linesize[plane];
2709 for (plane = 0; plane < 4 &&
out->data[plane]; plane++) {
2710 for (
i = 0; txt[
i];
i++) {
2714 for (char_y = 0; char_y < font_height; char_y++) {
2715 uint16_t *p = (uint16_t *)(
out->data[plane] + (y +
i * 10) *
out->linesize[plane]) + x;
2717 if (font[txt[
i] * font_height + font_height - 1 - char_y] &
mask)
2718 p[char_y] = p[char_y] * o2 + v * o1;
2719 p +=
out->linesize[plane] / 2;
2731 dst[0] = (v - dst[0]) * o1 + dst[0] * o2;
2733 dst += linesize *
step;
2739 uint16_t *dst = (uint16_t *)ddst;
2743 dst[0] = (v - dst[0]) * o1 + dst[0] * o2;
2745 dst += (linesize / 2) *
step;
2754 dst[x] = (v - dst[x]) * o1 + dst[x] * o2;
2760 uint16_t *dst = (uint16_t *)ddst;
2764 dst[x] = (v - dst[x]) * o1 + dst[x] * o2;
2776 for (plane = 0; plane < 4 &&
out->data[plane]; plane++) {
2777 for (
i = 0; txt[
i];
i++) {
2779 int v =
color[plane];
2781 uint8_t *p =
out->data[plane] + y *
out->linesize[plane] + (x +
i * 8);
2782 for (char_y = 0; char_y < font_height; char_y++) {
2784 if (font[txt[
i] * font_height + char_y] &
mask)
2785 p[0] = p[0] * o2 + (v - p[0]) * o1;
2788 p +=
out->linesize[plane] - 8;
2802 for (plane = 0; plane < 4 &&
out->data[plane]; plane++) {
2803 for (
i = 0; txt[
i];
i++) {
2807 uint16_t *p = (uint16_t *)(
out->data[plane] + y *
out->linesize[plane]) + (x +
i * 8);
2808 for (char_y = 0; char_y < font_height; char_y++) {
2810 if (font[txt[
i] * font_height + char_y] &
mask)
2811 p[0] = p[0] * o2 + (v - p[0]) * o1;
2814 p +=
out->linesize[plane] / 2 - 8;
2828 for (plane = 0; plane < 4 &&
out->data[plane]; plane++) {
2829 for (
i = 0; txt[
i];
i++) {
2831 int v =
color[plane];
2833 for (char_y = font_height - 1; char_y >= 0; char_y--) {
2834 uint8_t *p =
out->data[plane] + (y +
i * 10) *
out->linesize[plane] + x;
2836 if (font[txt[
i] * font_height + font_height - 1 - char_y] &
mask)
2837 p[char_y] = p[char_y] * o2 + (v - p[char_y]) * o1;
2838 p +=
out->linesize[plane];
2853 for (plane = 0; plane < 4 &&
out->data[plane]; plane++) {
2854 for (
i = 0; txt[
i];
i++) {
2858 for (char_y = 0; char_y < font_height; char_y++) {
2859 uint16_t *p = (uint16_t *)(
out->data[plane] + (y +
i * 10) *
out->linesize[plane]) + x;
2861 if (font[txt[
i] * font_height + font_height - 1 - char_y] &
mask)
2862 p[char_y] = p[char_y] * o2 + (v - p[char_y]) * o1;
2863 p +=
out->linesize[plane] / 2;
2876 const int step = (
s->flags & 2) + 1;
2877 const float o1 =
s->opacity;
2878 const float o2 = 1. - o1;
2880 int C, k = 0,
c, p, l, offset_x = 0, offset_y = 0;
2882 for (
c = 0;
c <
s->ncomp;
c++) {
2883 if (!((1 <<
c) &
s->pcomp) || (!
s->display && k > 0))
2888 for (p = 0; p <
s->ncomp; p++) {
2889 const int v =
s->grat_yuva_color[p];
2890 for (l = 0; l <
s->nb_glines; l++) {
2891 const uint16_t
pos =
s->glines[l].line[
C].pos;
2892 int x = offset_x + (
s->mirror ?
s->size - 1 -
pos :
pos);
2893 uint8_t *dst =
out->data[p] + offset_y *
out->linesize[p] + x;
2899 for (l = 0; l <
s->nb_glines && (
s->flags & 1); l++) {
2900 const char *
name =
s->glines[l].line[
C].name;
2901 const uint16_t
pos =
s->glines[l].line[
C].pos;
2902 int x = offset_x + (
s->mirror ?
s->size - 1 -
pos :
pos) - 10;
2907 s->draw_text(
out, x, offset_y + 2, 1, o1, o2,
name,
s->grat_yuva_color);
2910 offset_x +=
s->size * (
s->display ==
STACK);
2917 const int step = (
s->flags & 2) + 1;
2918 const float o1 =
s->opacity;
2919 const float o2 = 1. - o1;
2920 const int mult =
s->max / 256;
2922 int C, k = 0,
c, p, l, offset_x = 0, offset_y = 0;
2924 for (
c = 0;
c <
s->ncomp;
c++) {
2925 if (!((1 <<
c) &
s->pcomp) || (!
s->display && k > 0))
2930 for (p = 0; p <
s->ncomp; p++) {
2931 const int v =
s->grat_yuva_color[p] *
mult;
2932 for (l = 0; l <
s->nb_glines ; l++) {
2933 const uint16_t
pos =
s->glines[l].line[
C].pos;
2934 int x = offset_x + (
s->mirror ?
s->size - 1 -
pos :
pos);
2941 for (l = 0; l <
s->nb_glines && (
s->flags & 1); l++) {
2942 const char *
name =
s->glines[l].line[
C].name;
2943 const uint16_t
pos =
s->glines[l].line[
C].pos;
2944 int x = offset_x + (
s->mirror ?
s->size - 1 -
pos :
pos) - 10;
2949 s->draw_text(
out, x, offset_y + 2,
mult, o1, o2,
name,
s->grat_yuva_color);
2952 offset_x +=
s->size * (
s->display ==
STACK);
2959 const int step = (
s->flags & 2) + 1;
2960 const float o1 =
s->opacity;
2961 const float o2 = 1. - o1;
2963 int C, k = 0,
c, p, l, offset_y = 0, offset_x = 0;
2965 for (
c = 0;
c <
s->ncomp;
c++) {
2966 if ((!((1 <<
c) &
s->pcomp) || (!
s->display && k > 0)))
2971 for (p = 0; p <
s->ncomp; p++) {
2972 const int v =
s->grat_yuva_color[p];
2973 for (l = 0; l <
s->nb_glines ; l++) {
2974 const uint16_t
pos =
s->glines[l].line[
C].pos;
2975 int y = offset_y + (
s->mirror ?
s->size - 1 -
pos :
pos);
2976 uint8_t *dst =
out->data[p] + y *
out->linesize[p] + offset_x;
2978 s->blend_line(dst,
width, 1, o1, o2, v,
step);
2982 for (l = 0; l <
s->nb_glines && (
s->flags & 1); l++) {
2983 const char *
name =
s->glines[l].line[
C].name;
2984 const uint16_t
pos =
s->glines[l].line[
C].pos;
2985 int y = offset_y + (
s->mirror ?
s->size - 1 -
pos :
pos) - 10;
2990 s->draw_text(
out, 2 + offset_x, y, 1, o1, o2,
name,
s->grat_yuva_color);
2993 offset_y +=
s->size * (
s->display ==
STACK);
3000 const int step = (
s->flags & 2) + 1;
3001 const float o1 =
s->opacity;
3002 const float o2 = 1. - o1;
3003 const int mult =
s->max / 256;
3005 int C, k = 0,
c, p, l, offset_x = 0, offset_y = 0;
3007 for (
c = 0;
c <
s->ncomp;
c++) {
3008 if ((!((1 <<
c) &
s->pcomp) || (!
s->display && k > 0)))
3013 for (p = 0; p <
s->ncomp; p++) {
3014 const int v =
s->grat_yuva_color[p] *
mult;
3015 for (l = 0; l <
s->nb_glines ; l++) {
3016 const uint16_t
pos =
s->glines[l].line[
C].pos;
3017 int y = offset_y + (
s->mirror ?
s->size - 1 -
pos :
pos);
3020 s->blend_line(dst,
width, 1, o1, o2, v,
step);
3024 for (l = 0; l <
s->nb_glines && (
s->flags & 1); l++) {
3025 const char *
name =
s->glines[l].line[
C].name;
3026 const uint16_t
pos =
s->glines[l].line[
C].pos;
3027 int y = offset_y + (
s->mirror ?
s->size - 1 -
pos:
pos) - 10;
3032 s->draw_text(
out, 2 + offset_x, y,
mult, o1, o2,
name,
s->grat_yuva_color);
3035 offset_y +=
s->size * (
s->display ==
STACK);
3046 s->ncomp =
s->desc->nb_components;
3047 s->bits =
s->desc->comp[0].depth;
3048 s->max = 1 <<
s->bits;
3049 s->intensity =
s->fintensity * (
s->max - 1);
3051 s->shift_w[0] =
s->shift_w[3] = 0;
3052 s->shift_h[0] =
s->shift_h[3] = 0;
3053 s->shift_w[1] =
s->shift_w[2] =
s->desc->log2_chroma_w;
3054 s->shift_h[1] =
s->shift_h[2] =
s->desc->log2_chroma_h;
3058 switch (
s->filter) {
3061 case AFLAT:
s->size = 256 * 2;
break;
3062 case FLAT:
s->size = 256 * 3;
break;
3063 default:
s->size = 256;
break;
3066 switch (
s->filter | ((
s->bits > 8) << 4) |
3067 (
s->mode << 8) | (
s->mirror << 12)) {
3068 case 0x1100:
s->waveform_slice = lowpass_column_mirror;
break;
3069 case 0x1000:
s->waveform_slice = lowpass_row_mirror;
break;
3070 case 0x0100:
s->waveform_slice = lowpass_column;
break;
3071 case 0x0000:
s->waveform_slice = lowpass_row;
break;
3072 case 0x1110:
s->waveform_slice = lowpass16_column_mirror;
break;
3073 case 0x1010:
s->waveform_slice = lowpass16_row_mirror;
break;
3074 case 0x0110:
s->waveform_slice = lowpass16_column;
break;
3075 case 0x0010:
s->waveform_slice = lowpass16_row;
break;
3076 case 0x1101:
s->waveform_slice = flat_column_mirror;
break;
3077 case 0x1001:
s->waveform_slice = flat_row_mirror;
break;
3078 case 0x0101:
s->waveform_slice = flat_column;
break;
3079 case 0x0001:
s->waveform_slice = flat_row;
break;
3080 case 0x1111:
s->waveform_slice = flat16_column_mirror;
break;
3081 case 0x1011:
s->waveform_slice = flat16_row_mirror;
break;
3082 case 0x0111:
s->waveform_slice = flat16_column;
break;
3083 case 0x0011:
s->waveform_slice = flat16_row;
break;
3084 case 0x1102:
s->waveform_slice = aflat_column_mirror;
break;
3085 case 0x1002:
s->waveform_slice = aflat_row_mirror;
break;
3086 case 0x0102:
s->waveform_slice = aflat_column;
break;
3087 case 0x0002:
s->waveform_slice = aflat_row;
break;
3088 case 0x1112:
s->waveform_slice = aflat16_column_mirror;
break;
3089 case 0x1012:
s->waveform_slice = aflat16_row_mirror;
break;
3090 case 0x0112:
s->waveform_slice = aflat16_column;
break;
3091 case 0x0012:
s->waveform_slice = aflat16_row;
break;
3092 case 0x1103:
s->waveform_slice = chroma_column_mirror;
break;
3093 case 0x1003:
s->waveform_slice = chroma_row_mirror;
break;
3094 case 0x0103:
s->waveform_slice = chroma_column;
break;
3095 case 0x0003:
s->waveform_slice = chroma_row;
break;
3096 case 0x1113:
s->waveform_slice = chroma16_column_mirror;
break;
3097 case 0x1013:
s->waveform_slice = chroma16_row_mirror;
break;
3098 case 0x0113:
s->waveform_slice = chroma16_column;
break;
3099 case 0x0013:
s->waveform_slice = chroma16_row;
break;
3100 case 0x1104:
s->waveform_slice = color_column_mirror;
break;
3101 case 0x1004:
s->waveform_slice = color_row_mirror;
break;
3102 case 0x0104:
s->waveform_slice = color_column;
break;
3103 case 0x0004:
s->waveform_slice = color_row;
break;
3104 case 0x1114:
s->waveform_slice = color16_column_mirror;
break;
3105 case 0x1014:
s->waveform_slice = color16_row_mirror;
break;
3106 case 0x0114:
s->waveform_slice = color16_column;
break;
3107 case 0x0014:
s->waveform_slice = color16_row;
break;
3108 case 0x1105:
s->waveform_slice = acolor_column_mirror;
break;
3109 case 0x1005:
s->waveform_slice = acolor_row_mirror;
break;
3110 case 0x0105:
s->waveform_slice = acolor_column;
break;
3111 case 0x0005:
s->waveform_slice = acolor_row;
break;
3112 case 0x1115:
s->waveform_slice = acolor16_column_mirror;
break;
3113 case 0x1015:
s->waveform_slice = acolor16_row_mirror;
break;
3114 case 0x0115:
s->waveform_slice = acolor16_column;
break;
3115 case 0x0015:
s->waveform_slice = acolor16_row;
break;
3116 case 0x1106:
s->waveform_slice = xflat_column_mirror;
break;
3117 case 0x1006:
s->waveform_slice = xflat_row_mirror;
break;
3118 case 0x0106:
s->waveform_slice = xflat_column;
break;
3119 case 0x0006:
s->waveform_slice = xflat_row;
break;
3120 case 0x1116:
s->waveform_slice = xflat16_column_mirror;
break;
3121 case 0x1016:
s->waveform_slice = xflat16_row_mirror;
break;
3122 case 0x0116:
s->waveform_slice = xflat16_column;
break;
3123 case 0x0016:
s->waveform_slice = xflat16_row;
break;
3124 case 0x1107:
s->waveform_slice = yflat_column_mirror;
break;
3125 case 0x1007:
s->waveform_slice = yflat_row_mirror;
break;
3126 case 0x0107:
s->waveform_slice = yflat_column;
break;
3127 case 0x0007:
s->waveform_slice = yflat_row;
break;
3128 case 0x1117:
s->waveform_slice = yflat16_column_mirror;
break;
3129 case 0x1017:
s->waveform_slice = yflat16_row_mirror;
break;
3130 case 0x0117:
s->waveform_slice = yflat16_column;
break;
3131 case 0x0017:
s->waveform_slice = yflat16_row;
break;
3134 s->grat_yuva_color[0] = 255;
3135 s->grat_yuva_color[1] =
s->graticule ==
GRAT_INVERT ? 255 : 0;
3137 s->grat_yuva_color[3] = 255;
3153 switch (
s->filter) {
3164 else if (
s->graticule >
GRAT_NONE &&
s->mode == 0)
3169 switch (
s->filter) {
3288 s->size =
s->size << (
s->bits - 8);
3290 s->tint[0] = .5f * (
s->ftint[0] + 1.f) * (
s->size - 1);
3291 s->tint[1] = .5f * (
s->ftint[1] + 1.f) * (
s->size - 1);
3293 switch (
inlink->format) {
3306 s->bg_color[3] *=
s->bgopacity;
3318 for (
i = 0;
i <
s->ncomp;
i++) {
3319 if ((1 <<
i) &
s->pcomp)
3327 s->dcomp =
s->odesc->nb_components;
3345 for (p = 0; p <
s->ncomp; p++) {
3346 const int plane =
s->desc->comp[p].plane;
3349 if (!((1 << p) &
s->pcomp))
3352 for (k = 0; k < 4; k++) {
3353 s->emax[plane][k] =
s->peak +
size * (plane * 4 + k + 0);
3354 s->emin[plane][k] =
s->peak +
size * (plane * 4 + k + 16);
3359 s->eend[plane] = (
offset +
s->size - 1);
3361 for (k = 0; k < 4; k++) {
3362 s->emax[plane][k][
i] =
s->estart[plane];
3363 s->emin[plane][k][
i] =
s->eend[plane];
3389 for (k = 0; k <
s->dcomp; k++) {
3391 for (
i = 0;
i < outlink->
h ;
i++)
3392 memset(
out->data[
s->odesc->comp[k].plane] +
3393 i *
out->linesize[
s->odesc->comp[k].plane],
3394 s->bg_color[k], outlink->
w);
3396 const int mult =
s->max / 256;
3397 uint16_t *dst = (uint16_t *)
out->data[
s->odesc->comp[k].plane];
3399 for (
i = 0;
i < outlink->
h ;
i++) {
3400 for (j = 0; j < outlink->
w; j++)
3401 dst[j] =
s->bg_color[k] *
mult;
3402 dst +=
out->linesize[
s->odesc->comp[k].plane] / 2;
3407 for (k = 0,
i = 0; k <
s->ncomp; k++) {
3408 if ((1 << k) &
s->pcomp) {
3409 const int plane =
s->desc->comp[k].plane;
3415 offset_x =
s->mode ?
i++ *
inlink->w : 0;
3416 offset_y =
s->mode ? 0 :
i++ *
inlink->h;
3418 offset_y =
s->mode ?
i++ *
s->size * !!
s->display : 0;
3419 offset_x =
s->mode ? 0 :
i++ *
s->size * !!
s->display;
3425 td.offset_y = offset_y;
3426 td.offset_x = offset_x;
3428 switch (
s->filter) {
3439 envelope(
s,
out, plane, plane,
s->mode ? offset_x : offset_y);
3445 envelope(
s,
out, plane, plane,
s->mode ? offset_x : offset_y);
3446 envelope(
s,
out, plane, (plane + 1) %
s->ncomp,
s->mode ? offset_x : offset_y);
3449 envelope16(
s,
out, plane, (plane + 1) %
s->ncomp,
s->mode ? offset_x : offset_y);
3456 envelope(
s,
out, plane, (plane + 0) %
s->ncomp,
s->mode ? offset_x : offset_y);
3457 envelope(
s,
out, plane, (plane + 1) %
s->ncomp,
s->mode ? offset_x : offset_y);
3458 envelope(
s,
out, plane, (plane + 2) %
s->ncomp,
s->mode ? offset_x : offset_y);
3460 envelope16(
s,
out, plane, (plane + 0) %
s->ncomp,
s->mode ? offset_x : offset_y);
3461 envelope16(
s,
out, plane, (plane + 1) %
s->ncomp,
s->mode ? offset_x : offset_y);
3462 envelope16(
s,
out, plane, (plane + 2) %
s->ncomp,
s->mode ? offset_x : offset_y);
3468 s->graticulef(
s,
out);
3504 .priv_class = &waveform_class,