126 int jobnr,
int nb_jobs);
131 float o1,
float o2,
const char *txt,
132 const uint8_t
color[4]);
137 #define OFFSET(x) offsetof(WaveformContext, x)
138 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
139 #define TFLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
201 {
"all",
"try to select from all available formats", 0,
AV_OPT_TYPE_CONST, {.i64=0}, 0, 0,
FLAGS,
"input" },
330 if (!
ctx->inputs[0]->incfg.formats ||
331 !
ctx->inputs[0]->incfg.formats->nb_formats) {
347 if (!
ctx->inputs[0]->outcfg.formats) {
352 avff =
ctx->inputs[0]->incfg.formats;
353 avff2 =
ctx->inputs[0]->outcfg.formats;
359 depth =
desc->comp[0].depth;
361 if (
ncomp != ncomp2 || depth != depth2)
366 depth !=
desc->comp[0].depth)
378 else if (
rgb && depth == 8 &&
ncomp > 2)
380 else if (
rgb && depth == 9 &&
ncomp > 2)
382 else if (
rgb && depth == 10 &&
ncomp > 2)
384 else if (
rgb && depth == 12 &&
ncomp > 2)
386 else if (depth == 8 &&
ncomp > 2)
388 else if (depth == 9 &&
ncomp > 2)
390 else if (depth == 10 &&
ncomp > 2)
392 else if (depth == 12 &&
ncomp > 2)
404 const int dst_linesize =
out->linesize[component] / 2;
405 const int bg =
s->bg_color[component] * (
s->max / 256);
406 const int limit =
s->max - 1;
407 const int dst_h =
s->display ==
PARADE ?
out->height /
s->acomp :
out->height;
408 const int dst_w =
s->display ==
PARADE ?
out->width /
s->acomp :
out->width;
409 const int start =
s->estart[plane];
410 const int end =
s->eend[plane];
416 for (y = start; y < end; y++) {
417 dst = (uint16_t *)
out->data[component] + y * dst_linesize + x;
423 for (y = end - 1; y >= start; y--) {
424 dst = (uint16_t *)
out->data[component] + y * dst_linesize + x;
433 dst = (uint16_t *)
out->data[component] + y * dst_linesize;
434 for (x = start; x < end; x++) {
440 for (x = end - 1; x >= start; x--) {
452 const int dst_linesize =
out->linesize[component];
453 const uint8_t bg =
s->bg_color[component];
454 const int dst_h =
s->display ==
PARADE ?
out->height /
s->acomp :
out->height;
455 const int dst_w =
s->display ==
PARADE ?
out->width /
s->acomp :
out->width;
456 const int start =
s->estart[plane];
457 const int end =
s->eend[plane];
463 for (y = start; y < end; y++) {
464 dst =
out->data[component] + y * dst_linesize + x;
470 for (y = end - 1; y >= start; y--) {
471 dst =
out->data[component] + y * dst_linesize + x;
480 dst =
out->data[component] + y * dst_linesize;
481 for (x = start; x < end; x++) {
487 for (x = end - 1; x >= start; x--) {
499 const int dst_linesize =
out->linesize[component] / 2;
500 const int bg =
s->bg_color[component] * (
s->max / 256);
501 const int limit =
s->max - 1;
502 const int dst_h =
s->display ==
PARADE ?
out->height /
s->acomp :
out->height;
503 const int dst_w =
s->display ==
PARADE ?
out->width /
s->acomp :
out->width;
504 const int start =
s->estart[plane];
505 const int end =
s->eend[plane];
506 int *
emax =
s->emax[plane][component];
507 int *
emin =
s->emin[plane][component];
513 for (y = start; y < end && y <
emin[x -
offset]; y++) {
514 dst = (uint16_t *)
out->data[component] + y * dst_linesize + x;
520 for (y = end - 1; y >= start && y >=
emax[x -
offset]; y--) {
521 dst = (uint16_t *)
out->data[component] + y * dst_linesize + x;
529 if (
s->envelope == 3)
533 dst = (uint16_t *)
out->data[component] +
emin[x -
offset] * dst_linesize + x;
535 dst = (uint16_t *)
out->data[component] +
emax[x -
offset] * dst_linesize + x;
540 dst = (uint16_t *)
out->data[component] + y * dst_linesize;
547 for (x = end - 1; x >= start && x >=
emax[y -
offset]; x--) {
555 if (
s->envelope == 3)
559 dst = (uint16_t *)
out->data[component] + y * dst_linesize +
emin[y -
offset];
561 dst = (uint16_t *)
out->data[component] + y * dst_linesize +
emax[y -
offset];
569 const int dst_linesize =
out->linesize[component];
570 const int bg =
s->bg_color[component];
571 const int dst_h =
s->display ==
PARADE ?
out->height /
s->acomp :
out->height;
572 const int dst_w =
s->display ==
PARADE ?
out->width /
s->acomp :
out->width;
573 const int start =
s->estart[plane];
574 const int end =
s->eend[plane];
575 int *
emax =
s->emax[plane][component];
576 int *
emin =
s->emin[plane][component];
582 for (y = start; y < end && y <
emin[x -
offset]; y++) {
583 dst =
out->data[component] + y * dst_linesize + x;
589 for (y = end - 1; y >= start && y >=
emax[x -
offset]; y--) {
590 dst =
out->data[component] + y * dst_linesize + x;
598 if (
s->envelope == 3)
602 dst =
out->data[component] +
emin[x -
offset] * dst_linesize + x;
604 dst =
out->data[component] +
emax[x -
offset] * dst_linesize + x;
609 dst =
out->data[component] + y * dst_linesize;
610 for (x = start; x < end && x <
emin[y -
offset]; x++) {
616 for (x = end - 1; x >= start && x >=
emax[y -
offset]; x--) {
624 if (
s->envelope == 3)
628 dst =
out->data[component] + y * dst_linesize +
emin[y -
offset];
630 dst =
out->data[component] + y * dst_linesize +
emax[y -
offset];
638 if (
s->envelope == 0) {
640 }
else if (
s->envelope == 1) {
649 if (
s->envelope == 0) {
651 }
else if (
s->envelope == 1) {
693 int offset_y,
int offset_x,
695 int jobnr,
int nb_jobs)
697 const int plane =
s->desc->comp[component].plane;
698 const int dplane = (
s->rgb ||
s->display ==
OVERLAY) ? plane : 0;
699 const int shift_w =
s->shift_w[component];
700 const int shift_h =
s->shift_h[component];
701 const int src_linesize = in->
linesize[plane] / 2;
702 const int dst_linesize =
out->linesize[dplane] / 2;
703 const int dst_signed_linesize = dst_linesize * (
mirror == 1 ? -1 : 1);
704 const int limit =
s->max - 1;
708 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
709 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
710 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
711 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
713 const uint16_t *src_data = (
const uint16_t *)in->
data[plane] + sliceh_start * src_linesize;
714 uint16_t *dst_data = (uint16_t *)
out->data[dplane] + (offset_y + sliceh_start *
step) * dst_linesize + offset_x;
715 uint16_t *
const dst_bottom_line = dst_data + dst_linesize * (
s->size - 1);
716 uint16_t *
const dst_line = (
mirror ? dst_bottom_line : dst_data);
723 for (y = sliceh_start; y < sliceh_end; y++) {
724 const uint16_t *src_data_end = src_data + slicew_end;
725 uint16_t *dst = dst_line + slicew_start *
step;
727 for (p = src_data + slicew_start; p < src_data_end; p++) {
733 target = dst++ + dst_signed_linesize * v;
735 }
while (++
i <
step);
737 uint16_t *row = dst_data;
740 target = row - v - 1;
745 }
while (++
i <
step);
748 src_data += src_linesize;
749 dst_data += dst_linesize *
step;
752 if (
s->display !=
OVERLAY && column && !
s->rgb &&
out->data[1] &&
out->data[2]) {
753 const int mult =
s->max / 256;
754 const int bg =
s->bg_color[0] *
mult;
755 const int t0 =
s->tint[0];
756 const int t1 =
s->tint[1];
757 uint16_t *dst0, *dst1;
761 src = (
const uint16_t *)(
out->data[0]) + offset_y * dst_linesize + offset_x;
762 dst0 = (uint16_t *)(
out->data[1]) + offset_y * dst_linesize + offset_x;
763 dst1 = (uint16_t *)(
out->data[2]) + offset_y * dst_linesize + offset_x;
764 for (y = 0; y <
s->max; y++) {
765 for (x = slicew_start *
step; x < slicew_end *
step; x++) {
773 dst0 += dst_linesize;
774 dst1 += dst_linesize;
776 }
else if (
s->display !=
OVERLAY && !
s->rgb &&
out->data[1] &&
out->data[2]) {
777 const int mult =
s->max / 256;
778 const int bg =
s->bg_color[0] *
mult;
779 const int t0 =
s->tint[0];
780 const int t1 =
s->tint[1];
781 uint16_t *dst0, *dst1;
785 src = (
const uint16_t *)
out->data[0] + (offset_y + sliceh_start *
step) * dst_linesize + offset_x;
786 dst0 = (uint16_t *)(
out->data[1]) + (offset_y + sliceh_start *
step) * dst_linesize + offset_x;
787 dst1 = (uint16_t *)(
out->data[2]) + (offset_y + sliceh_start *
step) * dst_linesize + offset_x;
788 for (y = sliceh_start *
step; y < sliceh_end *
step; y++) {
789 for (x = 0; x <
s->max; x++) {
797 dst0 += dst_linesize;
798 dst1 += dst_linesize;
803 #define LOWPASS16_FUNC(name, column, mirror) \
804 static int lowpass16_##name(AVFilterContext *ctx, \
805 void *arg, int jobnr, \
808 WaveformContext *s = ctx->priv; \
809 ThreadData *td = arg; \
810 AVFrame *in = td->in; \
811 AVFrame *out = td->out; \
812 int component = td->component; \
813 int offset_y = td->offset_y; \
814 int offset_x = td->offset_x; \
816 lowpass16(s, in, out, component, s->intensity, \
817 offset_y, offset_x, column, mirror, \
831 int offset_y,
int offset_x,
833 int jobnr,
int nb_jobs)
835 const int plane =
s->desc->comp[component].plane;
836 const int dplane = (
s->rgb ||
s->display ==
OVERLAY) ? plane : 0;
837 const int shift_w =
s->shift_w[component];
838 const int shift_h =
s->shift_h[component];
839 const int src_linesize = in->linesize[plane];
840 const int dst_linesize =
out->linesize[dplane];
841 const int dst_signed_linesize = dst_linesize * (
mirror == 1 ? -1 : 1);
845 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
846 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
847 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
848 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
850 const uint8_t *src_data = in->data[plane] + sliceh_start * src_linesize;
851 uint8_t *dst_data =
out->data[dplane] + (offset_y + sliceh_start *
step) * dst_linesize + offset_x;
852 uint8_t *
const dst_bottom_line = dst_data + dst_linesize * (
s->size - 1);
853 uint8_t *
const dst_line = (
mirror ? dst_bottom_line : dst_data);
860 for (y = sliceh_start; y < sliceh_end; y++) {
861 const uint8_t *src_data_end = src_data + slicew_end;
862 uint8_t *dst = dst_line + slicew_start *
step;
864 for (p = src_data + slicew_start; p < src_data_end; p++) {
870 target = dst++ + dst_signed_linesize * *p;
872 }
while (++
i <
step);
874 uint8_t *row = dst_data;
877 target = row - *p - 1;
882 }
while (++
i <
step);
885 src_data += src_linesize;
886 dst_data += dst_linesize *
step;
889 if (
s->display !=
OVERLAY && column && !
s->rgb &&
out->data[1] &&
out->data[2]) {
890 const int bg =
s->bg_color[0];
891 const int dst_h = 256;
892 const int t0 =
s->tint[0];
893 const int t1 =
s->tint[1];
894 uint8_t *dst0, *dst1;
898 src =
out->data[0] + offset_y * dst_linesize + offset_x;
899 dst0 =
out->data[1] + offset_y * dst_linesize + offset_x;
900 dst1 =
out->data[2] + offset_y * dst_linesize + offset_x;
901 for (y = 0; y < dst_h; y++) {
902 for (x = slicew_start *
step; x < slicew_end *
step; x++) {
910 dst0 += dst_linesize;
911 dst1 += dst_linesize;
913 }
else if (
s->display !=
OVERLAY && !
s->rgb &&
out->data[1] &&
out->data[2]) {
914 const int bg =
s->bg_color[0];
915 const int dst_w = 256;
916 const int t0 =
s->tint[0];
917 const int t1 =
s->tint[1];
918 uint8_t *dst0, *dst1;
922 src =
out->data[0] + (offset_y + sliceh_start *
step) * dst_linesize + offset_x;
923 dst0 =
out->data[1] + (offset_y + sliceh_start *
step) * dst_linesize + offset_x;
924 dst1 =
out->data[2] + (offset_y + sliceh_start *
step) * dst_linesize + offset_x;
925 for (y = sliceh_start *
step; y < sliceh_end *
step; y++) {
926 for (x = 0; x < dst_w; x++) {
934 dst0 += dst_linesize;
935 dst1 += dst_linesize;
940 #define LOWPASS_FUNC(name, column, mirror) \
941 static int lowpass_##name(AVFilterContext *ctx, \
942 void *arg, int jobnr, \
945 WaveformContext *s = ctx->priv; \
946 ThreadData *td = arg; \
947 AVFrame *in = td->in; \
948 AVFrame *out = td->out; \
949 int component = td->component; \
950 int offset_y = td->offset_y; \
951 int offset_x = td->offset_x; \
953 lowpass(s, in, out, component, s->intensity, \
954 offset_y, offset_x, column, mirror, \
968 int offset_y,
int offset_x,
970 int jobnr,
int nb_jobs)
972 const int plane =
s->desc->comp[component].plane;
973 const int c0_linesize = in->linesize[ plane + 0 ] / 2;
974 const int c1_linesize = in->linesize[(plane + 1) %
s->ncomp] / 2;
975 const int c2_linesize = in->linesize[(plane + 2) %
s->ncomp] / 2;
976 const int c0_shift_w =
s->shift_w[ component + 0 ];
977 const int c1_shift_w =
s->shift_w[(component + 1) %
s->ncomp];
978 const int c2_shift_w =
s->shift_w[(component + 2) %
s->ncomp];
979 const int c0_shift_h =
s->shift_h[ component + 0 ];
980 const int c1_shift_h =
s->shift_h[(component + 1) %
s->ncomp];
981 const int c2_shift_h =
s->shift_h[(component + 2) %
s->ncomp];
982 const int d0_linesize =
out->linesize[ plane + 0 ] / 2;
983 const int d1_linesize =
out->linesize[(plane + 1) %
s->ncomp] / 2;
984 const int limit =
s->max - 1;
986 const int mid =
s->max / 2;
987 const int src_h = in->height;
988 const int src_w = in->width;
989 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
990 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
991 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
992 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
996 const int d0_signed_linesize = d0_linesize * (
mirror == 1 ? -1 : 1);
997 const int d1_signed_linesize = d1_linesize * (
mirror == 1 ? -1 : 1);
999 for (x = slicew_start; x < slicew_end; x++) {
1000 const uint16_t *c0_data = (uint16_t *)in->data[plane + 0];
1001 const uint16_t *c1_data = (uint16_t *)in->data[(plane + 1) %
s->ncomp];
1002 const uint16_t *c2_data = (uint16_t *)in->data[(plane + 2) %
s->ncomp];
1003 uint16_t *d0_data = (uint16_t *)(
out->data[plane]) + offset_y * d0_linesize + offset_x;
1004 uint16_t *d1_data = (uint16_t *)(
out->data[(plane + 1) %
s->ncomp]) + offset_y * d1_linesize + offset_x;
1005 uint16_t *
const d0_bottom_line = d0_data + d0_linesize * (
s->size - 1);
1006 uint16_t *
const d0 = (
mirror ? d0_bottom_line : d0_data);
1007 uint16_t *
const d1_bottom_line = d1_data + d1_linesize * (
s->size - 1);
1008 uint16_t *
const d1 = (
mirror ? d1_bottom_line : d1_data);
1010 for (y = 0; y < src_h; y++) {
1011 const int c0 =
FFMIN(c0_data[x >> c0_shift_w],
limit) +
s->max;
1012 const int c1 =
FFMIN(
FFABS(c1_data[x >> c1_shift_w] - mid) +
FFABS(c2_data[x >> c2_shift_w] - mid),
limit);
1015 target = d0 + x + d0_signed_linesize * c0;
1017 target = d1 + x + d1_signed_linesize * (c0 -
c1);
1019 target = d1 + x + d1_signed_linesize * (c0 +
c1);
1022 if (!c0_shift_h || (y & c0_shift_h))
1023 c0_data += c0_linesize;
1024 if (!c1_shift_h || (y & c1_shift_h))
1025 c1_data += c1_linesize;
1026 if (!c2_shift_h || (y & c2_shift_h))
1027 c2_data += c2_linesize;
1028 d0_data += d0_linesize;
1029 d1_data += d1_linesize;
1033 const uint16_t *c0_data = (uint16_t *)(in->data[plane]) + (sliceh_start >> c0_shift_h) * c0_linesize;
1034 const uint16_t *c1_data = (uint16_t *)(in->data[(plane + 1) %
s->ncomp]) + (sliceh_start >> c1_shift_h) * c1_linesize;
1035 const uint16_t *c2_data = (uint16_t *)(in->data[(plane + 2) %
s->ncomp]) + (sliceh_start >> c2_shift_h) * c2_linesize;
1036 uint16_t *d0_data = (uint16_t *)(
out->data[plane]) + (offset_y + sliceh_start) * d0_linesize + offset_x;
1037 uint16_t *d1_data = (uint16_t *)(
out->data[(plane + 1) %
s->ncomp]) + (offset_y + sliceh_start) * d1_linesize + offset_x;
1040 d0_data +=
s->size - 1;
1041 d1_data +=
s->size - 1;
1044 for (y = sliceh_start; y < sliceh_end; y++) {
1045 for (x = 0; x < src_w; x++) {
1046 const int c0 =
FFMIN(c0_data[x >> c0_shift_w],
limit) +
s->max;
1047 const int c1 =
FFMIN(
FFABS(c1_data[x >> c1_shift_w] - mid) +
FFABS(c2_data[x >> c2_shift_w] - mid),
limit);
1051 target = d0_data - c0;
1053 target = d1_data - (c0 -
c1);
1055 target = d1_data - (c0 +
c1);
1058 target = d0_data + c0;
1060 target = d1_data + (c0 -
c1);
1062 target = d1_data + (c0 +
c1);
1067 if (!c0_shift_h || (y & c0_shift_h))
1068 c0_data += c0_linesize;
1069 if (!c1_shift_h || (y & c1_shift_h))
1070 c1_data += c1_linesize;
1071 if (!c2_shift_h || (y & c2_shift_h))
1072 c2_data += c2_linesize;
1073 d0_data += d0_linesize;
1074 d1_data += d1_linesize;
1079 #define FLAT16_FUNC(name, column, mirror) \
1080 static int flat16_##name(AVFilterContext *ctx, \
1081 void *arg, int jobnr, \
1084 WaveformContext *s = ctx->priv; \
1085 ThreadData *td = arg; \
1086 AVFrame *in = td->in; \
1087 AVFrame *out = td->out; \
1088 int component = td->component; \
1089 int offset_y = td->offset_y; \
1090 int offset_x = td->offset_x; \
1092 flat16(s, in, out, component, s->intensity, \
1093 offset_y, offset_x, column, mirror, \
1107 int offset_y,
int offset_x,
1109 int jobnr,
int nb_jobs)
1111 const int plane =
s->desc->comp[component].plane;
1112 const int c0_linesize = in->linesize[ plane + 0 ];
1113 const int c1_linesize = in->linesize[(plane + 1) %
s->ncomp];
1114 const int c2_linesize = in->linesize[(plane + 2) %
s->ncomp];
1115 const int c0_shift_w =
s->shift_w[ component + 0 ];
1116 const int c1_shift_w =
s->shift_w[(component + 1) %
s->ncomp];
1117 const int c2_shift_w =
s->shift_w[(component + 2) %
s->ncomp];
1118 const int c0_shift_h =
s->shift_h[ component + 0 ];
1119 const int c1_shift_h =
s->shift_h[(component + 1) %
s->ncomp];
1120 const int c2_shift_h =
s->shift_h[(component + 2) %
s->ncomp];
1121 const int d0_linesize =
out->linesize[ plane + 0 ];
1122 const int d1_linesize =
out->linesize[(plane + 1) %
s->ncomp];
1124 const int src_h = in->height;
1125 const int src_w = in->width;
1126 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
1127 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
1128 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
1129 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
1133 const int d0_signed_linesize = d0_linesize * (
mirror == 1 ? -1 : 1);
1134 const int d1_signed_linesize = d1_linesize * (
mirror == 1 ? -1 : 1);
1136 for (x = slicew_start; x < slicew_end; x++) {
1137 const uint8_t *c0_data = in->data[plane + 0];
1138 const uint8_t *c1_data = in->data[(plane + 1) %
s->ncomp];
1139 const uint8_t *c2_data = in->data[(plane + 2) %
s->ncomp];
1140 uint8_t *d0_data =
out->data[plane] + offset_y * d0_linesize + offset_x;
1141 uint8_t *d1_data =
out->data[(plane + 1) %
s->ncomp] + offset_y * d1_linesize + offset_x;
1142 uint8_t *
const d0_bottom_line = d0_data + d0_linesize * (
s->size - 1);
1143 uint8_t *
const d0 = (
mirror ? d0_bottom_line : d0_data);
1144 uint8_t *
const d1_bottom_line = d1_data + d1_linesize * (
s->size - 1);
1145 uint8_t *
const d1 = (
mirror ? d1_bottom_line : d1_data);
1147 for (y = 0; y < src_h; y++) {
1148 const int c0 = c0_data[x >> c0_shift_w] + 256;
1149 const int c1 =
FFABS(c1_data[x >> c1_shift_w] - 128) +
FFABS(c2_data[x >> c2_shift_w] - 128);
1152 target = d0 + x + d0_signed_linesize * c0;
1154 target = d1 + x + d1_signed_linesize * (c0 -
c1);
1156 target = d1 + x + d1_signed_linesize * (c0 +
c1);
1159 if (!c0_shift_h || (y & c0_shift_h))
1160 c0_data += c0_linesize;
1161 if (!c1_shift_h || (y & c1_shift_h))
1162 c1_data += c1_linesize;
1163 if (!c2_shift_h || (y & c2_shift_h))
1164 c2_data += c2_linesize;
1165 d0_data += d0_linesize;
1166 d1_data += d1_linesize;
1170 const uint8_t *c0_data = in->data[plane] + (sliceh_start >> c0_shift_h) * c0_linesize;
1171 const uint8_t *c1_data = in->data[(plane + 1) %
s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize;
1172 const uint8_t *c2_data = in->data[(plane + 2) %
s->ncomp] + (sliceh_start >> c2_shift_h) * c2_linesize;
1173 uint8_t *d0_data =
out->data[plane] + (offset_y + sliceh_start) * d0_linesize + offset_x;
1174 uint8_t *d1_data =
out->data[(plane + 1) %
s->ncomp] + (offset_y + sliceh_start) * d1_linesize + offset_x;
1177 d0_data +=
s->size - 1;
1178 d1_data +=
s->size - 1;
1181 for (y = sliceh_start; y < sliceh_end; y++) {
1182 for (x = 0; x < src_w; x++) {
1183 const int c0 = c0_data[x >> c0_shift_w] + 256;
1184 const int c1 =
FFABS(c1_data[x >> c1_shift_w] - 128) +
FFABS(c2_data[x >> c2_shift_w] - 128);
1188 target = d0_data - c0;
1190 target = d1_data - (c0 -
c1);
1192 target = d1_data - (c0 +
c1);
1195 target = d0_data + c0;
1197 target = d1_data + (c0 -
c1);
1199 target = d1_data + (c0 +
c1);
1204 if (!c0_shift_h || (y & c0_shift_h))
1205 c0_data += c0_linesize;
1206 if (!c1_shift_h || (y & c1_shift_h))
1207 c1_data += c1_linesize;
1208 if (!c2_shift_h || (y & c2_shift_h))
1209 c2_data += c2_linesize;
1210 d0_data += d0_linesize;
1211 d1_data += d1_linesize;
1216 #define FLAT_FUNC(name, column, mirror) \
1217 static int flat_##name(AVFilterContext *ctx, \
1218 void *arg, int jobnr, \
1221 WaveformContext *s = ctx->priv; \
1222 ThreadData *td = arg; \
1223 AVFrame *in = td->in; \
1224 AVFrame *out = td->out; \
1225 int component = td->component; \
1226 int offset_y = td->offset_y; \
1227 int offset_x = td->offset_x; \
1229 flat(s, in, out, component, s->intensity, \
1230 offset_y, offset_x, column, mirror, \
1241 #define AFLAT16(name, update_cb, update_cr, column, mirror) \
1242 static int name(AVFilterContext *ctx, \
1243 void *arg, int jobnr, \
1246 WaveformContext *s = ctx->priv; \
1247 ThreadData *td = arg; \
1248 AVFrame *in = td->in; \
1249 AVFrame *out = td->out; \
1250 int component = td->component; \
1251 int offset_y = td->offset_y; \
1252 int offset_x = td->offset_x; \
1253 const int intensity = s->intensity; \
1254 const int plane = s->desc->comp[component].plane; \
1255 const int c0_linesize = in->linesize[ plane + 0 ] / 2; \
1256 const int c1_linesize = in->linesize[(plane + 1) % s->ncomp] / 2; \
1257 const int c2_linesize = in->linesize[(plane + 2) % s->ncomp] / 2; \
1258 const int c0_shift_w = s->shift_w[ component + 0 ]; \
1259 const int c1_shift_w = s->shift_w[(component + 1) % s->ncomp]; \
1260 const int c2_shift_w = s->shift_w[(component + 2) % s->ncomp]; \
1261 const int c0_shift_h = s->shift_h[ component + 0 ]; \
1262 const int c1_shift_h = s->shift_h[(component + 1) % s->ncomp]; \
1263 const int c2_shift_h = s->shift_h[(component + 2) % s->ncomp]; \
1264 const int d0_linesize = out->linesize[ plane + 0 ] / 2; \
1265 const int d1_linesize = out->linesize[(plane + 1) % s->ncomp] / 2; \
1266 const int d2_linesize = out->linesize[(plane + 2) % s->ncomp] / 2; \
1267 const int limit = s->max - 1; \
1268 const int max = limit - intensity; \
1269 const int mid = s->max / 2; \
1270 const int src_h = in->height; \
1271 const int src_w = in->width; \
1272 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0; \
1273 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h; \
1274 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0; \
1275 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w; \
1279 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1); \
1280 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1); \
1281 const int d2_signed_linesize = d2_linesize * (mirror == 1 ? -1 : 1); \
1283 for (x = slicew_start; x < slicew_end; x++) { \
1284 const uint16_t *c0_data = (uint16_t *)in->data[plane + 0]; \
1285 const uint16_t *c1_data = (uint16_t *)in->data[(plane + 1) % s->ncomp]; \
1286 const uint16_t *c2_data = (uint16_t *)in->data[(plane + 2) % s->ncomp]; \
1287 uint16_t *d0_data = (uint16_t *)out->data[plane] + offset_y * d0_linesize + offset_x; \
1288 uint16_t *d1_data = (uint16_t *)out->data[(plane + 1) % s->ncomp] + offset_y * d1_linesize + offset_x; \
1289 uint16_t *d2_data = (uint16_t *)out->data[(plane + 2) % s->ncomp] + offset_y * d2_linesize + offset_x; \
1290 uint16_t * const d0_bottom_line = d0_data + d0_linesize * (s->size - 1); \
1291 uint16_t * const d0 = (mirror ? d0_bottom_line : d0_data); \
1292 uint16_t * const d1_bottom_line = d1_data + d1_linesize * (s->size - 1); \
1293 uint16_t * const d1 = (mirror ? d1_bottom_line : d1_data); \
1294 uint16_t * const d2_bottom_line = d2_data + d2_linesize * (s->size - 1); \
1295 uint16_t * const d2 = (mirror ? d2_bottom_line : d2_data); \
1297 for (y = 0; y < src_h; y++) { \
1298 const int c0 = FFMIN(c0_data[x >> c0_shift_w], limit) + mid; \
1299 const int c1 = FFMIN(c1_data[x >> c1_shift_w], limit) - mid; \
1300 const int c2 = FFMIN(c2_data[x >> c2_shift_w], limit) - mid; \
1303 target = d0 + x + d0_signed_linesize * c0; \
1304 update16(target, max, intensity, limit); \
1306 target = d1 + x + d1_signed_linesize * (c0 + c1); \
1307 update_cb(target, max, intensity, limit); \
1309 target = d2 + x + d2_signed_linesize * (c0 + c2); \
1310 update_cr(target, max, intensity, limit); \
1312 if (!c0_shift_h || (y & c0_shift_h)) \
1313 c0_data += c0_linesize; \
1314 if (!c1_shift_h || (y & c1_shift_h)) \
1315 c1_data += c1_linesize; \
1316 if (!c2_shift_h || (y & c2_shift_h)) \
1317 c2_data += c2_linesize; \
1318 d0_data += d0_linesize; \
1319 d1_data += d1_linesize; \
1320 d2_data += d2_linesize; \
1324 const uint16_t *c0_data = (uint16_t *)in->data[plane] + (sliceh_start >> c0_shift_h) * c0_linesize; \
1325 const uint16_t *c1_data = (uint16_t *)in->data[(plane + 1) % s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize; \
1326 const uint16_t *c2_data = (uint16_t *)in->data[(plane + 2) % s->ncomp] + (sliceh_start >> c2_shift_h) * c2_linesize; \
1327 uint16_t *d0_data = (uint16_t *)out->data[plane] + (offset_y + sliceh_start) * d0_linesize + offset_x; \
1328 uint16_t *d1_data = (uint16_t *)out->data[(plane + 1) % s->ncomp] + (offset_y + sliceh_start) * d1_linesize + offset_x; \
1329 uint16_t *d2_data = (uint16_t *)out->data[(plane + 2) % s->ncomp] + (offset_y + sliceh_start) * d2_linesize + offset_x; \
1332 d0_data += s->size - 1; \
1333 d1_data += s->size - 1; \
1334 d2_data += s->size - 1; \
1337 for (y = sliceh_start; y < sliceh_end; y++) { \
1338 for (x = 0; x < src_w; x++) { \
1339 const int c0 = FFMIN(c0_data[x >> c0_shift_w], limit) + mid; \
1340 const int c1 = FFMIN(c1_data[x >> c1_shift_w], limit) - mid; \
1341 const int c2 = FFMIN(c2_data[x >> c2_shift_w], limit) - mid; \
1345 target = d0_data - c0; \
1346 update16(target, max, intensity, limit); \
1347 target = d1_data - (c0 + c1); \
1348 update_cb(target, max, intensity, limit); \
1349 target = d2_data - (c0 + c2); \
1350 update_cr(target, max, intensity, limit); \
1352 target = d0_data + c0; \
1353 update16(target, max, intensity, limit); \
1354 target = d1_data + (c0 + c1); \
1355 update_cb(target, max, intensity, limit); \
1356 target = d2_data + (c0 + c2); \
1357 update_cr(target, max, intensity, limit); \
1361 if (!c0_shift_h || (y & c0_shift_h)) \
1362 c0_data += c0_linesize; \
1363 if (!c1_shift_h || (y & c1_shift_h)) \
1364 c1_data += c1_linesize; \
1365 if (!c2_shift_h || (y & c2_shift_h)) \
1366 c2_data += c2_linesize; \
1367 d0_data += d0_linesize; \
1368 d1_data += d1_linesize; \
1369 d2_data += d2_linesize; \
1375 #define AFLAT(name, update_cb, update_cr, column, mirror) \
1376 static int name(AVFilterContext *ctx, \
1377 void *arg, int jobnr, \
1380 WaveformContext *s = ctx->priv; \
1381 ThreadData *td = arg; \
1382 AVFrame *in = td->in; \
1383 AVFrame *out = td->out; \
1384 int component = td->component; \
1385 int offset_y = td->offset_y; \
1386 int offset_x = td->offset_x; \
1387 const int src_h = in->height; \
1388 const int src_w = in->width; \
1389 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0; \
1390 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h; \
1391 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0; \
1392 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w; \
1393 const int intensity = s->intensity; \
1394 const int plane = s->desc->comp[component].plane; \
1395 const int c0_linesize = in->linesize[ plane + 0 ]; \
1396 const int c1_linesize = in->linesize[(plane + 1) % s->ncomp]; \
1397 const int c2_linesize = in->linesize[(plane + 2) % s->ncomp]; \
1398 const int c0_shift_w = s->shift_w[ component + 0 ]; \
1399 const int c1_shift_w = s->shift_w[(component + 1) % s->ncomp]; \
1400 const int c2_shift_w = s->shift_w[(component + 2) % s->ncomp]; \
1401 const int c0_shift_h = s->shift_h[ component + 0 ]; \
1402 const int c1_shift_h = s->shift_h[(component + 1) % s->ncomp]; \
1403 const int c2_shift_h = s->shift_h[(component + 2) % s->ncomp]; \
1404 const int d0_linesize = out->linesize[ plane + 0 ]; \
1405 const int d1_linesize = out->linesize[(plane + 1) % s->ncomp]; \
1406 const int d2_linesize = out->linesize[(plane + 2) % s->ncomp]; \
1407 const int max = 255 - intensity; \
1411 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1); \
1412 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1); \
1413 const int d2_signed_linesize = d2_linesize * (mirror == 1 ? -1 : 1); \
1415 for (x = slicew_start; x < slicew_end; x++) { \
1416 const uint8_t *c0_data = in->data[plane + 0]; \
1417 const uint8_t *c1_data = in->data[(plane + 1) % s->ncomp]; \
1418 const uint8_t *c2_data = in->data[(plane + 2) % s->ncomp]; \
1419 uint8_t *d0_data = out->data[plane] + offset_y * d0_linesize + offset_x; \
1420 uint8_t *d1_data = out->data[(plane + 1) % s->ncomp] + offset_y * d1_linesize + offset_x; \
1421 uint8_t *d2_data = out->data[(plane + 2) % s->ncomp] + offset_y * d2_linesize + offset_x; \
1422 uint8_t * const d0_bottom_line = d0_data + d0_linesize * (s->size - 1); \
1423 uint8_t * const d0 = (mirror ? d0_bottom_line : d0_data); \
1424 uint8_t * const d1_bottom_line = d1_data + d1_linesize * (s->size - 1); \
1425 uint8_t * const d1 = (mirror ? d1_bottom_line : d1_data); \
1426 uint8_t * const d2_bottom_line = d2_data + d2_linesize * (s->size - 1); \
1427 uint8_t * const d2 = (mirror ? d2_bottom_line : d2_data); \
1429 for (y = 0; y < src_h; y++) { \
1430 const int c0 = c0_data[x >> c0_shift_w] + 128; \
1431 const int c1 = c1_data[x >> c1_shift_w] - 128; \
1432 const int c2 = c2_data[x >> c2_shift_w] - 128; \
1435 target = d0 + x + d0_signed_linesize * c0; \
1436 update(target, max, intensity); \
1438 target = d1 + x + d1_signed_linesize * (c0 + c1); \
1439 update_cb(target, max, intensity); \
1441 target = d2 + x + d2_signed_linesize * (c0 + c2); \
1442 update_cr(target, max, intensity); \
1444 if (!c0_shift_h || (y & c0_shift_h)) \
1445 c0_data += c0_linesize; \
1446 if (!c1_shift_h || (y & c1_shift_h)) \
1447 c1_data += c1_linesize; \
1448 if (!c2_shift_h || (y & c2_shift_h)) \
1449 c2_data += c2_linesize; \
1450 d0_data += d0_linesize; \
1451 d1_data += d1_linesize; \
1452 d2_data += d2_linesize; \
1456 const uint8_t *c0_data = in->data[plane] + (sliceh_start >> c0_shift_h) * c0_linesize; \
1457 const uint8_t *c1_data = in->data[(plane + 1) % s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize; \
1458 const uint8_t *c2_data = in->data[(plane + 2) % s->ncomp] + (sliceh_start >> c2_shift_h) * c2_linesize; \
1459 uint8_t *d0_data = out->data[plane] + (offset_y + sliceh_start) * d0_linesize + offset_x; \
1460 uint8_t *d1_data = out->data[(plane + 1) % s->ncomp] + (offset_y + sliceh_start) * d1_linesize + offset_x; \
1461 uint8_t *d2_data = out->data[(plane + 2) % s->ncomp] + (offset_y + sliceh_start) * d2_linesize + offset_x; \
1464 d0_data += s->size - 1; \
1465 d1_data += s->size - 1; \
1466 d2_data += s->size - 1; \
1469 for (y = sliceh_start; y < sliceh_end; y++) { \
1470 for (x = 0; x < src_w; x++) { \
1471 const int c0 = c0_data[x >> c0_shift_w] + 128; \
1472 const int c1 = c1_data[x >> c1_shift_w] - 128; \
1473 const int c2 = c2_data[x >> c2_shift_w] - 128; \
1477 target = d0_data - c0; \
1478 update(target, max, intensity); \
1479 target = d1_data - (c0 + c1); \
1480 update_cb(target, max, intensity); \
1481 target = d2_data - (c0 + c2); \
1482 update_cr(target, max, intensity); \
1484 target = d0_data + c0; \
1485 update(target, max, intensity); \
1486 target = d1_data + (c0 + c1); \
1487 update_cb(target, max, intensity); \
1488 target = d2_data + (c0 + c2); \
1489 update_cr(target, max, intensity); \
1493 if (!c0_shift_h || (y & c0_shift_h)) \
1494 c0_data += c0_linesize; \
1495 if (!c1_shift_h || (y & c1_shift_h)) \
1496 c1_data += c1_linesize; \
1497 if (!c2_shift_h || (y & c2_shift_h)) \
1498 c2_data += c2_linesize; \
1499 d0_data += d0_linesize; \
1500 d1_data += d1_linesize; \
1501 d2_data += d2_linesize; \
1536 int offset_y,
int offset_x,
1538 int jobnr,
int nb_jobs)
1540 const int plane =
s->desc->comp[component].plane;
1541 const int c0_linesize = in->linesize[(plane + 1) %
s->ncomp] / 2;
1542 const int c1_linesize = in->linesize[(plane + 2) %
s->ncomp] / 2;
1543 const int dst_linesize =
out->linesize[plane] / 2;
1544 const int limit =
s->max - 1;
1546 const int mid =
s->max / 2;
1547 const int c0_shift_w =
s->shift_w[(component + 1) %
s->ncomp];
1548 const int c1_shift_w =
s->shift_w[(component + 2) %
s->ncomp];
1549 const int c0_shift_h =
s->shift_h[(component + 1) %
s->ncomp];
1550 const int c1_shift_h =
s->shift_h[(component + 2) %
s->ncomp];
1551 const int src_h = in->height;
1552 const int src_w = in->width;
1553 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
1554 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
1555 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
1556 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
1560 const int dst_signed_linesize = dst_linesize * (
mirror == 1 ? -1 : 1);
1562 for (x = slicew_start; x < slicew_end; x++) {
1563 const uint16_t *c0_data = (uint16_t *)in->data[(plane + 1) %
s->ncomp];
1564 const uint16_t *c1_data = (uint16_t *)in->data[(plane + 2) %
s->ncomp];
1565 uint16_t *dst_data = (uint16_t *)
out->data[plane] + offset_y * dst_linesize + offset_x;
1566 uint16_t *
const dst_bottom_line = dst_data + dst_linesize * (
s->size - 1);
1567 uint16_t *
const dst_line = (
mirror ? dst_bottom_line : dst_data);
1568 uint16_t *dst = dst_line;
1570 for (y = 0; y < src_h; y++) {
1571 const int sum =
FFMIN(
FFABS(c0_data[x >> c0_shift_w] - mid) +
FFABS(c1_data[x >> c1_shift_w] - mid - 1),
limit);
1574 target = dst + x + dst_signed_linesize * sum;
1577 if (!c0_shift_h || (y & c0_shift_h))
1578 c0_data += c0_linesize;
1579 if (!c1_shift_h || (y & c1_shift_h))
1580 c1_data += c1_linesize;
1581 dst_data += dst_linesize;
1585 const uint16_t *c0_data = (uint16_t *)in->data[(plane + 1) %
s->ncomp] + (sliceh_start >> c0_shift_h) * c0_linesize;
1586 const uint16_t *c1_data = (uint16_t *)in->data[(plane + 2) %
s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize;
1587 uint16_t *dst_data = (uint16_t *)
out->data[plane] + (offset_y + sliceh_start) * dst_linesize + offset_x;
1590 dst_data +=
s->size - 1;
1591 for (y = sliceh_start; y < sliceh_end; y++) {
1592 for (x = 0; x < src_w; x++) {
1593 const int sum =
FFMIN(
FFABS(c0_data[x >> c0_shift_w] - mid) +
FFABS(c1_data[x >> c1_shift_w] - mid - 1),
limit);
1597 target = dst_data - sum;
1600 target = dst_data + sum;
1605 if (!c0_shift_h || (y & c0_shift_h))
1606 c0_data += c0_linesize;
1607 if (!c1_shift_h || (y & c1_shift_h))
1608 c1_data += c1_linesize;
1609 dst_data += dst_linesize;
1614 #define CHROMA16_FUNC(name, column, mirror) \
1615 static int chroma16_##name(AVFilterContext *ctx, \
1616 void *arg, int jobnr, \
1619 WaveformContext *s = ctx->priv; \
1620 ThreadData *td = arg; \
1621 AVFrame *in = td->in; \
1622 AVFrame *out = td->out; \
1623 int component = td->component; \
1624 int offset_y = td->offset_y; \
1625 int offset_x = td->offset_x; \
1627 chroma16(s, in, out, component, s->intensity,\
1628 offset_y, offset_x, column, mirror, \
1642 int offset_y,
int offset_x,
1644 int jobnr,
int nb_jobs)
1646 const int plane =
s->desc->comp[component].plane;
1647 const int src_h = in->height;
1648 const int src_w = in->width;
1649 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
1650 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
1651 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
1652 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
1653 const int c0_linesize = in->linesize[(plane + 1) %
s->ncomp];
1654 const int c1_linesize = in->linesize[(plane + 2) %
s->ncomp];
1655 const int dst_linesize =
out->linesize[plane];
1657 const int c0_shift_w =
s->shift_w[(component + 1) %
s->ncomp];
1658 const int c1_shift_w =
s->shift_w[(component + 2) %
s->ncomp];
1659 const int c0_shift_h =
s->shift_h[(component + 1) %
s->ncomp];
1660 const int c1_shift_h =
s->shift_h[(component + 2) %
s->ncomp];
1664 const int dst_signed_linesize = dst_linesize * (
mirror == 1 ? -1 : 1);
1666 for (x = slicew_start; x < slicew_end; x++) {
1667 const uint8_t *c0_data = in->data[(plane + 1) %
s->ncomp];
1668 const uint8_t *c1_data = in->data[(plane + 2) %
s->ncomp];
1669 uint8_t *dst_data =
out->data[plane] + offset_y * dst_linesize + offset_x;
1670 uint8_t *
const dst_bottom_line = dst_data + dst_linesize * (
s->size - 1);
1671 uint8_t *
const dst_line = (
mirror ? dst_bottom_line : dst_data);
1672 uint8_t *dst = dst_line;
1674 for (y = 0; y < src_h; y++) {
1675 const int sum =
FFABS(c0_data[x >> c0_shift_w] - 128) +
FFABS(c1_data[x >> c1_shift_w] - 127);
1678 target = dst + x + dst_signed_linesize * sum;
1681 if (!c0_shift_h || (y & c0_shift_h))
1682 c0_data += c0_linesize;
1683 if (!c1_shift_h || (y & c1_shift_h))
1684 c1_data += c1_linesize;
1685 dst_data += dst_linesize;
1689 const uint8_t *c0_data = in->data[(plane + 1) %
s->ncomp] + (sliceh_start >> c0_shift_h) * c0_linesize;
1690 const uint8_t *c1_data = in->data[(plane + 2) %
s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize;
1691 uint8_t *dst_data =
out->data[plane] + (offset_y + sliceh_start) * dst_linesize + offset_x;
1694 dst_data +=
s->size - 1;
1695 for (y = sliceh_start; y < sliceh_end; y++) {
1696 for (x = 0; x < src_w; x++) {
1697 const int sum =
FFABS(c0_data[x >> c0_shift_w] - 128) +
FFABS(c1_data[x >> c1_shift_w] - 127);
1701 target = dst_data - sum;
1704 target = dst_data + sum;
1709 if (!c0_shift_h || (y & c0_shift_h))
1710 c0_data += c0_linesize;
1711 if (!c1_shift_h || (y & c1_shift_h))
1712 c1_data += c1_linesize;
1713 dst_data += dst_linesize;
1718 #define CHROMA_FUNC(name, column, mirror) \
1719 static int chroma_##name(AVFilterContext *ctx, \
1720 void *arg, int jobnr, \
1723 WaveformContext *s = ctx->priv; \
1724 ThreadData *td = arg; \
1725 AVFrame *in = td->in; \
1726 AVFrame *out = td->out; \
1727 int component = td->component; \
1728 int offset_y = td->offset_y; \
1729 int offset_x = td->offset_x; \
1731 chroma(s, in, out, component, s->intensity, \
1732 offset_y, offset_x, column, mirror, \
1746 int offset_y,
int offset_x,
1748 int jobnr,
int nb_jobs)
1750 const int plane =
s->desc->comp[component].plane;
1751 const int limit =
s->max - 1;
1752 const int src_h = in->height;
1753 const int src_w = in->width;
1754 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
1755 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
1756 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
1757 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
1758 const int c0_linesize = in->linesize[ plane + 0 ] / 2;
1759 const int c1_linesize = in->linesize[(plane + 1) %
s->ncomp] / 2;
1760 const int c2_linesize = in->linesize[(plane + 2) %
s->ncomp] / 2;
1761 const int c0_shift_h =
s->shift_h[ component + 0 ];
1762 const int c1_shift_h =
s->shift_h[(component + 1) %
s->ncomp];
1763 const int c2_shift_h =
s->shift_h[(component + 2) %
s->ncomp];
1764 const uint16_t *c0_data = (
const uint16_t *)in->data[plane + 0] + (sliceh_start >> c0_shift_h) * c0_linesize;
1765 const uint16_t *c1_data = (
const uint16_t *)in->data[(plane + 1) %
s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize;
1766 const uint16_t *c2_data = (
const uint16_t *)in->data[(plane + 2) %
s->ncomp] + (sliceh_start >> c2_shift_h) * c2_linesize;
1767 const int d0_linesize =
out->linesize[ plane + 0 ] / 2;
1768 const int d1_linesize =
out->linesize[(plane + 1) %
s->ncomp] / 2;
1769 const int d2_linesize =
out->linesize[(plane + 2) %
s->ncomp] / 2;
1770 const int c0_shift_w =
s->shift_w[ component + 0 ];
1771 const int c1_shift_w =
s->shift_w[(component + 1) %
s->ncomp];
1772 const int c2_shift_w =
s->shift_w[(component + 2) %
s->ncomp];
1776 const int d0_signed_linesize = d0_linesize * (
mirror == 1 ? -1 : 1);
1777 const int d1_signed_linesize = d1_linesize * (
mirror == 1 ? -1 : 1);
1778 const int d2_signed_linesize = d2_linesize * (
mirror == 1 ? -1 : 1);
1779 uint16_t *d0_data = (uint16_t *)
out->data[plane] + offset_y * d0_linesize + offset_x;
1780 uint16_t *d1_data = (uint16_t *)
out->data[(plane + 1) %
s->ncomp] + offset_y * d1_linesize + offset_x;
1781 uint16_t *d2_data = (uint16_t *)
out->data[(plane + 2) %
s->ncomp] + offset_y * d2_linesize + offset_x;
1782 uint16_t *
const d0_bottom_line = d0_data + d0_linesize * (
s->size - 1);
1783 uint16_t *
const d0 = (
mirror ? d0_bottom_line : d0_data);
1784 uint16_t *
const d1_bottom_line = d1_data + d1_linesize * (
s->size - 1);
1785 uint16_t *
const d1 = (
mirror ? d1_bottom_line : d1_data);
1786 uint16_t *
const d2_bottom_line = d2_data + d2_linesize * (
s->size - 1);
1787 uint16_t *
const d2 = (
mirror ? d2_bottom_line : d2_data);
1789 for (y = 0; y < src_h; y++) {
1790 for (x = slicew_start; x < slicew_end; x++) {
1791 const int c0 =
FFMIN(c0_data[x >> c0_shift_w],
limit);
1792 const int c1 = c1_data[x >> c1_shift_w];
1793 const int c2 = c2_data[x >> c2_shift_w];
1795 *(d0 + d0_signed_linesize * c0 + x) = c0;
1796 *(d1 + d1_signed_linesize * c0 + x) =
c1;
1797 *(d2 + d2_signed_linesize * c0 + x) =
c2;
1800 if (!c0_shift_h || (y & c0_shift_h))
1801 c0_data += c0_linesize;
1802 if (!c1_shift_h || (y & c1_shift_h))
1803 c1_data += c1_linesize;
1804 if (!c2_shift_h || (y & c2_shift_h))
1805 c2_data += c2_linesize;
1806 d0_data += d0_linesize;
1807 d1_data += d1_linesize;
1808 d2_data += d2_linesize;
1811 uint16_t *d0_data = (uint16_t *)
out->data[plane] + (offset_y + sliceh_start) * d0_linesize + offset_x;
1812 uint16_t *d1_data = (uint16_t *)
out->data[(plane + 1) %
s->ncomp] + (offset_y + sliceh_start) * d1_linesize + offset_x;
1813 uint16_t *d2_data = (uint16_t *)
out->data[(plane + 2) %
s->ncomp] + (offset_y + sliceh_start) * d2_linesize + offset_x;
1816 d0_data +=
s->size - 1;
1817 d1_data +=
s->size - 1;
1818 d2_data +=
s->size - 1;
1821 for (y = sliceh_start; y < sliceh_end; y++) {
1822 for (x = 0; x < src_w; x++) {
1823 const int c0 =
FFMIN(c0_data[x >> c0_shift_w],
limit);
1824 const int c1 = c1_data[x >> c1_shift_w];
1825 const int c2 = c2_data[x >> c2_shift_w];
1828 *(d0_data - c0) = c0;
1829 *(d1_data - c0) =
c1;
1830 *(d2_data - c0) =
c2;
1832 *(d0_data + c0) = c0;
1833 *(d1_data + c0) =
c1;
1834 *(d2_data + c0) =
c2;
1838 if (!c0_shift_h || (y & c0_shift_h))
1839 c0_data += c0_linesize;
1840 if (!c1_shift_h || (y & c1_shift_h))
1841 c1_data += c1_linesize;
1842 if (!c2_shift_h || (y & c2_shift_h))
1843 c2_data += c2_linesize;
1844 d0_data += d0_linesize;
1845 d1_data += d1_linesize;
1846 d2_data += d2_linesize;
1851 #define COLOR16_FUNC(name, column, mirror) \
1852 static int color16_##name(AVFilterContext *ctx, \
1853 void *arg, int jobnr, \
1856 WaveformContext *s = ctx->priv; \
1857 ThreadData *td = arg; \
1858 AVFrame *in = td->in; \
1859 AVFrame *out = td->out; \
1860 int component = td->component; \
1861 int offset_y = td->offset_y; \
1862 int offset_x = td->offset_x; \
1864 color16(s, in, out, component, s->intensity, \
1865 offset_y, offset_x, column, mirror, \
1879 int offset_y,
int offset_x,
1881 int jobnr,
int nb_jobs)
1883 const int plane =
s->desc->comp[component].plane;
1884 const int src_h = in->height;
1885 const int src_w = in->width;
1886 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
1887 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
1888 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
1889 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
1890 const int c0_linesize = in->linesize[ plane + 0 ];
1891 const int c1_linesize = in->linesize[(plane + 1) %
s->ncomp];
1892 const int c2_linesize = in->linesize[(plane + 2) %
s->ncomp];
1893 const int c0_shift_h =
s->shift_h[ component + 0 ];
1894 const int c1_shift_h =
s->shift_h[(component + 1) %
s->ncomp];
1895 const int c2_shift_h =
s->shift_h[(component + 2) %
s->ncomp];
1896 const uint8_t *c0_data = in->data[plane] + (sliceh_start >> c0_shift_h) * c0_linesize;
1897 const uint8_t *c1_data = in->data[(plane + 1) %
s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize;
1898 const uint8_t *c2_data = in->data[(plane + 2) %
s->ncomp] + (sliceh_start >> c2_shift_h) * c2_linesize;
1899 const int d0_linesize =
out->linesize[ plane + 0 ];
1900 const int d1_linesize =
out->linesize[(plane + 1) %
s->ncomp];
1901 const int d2_linesize =
out->linesize[(plane + 2) %
s->ncomp];
1902 const int c0_shift_w =
s->shift_w[ component + 0 ];
1903 const int c1_shift_w =
s->shift_w[(component + 1) %
s->ncomp];
1904 const int c2_shift_w =
s->shift_w[(component + 2) %
s->ncomp];
1908 const int d0_signed_linesize = d0_linesize * (
mirror == 1 ? -1 : 1);
1909 const int d1_signed_linesize = d1_linesize * (
mirror == 1 ? -1 : 1);
1910 const int d2_signed_linesize = d2_linesize * (
mirror == 1 ? -1 : 1);
1911 uint8_t *d0_data =
out->data[plane] + offset_y * d0_linesize + offset_x;
1912 uint8_t *d1_data =
out->data[(plane + 1) %
s->ncomp] + offset_y * d1_linesize + offset_x;
1913 uint8_t *d2_data =
out->data[(plane + 2) %
s->ncomp] + offset_y * d2_linesize + offset_x;
1914 uint8_t *
const d0_bottom_line = d0_data + d0_linesize * (
s->size - 1);
1915 uint8_t *
const d0 = (
mirror ? d0_bottom_line : d0_data);
1916 uint8_t *
const d1_bottom_line = d1_data + d1_linesize * (
s->size - 1);
1917 uint8_t *
const d1 = (
mirror ? d1_bottom_line : d1_data);
1918 uint8_t *
const d2_bottom_line = d2_data + d2_linesize * (
s->size - 1);
1919 uint8_t *
const d2 = (
mirror ? d2_bottom_line : d2_data);
1921 for (y = 0; y < src_h; y++) {
1922 for (x = slicew_start; x < slicew_end; x++) {
1923 const int c0 = c0_data[x >> c0_shift_w];
1924 const int c1 = c1_data[x >> c1_shift_w];
1925 const int c2 = c2_data[x >> c2_shift_w];
1927 *(d0 + d0_signed_linesize * c0 + x) = c0;
1928 *(d1 + d1_signed_linesize * c0 + x) =
c1;
1929 *(d2 + d2_signed_linesize * c0 + x) =
c2;
1932 if (!c0_shift_h || (y & c0_shift_h))
1933 c0_data += c0_linesize;
1934 if (!c1_shift_h || (y & c1_shift_h))
1935 c1_data += c1_linesize;
1936 if (!c2_shift_h || (y & c2_shift_h))
1937 c2_data += c2_linesize;
1938 d0_data += d0_linesize;
1939 d1_data += d1_linesize;
1940 d2_data += d2_linesize;
1943 uint8_t *d0_data =
out->data[plane] + (offset_y + sliceh_start) * d0_linesize + offset_x;
1944 uint8_t *d1_data =
out->data[(plane + 1) %
s->ncomp] + (offset_y + sliceh_start) * d1_linesize + offset_x;
1945 uint8_t *d2_data =
out->data[(plane + 2) %
s->ncomp] + (offset_y + sliceh_start) * d2_linesize + offset_x;
1948 d0_data +=
s->size - 1;
1949 d1_data +=
s->size - 1;
1950 d2_data +=
s->size - 1;
1953 for (y = sliceh_start; y < sliceh_end; y++) {
1954 for (x = 0; x < src_w; x++) {
1955 const int c0 = c0_data[x >> c0_shift_w];
1956 const int c1 = c1_data[x >> c1_shift_w];
1957 const int c2 = c2_data[x >> c2_shift_w];
1960 *(d0_data - c0) = c0;
1961 *(d1_data - c0) =
c1;
1962 *(d2_data - c0) =
c2;
1964 *(d0_data + c0) = c0;
1965 *(d1_data + c0) =
c1;
1966 *(d2_data + c0) =
c2;
1970 if (!c0_shift_h || (y & c0_shift_h))
1971 c0_data += c0_linesize;
1972 if (!c1_shift_h || (y & c1_shift_h))
1973 c1_data += c1_linesize;
1974 if (!c2_shift_h || (y & c2_shift_h))
1975 c2_data += c2_linesize;
1976 d0_data += d0_linesize;
1977 d1_data += d1_linesize;
1978 d2_data += d2_linesize;
1983 #define COLOR_FUNC(name, column, mirror) \
1984 static int color_##name(AVFilterContext *ctx, \
1985 void *arg, int jobnr, \
1988 WaveformContext *s = ctx->priv; \
1989 ThreadData *td = arg; \
1990 AVFrame *in = td->in; \
1991 AVFrame *out = td->out; \
1992 int component = td->component; \
1993 int offset_y = td->offset_y; \
1994 int offset_x = td->offset_x; \
1996 color(s, in, out, component, s->intensity, \
1997 offset_y, offset_x, column, mirror, \
2011 int offset_y,
int offset_x,
2013 int jobnr,
int nb_jobs)
2015 const int plane =
s->desc->comp[component].plane;
2016 const int limit =
s->max - 1;
2018 const int src_h = in->height;
2019 const int src_w = in->width;
2020 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
2021 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
2022 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
2023 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
2024 const int c0_shift_h =
s->shift_h[ component + 0 ];
2025 const int c1_shift_h =
s->shift_h[(component + 1) %
s->ncomp];
2026 const int c2_shift_h =
s->shift_h[(component + 2) %
s->ncomp];
2027 const int c0_linesize = in->linesize[ plane + 0 ] / 2;
2028 const int c1_linesize = in->linesize[(plane + 1) %
s->ncomp] / 2;
2029 const int c2_linesize = in->linesize[(plane + 2) %
s->ncomp] / 2;
2030 const uint16_t *c0_data = (
const uint16_t *)in->data[plane + 0] + (sliceh_start >> c0_shift_h) * c0_linesize;
2031 const uint16_t *c1_data = (
const uint16_t *)in->data[(plane + 1) %
s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize;
2032 const uint16_t *c2_data = (
const uint16_t *)in->data[(plane + 2) %
s->ncomp] + (sliceh_start >> c2_shift_h) * c2_linesize;
2033 const int d0_linesize =
out->linesize[ plane + 0 ] / 2;
2034 const int d1_linesize =
out->linesize[(plane + 1) %
s->ncomp] / 2;
2035 const int d2_linesize =
out->linesize[(plane + 2) %
s->ncomp] / 2;
2036 const int c0_shift_w =
s->shift_w[ component + 0 ];
2037 const int c1_shift_w =
s->shift_w[(component + 1) %
s->ncomp];
2038 const int c2_shift_w =
s->shift_w[(component + 2) %
s->ncomp];
2042 const int d0_signed_linesize = d0_linesize * (
mirror == 1 ? -1 : 1);
2043 const int d1_signed_linesize = d1_linesize * (
mirror == 1 ? -1 : 1);
2044 const int d2_signed_linesize = d2_linesize * (
mirror == 1 ? -1 : 1);
2045 uint16_t *d0_data = (uint16_t *)
out->data[plane] + offset_y * d0_linesize + offset_x;
2046 uint16_t *d1_data = (uint16_t *)
out->data[(plane + 1) %
s->ncomp] + offset_y * d1_linesize + offset_x;
2047 uint16_t *d2_data = (uint16_t *)
out->data[(plane + 2) %
s->ncomp] + offset_y * d2_linesize + offset_x;
2048 uint16_t *
const d0_bottom_line = d0_data + d0_linesize * (
s->size - 1);
2049 uint16_t *
const d0 = (
mirror ? d0_bottom_line : d0_data);
2050 uint16_t *
const d1_bottom_line = d1_data + d1_linesize * (
s->size - 1);
2051 uint16_t *
const d1 = (
mirror ? d1_bottom_line : d1_data);
2052 uint16_t *
const d2_bottom_line = d2_data + d2_linesize * (
s->size - 1);
2053 uint16_t *
const d2 = (
mirror ? d2_bottom_line : d2_data);
2055 for (y = 0; y < src_h; y++) {
2056 for (x = slicew_start; x < slicew_end; x++) {
2057 const int c0 =
FFMIN(c0_data[x >> c0_shift_w],
limit);
2058 const int c1 = c1_data[x >> c1_shift_w];
2059 const int c2 = c2_data[x >> c2_shift_w];
2062 *(d1 + d1_signed_linesize * c0 + x) =
c1;
2063 *(d2 + d2_signed_linesize * c0 + x) =
c2;
2066 if (!c0_shift_h || (y & c0_shift_h))
2067 c0_data += c0_linesize;
2068 if (!c1_shift_h || (y & c1_shift_h))
2069 c1_data += c1_linesize;
2070 if (!c2_shift_h || (y & c2_shift_h))
2071 c2_data += c2_linesize;
2072 d0_data += d0_linesize;
2073 d1_data += d1_linesize;
2074 d2_data += d2_linesize;
2077 uint16_t *d0_data = (uint16_t *)
out->data[plane] + (offset_y + sliceh_start) * d0_linesize + offset_x;
2078 uint16_t *d1_data = (uint16_t *)
out->data[(plane + 1) %
s->ncomp] + (offset_y + sliceh_start) * d1_linesize + offset_x;
2079 uint16_t *d2_data = (uint16_t *)
out->data[(plane + 2) %
s->ncomp] + (offset_y + sliceh_start) * d2_linesize + offset_x;
2082 d0_data +=
s->size - 1;
2083 d1_data +=
s->size - 1;
2084 d2_data +=
s->size - 1;
2087 for (y = sliceh_start; y < sliceh_end; y++) {
2088 for (x = 0; x < src_w; x++) {
2089 const int c0 =
FFMIN(c0_data[x >> c0_shift_w],
limit);
2090 const int c1 = c1_data[x >> c1_shift_w];
2091 const int c2 = c2_data[x >> c2_shift_w];
2095 *(d1_data - c0) =
c1;
2096 *(d2_data - c0) =
c2;
2099 *(d1_data + c0) =
c1;
2100 *(d2_data + c0) =
c2;
2104 if (!c0_shift_h || (y & c0_shift_h))
2105 c0_data += c0_linesize;
2106 if (!c1_shift_h || (y & c1_shift_h))
2107 c1_data += c1_linesize;
2108 if (!c2_shift_h || (y & c2_shift_h))
2109 c2_data += c2_linesize;
2110 d0_data += d0_linesize;
2111 d1_data += d1_linesize;
2112 d2_data += d2_linesize;
2117 #define ACOLOR16_FUNC(name, column, mirror) \
2118 static int acolor16_##name(AVFilterContext *ctx, \
2119 void *arg, int jobnr, \
2122 WaveformContext *s = ctx->priv; \
2123 ThreadData *td = arg; \
2124 AVFrame *in = td->in; \
2125 AVFrame *out = td->out; \
2126 int component = td->component; \
2127 int offset_y = td->offset_y; \
2128 int offset_x = td->offset_x; \
2130 acolor16(s, in, out, component, s->intensity,\
2131 offset_y, offset_x, column, mirror, \
2145 int offset_y,
int offset_x,
2147 int jobnr,
int nb_jobs)
2149 const int plane =
s->desc->comp[component].plane;
2150 const int src_h = in->height;
2151 const int src_w = in->width;
2152 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
2153 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
2154 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
2155 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
2156 const int c0_shift_w =
s->shift_w[ component + 0 ];
2157 const int c1_shift_w =
s->shift_w[(component + 1) %
s->ncomp];
2158 const int c2_shift_w =
s->shift_w[(component + 2) %
s->ncomp];
2159 const int c0_shift_h =
s->shift_h[ component + 0 ];
2160 const int c1_shift_h =
s->shift_h[(component + 1) %
s->ncomp];
2161 const int c2_shift_h =
s->shift_h[(component + 2) %
s->ncomp];
2162 const int c0_linesize = in->linesize[ plane + 0 ];
2163 const int c1_linesize = in->linesize[(plane + 1) %
s->ncomp];
2164 const int c2_linesize = in->linesize[(plane + 2) %
s->ncomp];
2165 const uint8_t *c0_data = in->data[plane + 0] + (sliceh_start >> c0_shift_h) * c0_linesize;
2166 const uint8_t *c1_data = in->data[(plane + 1) %
s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize;
2167 const uint8_t *c2_data = in->data[(plane + 2) %
s->ncomp] + (sliceh_start >> c2_shift_h) * c2_linesize;
2168 const int d0_linesize =
out->linesize[ plane + 0 ];
2169 const int d1_linesize =
out->linesize[(plane + 1) %
s->ncomp];
2170 const int d2_linesize =
out->linesize[(plane + 2) %
s->ncomp];
2175 const int d0_signed_linesize = d0_linesize * (
mirror == 1 ? -1 : 1);
2176 const int d1_signed_linesize = d1_linesize * (
mirror == 1 ? -1 : 1);
2177 const int d2_signed_linesize = d2_linesize * (
mirror == 1 ? -1 : 1);
2178 uint8_t *d0_data =
out->data[plane] + offset_y * d0_linesize + offset_x;
2179 uint8_t *d1_data =
out->data[(plane + 1) %
s->ncomp] + offset_y * d1_linesize + offset_x;
2180 uint8_t *d2_data =
out->data[(plane + 2) %
s->ncomp] + offset_y * d2_linesize + offset_x;
2181 uint8_t *
const d0_bottom_line = d0_data + d0_linesize * (
s->size - 1);
2182 uint8_t *
const d0 = (
mirror ? d0_bottom_line : d0_data);
2183 uint8_t *
const d1_bottom_line = d1_data + d1_linesize * (
s->size - 1);
2184 uint8_t *
const d1 = (
mirror ? d1_bottom_line : d1_data);
2185 uint8_t *
const d2_bottom_line = d2_data + d2_linesize * (
s->size - 1);
2186 uint8_t *
const d2 = (
mirror ? d2_bottom_line : d2_data);
2188 for (y = 0; y < src_h; y++) {
2189 for (x = slicew_start; x < slicew_end; x++) {
2190 const int c0 = c0_data[x >> c0_shift_w];
2191 const int c1 = c1_data[x >> c1_shift_w];
2192 const int c2 = c2_data[x >> c2_shift_w];
2195 *(d1 + d1_signed_linesize * c0 + x) =
c1;
2196 *(d2 + d2_signed_linesize * c0 + x) =
c2;
2199 if (!c0_shift_h || (y & c0_shift_h))
2200 c0_data += c0_linesize;
2201 if (!c1_shift_h || (y & c1_shift_h))
2202 c1_data += c1_linesize;
2203 if (!c2_shift_h || (y & c2_shift_h))
2204 c2_data += c2_linesize;
2205 d0_data += d0_linesize;
2206 d1_data += d1_linesize;
2207 d2_data += d2_linesize;
2210 uint8_t *d0_data =
out->data[plane] + (offset_y + sliceh_start) * d0_linesize + offset_x;
2211 uint8_t *d1_data =
out->data[(plane + 1) %
s->ncomp] + (offset_y + sliceh_start) * d1_linesize + offset_x;
2212 uint8_t *d2_data =
out->data[(plane + 2) %
s->ncomp] + (offset_y + sliceh_start) * d2_linesize + offset_x;
2215 d0_data +=
s->size - 1;
2216 d1_data +=
s->size - 1;
2217 d2_data +=
s->size - 1;
2220 for (y = sliceh_start; y < sliceh_end; y++) {
2221 for (x = 0; x < src_w; x++) {
2222 const int c0 = c0_data[x >> c0_shift_w];
2223 const int c1 = c1_data[x >> c1_shift_w];
2224 const int c2 = c2_data[x >> c2_shift_w];
2228 *(d1_data - c0) =
c1;
2229 *(d2_data - c0) =
c2;
2232 *(d1_data + c0) =
c1;
2233 *(d2_data + c0) =
c2;
2237 if (!c0_shift_h || (y & c0_shift_h))
2238 c0_data += c0_linesize;
2239 if (!c1_shift_h || (y & c1_shift_h))
2240 c1_data += c1_linesize;
2241 if (!c2_shift_h || (y & c2_shift_h))
2242 c2_data += c2_linesize;
2243 d0_data += d0_linesize;
2244 d1_data += d1_linesize;
2245 d2_data += d2_linesize;
2250 #define ACOLOR_FUNC(name, column, mirror) \
2251 static int acolor_##name(AVFilterContext *ctx, \
2252 void *arg, int jobnr, \
2255 WaveformContext *s = ctx->priv; \
2256 ThreadData *td = arg; \
2257 AVFrame *in = td->in; \
2258 AVFrame *out = td->out; \
2259 int component = td->component; \
2260 int offset_y = td->offset_y; \
2261 int offset_x = td->offset_x; \
2263 acolor(s, in, out, component, s->intensity, \
2264 offset_y, offset_x, column, mirror, \
2279 { { {
"16", 16+128 }, {
"16", 16+128 }, {
"16", 16+128 }, {
"0", 0+128 } } },
2280 { { {
"128", 128+128 }, {
"128", 128+128 }, {
"128", 128+128 }, {
"128", 128+128 } } },
2281 { { {
"235", 235+128 }, {
"240", 240+128 }, {
"240", 240+128 }, {
"255", 255+128 } } },
2285 { { {
"32", 32+256 }, {
"32", 32+256 }, {
"32", 32+256 }, {
"0", 0+256 } } },
2286 { { {
"256", 256+256 }, {
"256", 256+256 }, {
"256", 256+256 }, {
"256", 256+256 } } },
2287 { { {
"470", 470+256 }, {
"480", 480+256 }, {
"480", 480+256 }, {
"511", 511+256 } } },
2291 { { {
"64", 64+512 }, {
"64", 64+512 }, {
"64", 64+512 }, {
"0", 0+512 } } },
2292 { { {
"512", 512+512 }, {
"512", 512+512 }, {
"512", 512+512 }, {
"512", 512+512 } } },
2293 { { {
"940", 940+512 }, {
"960", 960+512 }, {
"960", 960+512 }, {
"1023", 1023+512 } } },
2297 { { {
"256", 256+2048 }, {
"256", 256+2048 }, {
"256", 256+2048 }, {
"0", 0+2048 } } },
2298 { { {
"2048", 2048+2048 }, {
"2048", 2048+2048 }, {
"2048", 2048+2048 }, {
"2048", 2048+2048 } } },
2299 { { {
"3760", 3760+2048 }, {
"3840", 3840+2048 }, {
"3840", 3840+2048 }, {
"4095", 4095+2048 } } },
2303 { { {
"0", 16+128 }, {
"0", 16+128 }, {
"0", 16+128 }, {
"0", 0+128 } } },
2304 { { {
"175", 71+128 }, {
"175", 72+128 }, {
"175", 72+128 }, {
"175", 64+128 } } },
2305 { { {
"350", 126+128 }, {
"350", 128+128 }, {
"350", 128+128 }, {
"350", 128+128 } } },
2306 { { {
"525", 180+128 }, {
"525", 184+128 }, {
"525", 184+128 }, {
"525", 192+128 } } },
2307 { { {
"700", 235+128 }, {
"700", 240+128 }, {
"700", 240+128 }, {
"700", 255+128 } } },
2311 { { {
"0", 32+256 }, {
"0", 32+256 }, {
"0", 32+256 }, {
"0", 0+256 } } },
2312 { { {
"175", 142+256 }, {
"175", 144+256 }, {
"175", 144+256 }, {
"175", 128+256 } } },
2313 { { {
"350", 251+256 }, {
"350", 256+256 }, {
"350", 256+256 }, {
"350", 256+256 } } },
2314 { { {
"525", 361+256 }, {
"525", 368+256 }, {
"525", 368+256 }, {
"525", 384+256 } } },
2315 { { {
"700", 470+256 }, {
"700", 480+256 }, {
"700", 480+256 }, {
"700", 511+256 } } },
2319 { { {
"0", 64+512 }, {
"0", 64+512 }, {
"0", 64+512 }, {
"0", 0+512 } } },
2320 { { {
"175", 283+512 }, {
"175", 288+512 }, {
"175", 288+512 }, {
"175", 256+512 } } },
2321 { { {
"350", 502+512 }, {
"350", 512+512 }, {
"350", 512+512 }, {
"350", 512+512 } } },
2322 { { {
"525", 721+512 }, {
"525", 736+512 }, {
"525", 736+512 }, {
"525", 768+512 } } },
2323 { { {
"700", 940+512 }, {
"700", 960+512 }, {
"700", 960+512 }, {
"700", 1023+512 } } },
2327 { { {
"0", 256+2048 }, {
"0", 256+2048 }, {
"0", 256+2048 }, {
"0", 0+2048 } } },
2328 { { {
"175", 1132+2048 }, {
"175", 1152+2048 }, {
"175", 1152+2048 }, {
"175", 1024+2048 } } },
2329 { { {
"350", 2008+2048 }, {
"350", 2048+2048 }, {
"350", 2048+2048 }, {
"350", 2048+2048 } } },
2330 { { {
"525", 2884+2048 }, {
"525", 2944+2048 }, {
"525", 2944+2048 }, {
"525", 3072+2048 } } },
2331 { { {
"700", 3760+2048 }, {
"700", 3840+2048 }, {
"700", 3840+2048 }, {
"700", 4095+2048 } } },
2335 { { {
"-25", -39+128 }, {
"-25", -40+128 }, {
"-25", -40+128 }, {
"-25", -64+128 } } },
2336 { { {
"0", 16+128 }, {
"0", 16+128 }, {
"0", 16+128 }, {
"0", 0+128 } } },
2337 { { {
"25", 71+128 }, {
"25", 72+128 }, {
"25", 72+128 }, {
"25", 64+128 } } },
2338 { { {
"50", 126+128 }, {
"50", 128+128 }, {
"50", 128+128 }, {
"50", 128+128 } } },
2339 { { {
"75", 180+128 }, {
"75", 184+128 }, {
"75", 184+128 }, {
"75", 192+128 } } },
2340 { { {
"100", 235+128 }, {
"100", 240+128 }, {
"100", 240+128 }, {
"100", 256+128 } } },
2341 { { {
"125", 290+128 }, {
"125", 296+128 }, {
"125", 296+128 }, {
"125", 320+128 } } },
2345 { { {
"-25", -78+256 }, {
"-25", -80+256 }, {
"-25", -80+256 }, {
"-25",-128+256 } } },
2346 { { {
"0", 32+256 }, {
"0", 32+256 }, {
"0", 32+256 }, {
"0", 0+256 } } },
2347 { { {
"25", 142+256 }, {
"25", 144+256 }, {
"25", 144+256 }, {
"25", 128+256 } } },
2348 { { {
"50", 251+256 }, {
"50", 256+256 }, {
"50", 256+256 }, {
"50", 256+256 } } },
2349 { { {
"75", 361+256 }, {
"75", 368+256 }, {
"75", 368+256 }, {
"75", 384+256 } } },
2350 { { {
"100", 470+256 }, {
"100", 480+256 }, {
"100", 480+256 }, {
"100", 512+256 } } },
2351 { { {
"125", 580+256 }, {
"125", 592+256 }, {
"125", 592+256 }, {
"125", 640+256 } } },
2355 { { {
"-25",-156+512 }, {
"-25",-160+512 }, {
"-25",-160+512 }, {
"-25", -256+512 } } },
2356 { { {
"0", 64+512 }, {
"0", 64+512 }, {
"0", 64+512 }, {
"0", 0+512 } } },
2357 { { {
"25", 283+512 }, {
"25", 288+512 }, {
"25", 288+512 }, {
"25", 256+512 } } },
2358 { { {
"50", 502+512 }, {
"50", 512+512 }, {
"50", 512+512 }, {
"50", 512+512 } } },
2359 { { {
"75", 721+512 }, {
"75", 736+512 }, {
"75", 736+512 }, {
"75", 768+512 } } },
2360 { { {
"100", 940+512 }, {
"100", 960+512 }, {
"100", 960+512 }, {
"100", 1024+512 } } },
2361 { { {
"125",1160+512 }, {
"125",1184+512 }, {
"125",1184+512 }, {
"125", 1280+512 } } },
2365 { { {
"-25", -624+2048 }, {
"-25", -640+2048 }, {
"-25", -640+2048 }, {
"-25",-1024+2048 } } },
2366 { { {
"0", 256+2048 }, {
"0", 256+2048 }, {
"0", 256+2048 }, {
"0", 0+2048 } } },
2367 { { {
"25", 1132+2048 }, {
"25", 1152+2048 }, {
"25", 1152+2048 }, {
"25", 1024+2048 } } },
2368 { { {
"50", 2008+2048 }, {
"50", 2048+2048 }, {
"50", 2048+2048 }, {
"50", 2048+2048 } } },
2369 { { {
"75", 2884+2048 }, {
"75", 2944+2048 }, {
"75", 2944+2048 }, {
"75", 3072+2048 } } },
2370 { { {
"100", 3760+2048 }, {
"100", 3840+2048 }, {
"100", 3840+2048 }, {
"100", 4096+2048 } } },
2371 { { {
"125", 4640+2048 }, {
"125", 4736+2048 }, {
"125", 4736+2048 }, {
"125", 5120+2048 } } },
2375 { { {
"16", 16+256 }, {
"16", 16+256 }, {
"16", 16+256 }, {
"0", 0+256 } } },
2376 { { {
"128", 128+256 }, {
"128", 128+256 }, {
"128", 128+256 }, {
"128", 128+256 } } },
2377 { { {
"235", 235+256 }, {
"240", 240+256 }, {
"240", 240+256 }, {
"255", 255+256 } } },
2381 { { {
"32", 32+512 }, {
"32", 32+512 }, {
"32", 32+512 }, {
"0", 0+512 } } },
2382 { { {
"256", 256+512 }, {
"256", 256+512 }, {
"256", 256+512 }, {
"256", 256+512 } } },
2383 { { {
"470", 470+512 }, {
"480", 480+512 }, {
"480", 480+512 }, {
"511", 511+512 } } },
2387 { { {
"64", 64+1024 }, {
"64", 64+1024 }, {
"64", 64+1024 }, {
"0", 0+1024 } } },
2388 { { {
"512", 512+1024 }, {
"512", 512+1024 }, {
"512", 512+1024 }, {
"512", 512+1024 } } },
2389 { { {
"940", 940+1024 }, {
"960", 960+1024 }, {
"960", 960+1024 }, {
"1023", 1023+1024 } } },
2393 { { {
"256", 256+4096 }, {
"256", 256+4096 }, {
"256", 256+4096 }, {
"0", 0+4096 } } },
2394 { { {
"2048", 2048+4096 }, {
"2048", 2048+4096 }, {
"2048", 2048+4096 }, {
"2048", 2048+4096 } } },
2395 { { {
"3760", 3760+4096 }, {
"3840", 3840+4096 }, {
"3840", 3840+4096 }, {
"4095", 4095+4096 } } },
2399 { { {
"0", 16+256 }, {
"0", 16+256 }, {
"0", 16+256 }, {
"0", 0+256 } } },
2400 { { {
"175", 71+256 }, {
"175", 72+256 }, {
"175", 72+256 }, {
"175", 64+256 } } },
2401 { { {
"350", 126+256 }, {
"350", 128+256 }, {
"350", 128+256 }, {
"350", 128+256 } } },
2402 { { {
"525", 180+256 }, {
"525", 184+256 }, {
"525", 184+256 }, {
"525", 192+256 } } },
2403 { { {
"700", 235+256 }, {
"700", 240+256 }, {
"700", 240+256 }, {
"700", 255+256 } } },
2407 { { {
"0", 32+512 }, {
"0", 32+512 }, {
"0", 32+512 }, {
"0", 0+512 } } },
2408 { { {
"175", 142+512 }, {
"175", 144+512 }, {
"175", 144+512 }, {
"175", 128+512 } } },
2409 { { {
"350", 251+512 }, {
"350", 256+512 }, {
"350", 256+512 }, {
"350", 256+512 } } },
2410 { { {
"525", 361+512 }, {
"525", 368+512 }, {
"525", 368+512 }, {
"525", 384+512 } } },
2411 { { {
"700", 470+512 }, {
"700", 480+512 }, {
"700", 480+512 }, {
"700", 511+512 } } },
2415 { { {
"0", 64+1024 }, {
"0", 64+1024 }, {
"0", 64+1024 }, {
"0", 0+1024 } } },
2416 { { {
"175", 283+1024 }, {
"175", 288+1024 }, {
"175", 288+1024 }, {
"175", 256+1024 } } },
2417 { { {
"350", 502+1024 }, {
"350", 512+1024 }, {
"350", 512+1024 }, {
"350", 512+1024 } } },
2418 { { {
"525", 721+1024 }, {
"525", 736+1024 }, {
"525", 736+1024 }, {
"525", 768+1024 } } },
2419 { { {
"700", 940+1024 }, {
"700", 960+1024 }, {
"700", 960+1024 }, {
"700", 1023+1024 } } },
2423 { { {
"0", 256+4096 }, {
"0", 256+4096 }, {
"0", 256+4096 }, {
"0", 0+4096 } } },
2424 { { {
"175", 1132+4096 }, {
"175", 1152+4096 }, {
"175", 1152+4096 }, {
"175", 1024+4096 } } },
2425 { { {
"350", 2008+4096 }, {
"350", 2048+4096 }, {
"350", 2048+4096 }, {
"350", 2048+4096 } } },
2426 { { {
"525", 2884+4096 }, {
"525", 2944+4096 }, {
"525", 2944+4096 }, {
"525", 3072+4096 } } },
2427 { { {
"700", 3760+4096 }, {
"700", 3840+4096 }, {
"700", 3840+4096 }, {
"700", 4095+4096 } } },
2431 { { {
"-25", -39+256 }, {
"-25", -40+256 }, {
"-25", -40+256 }, {
"-25", -64+256 } } },
2432 { { {
"0", 16+256 }, {
"0", 16+256 }, {
"0", 16+256 }, {
"0", 0+256 } } },
2433 { { {
"25", 71+256 }, {
"25", 72+256 }, {
"25", 72+256 }, {
"25", 64+256 } } },
2434 { { {
"50", 126+256 }, {
"50", 128+256 }, {
"50", 128+256 }, {
"50", 128+256 } } },
2435 { { {
"75", 180+256 }, {
"75", 184+256 }, {
"75", 184+256 }, {
"75", 192+256 } } },
2436 { { {
"100", 235+256 }, {
"100", 240+256 }, {
"100", 240+256 }, {
"100", 256+256 } } },
2437 { { {
"125", 290+256 }, {
"125", 296+256 }, {
"125", 296+256 }, {
"125", 320+256 } } },
2441 { { {
"-25", -78+512 }, {
"-25", -80+512 }, {
"-25", -80+512 }, {
"-25",-128+512 } } },
2442 { { {
"0", 32+512 }, {
"0", 32+512 }, {
"0", 32+512 }, {
"0", 0+512 } } },
2443 { { {
"25", 142+512 }, {
"25", 144+512 }, {
"25", 144+512 }, {
"25", 128+512 } } },
2444 { { {
"50", 251+512 }, {
"50", 256+512 }, {
"50", 256+512 }, {
"50", 256+512 } } },
2445 { { {
"75", 361+512 }, {
"75", 368+512 }, {
"75", 368+512 }, {
"75", 384+512 } } },
2446 { { {
"100", 470+512 }, {
"100", 480+512 }, {
"100", 480+512 }, {
"100", 512+512 } } },
2447 { { {
"125", 580+512 }, {
"125", 592+512 }, {
"125", 592+512 }, {
"125", 640+512 } } },
2451 { { {
"-25",-156+1024 }, {
"-25",-160+1024 }, {
"-25",-160+1024 }, {
"-25", -256+1024 } } },
2452 { { {
"0", 64+1024 }, {
"0", 64+1024 }, {
"0", 64+1024 }, {
"0", 0+1024 } } },
2453 { { {
"25", 283+1024 }, {
"25", 288+1024 }, {
"25", 288+1024 }, {
"25", 256+1024 } } },
2454 { { {
"50", 502+1024 }, {
"50", 512+1024 }, {
"50", 512+1024 }, {
"50", 512+1024 } } },
2455 { { {
"75", 721+1024 }, {
"75", 736+1024 }, {
"75", 736+1024 }, {
"75", 768+1024 } } },
2456 { { {
"100", 940+1024 }, {
"100", 960+1024 }, {
"100", 960+1024 }, {
"100", 1024+1024 } } },
2457 { { {
"125",1160+1024 }, {
"125",1184+1024 }, {
"125",1184+1024 }, {
"125", 1280+1024 } } },
2461 { { {
"-25", -624+4096 }, {
"-25", -640+4096 }, {
"-25", -640+4096 }, {
"-25",-1024+4096 } } },
2462 { { {
"0", 256+4096 }, {
"0", 256+4096 }, {
"0", 256+4096 }, {
"0", 0+4096 } } },
2463 { { {
"25", 1132+4096 }, {
"25", 1152+4096 }, {
"25", 1152+4096 }, {
"25", 1024+4096 } } },
2464 { { {
"50", 2008+4096 }, {
"50", 2048+4096 }, {
"50", 2048+4096 }, {
"50", 2048+4096 } } },
2465 { { {
"75", 2884+4096 }, {
"75", 2944+4096 }, {
"75", 2944+4096 }, {
"75", 3072+4096 } } },
2466 { { {
"100", 3760+4096 }, {
"100", 3840+4096 }, {
"100", 3840+4096 }, {
"100", 4096+4096 } } },
2467 { { {
"125", 4640+4096 }, {
"125", 4736+4096 }, {
"125", 4736+4096 }, {
"125", 5120+4096 } } },
2471 { { {
"16", 16 }, {
"16", 16 }, {
"16", 16 }, {
"0", 0 } } },
2472 { { {
"128", 128 }, {
"128", 128 }, {
"128", 128 }, {
"128", 128 } } },
2473 { { {
"235", 235 }, {
"240", 240 }, {
"240", 240 }, {
"255", 255 } } },
2477 { { {
"32", 32 }, {
"32", 32 }, {
"32", 32 }, {
"0", 0 } } },
2478 { { {
"256", 256 }, {
"256", 256 }, {
"256", 256 }, {
"256", 256 } } },
2479 { { {
"470", 470 }, {
"480", 480 }, {
"480", 480 }, {
"511", 511 } } },
2483 { { {
"64", 64 }, {
"64", 64 }, {
"64", 64 }, {
"0", 0 } } },
2484 { { {
"512", 512 }, {
"512", 512 }, {
"512", 512 }, {
"512", 512 } } },
2485 { { {
"940", 940 }, {
"960", 960 }, {
"960", 960 }, {
"1023", 1023 } } },
2489 { { {
"256", 256 }, {
"256", 256 }, {
"256", 256 }, {
"0", 0 } } },
2490 { { {
"2048", 2048 }, {
"2048", 2048 }, {
"2048", 2048 }, {
"2048", 2048 } } },
2491 { { {
"3760", 3760 }, {
"3840", 3840 }, {
"3840", 3840 }, {
"4095", 4095 } } },
2495 { { {
"0", 16 }, {
"0", 16 }, {
"0", 16 }, {
"0", 0 } } },
2496 { { {
"175", 71 }, {
"175", 72 }, {
"175", 72 }, {
"175", 64 } } },
2497 { { {
"350", 126 }, {
"350", 128 }, {
"350", 128 }, {
"350", 128 } } },
2498 { { {
"525", 180 }, {
"525", 184 }, {
"525", 184 }, {
"525", 192 } } },
2499 { { {
"700", 235 }, {
"700", 240 }, {
"700", 240 }, {
"700", 255 } } },
2503 { { {
"0", 32 }, {
"0", 32 }, {
"0", 32 }, {
"0", 0 } } },
2504 { { {
"175", 142 }, {
"175", 144 }, {
"175", 144 }, {
"175", 128 } } },
2505 { { {
"350", 251 }, {
"350", 256 }, {
"350", 256 }, {
"350", 256 } } },
2506 { { {
"525", 361 }, {
"525", 368 }, {
"525", 368 }, {
"525", 384 } } },
2507 { { {
"700", 470 }, {
"700", 480 }, {
"700", 480 }, {
"700", 511 } } },
2511 { { {
"0", 64 }, {
"0", 64 }, {
"0", 64 }, {
"0", 0 } } },
2512 { { {
"175", 283 }, {
"175", 288 }, {
"175", 288 }, {
"175", 256 } } },
2513 { { {
"350", 502 }, {
"350", 512 }, {
"350", 512 }, {
"350", 512 } } },
2514 { { {
"525", 721 }, {
"525", 736 }, {
"525", 736 }, {
"525", 768 } } },
2515 { { {
"700", 940 }, {
"700", 960 }, {
"700", 960 }, {
"700", 1023 } } },
2519 { { {
"0", 256 }, {
"0", 256 }, {
"0", 256 }, {
"0", 0 } } },
2520 { { {
"175", 1132 }, {
"175", 1152 }, {
"175", 1152 }, {
"175", 1024 } } },
2521 { { {
"350", 2008 }, {
"350", 2048 }, {
"350", 2048 }, {
"350", 2048 } } },
2522 { { {
"525", 2884 }, {
"525", 2944 }, {
"525", 2944 }, {
"525", 3072 } } },
2523 { { {
"700", 3760 }, {
"700", 3840 }, {
"700", 3840 }, {
"700", 4095 } } },
2527 { { {
"0", 16 }, {
"0", 16 }, {
"0", 16 }, {
"0", 0 } } },
2528 { { {
"25", 71 }, {
"25", 72 }, {
"25", 72 }, {
"25", 64 } } },
2529 { { {
"50", 126 }, {
"50", 128 }, {
"50", 128 }, {
"50", 128 } } },
2530 { { {
"75", 180 }, {
"75", 184 }, {
"75", 184 }, {
"75", 192 } } },
2531 { { {
"100", 235 }, {
"100", 240 }, {
"100", 240 }, {
"100", 255 } } },
2535 { { {
"0", 32 }, {
"0", 32 }, {
"0", 32 }, {
"0", 0 } } },
2536 { { {
"25", 142 }, {
"25", 144 }, {
"25", 144 }, {
"25", 128 } } },
2537 { { {
"50", 251 }, {
"50", 256 }, {
"50", 256 }, {
"50", 256 } } },
2538 { { {
"75", 361 }, {
"75", 368 }, {
"75", 368 }, {
"75", 384 } } },
2539 { { {
"100", 470 }, {
"100", 480 }, {
"100", 480 }, {
"100", 511 } } },
2543 { { {
"0", 64 }, {
"0", 64 }, {
"0", 64 }, {
"0", 0 } } },
2544 { { {
"25", 283 }, {
"25", 288 }, {
"25", 288 }, {
"25", 256 } } },
2545 { { {
"50", 502 }, {
"50", 512 }, {
"50", 512 }, {
"50", 512 } } },
2546 { { {
"75", 721 }, {
"75", 736 }, {
"75", 736 }, {
"75", 768 } } },
2547 { { {
"100", 940 }, {
"100", 960 }, {
"100", 960 }, {
"100", 1023 } } },
2551 { { {
"0", 256 }, {
"0", 256 }, {
"0", 256 }, {
"0", 0 } } },
2552 { { {
"25", 1132 }, {
"25", 1152 }, {
"25", 1152 }, {
"25", 1024 } } },
2553 { { {
"50", 2008 }, {
"50", 2048 }, {
"50", 2048 }, {
"50", 2048 } } },
2554 { { {
"75", 2884 }, {
"75", 2944 }, {
"75", 2944 }, {
"75", 3072 } } },
2555 { { {
"100", 3760 }, {
"100", 3840 }, {
"100", 3840 }, {
"100", 4095 } } },
2559 { { {
"50", 50 }, {
"50", 50 }, {
"50", 50 }, {
"50", 50 } } },
2560 { { {
"100", 100 }, {
"100", 100 }, {
"100", 100 }, {
"100", 100 } } },
2561 { { {
"150", 150 }, {
"150", 150 }, {
"150", 150 }, {
"150", 150 } } },
2562 { { {
"200", 200 }, {
"200", 200 }, {
"200", 200 }, {
"200", 200 } } },
2563 { { {
"255", 255 }, {
"255", 255 }, {
"255", 255 }, {
"255", 255 } } },
2567 { { {
"100", 100 }, {
"100", 100 }, {
"100", 100 }, {
"100", 100 } } },
2568 { { {
"200", 200 }, {
"200", 200 }, {
"200", 200 }, {
"200", 200 } } },
2569 { { {
"300", 300 }, {
"300", 300 }, {
"300", 300 }, {
"300", 300 } } },
2570 { { {
"400", 400 }, {
"400", 400 }, {
"400", 400 }, {
"400", 400 } } },
2571 { { {
"500", 500 }, {
"500", 500 }, {
"500", 500 }, {
"500", 500 } } },
2575 { { {
"200", 200 }, {
"200", 200 }, {
"200", 200 }, {
"200", 200 } } },
2576 { { {
"400", 400 }, {
"400", 400 }, {
"400", 400 }, {
"400", 400 } } },
2577 { { {
"600", 600 }, {
"600", 600 }, {
"600", 600 }, {
"600", 600 } } },
2578 { { {
"800", 800 }, {
"800", 800 }, {
"800", 800 }, {
"800", 800 } } },
2579 { { {
"1000",1000 }, {
"1000",1000 }, {
"1000",1000 }, {
"1000",1000 } } },
2583 { { {
"800", 800 }, {
"800", 800 }, {
"800", 800 }, {
"800", 800 } } },
2584 { { {
"1600", 1600 }, {
"1600", 1600 }, {
"1600", 1600 }, {
"1600", 1600 } } },
2585 { { {
"2400", 2400 }, {
"2400", 2400 }, {
"2400", 2400 }, {
"2400", 2400 } } },
2586 { { {
"3200", 3200 }, {
"3200", 3200 }, {
"3200", 3200 }, {
"3200", 3200 } } },
2587 { { {
"4000", 4000 }, {
"4000", 4000 }, {
"4000", 4000 }, {
"4000", 4000 } } },
2595 dst[0] = v * o1 + dst[0] * o2;
2597 dst += linesize *
step;
2603 uint16_t *dst = (uint16_t *)ddst;
2607 dst[0] = v * o1 + dst[0] * o2;
2609 dst += (linesize / 2) *
step;
2618 dst[x] = v * o1 + dst[x] * o2;
2624 uint16_t *dst = (uint16_t *)ddst;
2628 dst[x] = v * o1 + dst[x] * o2;
2634 const uint8_t *font;
2640 for (plane = 0; plane < 4 &&
out->data[plane]; plane++) {
2641 for (
i = 0; txt[
i];
i++) {
2643 int v =
color[plane];
2645 uint8_t *p =
out->data[plane] + y *
out->linesize[plane] + (x +
i * 8);
2646 for (char_y = 0; char_y < font_height; char_y++) {
2648 if (font[txt[
i] * font_height + char_y] &
mask)
2649 p[0] = p[0] * o2 + v * o1;
2652 p +=
out->linesize[plane] - 8;
2660 const uint8_t *font;
2666 for (plane = 0; plane < 4 &&
out->data[plane]; plane++) {
2667 for (
i = 0; txt[
i];
i++) {
2671 uint16_t *p = (uint16_t *)(
out->data[plane] + y *
out->linesize[plane]) + (x +
i * 8);
2672 for (char_y = 0; char_y < font_height; char_y++) {
2674 if (font[txt[
i] * font_height + char_y] &
mask)
2675 p[0] = p[0] * o2 + v * o1;
2678 p +=
out->linesize[plane] / 2 - 8;
2686 const uint8_t *font;
2692 for (plane = 0; plane < 4 &&
out->data[plane]; plane++) {
2693 for (
i = 0; txt[
i];
i++) {
2695 int v =
color[plane];
2697 for (char_y = font_height - 1; char_y >= 0; char_y--) {
2698 uint8_t *p =
out->data[plane] + (y +
i * 10) *
out->linesize[plane] + x;
2700 if (font[txt[
i] * font_height + font_height - 1 - char_y] &
mask)
2701 p[char_y] = p[char_y] * o2 + v * o1;
2702 p +=
out->linesize[plane];
2711 const uint8_t *font;
2717 for (plane = 0; plane < 4 &&
out->data[plane]; plane++) {
2718 for (
i = 0; txt[
i];
i++) {
2722 for (char_y = 0; char_y < font_height; char_y++) {
2723 uint16_t *p = (uint16_t *)(
out->data[plane] + (y +
i * 10) *
out->linesize[plane]) + x;
2725 if (font[txt[
i] * font_height + font_height - 1 - char_y] &
mask)
2726 p[char_y] = p[char_y] * o2 + v * o1;
2727 p +=
out->linesize[plane] / 2;
2739 dst[0] = (v - dst[0]) * o1 + dst[0] * o2;
2741 dst += linesize *
step;
2747 uint16_t *dst = (uint16_t *)ddst;
2751 dst[0] = (v - dst[0]) * o1 + dst[0] * o2;
2753 dst += (linesize / 2) *
step;
2762 dst[x] = (v - dst[x]) * o1 + dst[x] * o2;
2768 uint16_t *dst = (uint16_t *)ddst;
2772 dst[x] = (v - dst[x]) * o1 + dst[x] * o2;
2778 const uint8_t *font;
2784 for (plane = 0; plane < 4 &&
out->data[plane]; plane++) {
2785 for (
i = 0; txt[
i];
i++) {
2787 int v =
color[plane];
2789 uint8_t *p =
out->data[plane] + y *
out->linesize[plane] + (x +
i * 8);
2790 for (char_y = 0; char_y < font_height; char_y++) {
2792 if (font[txt[
i] * font_height + char_y] &
mask)
2793 p[0] = p[0] * o2 + (v - p[0]) * o1;
2796 p +=
out->linesize[plane] - 8;
2804 const uint8_t *font;
2810 for (plane = 0; plane < 4 &&
out->data[plane]; plane++) {
2811 for (
i = 0; txt[
i];
i++) {
2815 uint16_t *p = (uint16_t *)(
out->data[plane] + y *
out->linesize[plane]) + (x +
i * 8);
2816 for (char_y = 0; char_y < font_height; char_y++) {
2818 if (font[txt[
i] * font_height + char_y] &
mask)
2819 p[0] = p[0] * o2 + (v - p[0]) * o1;
2822 p +=
out->linesize[plane] / 2 - 8;
2830 const uint8_t *font;
2836 for (plane = 0; plane < 4 &&
out->data[plane]; plane++) {
2837 for (
i = 0; txt[
i];
i++) {
2839 int v =
color[plane];
2841 for (char_y = font_height - 1; char_y >= 0; char_y--) {
2842 uint8_t *p =
out->data[plane] + (y +
i * 10) *
out->linesize[plane] + x;
2844 if (font[txt[
i] * font_height + font_height - 1 - char_y] &
mask)
2845 p[char_y] = p[char_y] * o2 + (v - p[char_y]) * o1;
2846 p +=
out->linesize[plane];
2855 const uint8_t *font;
2861 for (plane = 0; plane < 4 &&
out->data[plane]; plane++) {
2862 for (
i = 0; txt[
i];
i++) {
2866 for (char_y = 0; char_y < font_height; char_y++) {
2867 uint16_t *p = (uint16_t *)(
out->data[plane] + (y +
i * 10) *
out->linesize[plane]) + x;
2869 if (font[txt[
i] * font_height + font_height - 1 - char_y] &
mask)
2870 p[char_y] = p[char_y] * o2 + (v - p[char_y]) * o1;
2871 p +=
out->linesize[plane] / 2;
2884 const int step = (
s->flags & 2) + 1;
2885 const float o1 =
s->opacity;
2886 const float o2 = 1. - o1;
2888 int C, k = 0,
c, p, l, offset_x = 0, offset_y = 0;
2890 for (
c = 0;
c <
s->ncomp;
c++) {
2891 if (!((1 <<
c) &
s->pcomp) || (!
s->display && k > 0))
2896 for (p = 0; p <
s->ncomp; p++) {
2897 const int v =
s->grat_yuva_color[p];
2898 for (l = 0; l <
s->nb_glines; l++) {
2899 const uint16_t
pos =
s->glines[l].line[
C].pos;
2900 int x = offset_x + (
s->mirror ?
s->size - 1 -
pos :
pos);
2901 uint8_t *dst =
out->data[p] + offset_y *
out->linesize[p] + x;
2907 for (l = 0; l <
s->nb_glines && (
s->flags & 1); l++) {
2908 const char *
name =
s->glines[l].line[
C].name;
2909 const uint16_t
pos =
s->glines[l].line[
C].pos;
2910 int x = offset_x + (
s->mirror ?
s->size - 1 -
pos :
pos) - 10;
2915 s->draw_text(
out, x, offset_y + 2, 1, o1, o2,
name,
s->grat_yuva_color);
2918 offset_x +=
s->size * (
s->display ==
STACK);
2925 const int step = (
s->flags & 2) + 1;
2926 const float o1 =
s->opacity;
2927 const float o2 = 1. - o1;
2928 const int mult =
s->max / 256;
2930 int C, k = 0,
c, p, l, offset_x = 0, offset_y = 0;
2932 for (
c = 0;
c <
s->ncomp;
c++) {
2933 if (!((1 <<
c) &
s->pcomp) || (!
s->display && k > 0))
2938 for (p = 0; p <
s->ncomp; p++) {
2939 const int v =
s->grat_yuva_color[p] *
mult;
2940 for (l = 0; l <
s->nb_glines ; l++) {
2941 const uint16_t
pos =
s->glines[l].line[
C].pos;
2942 int x = offset_x + (
s->mirror ?
s->size - 1 -
pos :
pos);
2943 uint8_t *dst = (uint8_t *)(
out->data[p] + offset_y *
out->linesize[p]) + x * 2;
2949 for (l = 0; l <
s->nb_glines && (
s->flags & 1); l++) {
2950 const char *
name =
s->glines[l].line[
C].name;
2951 const uint16_t
pos =
s->glines[l].line[
C].pos;
2952 int x = offset_x + (
s->mirror ?
s->size - 1 -
pos :
pos) - 10;
2957 s->draw_text(
out, x, offset_y + 2,
mult, o1, o2,
name,
s->grat_yuva_color);
2960 offset_x +=
s->size * (
s->display ==
STACK);
2967 const int step = (
s->flags & 2) + 1;
2968 const float o1 =
s->opacity;
2969 const float o2 = 1. - o1;
2971 int C, k = 0,
c, p, l, offset_y = 0, offset_x = 0;
2973 for (
c = 0;
c <
s->ncomp;
c++) {
2974 if ((!((1 <<
c) &
s->pcomp) || (!
s->display && k > 0)))
2979 for (p = 0; p <
s->ncomp; p++) {
2980 const int v =
s->grat_yuva_color[p];
2981 for (l = 0; l <
s->nb_glines ; l++) {
2982 const uint16_t
pos =
s->glines[l].line[
C].pos;
2983 int y = offset_y + (
s->mirror ?
s->size - 1 -
pos :
pos);
2984 uint8_t *dst =
out->data[p] + y *
out->linesize[p] + offset_x;
2986 s->blend_line(dst,
width, 1, o1, o2, v,
step);
2990 for (l = 0; l <
s->nb_glines && (
s->flags & 1); l++) {
2991 const char *
name =
s->glines[l].line[
C].name;
2992 const uint16_t
pos =
s->glines[l].line[
C].pos;
2993 int y = offset_y + (
s->mirror ?
s->size - 1 -
pos :
pos) - 10;
2998 s->draw_text(
out, 2 + offset_x, y, 1, o1, o2,
name,
s->grat_yuva_color);
3001 offset_y +=
s->size * (
s->display ==
STACK);
3008 const int step = (
s->flags & 2) + 1;
3009 const float o1 =
s->opacity;
3010 const float o2 = 1. - o1;
3011 const int mult =
s->max / 256;
3013 int C, k = 0,
c, p, l, offset_x = 0, offset_y = 0;
3015 for (
c = 0;
c <
s->ncomp;
c++) {
3016 if ((!((1 <<
c) &
s->pcomp) || (!
s->display && k > 0)))
3021 for (p = 0; p <
s->ncomp; p++) {
3022 const int v =
s->grat_yuva_color[p] *
mult;
3023 for (l = 0; l <
s->nb_glines ; l++) {
3024 const uint16_t
pos =
s->glines[l].line[
C].pos;
3025 int y = offset_y + (
s->mirror ?
s->size - 1 -
pos :
pos);
3026 uint8_t *dst = (uint8_t *)(
out->data[p] + y *
out->linesize[p]) + offset_x * 2;
3028 s->blend_line(dst,
width, 1, o1, o2, v,
step);
3032 for (l = 0; l <
s->nb_glines && (
s->flags & 1); l++) {
3033 const char *
name =
s->glines[l].line[
C].name;
3034 const uint16_t
pos =
s->glines[l].line[
C].pos;
3035 int y = offset_y + (
s->mirror ?
s->size - 1 -
pos:
pos) - 10;
3040 s->draw_text(
out, 2 + offset_x, y,
mult, o1, o2,
name,
s->grat_yuva_color);
3043 offset_y +=
s->size * (
s->display ==
STACK);
3054 s->ncomp =
s->desc->nb_components;
3055 s->bits =
s->desc->comp[0].depth;
3056 s->max = 1 <<
s->bits;
3058 s->shift_w[0] =
s->shift_w[3] = 0;
3059 s->shift_h[0] =
s->shift_h[3] = 0;
3060 s->shift_w[1] =
s->shift_w[2] =
s->desc->log2_chroma_w;
3061 s->shift_h[1] =
s->shift_h[2] =
s->desc->log2_chroma_h;
3065 switch (
s->filter) {
3068 case AFLAT:
s->size = 256 * 2;
break;
3069 case FLAT:
s->size = 256 * 3;
break;
3070 default:
s->size = 256;
break;
3073 switch (
s->filter | ((
s->bits > 8) << 4) |
3074 (
s->mode << 8) | (
s->mirror << 12)) {
3075 case 0x1100:
s->waveform_slice = lowpass_column_mirror;
break;
3076 case 0x1000:
s->waveform_slice = lowpass_row_mirror;
break;
3077 case 0x0100:
s->waveform_slice = lowpass_column;
break;
3078 case 0x0000:
s->waveform_slice = lowpass_row;
break;
3079 case 0x1110:
s->waveform_slice = lowpass16_column_mirror;
break;
3080 case 0x1010:
s->waveform_slice = lowpass16_row_mirror;
break;
3081 case 0x0110:
s->waveform_slice = lowpass16_column;
break;
3082 case 0x0010:
s->waveform_slice = lowpass16_row;
break;
3083 case 0x1101:
s->waveform_slice = flat_column_mirror;
break;
3084 case 0x1001:
s->waveform_slice = flat_row_mirror;
break;
3085 case 0x0101:
s->waveform_slice = flat_column;
break;
3086 case 0x0001:
s->waveform_slice = flat_row;
break;
3087 case 0x1111:
s->waveform_slice = flat16_column_mirror;
break;
3088 case 0x1011:
s->waveform_slice = flat16_row_mirror;
break;
3089 case 0x0111:
s->waveform_slice = flat16_column;
break;
3090 case 0x0011:
s->waveform_slice = flat16_row;
break;
3091 case 0x1102:
s->waveform_slice = aflat_column_mirror;
break;
3092 case 0x1002:
s->waveform_slice = aflat_row_mirror;
break;
3093 case 0x0102:
s->waveform_slice = aflat_column;
break;
3094 case 0x0002:
s->waveform_slice = aflat_row;
break;
3095 case 0x1112:
s->waveform_slice = aflat16_column_mirror;
break;
3096 case 0x1012:
s->waveform_slice = aflat16_row_mirror;
break;
3097 case 0x0112:
s->waveform_slice = aflat16_column;
break;
3098 case 0x0012:
s->waveform_slice = aflat16_row;
break;
3099 case 0x1103:
s->waveform_slice = chroma_column_mirror;
break;
3100 case 0x1003:
s->waveform_slice = chroma_row_mirror;
break;
3101 case 0x0103:
s->waveform_slice = chroma_column;
break;
3102 case 0x0003:
s->waveform_slice = chroma_row;
break;
3103 case 0x1113:
s->waveform_slice = chroma16_column_mirror;
break;
3104 case 0x1013:
s->waveform_slice = chroma16_row_mirror;
break;
3105 case 0x0113:
s->waveform_slice = chroma16_column;
break;
3106 case 0x0013:
s->waveform_slice = chroma16_row;
break;
3107 case 0x1104:
s->waveform_slice = color_column_mirror;
break;
3108 case 0x1004:
s->waveform_slice = color_row_mirror;
break;
3109 case 0x0104:
s->waveform_slice = color_column;
break;
3110 case 0x0004:
s->waveform_slice = color_row;
break;
3111 case 0x1114:
s->waveform_slice = color16_column_mirror;
break;
3112 case 0x1014:
s->waveform_slice = color16_row_mirror;
break;
3113 case 0x0114:
s->waveform_slice = color16_column;
break;
3114 case 0x0014:
s->waveform_slice = color16_row;
break;
3115 case 0x1105:
s->waveform_slice = acolor_column_mirror;
break;
3116 case 0x1005:
s->waveform_slice = acolor_row_mirror;
break;
3117 case 0x0105:
s->waveform_slice = acolor_column;
break;
3118 case 0x0005:
s->waveform_slice = acolor_row;
break;
3119 case 0x1115:
s->waveform_slice = acolor16_column_mirror;
break;
3120 case 0x1015:
s->waveform_slice = acolor16_row_mirror;
break;
3121 case 0x0115:
s->waveform_slice = acolor16_column;
break;
3122 case 0x0015:
s->waveform_slice = acolor16_row;
break;
3123 case 0x1106:
s->waveform_slice = xflat_column_mirror;
break;
3124 case 0x1006:
s->waveform_slice = xflat_row_mirror;
break;
3125 case 0x0106:
s->waveform_slice = xflat_column;
break;
3126 case 0x0006:
s->waveform_slice = xflat_row;
break;
3127 case 0x1116:
s->waveform_slice = xflat16_column_mirror;
break;
3128 case 0x1016:
s->waveform_slice = xflat16_row_mirror;
break;
3129 case 0x0116:
s->waveform_slice = xflat16_column;
break;
3130 case 0x0016:
s->waveform_slice = xflat16_row;
break;
3131 case 0x1107:
s->waveform_slice = yflat_column_mirror;
break;
3132 case 0x1007:
s->waveform_slice = yflat_row_mirror;
break;
3133 case 0x0107:
s->waveform_slice = yflat_column;
break;
3134 case 0x0007:
s->waveform_slice = yflat_row;
break;
3135 case 0x1117:
s->waveform_slice = yflat16_column_mirror;
break;
3136 case 0x1017:
s->waveform_slice = yflat16_row_mirror;
break;
3137 case 0x0117:
s->waveform_slice = yflat16_column;
break;
3138 case 0x0017:
s->waveform_slice = yflat16_row;
break;
3141 s->grat_yuva_color[0] = 255;
3142 s->grat_yuva_color[1] =
s->graticule ==
GRAT_INVERT ? 255 : 0;
3144 s->grat_yuva_color[3] = 255;
3160 switch (
s->filter) {
3171 else if (
s->graticule >
GRAT_NONE &&
s->mode == 0)
3176 switch (
s->filter) {
3295 s->size =
s->size << (
s->bits - 8);
3297 switch (
inlink->format) {
3320 for (
i = 0;
i <
s->ncomp;
i++) {
3321 if ((1 <<
i) &
s->pcomp)
3329 s->dcomp =
s->odesc->nb_components;
3347 for (p = 0; p <
s->ncomp; p++) {
3348 const int plane =
s->desc->comp[p].plane;
3351 if (!((1 << p) &
s->pcomp))
3354 for (k = 0; k < 4; k++) {
3355 s->emax[plane][k] =
s->peak +
size * (plane * 4 + k + 0);
3356 s->emin[plane][k] =
s->peak +
size * (plane * 4 + k + 16);
3361 s->eend[plane] = (
offset +
s->size - 1);
3363 for (k = 0; k < 4; k++) {
3364 s->emax[plane][k][
i] =
s->estart[plane];
3365 s->emin[plane][k][
i] =
s->eend[plane];
3370 switch (
s->fitmode) {
3396 s->intensity =
s->fintensity * (
s->max - 1);
3397 s->bg_color[3] =
s->bgopacity * (
s->max - 1);
3398 s->tint[0] = .5f * (
s->ftint[0] + 1.f) * (
s->size - 1);
3399 s->tint[1] = .5f * (
s->ftint[1] + 1.f) * (
s->size - 1);
3407 for (k = 0; k <
s->dcomp; k++) {
3409 for (
i = 0;
i < outlink->
h ;
i++)
3410 memset(
out->data[
s->odesc->comp[k].plane] +
3411 i *
out->linesize[
s->odesc->comp[k].plane],
3412 s->bg_color[k], outlink->
w);
3414 const int mult =
s->max / 256;
3415 uint16_t *dst = (uint16_t *)
out->data[
s->odesc->comp[k].plane];
3417 for (
i = 0;
i < outlink->
h ;
i++) {
3418 for (j = 0; j < outlink->
w; j++)
3419 dst[j] =
s->bg_color[k] *
mult;
3420 dst +=
out->linesize[
s->odesc->comp[k].plane] / 2;
3425 for (k = 0,
i = 0; k <
s->ncomp; k++) {
3426 if ((1 << k) &
s->pcomp) {
3427 const int plane =
s->desc->comp[k].plane;
3433 offset_x =
s->mode ?
i++ *
inlink->w : 0;
3434 offset_y =
s->mode ? 0 :
i++ *
inlink->h;
3436 offset_y =
s->mode ?
i++ *
s->size * !!
s->display : 0;
3437 offset_x =
s->mode ? 0 :
i++ *
s->size * !!
s->display;
3443 td.offset_y = offset_y;
3444 td.offset_x = offset_x;
3447 switch (
s->filter) {
3458 envelope(
s,
out, plane, plane,
s->mode ? offset_x : offset_y);
3464 envelope(
s,
out, plane, plane,
s->mode ? offset_x : offset_y);
3465 envelope(
s,
out, plane, (plane + 1) %
s->ncomp,
s->mode ? offset_x : offset_y);
3468 envelope16(
s,
out, plane, (plane + 1) %
s->ncomp,
s->mode ? offset_x : offset_y);
3475 envelope(
s,
out, plane, (plane + 0) %
s->ncomp,
s->mode ? offset_x : offset_y);
3476 envelope(
s,
out, plane, (plane + 1) %
s->ncomp,
s->mode ? offset_x : offset_y);
3477 envelope(
s,
out, plane, (plane + 2) %
s->ncomp,
s->mode ? offset_x : offset_y);
3479 envelope16(
s,
out, plane, (plane + 0) %
s->ncomp,
s->mode ? offset_x : offset_y);
3480 envelope16(
s,
out, plane, (plane + 1) %
s->ncomp,
s->mode ? offset_x : offset_y);
3481 envelope16(
s,
out, plane, (plane + 2) %
s->ncomp,
s->mode ? offset_x : offset_y);
3487 s->graticulef(
s,
out);
3524 .priv_class = &waveform_class,