125 int jobnr,
int nb_jobs);
130 float o1,
float o2,
const char *txt,
131 const uint8_t
color[4]);
136 #define OFFSET(x) offsetof(WaveformContext, x)
137 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
138 #define TFLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
326 if (!
ctx->inputs[0]->incfg.formats ||
327 !
ctx->inputs[0]->incfg.formats->nb_formats) {
343 if (!
ctx->inputs[0]->outcfg.formats) {
348 avff =
ctx->inputs[0]->incfg.formats;
349 avff2 =
ctx->inputs[0]->outcfg.formats;
355 depth =
desc->comp[0].depth;
357 if (
ncomp != ncomp2 || depth != depth2)
362 depth !=
desc->comp[0].depth)
374 else if (
rgb && depth == 8 &&
ncomp > 2)
376 else if (
rgb && depth == 9 &&
ncomp > 2)
378 else if (
rgb && depth == 10 &&
ncomp > 2)
380 else if (
rgb && depth == 12 &&
ncomp > 2)
382 else if (depth == 8 &&
ncomp > 2)
384 else if (depth == 9 &&
ncomp > 2)
386 else if (depth == 10 &&
ncomp > 2)
388 else if (depth == 12 &&
ncomp > 2)
400 const int dst_linesize =
out->linesize[component] / 2;
401 const int bg =
s->bg_color[component] * (
s->max / 256);
402 const int limit =
s->max - 1;
403 const int dst_h =
s->display ==
PARADE ?
out->height /
s->acomp :
out->height;
404 const int dst_w =
s->display ==
PARADE ?
out->width /
s->acomp :
out->width;
405 const int start =
s->estart[plane];
406 const int end =
s->eend[plane];
412 for (y = start; y < end; y++) {
413 dst = (uint16_t *)
out->data[component] + y * dst_linesize + x;
419 for (y = end - 1; y >= start; y--) {
420 dst = (uint16_t *)
out->data[component] + y * dst_linesize + x;
429 dst = (uint16_t *)
out->data[component] + y * dst_linesize;
430 for (x = start; x < end; x++) {
436 for (x = end - 1; x >= start; x--) {
448 const int dst_linesize =
out->linesize[component];
449 const uint8_t bg =
s->bg_color[component];
450 const int dst_h =
s->display ==
PARADE ?
out->height /
s->acomp :
out->height;
451 const int dst_w =
s->display ==
PARADE ?
out->width /
s->acomp :
out->width;
452 const int start =
s->estart[plane];
453 const int end =
s->eend[plane];
459 for (y = start; y < end; y++) {
460 dst =
out->data[component] + y * dst_linesize + x;
466 for (y = end - 1; y >= start; y--) {
467 dst =
out->data[component] + y * dst_linesize + x;
476 dst =
out->data[component] + y * dst_linesize;
477 for (x = start; x < end; x++) {
483 for (x = end - 1; x >= start; x--) {
495 const int dst_linesize =
out->linesize[component] / 2;
496 const int bg =
s->bg_color[component] * (
s->max / 256);
497 const int limit =
s->max - 1;
498 const int dst_h =
s->display ==
PARADE ?
out->height /
s->acomp :
out->height;
499 const int dst_w =
s->display ==
PARADE ?
out->width /
s->acomp :
out->width;
500 const int start =
s->estart[plane];
501 const int end =
s->eend[plane];
502 int *
emax =
s->emax[plane][component];
503 int *
emin =
s->emin[plane][component];
509 for (y = start; y < end && y <
emin[x -
offset]; y++) {
510 dst = (uint16_t *)
out->data[component] + y * dst_linesize + x;
516 for (y = end - 1; y >= start && y >=
emax[x -
offset]; y--) {
517 dst = (uint16_t *)
out->data[component] + y * dst_linesize + x;
525 if (
s->envelope == 3)
529 dst = (uint16_t *)
out->data[component] +
emin[x -
offset] * dst_linesize + x;
531 dst = (uint16_t *)
out->data[component] +
emax[x -
offset] * dst_linesize + x;
536 dst = (uint16_t *)
out->data[component] + y * dst_linesize;
543 for (x = end - 1; x >= start && x >=
emax[y -
offset]; x--) {
551 if (
s->envelope == 3)
555 dst = (uint16_t *)
out->data[component] + y * dst_linesize +
emin[y -
offset];
557 dst = (uint16_t *)
out->data[component] + y * dst_linesize +
emax[y -
offset];
565 const int dst_linesize =
out->linesize[component];
566 const int bg =
s->bg_color[component];
567 const int dst_h =
s->display ==
PARADE ?
out->height /
s->acomp :
out->height;
568 const int dst_w =
s->display ==
PARADE ?
out->width /
s->acomp :
out->width;
569 const int start =
s->estart[plane];
570 const int end =
s->eend[plane];
571 int *
emax =
s->emax[plane][component];
572 int *
emin =
s->emin[plane][component];
578 for (y = start; y < end && y <
emin[x -
offset]; y++) {
579 dst =
out->data[component] + y * dst_linesize + x;
585 for (y = end - 1; y >= start && y >=
emax[x -
offset]; y--) {
586 dst =
out->data[component] + y * dst_linesize + x;
594 if (
s->envelope == 3)
598 dst =
out->data[component] +
emin[x -
offset] * dst_linesize + x;
600 dst =
out->data[component] +
emax[x -
offset] * dst_linesize + x;
605 dst =
out->data[component] + y * dst_linesize;
606 for (x = start; x < end && x <
emin[y -
offset]; x++) {
612 for (x = end - 1; x >= start && x >=
emax[y -
offset]; x--) {
620 if (
s->envelope == 3)
624 dst =
out->data[component] + y * dst_linesize +
emin[y -
offset];
626 dst =
out->data[component] + y * dst_linesize +
emax[y -
offset];
634 if (
s->envelope == 0) {
636 }
else if (
s->envelope == 1) {
645 if (
s->envelope == 0) {
647 }
else if (
s->envelope == 1) {
689 int offset_y,
int offset_x,
691 int jobnr,
int nb_jobs)
693 const int plane =
s->desc->comp[component].plane;
694 const int dplane = (
s->rgb ||
s->display ==
OVERLAY) ? plane : 0;
695 const int shift_w =
s->shift_w[component];
696 const int shift_h =
s->shift_h[component];
697 const int src_linesize = in->
linesize[plane] / 2;
698 const int dst_linesize =
out->linesize[dplane] / 2;
699 const int dst_signed_linesize = dst_linesize * (
mirror == 1 ? -1 : 1);
700 const int limit =
s->max - 1;
704 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
705 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
706 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
707 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
709 const uint16_t *src_data = (
const uint16_t *)in->
data[plane] + sliceh_start * src_linesize;
710 uint16_t *dst_data = (uint16_t *)
out->data[dplane] + (offset_y + sliceh_start *
step) * dst_linesize + offset_x;
711 uint16_t *
const dst_bottom_line = dst_data + dst_linesize * (
s->size - 1);
712 uint16_t *
const dst_line = (
mirror ? dst_bottom_line : dst_data);
719 for (y = sliceh_start; y < sliceh_end; y++) {
720 const uint16_t *src_data_end = src_data + slicew_end;
721 uint16_t *dst = dst_line + slicew_start *
step;
723 for (p = src_data + slicew_start; p < src_data_end; p++) {
729 target = dst++ + dst_signed_linesize * v;
731 }
while (++
i <
step);
733 uint16_t *row = dst_data;
736 target = row - v - 1;
741 }
while (++
i <
step);
744 src_data += src_linesize;
745 dst_data += dst_linesize *
step;
748 if (
s->display !=
OVERLAY && column && !
s->rgb) {
749 const int mult =
s->max / 256;
750 const int bg =
s->bg_color[0] *
mult;
751 const int t0 =
s->tint[0];
752 const int t1 =
s->tint[1];
753 uint16_t *dst0, *dst1;
757 src = (
const uint16_t *)(
out->data[0]) + offset_y * dst_linesize + offset_x;
758 dst0 = (uint16_t *)(
out->data[1]) + offset_y * dst_linesize + offset_x;
759 dst1 = (uint16_t *)(
out->data[2]) + offset_y * dst_linesize + offset_x;
760 for (y = 0; y <
s->max; y++) {
761 for (x = slicew_start *
step; x < slicew_end *
step; x++) {
769 dst0 += dst_linesize;
770 dst1 += dst_linesize;
772 }
else if (
s->display !=
OVERLAY && !
s->rgb) {
773 const int mult =
s->max / 256;
774 const int bg =
s->bg_color[0] *
mult;
775 const int t0 =
s->tint[0];
776 const int t1 =
s->tint[1];
777 uint16_t *dst0, *dst1;
781 src = (
const uint16_t *)
out->data[0] + (offset_y + sliceh_start *
step) * dst_linesize + offset_x;
782 dst0 = (uint16_t *)(
out->data[1]) + (offset_y + sliceh_start *
step) * dst_linesize + offset_x;
783 dst1 = (uint16_t *)(
out->data[2]) + (offset_y + sliceh_start *
step) * dst_linesize + offset_x;
784 for (y = sliceh_start *
step; y < sliceh_end *
step; y++) {
785 for (x = 0; x <
s->max; x++) {
793 dst0 += dst_linesize;
794 dst1 += dst_linesize;
799 #define LOWPASS16_FUNC(name, column, mirror) \
800 static int lowpass16_##name(AVFilterContext *ctx, \
801 void *arg, int jobnr, \
804 WaveformContext *s = ctx->priv; \
805 ThreadData *td = arg; \
806 AVFrame *in = td->in; \
807 AVFrame *out = td->out; \
808 int component = td->component; \
809 int offset_y = td->offset_y; \
810 int offset_x = td->offset_x; \
812 lowpass16(s, in, out, component, s->intensity, \
813 offset_y, offset_x, column, mirror, \
827 int offset_y,
int offset_x,
829 int jobnr,
int nb_jobs)
831 const int plane =
s->desc->comp[component].plane;
832 const int dplane = (
s->rgb ||
s->display ==
OVERLAY) ? plane : 0;
833 const int shift_w =
s->shift_w[component];
834 const int shift_h =
s->shift_h[component];
835 const int src_linesize = in->linesize[plane];
836 const int dst_linesize =
out->linesize[dplane];
837 const int dst_signed_linesize = dst_linesize * (
mirror == 1 ? -1 : 1);
841 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
842 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
843 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
844 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
846 const uint8_t *src_data = in->data[plane] + sliceh_start * src_linesize;
847 uint8_t *dst_data =
out->data[dplane] + (offset_y + sliceh_start *
step) * dst_linesize + offset_x;
848 uint8_t *
const dst_bottom_line = dst_data + dst_linesize * (
s->size - 1);
849 uint8_t *
const dst_line = (
mirror ? dst_bottom_line : dst_data);
856 for (y = sliceh_start; y < sliceh_end; y++) {
857 const uint8_t *src_data_end = src_data + slicew_end;
858 uint8_t *dst = dst_line + slicew_start *
step;
860 for (p = src_data + slicew_start; p < src_data_end; p++) {
866 target = dst++ + dst_signed_linesize * *p;
868 }
while (++
i <
step);
870 uint8_t *row = dst_data;
873 target = row - *p - 1;
878 }
while (++
i <
step);
881 src_data += src_linesize;
882 dst_data += dst_linesize *
step;
885 if (
s->display !=
OVERLAY && column && !
s->rgb &&
out->data[1] &&
out->data[2]) {
886 const int bg =
s->bg_color[0];
887 const int dst_h = 256;
888 const int t0 =
s->tint[0];
889 const int t1 =
s->tint[1];
890 uint8_t *dst0, *dst1;
894 src =
out->data[0] + offset_y * dst_linesize + offset_x;
895 dst0 =
out->data[1] + offset_y * dst_linesize + offset_x;
896 dst1 =
out->data[2] + offset_y * dst_linesize + offset_x;
897 for (y = 0; y < dst_h; y++) {
898 for (x = slicew_start *
step; x < slicew_end *
step; x++) {
906 dst0 += dst_linesize;
907 dst1 += dst_linesize;
909 }
else if (
s->display !=
OVERLAY && !
s->rgb &&
out->data[1] &&
out->data[2]) {
910 const int bg =
s->bg_color[0];
911 const int dst_w = 256;
912 const int t0 =
s->tint[0];
913 const int t1 =
s->tint[1];
914 uint8_t *dst0, *dst1;
918 src =
out->data[0] + (offset_y + sliceh_start *
step) * dst_linesize + offset_x;
919 dst0 =
out->data[1] + (offset_y + sliceh_start *
step) * dst_linesize + offset_x;
920 dst1 =
out->data[2] + (offset_y + sliceh_start *
step) * dst_linesize + offset_x;
921 for (y = sliceh_start *
step; y < sliceh_end *
step; y++) {
922 for (x = 0; x < dst_w; x++) {
930 dst0 += dst_linesize;
931 dst1 += dst_linesize;
936 #define LOWPASS_FUNC(name, column, mirror) \
937 static int lowpass_##name(AVFilterContext *ctx, \
938 void *arg, int jobnr, \
941 WaveformContext *s = ctx->priv; \
942 ThreadData *td = arg; \
943 AVFrame *in = td->in; \
944 AVFrame *out = td->out; \
945 int component = td->component; \
946 int offset_y = td->offset_y; \
947 int offset_x = td->offset_x; \
949 lowpass(s, in, out, component, s->intensity, \
950 offset_y, offset_x, column, mirror, \
964 int offset_y,
int offset_x,
966 int jobnr,
int nb_jobs)
968 const int plane =
s->desc->comp[component].plane;
969 const int c0_linesize = in->linesize[ plane + 0 ] / 2;
970 const int c1_linesize = in->linesize[(plane + 1) %
s->ncomp] / 2;
971 const int c2_linesize = in->linesize[(plane + 2) %
s->ncomp] / 2;
972 const int c0_shift_w =
s->shift_w[ component + 0 ];
973 const int c1_shift_w =
s->shift_w[(component + 1) %
s->ncomp];
974 const int c2_shift_w =
s->shift_w[(component + 2) %
s->ncomp];
975 const int c0_shift_h =
s->shift_h[ component + 0 ];
976 const int c1_shift_h =
s->shift_h[(component + 1) %
s->ncomp];
977 const int c2_shift_h =
s->shift_h[(component + 2) %
s->ncomp];
978 const int d0_linesize =
out->linesize[ plane + 0 ] / 2;
979 const int d1_linesize =
out->linesize[(plane + 1) %
s->ncomp] / 2;
980 const int limit =
s->max - 1;
982 const int mid =
s->max / 2;
983 const int src_h = in->height;
984 const int src_w = in->width;
985 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
986 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
987 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
988 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
992 const int d0_signed_linesize = d0_linesize * (
mirror == 1 ? -1 : 1);
993 const int d1_signed_linesize = d1_linesize * (
mirror == 1 ? -1 : 1);
995 for (x = slicew_start; x < slicew_end; x++) {
996 const uint16_t *c0_data = (uint16_t *)in->data[plane + 0];
997 const uint16_t *c1_data = (uint16_t *)in->data[(plane + 1) %
s->ncomp];
998 const uint16_t *c2_data = (uint16_t *)in->data[(plane + 2) %
s->ncomp];
999 uint16_t *d0_data = (uint16_t *)(
out->data[plane]) + offset_y * d0_linesize + offset_x;
1000 uint16_t *d1_data = (uint16_t *)(
out->data[(plane + 1) %
s->ncomp]) + offset_y * d1_linesize + offset_x;
1001 uint16_t *
const d0_bottom_line = d0_data + d0_linesize * (
s->size - 1);
1002 uint16_t *
const d0 = (
mirror ? d0_bottom_line : d0_data);
1003 uint16_t *
const d1_bottom_line = d1_data + d1_linesize * (
s->size - 1);
1004 uint16_t *
const d1 = (
mirror ? d1_bottom_line : d1_data);
1006 for (y = 0; y < src_h; y++) {
1007 const int c0 =
FFMIN(c0_data[x >> c0_shift_w],
limit) +
s->max;
1008 const int c1 =
FFMIN(
FFABS(c1_data[x >> c1_shift_w] - mid) +
FFABS(c2_data[x >> c2_shift_w] - mid),
limit);
1011 target = d0 + x + d0_signed_linesize * c0;
1013 target = d1 + x + d1_signed_linesize * (c0 -
c1);
1015 target = d1 + x + d1_signed_linesize * (c0 +
c1);
1018 if (!c0_shift_h || (y & c0_shift_h))
1019 c0_data += c0_linesize;
1020 if (!c1_shift_h || (y & c1_shift_h))
1021 c1_data += c1_linesize;
1022 if (!c2_shift_h || (y & c2_shift_h))
1023 c2_data += c2_linesize;
1024 d0_data += d0_linesize;
1025 d1_data += d1_linesize;
1029 const uint16_t *c0_data = (uint16_t *)(in->data[plane]) + (sliceh_start >> c0_shift_h) * c0_linesize;
1030 const uint16_t *c1_data = (uint16_t *)(in->data[(plane + 1) %
s->ncomp]) + (sliceh_start >> c1_shift_h) * c1_linesize;
1031 const uint16_t *c2_data = (uint16_t *)(in->data[(plane + 2) %
s->ncomp]) + (sliceh_start >> c2_shift_h) * c2_linesize;
1032 uint16_t *d0_data = (uint16_t *)(
out->data[plane]) + (offset_y + sliceh_start) * d0_linesize + offset_x;
1033 uint16_t *d1_data = (uint16_t *)(
out->data[(plane + 1) %
s->ncomp]) + (offset_y + sliceh_start) * d1_linesize + offset_x;
1036 d0_data +=
s->size - 1;
1037 d1_data +=
s->size - 1;
1040 for (y = sliceh_start; y < sliceh_end; y++) {
1041 for (x = 0; x < src_w; x++) {
1042 const int c0 =
FFMIN(c0_data[x >> c0_shift_w],
limit) +
s->max;
1043 const int c1 =
FFMIN(
FFABS(c1_data[x >> c1_shift_w] - mid) +
FFABS(c2_data[x >> c2_shift_w] - mid),
limit);
1047 target = d0_data - c0;
1049 target = d1_data - (c0 -
c1);
1051 target = d1_data - (c0 +
c1);
1054 target = d0_data + c0;
1056 target = d1_data + (c0 -
c1);
1058 target = d1_data + (c0 +
c1);
1063 if (!c0_shift_h || (y & c0_shift_h))
1064 c0_data += c0_linesize;
1065 if (!c1_shift_h || (y & c1_shift_h))
1066 c1_data += c1_linesize;
1067 if (!c2_shift_h || (y & c2_shift_h))
1068 c2_data += c2_linesize;
1069 d0_data += d0_linesize;
1070 d1_data += d1_linesize;
1075 #define FLAT16_FUNC(name, column, mirror) \
1076 static int flat16_##name(AVFilterContext *ctx, \
1077 void *arg, int jobnr, \
1080 WaveformContext *s = ctx->priv; \
1081 ThreadData *td = arg; \
1082 AVFrame *in = td->in; \
1083 AVFrame *out = td->out; \
1084 int component = td->component; \
1085 int offset_y = td->offset_y; \
1086 int offset_x = td->offset_x; \
1088 flat16(s, in, out, component, s->intensity, \
1089 offset_y, offset_x, column, mirror, \
1103 int offset_y,
int offset_x,
1105 int jobnr,
int nb_jobs)
1107 const int plane =
s->desc->comp[component].plane;
1108 const int c0_linesize = in->linesize[ plane + 0 ];
1109 const int c1_linesize = in->linesize[(plane + 1) %
s->ncomp];
1110 const int c2_linesize = in->linesize[(plane + 2) %
s->ncomp];
1111 const int c0_shift_w =
s->shift_w[ component + 0 ];
1112 const int c1_shift_w =
s->shift_w[(component + 1) %
s->ncomp];
1113 const int c2_shift_w =
s->shift_w[(component + 2) %
s->ncomp];
1114 const int c0_shift_h =
s->shift_h[ component + 0 ];
1115 const int c1_shift_h =
s->shift_h[(component + 1) %
s->ncomp];
1116 const int c2_shift_h =
s->shift_h[(component + 2) %
s->ncomp];
1117 const int d0_linesize =
out->linesize[ plane + 0 ];
1118 const int d1_linesize =
out->linesize[(plane + 1) %
s->ncomp];
1120 const int src_h = in->height;
1121 const int src_w = in->width;
1122 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
1123 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
1124 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
1125 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
1129 const int d0_signed_linesize = d0_linesize * (
mirror == 1 ? -1 : 1);
1130 const int d1_signed_linesize = d1_linesize * (
mirror == 1 ? -1 : 1);
1132 for (x = slicew_start; x < slicew_end; x++) {
1133 const uint8_t *c0_data = in->data[plane + 0];
1134 const uint8_t *c1_data = in->data[(plane + 1) %
s->ncomp];
1135 const uint8_t *c2_data = in->data[(plane + 2) %
s->ncomp];
1136 uint8_t *d0_data =
out->data[plane] + offset_y * d0_linesize + offset_x;
1137 uint8_t *d1_data =
out->data[(plane + 1) %
s->ncomp] + offset_y * d1_linesize + offset_x;
1138 uint8_t *
const d0_bottom_line = d0_data + d0_linesize * (
s->size - 1);
1139 uint8_t *
const d0 = (
mirror ? d0_bottom_line : d0_data);
1140 uint8_t *
const d1_bottom_line = d1_data + d1_linesize * (
s->size - 1);
1141 uint8_t *
const d1 = (
mirror ? d1_bottom_line : d1_data);
1143 for (y = 0; y < src_h; y++) {
1144 const int c0 = c0_data[x >> c0_shift_w] + 256;
1145 const int c1 =
FFABS(c1_data[x >> c1_shift_w] - 128) +
FFABS(c2_data[x >> c2_shift_w] - 128);
1148 target = d0 + x + d0_signed_linesize * c0;
1150 target = d1 + x + d1_signed_linesize * (c0 -
c1);
1152 target = d1 + x + d1_signed_linesize * (c0 +
c1);
1155 if (!c0_shift_h || (y & c0_shift_h))
1156 c0_data += c0_linesize;
1157 if (!c1_shift_h || (y & c1_shift_h))
1158 c1_data += c1_linesize;
1159 if (!c2_shift_h || (y & c2_shift_h))
1160 c2_data += c2_linesize;
1161 d0_data += d0_linesize;
1162 d1_data += d1_linesize;
1166 const uint8_t *c0_data = in->data[plane] + (sliceh_start >> c0_shift_h) * c0_linesize;
1167 const uint8_t *c1_data = in->data[(plane + 1) %
s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize;
1168 const uint8_t *c2_data = in->data[(plane + 2) %
s->ncomp] + (sliceh_start >> c2_shift_h) * c2_linesize;
1169 uint8_t *d0_data =
out->data[plane] + (offset_y + sliceh_start) * d0_linesize + offset_x;
1170 uint8_t *d1_data =
out->data[(plane + 1) %
s->ncomp] + (offset_y + sliceh_start) * d1_linesize + offset_x;
1173 d0_data +=
s->size - 1;
1174 d1_data +=
s->size - 1;
1177 for (y = sliceh_start; y < sliceh_end; y++) {
1178 for (x = 0; x < src_w; x++) {
1179 const int c0 = c0_data[x >> c0_shift_w] + 256;
1180 const int c1 =
FFABS(c1_data[x >> c1_shift_w] - 128) +
FFABS(c2_data[x >> c2_shift_w] - 128);
1184 target = d0_data - c0;
1186 target = d1_data - (c0 -
c1);
1188 target = d1_data - (c0 +
c1);
1191 target = d0_data + c0;
1193 target = d1_data + (c0 -
c1);
1195 target = d1_data + (c0 +
c1);
1200 if (!c0_shift_h || (y & c0_shift_h))
1201 c0_data += c0_linesize;
1202 if (!c1_shift_h || (y & c1_shift_h))
1203 c1_data += c1_linesize;
1204 if (!c2_shift_h || (y & c2_shift_h))
1205 c2_data += c2_linesize;
1206 d0_data += d0_linesize;
1207 d1_data += d1_linesize;
1212 #define FLAT_FUNC(name, column, mirror) \
1213 static int flat_##name(AVFilterContext *ctx, \
1214 void *arg, int jobnr, \
1217 WaveformContext *s = ctx->priv; \
1218 ThreadData *td = arg; \
1219 AVFrame *in = td->in; \
1220 AVFrame *out = td->out; \
1221 int component = td->component; \
1222 int offset_y = td->offset_y; \
1223 int offset_x = td->offset_x; \
1225 flat(s, in, out, component, s->intensity, \
1226 offset_y, offset_x, column, mirror, \
1237 #define AFLAT16(name, update_cb, update_cr, column, mirror) \
1238 static int name(AVFilterContext *ctx, \
1239 void *arg, int jobnr, \
1242 WaveformContext *s = ctx->priv; \
1243 ThreadData *td = arg; \
1244 AVFrame *in = td->in; \
1245 AVFrame *out = td->out; \
1246 int component = td->component; \
1247 int offset_y = td->offset_y; \
1248 int offset_x = td->offset_x; \
1249 const int intensity = s->intensity; \
1250 const int plane = s->desc->comp[component].plane; \
1251 const int c0_linesize = in->linesize[ plane + 0 ] / 2; \
1252 const int c1_linesize = in->linesize[(plane + 1) % s->ncomp] / 2; \
1253 const int c2_linesize = in->linesize[(plane + 2) % s->ncomp] / 2; \
1254 const int c0_shift_w = s->shift_w[ component + 0 ]; \
1255 const int c1_shift_w = s->shift_w[(component + 1) % s->ncomp]; \
1256 const int c2_shift_w = s->shift_w[(component + 2) % s->ncomp]; \
1257 const int c0_shift_h = s->shift_h[ component + 0 ]; \
1258 const int c1_shift_h = s->shift_h[(component + 1) % s->ncomp]; \
1259 const int c2_shift_h = s->shift_h[(component + 2) % s->ncomp]; \
1260 const int d0_linesize = out->linesize[ plane + 0 ] / 2; \
1261 const int d1_linesize = out->linesize[(plane + 1) % s->ncomp] / 2; \
1262 const int d2_linesize = out->linesize[(plane + 2) % s->ncomp] / 2; \
1263 const int limit = s->max - 1; \
1264 const int max = limit - intensity; \
1265 const int mid = s->max / 2; \
1266 const int src_h = in->height; \
1267 const int src_w = in->width; \
1268 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0; \
1269 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h; \
1270 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0; \
1271 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w; \
1275 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1); \
1276 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1); \
1277 const int d2_signed_linesize = d2_linesize * (mirror == 1 ? -1 : 1); \
1279 for (x = slicew_start; x < slicew_end; x++) { \
1280 const uint16_t *c0_data = (uint16_t *)in->data[plane + 0]; \
1281 const uint16_t *c1_data = (uint16_t *)in->data[(plane + 1) % s->ncomp]; \
1282 const uint16_t *c2_data = (uint16_t *)in->data[(plane + 2) % s->ncomp]; \
1283 uint16_t *d0_data = (uint16_t *)out->data[plane] + offset_y * d0_linesize + offset_x; \
1284 uint16_t *d1_data = (uint16_t *)out->data[(plane + 1) % s->ncomp] + offset_y * d1_linesize + offset_x; \
1285 uint16_t *d2_data = (uint16_t *)out->data[(plane + 2) % s->ncomp] + offset_y * d2_linesize + offset_x; \
1286 uint16_t * const d0_bottom_line = d0_data + d0_linesize * (s->size - 1); \
1287 uint16_t * const d0 = (mirror ? d0_bottom_line : d0_data); \
1288 uint16_t * const d1_bottom_line = d1_data + d1_linesize * (s->size - 1); \
1289 uint16_t * const d1 = (mirror ? d1_bottom_line : d1_data); \
1290 uint16_t * const d2_bottom_line = d2_data + d2_linesize * (s->size - 1); \
1291 uint16_t * const d2 = (mirror ? d2_bottom_line : d2_data); \
1293 for (y = 0; y < src_h; y++) { \
1294 const int c0 = FFMIN(c0_data[x >> c0_shift_w], limit) + mid; \
1295 const int c1 = FFMIN(c1_data[x >> c1_shift_w], limit) - mid; \
1296 const int c2 = FFMIN(c2_data[x >> c2_shift_w], limit) - mid; \
1299 target = d0 + x + d0_signed_linesize * c0; \
1300 update16(target, max, intensity, limit); \
1302 target = d1 + x + d1_signed_linesize * (c0 + c1); \
1303 update_cb(target, max, intensity, limit); \
1305 target = d2 + x + d2_signed_linesize * (c0 + c2); \
1306 update_cr(target, max, intensity, limit); \
1308 if (!c0_shift_h || (y & c0_shift_h)) \
1309 c0_data += c0_linesize; \
1310 if (!c1_shift_h || (y & c1_shift_h)) \
1311 c1_data += c1_linesize; \
1312 if (!c2_shift_h || (y & c2_shift_h)) \
1313 c2_data += c2_linesize; \
1314 d0_data += d0_linesize; \
1315 d1_data += d1_linesize; \
1316 d2_data += d2_linesize; \
1320 const uint16_t *c0_data = (uint16_t *)in->data[plane] + (sliceh_start >> c0_shift_h) * c0_linesize; \
1321 const uint16_t *c1_data = (uint16_t *)in->data[(plane + 1) % s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize; \
1322 const uint16_t *c2_data = (uint16_t *)in->data[(plane + 2) % s->ncomp] + (sliceh_start >> c2_shift_h) * c2_linesize; \
1323 uint16_t *d0_data = (uint16_t *)out->data[plane] + (offset_y + sliceh_start) * d0_linesize + offset_x; \
1324 uint16_t *d1_data = (uint16_t *)out->data[(plane + 1) % s->ncomp] + (offset_y + sliceh_start) * d1_linesize + offset_x; \
1325 uint16_t *d2_data = (uint16_t *)out->data[(plane + 2) % s->ncomp] + (offset_y + sliceh_start) * d2_linesize + offset_x; \
1328 d0_data += s->size - 1; \
1329 d1_data += s->size - 1; \
1330 d2_data += s->size - 1; \
1333 for (y = sliceh_start; y < sliceh_end; y++) { \
1334 for (x = 0; x < src_w; x++) { \
1335 const int c0 = FFMIN(c0_data[x >> c0_shift_w], limit) + mid; \
1336 const int c1 = FFMIN(c1_data[x >> c1_shift_w], limit) - mid; \
1337 const int c2 = FFMIN(c2_data[x >> c2_shift_w], limit) - mid; \
1341 target = d0_data - c0; \
1342 update16(target, max, intensity, limit); \
1343 target = d1_data - (c0 + c1); \
1344 update_cb(target, max, intensity, limit); \
1345 target = d2_data - (c0 + c2); \
1346 update_cr(target, max, intensity, limit); \
1348 target = d0_data + c0; \
1349 update16(target, max, intensity, limit); \
1350 target = d1_data + (c0 + c1); \
1351 update_cb(target, max, intensity, limit); \
1352 target = d2_data + (c0 + c2); \
1353 update_cr(target, max, intensity, limit); \
1357 if (!c0_shift_h || (y & c0_shift_h)) \
1358 c0_data += c0_linesize; \
1359 if (!c1_shift_h || (y & c1_shift_h)) \
1360 c1_data += c1_linesize; \
1361 if (!c2_shift_h || (y & c2_shift_h)) \
1362 c2_data += c2_linesize; \
1363 d0_data += d0_linesize; \
1364 d1_data += d1_linesize; \
1365 d2_data += d2_linesize; \
1371 #define AFLAT(name, update_cb, update_cr, column, mirror) \
1372 static int name(AVFilterContext *ctx, \
1373 void *arg, int jobnr, \
1376 WaveformContext *s = ctx->priv; \
1377 ThreadData *td = arg; \
1378 AVFrame *in = td->in; \
1379 AVFrame *out = td->out; \
1380 int component = td->component; \
1381 int offset_y = td->offset_y; \
1382 int offset_x = td->offset_x; \
1383 const int src_h = in->height; \
1384 const int src_w = in->width; \
1385 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0; \
1386 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h; \
1387 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0; \
1388 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w; \
1389 const int intensity = s->intensity; \
1390 const int plane = s->desc->comp[component].plane; \
1391 const int c0_linesize = in->linesize[ plane + 0 ]; \
1392 const int c1_linesize = in->linesize[(plane + 1) % s->ncomp]; \
1393 const int c2_linesize = in->linesize[(plane + 2) % s->ncomp]; \
1394 const int c0_shift_w = s->shift_w[ component + 0 ]; \
1395 const int c1_shift_w = s->shift_w[(component + 1) % s->ncomp]; \
1396 const int c2_shift_w = s->shift_w[(component + 2) % s->ncomp]; \
1397 const int c0_shift_h = s->shift_h[ component + 0 ]; \
1398 const int c1_shift_h = s->shift_h[(component + 1) % s->ncomp]; \
1399 const int c2_shift_h = s->shift_h[(component + 2) % s->ncomp]; \
1400 const int d0_linesize = out->linesize[ plane + 0 ]; \
1401 const int d1_linesize = out->linesize[(plane + 1) % s->ncomp]; \
1402 const int d2_linesize = out->linesize[(plane + 2) % s->ncomp]; \
1403 const int max = 255 - intensity; \
1407 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1); \
1408 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1); \
1409 const int d2_signed_linesize = d2_linesize * (mirror == 1 ? -1 : 1); \
1411 for (x = slicew_start; x < slicew_end; x++) { \
1412 const uint8_t *c0_data = in->data[plane + 0]; \
1413 const uint8_t *c1_data = in->data[(plane + 1) % s->ncomp]; \
1414 const uint8_t *c2_data = in->data[(plane + 2) % s->ncomp]; \
1415 uint8_t *d0_data = out->data[plane] + offset_y * d0_linesize + offset_x; \
1416 uint8_t *d1_data = out->data[(plane + 1) % s->ncomp] + offset_y * d1_linesize + offset_x; \
1417 uint8_t *d2_data = out->data[(plane + 2) % s->ncomp] + offset_y * d2_linesize + offset_x; \
1418 uint8_t * const d0_bottom_line = d0_data + d0_linesize * (s->size - 1); \
1419 uint8_t * const d0 = (mirror ? d0_bottom_line : d0_data); \
1420 uint8_t * const d1_bottom_line = d1_data + d1_linesize * (s->size - 1); \
1421 uint8_t * const d1 = (mirror ? d1_bottom_line : d1_data); \
1422 uint8_t * const d2_bottom_line = d2_data + d2_linesize * (s->size - 1); \
1423 uint8_t * const d2 = (mirror ? d2_bottom_line : d2_data); \
1425 for (y = 0; y < src_h; y++) { \
1426 const int c0 = c0_data[x >> c0_shift_w] + 128; \
1427 const int c1 = c1_data[x >> c1_shift_w] - 128; \
1428 const int c2 = c2_data[x >> c2_shift_w] - 128; \
1431 target = d0 + x + d0_signed_linesize * c0; \
1432 update(target, max, intensity); \
1434 target = d1 + x + d1_signed_linesize * (c0 + c1); \
1435 update_cb(target, max, intensity); \
1437 target = d2 + x + d2_signed_linesize * (c0 + c2); \
1438 update_cr(target, max, intensity); \
1440 if (!c0_shift_h || (y & c0_shift_h)) \
1441 c0_data += c0_linesize; \
1442 if (!c1_shift_h || (y & c1_shift_h)) \
1443 c1_data += c1_linesize; \
1444 if (!c2_shift_h || (y & c2_shift_h)) \
1445 c2_data += c2_linesize; \
1446 d0_data += d0_linesize; \
1447 d1_data += d1_linesize; \
1448 d2_data += d2_linesize; \
1452 const uint8_t *c0_data = in->data[plane] + (sliceh_start >> c0_shift_h) * c0_linesize; \
1453 const uint8_t *c1_data = in->data[(plane + 1) % s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize; \
1454 const uint8_t *c2_data = in->data[(plane + 2) % s->ncomp] + (sliceh_start >> c2_shift_h) * c2_linesize; \
1455 uint8_t *d0_data = out->data[plane] + (offset_y + sliceh_start) * d0_linesize + offset_x; \
1456 uint8_t *d1_data = out->data[(plane + 1) % s->ncomp] + (offset_y + sliceh_start) * d1_linesize + offset_x; \
1457 uint8_t *d2_data = out->data[(plane + 2) % s->ncomp] + (offset_y + sliceh_start) * d2_linesize + offset_x; \
1460 d0_data += s->size - 1; \
1461 d1_data += s->size - 1; \
1462 d2_data += s->size - 1; \
1465 for (y = sliceh_start; y < sliceh_end; y++) { \
1466 for (x = 0; x < src_w; x++) { \
1467 const int c0 = c0_data[x >> c0_shift_w] + 128; \
1468 const int c1 = c1_data[x >> c1_shift_w] - 128; \
1469 const int c2 = c2_data[x >> c2_shift_w] - 128; \
1473 target = d0_data - c0; \
1474 update(target, max, intensity); \
1475 target = d1_data - (c0 + c1); \
1476 update_cb(target, max, intensity); \
1477 target = d2_data - (c0 + c2); \
1478 update_cr(target, max, intensity); \
1480 target = d0_data + c0; \
1481 update(target, max, intensity); \
1482 target = d1_data + (c0 + c1); \
1483 update_cb(target, max, intensity); \
1484 target = d2_data + (c0 + c2); \
1485 update_cr(target, max, intensity); \
1489 if (!c0_shift_h || (y & c0_shift_h)) \
1490 c0_data += c0_linesize; \
1491 if (!c1_shift_h || (y & c1_shift_h)) \
1492 c1_data += c1_linesize; \
1493 if (!c2_shift_h || (y & c2_shift_h)) \
1494 c2_data += c2_linesize; \
1495 d0_data += d0_linesize; \
1496 d1_data += d1_linesize; \
1497 d2_data += d2_linesize; \
1532 int offset_y,
int offset_x,
1534 int jobnr,
int nb_jobs)
1536 const int plane =
s->desc->comp[component].plane;
1537 const int c0_linesize = in->linesize[(plane + 1) %
s->ncomp] / 2;
1538 const int c1_linesize = in->linesize[(plane + 2) %
s->ncomp] / 2;
1539 const int dst_linesize =
out->linesize[plane] / 2;
1540 const int limit =
s->max - 1;
1542 const int mid =
s->max / 2;
1543 const int c0_shift_w =
s->shift_w[(component + 1) %
s->ncomp];
1544 const int c1_shift_w =
s->shift_w[(component + 2) %
s->ncomp];
1545 const int c0_shift_h =
s->shift_h[(component + 1) %
s->ncomp];
1546 const int c1_shift_h =
s->shift_h[(component + 2) %
s->ncomp];
1547 const int src_h = in->height;
1548 const int src_w = in->width;
1549 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
1550 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
1551 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
1552 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
1556 const int dst_signed_linesize = dst_linesize * (
mirror == 1 ? -1 : 1);
1558 for (x = slicew_start; x < slicew_end; x++) {
1559 const uint16_t *c0_data = (uint16_t *)in->data[(plane + 1) %
s->ncomp];
1560 const uint16_t *c1_data = (uint16_t *)in->data[(plane + 2) %
s->ncomp];
1561 uint16_t *dst_data = (uint16_t *)
out->data[plane] + offset_y * dst_linesize + offset_x;
1562 uint16_t *
const dst_bottom_line = dst_data + dst_linesize * (
s->size - 1);
1563 uint16_t *
const dst_line = (
mirror ? dst_bottom_line : dst_data);
1564 uint16_t *dst = dst_line;
1566 for (y = 0; y < src_h; y++) {
1567 const int sum =
FFMIN(
FFABS(c0_data[x >> c0_shift_w] - mid) +
FFABS(c1_data[x >> c1_shift_w] - mid - 1),
limit);
1570 target = dst + x + dst_signed_linesize * sum;
1573 if (!c0_shift_h || (y & c0_shift_h))
1574 c0_data += c0_linesize;
1575 if (!c1_shift_h || (y & c1_shift_h))
1576 c1_data += c1_linesize;
1577 dst_data += dst_linesize;
1581 const uint16_t *c0_data = (uint16_t *)in->data[(plane + 1) %
s->ncomp] + (sliceh_start >> c0_shift_h) * c0_linesize;
1582 const uint16_t *c1_data = (uint16_t *)in->data[(plane + 2) %
s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize;
1583 uint16_t *dst_data = (uint16_t *)
out->data[plane] + (offset_y + sliceh_start) * dst_linesize + offset_x;
1586 dst_data +=
s->size - 1;
1587 for (y = sliceh_start; y < sliceh_end; y++) {
1588 for (x = 0; x < src_w; x++) {
1589 const int sum =
FFMIN(
FFABS(c0_data[x >> c0_shift_w] - mid) +
FFABS(c1_data[x >> c1_shift_w] - mid - 1),
limit);
1593 target = dst_data - sum;
1596 target = dst_data + sum;
1601 if (!c0_shift_h || (y & c0_shift_h))
1602 c0_data += c0_linesize;
1603 if (!c1_shift_h || (y & c1_shift_h))
1604 c1_data += c1_linesize;
1605 dst_data += dst_linesize;
1610 #define CHROMA16_FUNC(name, column, mirror) \
1611 static int chroma16_##name(AVFilterContext *ctx, \
1612 void *arg, int jobnr, \
1615 WaveformContext *s = ctx->priv; \
1616 ThreadData *td = arg; \
1617 AVFrame *in = td->in; \
1618 AVFrame *out = td->out; \
1619 int component = td->component; \
1620 int offset_y = td->offset_y; \
1621 int offset_x = td->offset_x; \
1623 chroma16(s, in, out, component, s->intensity,\
1624 offset_y, offset_x, column, mirror, \
1638 int offset_y,
int offset_x,
1640 int jobnr,
int nb_jobs)
1642 const int plane =
s->desc->comp[component].plane;
1643 const int src_h = in->height;
1644 const int src_w = in->width;
1645 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
1646 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
1647 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
1648 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
1649 const int c0_linesize = in->linesize[(plane + 1) %
s->ncomp];
1650 const int c1_linesize = in->linesize[(plane + 2) %
s->ncomp];
1651 const int dst_linesize =
out->linesize[plane];
1653 const int c0_shift_w =
s->shift_w[(component + 1) %
s->ncomp];
1654 const int c1_shift_w =
s->shift_w[(component + 2) %
s->ncomp];
1655 const int c0_shift_h =
s->shift_h[(component + 1) %
s->ncomp];
1656 const int c1_shift_h =
s->shift_h[(component + 2) %
s->ncomp];
1660 const int dst_signed_linesize = dst_linesize * (
mirror == 1 ? -1 : 1);
1662 for (x = slicew_start; x < slicew_end; x++) {
1663 const uint8_t *c0_data = in->data[(plane + 1) %
s->ncomp];
1664 const uint8_t *c1_data = in->data[(plane + 2) %
s->ncomp];
1665 uint8_t *dst_data =
out->data[plane] + offset_y * dst_linesize + offset_x;
1666 uint8_t *
const dst_bottom_line = dst_data + dst_linesize * (
s->size - 1);
1667 uint8_t *
const dst_line = (
mirror ? dst_bottom_line : dst_data);
1668 uint8_t *dst = dst_line;
1670 for (y = 0; y < src_h; y++) {
1671 const int sum =
FFABS(c0_data[x >> c0_shift_w] - 128) +
FFABS(c1_data[x >> c1_shift_w] - 127);
1674 target = dst + x + dst_signed_linesize * sum;
1677 if (!c0_shift_h || (y & c0_shift_h))
1678 c0_data += c0_linesize;
1679 if (!c1_shift_h || (y & c1_shift_h))
1680 c1_data += c1_linesize;
1681 dst_data += dst_linesize;
1685 const uint8_t *c0_data = in->data[(plane + 1) %
s->ncomp] + (sliceh_start >> c0_shift_h) * c0_linesize;
1686 const uint8_t *c1_data = in->data[(plane + 2) %
s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize;
1687 uint8_t *dst_data =
out->data[plane] + (offset_y + sliceh_start) * dst_linesize + offset_x;
1690 dst_data +=
s->size - 1;
1691 for (y = sliceh_start; y < sliceh_end; y++) {
1692 for (x = 0; x < src_w; x++) {
1693 const int sum =
FFABS(c0_data[x >> c0_shift_w] - 128) +
FFABS(c1_data[x >> c1_shift_w] - 127);
1697 target = dst_data - sum;
1700 target = dst_data + sum;
1705 if (!c0_shift_h || (y & c0_shift_h))
1706 c0_data += c0_linesize;
1707 if (!c1_shift_h || (y & c1_shift_h))
1708 c1_data += c1_linesize;
1709 dst_data += dst_linesize;
1714 #define CHROMA_FUNC(name, column, mirror) \
1715 static int chroma_##name(AVFilterContext *ctx, \
1716 void *arg, int jobnr, \
1719 WaveformContext *s = ctx->priv; \
1720 ThreadData *td = arg; \
1721 AVFrame *in = td->in; \
1722 AVFrame *out = td->out; \
1723 int component = td->component; \
1724 int offset_y = td->offset_y; \
1725 int offset_x = td->offset_x; \
1727 chroma(s, in, out, component, s->intensity, \
1728 offset_y, offset_x, column, mirror, \
1742 int offset_y,
int offset_x,
1744 int jobnr,
int nb_jobs)
1746 const int plane =
s->desc->comp[component].plane;
1747 const int limit =
s->max - 1;
1748 const int src_h = in->height;
1749 const int src_w = in->width;
1750 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
1751 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
1752 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
1753 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
1754 const int c0_linesize = in->linesize[ plane + 0 ] / 2;
1755 const int c1_linesize = in->linesize[(plane + 1) %
s->ncomp] / 2;
1756 const int c2_linesize = in->linesize[(plane + 2) %
s->ncomp] / 2;
1757 const int c0_shift_h =
s->shift_h[ component + 0 ];
1758 const int c1_shift_h =
s->shift_h[(component + 1) %
s->ncomp];
1759 const int c2_shift_h =
s->shift_h[(component + 2) %
s->ncomp];
1760 const uint16_t *c0_data = (
const uint16_t *)in->data[plane + 0] + (sliceh_start >> c0_shift_h) * c0_linesize;
1761 const uint16_t *c1_data = (
const uint16_t *)in->data[(plane + 1) %
s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize;
1762 const uint16_t *c2_data = (
const uint16_t *)in->data[(plane + 2) %
s->ncomp] + (sliceh_start >> c2_shift_h) * c2_linesize;
1763 const int d0_linesize =
out->linesize[ plane + 0 ] / 2;
1764 const int d1_linesize =
out->linesize[(plane + 1) %
s->ncomp] / 2;
1765 const int d2_linesize =
out->linesize[(plane + 2) %
s->ncomp] / 2;
1766 const int c0_shift_w =
s->shift_w[ component + 0 ];
1767 const int c1_shift_w =
s->shift_w[(component + 1) %
s->ncomp];
1768 const int c2_shift_w =
s->shift_w[(component + 2) %
s->ncomp];
1772 const int d0_signed_linesize = d0_linesize * (
mirror == 1 ? -1 : 1);
1773 const int d1_signed_linesize = d1_linesize * (
mirror == 1 ? -1 : 1);
1774 const int d2_signed_linesize = d2_linesize * (
mirror == 1 ? -1 : 1);
1775 uint16_t *d0_data = (uint16_t *)
out->data[plane] + offset_y * d0_linesize + offset_x;
1776 uint16_t *d1_data = (uint16_t *)
out->data[(plane + 1) %
s->ncomp] + offset_y * d1_linesize + offset_x;
1777 uint16_t *d2_data = (uint16_t *)
out->data[(plane + 2) %
s->ncomp] + offset_y * d2_linesize + offset_x;
1778 uint16_t *
const d0_bottom_line = d0_data + d0_linesize * (
s->size - 1);
1779 uint16_t *
const d0 = (
mirror ? d0_bottom_line : d0_data);
1780 uint16_t *
const d1_bottom_line = d1_data + d1_linesize * (
s->size - 1);
1781 uint16_t *
const d1 = (
mirror ? d1_bottom_line : d1_data);
1782 uint16_t *
const d2_bottom_line = d2_data + d2_linesize * (
s->size - 1);
1783 uint16_t *
const d2 = (
mirror ? d2_bottom_line : d2_data);
1785 for (y = 0; y < src_h; y++) {
1786 for (x = slicew_start; x < slicew_end; x++) {
1787 const int c0 =
FFMIN(c0_data[x >> c0_shift_w],
limit);
1788 const int c1 = c1_data[x >> c1_shift_w];
1789 const int c2 = c2_data[x >> c2_shift_w];
1791 *(d0 + d0_signed_linesize * c0 + x) = c0;
1792 *(d1 + d1_signed_linesize * c0 + x) =
c1;
1793 *(d2 + d2_signed_linesize * c0 + x) =
c2;
1796 if (!c0_shift_h || (y & c0_shift_h))
1797 c0_data += c0_linesize;
1798 if (!c1_shift_h || (y & c1_shift_h))
1799 c1_data += c1_linesize;
1800 if (!c2_shift_h || (y & c2_shift_h))
1801 c2_data += c2_linesize;
1802 d0_data += d0_linesize;
1803 d1_data += d1_linesize;
1804 d2_data += d2_linesize;
1807 uint16_t *d0_data = (uint16_t *)
out->data[plane] + (offset_y + sliceh_start) * d0_linesize + offset_x;
1808 uint16_t *d1_data = (uint16_t *)
out->data[(plane + 1) %
s->ncomp] + (offset_y + sliceh_start) * d1_linesize + offset_x;
1809 uint16_t *d2_data = (uint16_t *)
out->data[(plane + 2) %
s->ncomp] + (offset_y + sliceh_start) * d2_linesize + offset_x;
1812 d0_data +=
s->size - 1;
1813 d1_data +=
s->size - 1;
1814 d2_data +=
s->size - 1;
1817 for (y = sliceh_start; y < sliceh_end; y++) {
1818 for (x = 0; x < src_w; x++) {
1819 const int c0 =
FFMIN(c0_data[x >> c0_shift_w],
limit);
1820 const int c1 = c1_data[x >> c1_shift_w];
1821 const int c2 = c2_data[x >> c2_shift_w];
1824 *(d0_data - c0) = c0;
1825 *(d1_data - c0) =
c1;
1826 *(d2_data - c0) =
c2;
1828 *(d0_data + c0) = c0;
1829 *(d1_data + c0) =
c1;
1830 *(d2_data + c0) =
c2;
1834 if (!c0_shift_h || (y & c0_shift_h))
1835 c0_data += c0_linesize;
1836 if (!c1_shift_h || (y & c1_shift_h))
1837 c1_data += c1_linesize;
1838 if (!c2_shift_h || (y & c2_shift_h))
1839 c2_data += c2_linesize;
1840 d0_data += d0_linesize;
1841 d1_data += d1_linesize;
1842 d2_data += d2_linesize;
1847 #define COLOR16_FUNC(name, column, mirror) \
1848 static int color16_##name(AVFilterContext *ctx, \
1849 void *arg, int jobnr, \
1852 WaveformContext *s = ctx->priv; \
1853 ThreadData *td = arg; \
1854 AVFrame *in = td->in; \
1855 AVFrame *out = td->out; \
1856 int component = td->component; \
1857 int offset_y = td->offset_y; \
1858 int offset_x = td->offset_x; \
1860 color16(s, in, out, component, s->intensity, \
1861 offset_y, offset_x, column, mirror, \
1875 int offset_y,
int offset_x,
1877 int jobnr,
int nb_jobs)
1879 const int plane =
s->desc->comp[component].plane;
1880 const int src_h = in->height;
1881 const int src_w = in->width;
1882 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
1883 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
1884 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
1885 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
1886 const int c0_linesize = in->linesize[ plane + 0 ];
1887 const int c1_linesize = in->linesize[(plane + 1) %
s->ncomp];
1888 const int c2_linesize = in->linesize[(plane + 2) %
s->ncomp];
1889 const int c0_shift_h =
s->shift_h[ component + 0 ];
1890 const int c1_shift_h =
s->shift_h[(component + 1) %
s->ncomp];
1891 const int c2_shift_h =
s->shift_h[(component + 2) %
s->ncomp];
1892 const uint8_t *c0_data = in->data[plane] + (sliceh_start >> c0_shift_h) * c0_linesize;
1893 const uint8_t *c1_data = in->data[(plane + 1) %
s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize;
1894 const uint8_t *c2_data = in->data[(plane + 2) %
s->ncomp] + (sliceh_start >> c2_shift_h) * c2_linesize;
1895 const int d0_linesize =
out->linesize[ plane + 0 ];
1896 const int d1_linesize =
out->linesize[(plane + 1) %
s->ncomp];
1897 const int d2_linesize =
out->linesize[(plane + 2) %
s->ncomp];
1898 const int c0_shift_w =
s->shift_w[ component + 0 ];
1899 const int c1_shift_w =
s->shift_w[(component + 1) %
s->ncomp];
1900 const int c2_shift_w =
s->shift_w[(component + 2) %
s->ncomp];
1904 const int d0_signed_linesize = d0_linesize * (
mirror == 1 ? -1 : 1);
1905 const int d1_signed_linesize = d1_linesize * (
mirror == 1 ? -1 : 1);
1906 const int d2_signed_linesize = d2_linesize * (
mirror == 1 ? -1 : 1);
1907 uint8_t *d0_data =
out->data[plane] + offset_y * d0_linesize + offset_x;
1908 uint8_t *d1_data =
out->data[(plane + 1) %
s->ncomp] + offset_y * d1_linesize + offset_x;
1909 uint8_t *d2_data =
out->data[(plane + 2) %
s->ncomp] + offset_y * d2_linesize + offset_x;
1910 uint8_t *
const d0_bottom_line = d0_data + d0_linesize * (
s->size - 1);
1911 uint8_t *
const d0 = (
mirror ? d0_bottom_line : d0_data);
1912 uint8_t *
const d1_bottom_line = d1_data + d1_linesize * (
s->size - 1);
1913 uint8_t *
const d1 = (
mirror ? d1_bottom_line : d1_data);
1914 uint8_t *
const d2_bottom_line = d2_data + d2_linesize * (
s->size - 1);
1915 uint8_t *
const d2 = (
mirror ? d2_bottom_line : d2_data);
1917 for (y = 0; y < src_h; y++) {
1918 for (x = slicew_start; x < slicew_end; x++) {
1919 const int c0 = c0_data[x >> c0_shift_w];
1920 const int c1 = c1_data[x >> c1_shift_w];
1921 const int c2 = c2_data[x >> c2_shift_w];
1923 *(d0 + d0_signed_linesize * c0 + x) = c0;
1924 *(d1 + d1_signed_linesize * c0 + x) =
c1;
1925 *(d2 + d2_signed_linesize * c0 + x) =
c2;
1928 if (!c0_shift_h || (y & c0_shift_h))
1929 c0_data += c0_linesize;
1930 if (!c1_shift_h || (y & c1_shift_h))
1931 c1_data += c1_linesize;
1932 if (!c2_shift_h || (y & c2_shift_h))
1933 c2_data += c2_linesize;
1934 d0_data += d0_linesize;
1935 d1_data += d1_linesize;
1936 d2_data += d2_linesize;
1939 uint8_t *d0_data =
out->data[plane] + (offset_y + sliceh_start) * d0_linesize + offset_x;
1940 uint8_t *d1_data =
out->data[(plane + 1) %
s->ncomp] + (offset_y + sliceh_start) * d1_linesize + offset_x;
1941 uint8_t *d2_data =
out->data[(plane + 2) %
s->ncomp] + (offset_y + sliceh_start) * d2_linesize + offset_x;
1944 d0_data +=
s->size - 1;
1945 d1_data +=
s->size - 1;
1946 d2_data +=
s->size - 1;
1949 for (y = sliceh_start; y < sliceh_end; y++) {
1950 for (x = 0; x < src_w; x++) {
1951 const int c0 = c0_data[x >> c0_shift_w];
1952 const int c1 = c1_data[x >> c1_shift_w];
1953 const int c2 = c2_data[x >> c2_shift_w];
1956 *(d0_data - c0) = c0;
1957 *(d1_data - c0) =
c1;
1958 *(d2_data - c0) =
c2;
1960 *(d0_data + c0) = c0;
1961 *(d1_data + c0) =
c1;
1962 *(d2_data + c0) =
c2;
1966 if (!c0_shift_h || (y & c0_shift_h))
1967 c0_data += c0_linesize;
1968 if (!c1_shift_h || (y & c1_shift_h))
1969 c1_data += c1_linesize;
1970 if (!c2_shift_h || (y & c2_shift_h))
1971 c2_data += c2_linesize;
1972 d0_data += d0_linesize;
1973 d1_data += d1_linesize;
1974 d2_data += d2_linesize;
1979 #define COLOR_FUNC(name, column, mirror) \
1980 static int color_##name(AVFilterContext *ctx, \
1981 void *arg, int jobnr, \
1984 WaveformContext *s = ctx->priv; \
1985 ThreadData *td = arg; \
1986 AVFrame *in = td->in; \
1987 AVFrame *out = td->out; \
1988 int component = td->component; \
1989 int offset_y = td->offset_y; \
1990 int offset_x = td->offset_x; \
1992 color(s, in, out, component, s->intensity, \
1993 offset_y, offset_x, column, mirror, \
2007 int offset_y,
int offset_x,
2009 int jobnr,
int nb_jobs)
2011 const int plane =
s->desc->comp[component].plane;
2012 const int limit =
s->max - 1;
2014 const int src_h = in->height;
2015 const int src_w = in->width;
2016 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
2017 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
2018 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
2019 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
2020 const int c0_shift_h =
s->shift_h[ component + 0 ];
2021 const int c1_shift_h =
s->shift_h[(component + 1) %
s->ncomp];
2022 const int c2_shift_h =
s->shift_h[(component + 2) %
s->ncomp];
2023 const int c0_linesize = in->linesize[ plane + 0 ] / 2;
2024 const int c1_linesize = in->linesize[(plane + 1) %
s->ncomp] / 2;
2025 const int c2_linesize = in->linesize[(plane + 2) %
s->ncomp] / 2;
2026 const uint16_t *c0_data = (
const uint16_t *)in->data[plane + 0] + (sliceh_start >> c0_shift_h) * c0_linesize;
2027 const uint16_t *c1_data = (
const uint16_t *)in->data[(plane + 1) %
s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize;
2028 const uint16_t *c2_data = (
const uint16_t *)in->data[(plane + 2) %
s->ncomp] + (sliceh_start >> c2_shift_h) * c2_linesize;
2029 const int d0_linesize =
out->linesize[ plane + 0 ] / 2;
2030 const int d1_linesize =
out->linesize[(plane + 1) %
s->ncomp] / 2;
2031 const int d2_linesize =
out->linesize[(plane + 2) %
s->ncomp] / 2;
2032 const int c0_shift_w =
s->shift_w[ component + 0 ];
2033 const int c1_shift_w =
s->shift_w[(component + 1) %
s->ncomp];
2034 const int c2_shift_w =
s->shift_w[(component + 2) %
s->ncomp];
2038 const int d0_signed_linesize = d0_linesize * (
mirror == 1 ? -1 : 1);
2039 const int d1_signed_linesize = d1_linesize * (
mirror == 1 ? -1 : 1);
2040 const int d2_signed_linesize = d2_linesize * (
mirror == 1 ? -1 : 1);
2041 uint16_t *d0_data = (uint16_t *)
out->data[plane] + offset_y * d0_linesize + offset_x;
2042 uint16_t *d1_data = (uint16_t *)
out->data[(plane + 1) %
s->ncomp] + offset_y * d1_linesize + offset_x;
2043 uint16_t *d2_data = (uint16_t *)
out->data[(plane + 2) %
s->ncomp] + offset_y * d2_linesize + offset_x;
2044 uint16_t *
const d0_bottom_line = d0_data + d0_linesize * (
s->size - 1);
2045 uint16_t *
const d0 = (
mirror ? d0_bottom_line : d0_data);
2046 uint16_t *
const d1_bottom_line = d1_data + d1_linesize * (
s->size - 1);
2047 uint16_t *
const d1 = (
mirror ? d1_bottom_line : d1_data);
2048 uint16_t *
const d2_bottom_line = d2_data + d2_linesize * (
s->size - 1);
2049 uint16_t *
const d2 = (
mirror ? d2_bottom_line : d2_data);
2051 for (y = 0; y < src_h; y++) {
2052 for (x = slicew_start; x < slicew_end; x++) {
2053 const int c0 =
FFMIN(c0_data[x >> c0_shift_w],
limit);
2054 const int c1 = c1_data[x >> c1_shift_w];
2055 const int c2 = c2_data[x >> c2_shift_w];
2058 *(d1 + d1_signed_linesize * c0 + x) =
c1;
2059 *(d2 + d2_signed_linesize * c0 + x) =
c2;
2062 if (!c0_shift_h || (y & c0_shift_h))
2063 c0_data += c0_linesize;
2064 if (!c1_shift_h || (y & c1_shift_h))
2065 c1_data += c1_linesize;
2066 if (!c2_shift_h || (y & c2_shift_h))
2067 c2_data += c2_linesize;
2068 d0_data += d0_linesize;
2069 d1_data += d1_linesize;
2070 d2_data += d2_linesize;
2073 uint16_t *d0_data = (uint16_t *)
out->data[plane] + (offset_y + sliceh_start) * d0_linesize + offset_x;
2074 uint16_t *d1_data = (uint16_t *)
out->data[(plane + 1) %
s->ncomp] + (offset_y + sliceh_start) * d1_linesize + offset_x;
2075 uint16_t *d2_data = (uint16_t *)
out->data[(plane + 2) %
s->ncomp] + (offset_y + sliceh_start) * d2_linesize + offset_x;
2078 d0_data +=
s->size - 1;
2079 d1_data +=
s->size - 1;
2080 d2_data +=
s->size - 1;
2083 for (y = sliceh_start; y < sliceh_end; y++) {
2084 for (x = 0; x < src_w; x++) {
2085 const int c0 =
FFMIN(c0_data[x >> c0_shift_w],
limit);
2086 const int c1 = c1_data[x >> c1_shift_w];
2087 const int c2 = c2_data[x >> c2_shift_w];
2091 *(d1_data - c0) =
c1;
2092 *(d2_data - c0) =
c2;
2095 *(d1_data + c0) =
c1;
2096 *(d2_data + c0) =
c2;
2100 if (!c0_shift_h || (y & c0_shift_h))
2101 c0_data += c0_linesize;
2102 if (!c1_shift_h || (y & c1_shift_h))
2103 c1_data += c1_linesize;
2104 if (!c2_shift_h || (y & c2_shift_h))
2105 c2_data += c2_linesize;
2106 d0_data += d0_linesize;
2107 d1_data += d1_linesize;
2108 d2_data += d2_linesize;
2113 #define ACOLOR16_FUNC(name, column, mirror) \
2114 static int acolor16_##name(AVFilterContext *ctx, \
2115 void *arg, int jobnr, \
2118 WaveformContext *s = ctx->priv; \
2119 ThreadData *td = arg; \
2120 AVFrame *in = td->in; \
2121 AVFrame *out = td->out; \
2122 int component = td->component; \
2123 int offset_y = td->offset_y; \
2124 int offset_x = td->offset_x; \
2126 acolor16(s, in, out, component, s->intensity,\
2127 offset_y, offset_x, column, mirror, \
2141 int offset_y,
int offset_x,
2143 int jobnr,
int nb_jobs)
2145 const int plane =
s->desc->comp[component].plane;
2146 const int src_h = in->height;
2147 const int src_w = in->width;
2148 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
2149 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
2150 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
2151 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
2152 const int c0_shift_w =
s->shift_w[ component + 0 ];
2153 const int c1_shift_w =
s->shift_w[(component + 1) %
s->ncomp];
2154 const int c2_shift_w =
s->shift_w[(component + 2) %
s->ncomp];
2155 const int c0_shift_h =
s->shift_h[ component + 0 ];
2156 const int c1_shift_h =
s->shift_h[(component + 1) %
s->ncomp];
2157 const int c2_shift_h =
s->shift_h[(component + 2) %
s->ncomp];
2158 const int c0_linesize = in->linesize[ plane + 0 ];
2159 const int c1_linesize = in->linesize[(plane + 1) %
s->ncomp];
2160 const int c2_linesize = in->linesize[(plane + 2) %
s->ncomp];
2161 const uint8_t *c0_data = in->data[plane + 0] + (sliceh_start >> c0_shift_h) * c0_linesize;
2162 const uint8_t *c1_data = in->data[(plane + 1) %
s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize;
2163 const uint8_t *c2_data = in->data[(plane + 2) %
s->ncomp] + (sliceh_start >> c2_shift_h) * c2_linesize;
2164 const int d0_linesize =
out->linesize[ plane + 0 ];
2165 const int d1_linesize =
out->linesize[(plane + 1) %
s->ncomp];
2166 const int d2_linesize =
out->linesize[(plane + 2) %
s->ncomp];
2171 const int d0_signed_linesize = d0_linesize * (
mirror == 1 ? -1 : 1);
2172 const int d1_signed_linesize = d1_linesize * (
mirror == 1 ? -1 : 1);
2173 const int d2_signed_linesize = d2_linesize * (
mirror == 1 ? -1 : 1);
2174 uint8_t *d0_data =
out->data[plane] + offset_y * d0_linesize + offset_x;
2175 uint8_t *d1_data =
out->data[(plane + 1) %
s->ncomp] + offset_y * d1_linesize + offset_x;
2176 uint8_t *d2_data =
out->data[(plane + 2) %
s->ncomp] + offset_y * d2_linesize + offset_x;
2177 uint8_t *
const d0_bottom_line = d0_data + d0_linesize * (
s->size - 1);
2178 uint8_t *
const d0 = (
mirror ? d0_bottom_line : d0_data);
2179 uint8_t *
const d1_bottom_line = d1_data + d1_linesize * (
s->size - 1);
2180 uint8_t *
const d1 = (
mirror ? d1_bottom_line : d1_data);
2181 uint8_t *
const d2_bottom_line = d2_data + d2_linesize * (
s->size - 1);
2182 uint8_t *
const d2 = (
mirror ? d2_bottom_line : d2_data);
2184 for (y = 0; y < src_h; y++) {
2185 for (x = slicew_start; x < slicew_end; x++) {
2186 const int c0 = c0_data[x >> c0_shift_w];
2187 const int c1 = c1_data[x >> c1_shift_w];
2188 const int c2 = c2_data[x >> c2_shift_w];
2191 *(d1 + d1_signed_linesize * c0 + x) =
c1;
2192 *(d2 + d2_signed_linesize * c0 + x) =
c2;
2195 if (!c0_shift_h || (y & c0_shift_h))
2196 c0_data += c0_linesize;
2197 if (!c1_shift_h || (y & c1_shift_h))
2198 c1_data += c1_linesize;
2199 if (!c2_shift_h || (y & c2_shift_h))
2200 c2_data += c2_linesize;
2201 d0_data += d0_linesize;
2202 d1_data += d1_linesize;
2203 d2_data += d2_linesize;
2206 uint8_t *d0_data =
out->data[plane] + (offset_y + sliceh_start) * d0_linesize + offset_x;
2207 uint8_t *d1_data =
out->data[(plane + 1) %
s->ncomp] + (offset_y + sliceh_start) * d1_linesize + offset_x;
2208 uint8_t *d2_data =
out->data[(plane + 2) %
s->ncomp] + (offset_y + sliceh_start) * d2_linesize + offset_x;
2211 d0_data +=
s->size - 1;
2212 d1_data +=
s->size - 1;
2213 d2_data +=
s->size - 1;
2216 for (y = sliceh_start; y < sliceh_end; y++) {
2217 for (x = 0; x < src_w; x++) {
2218 const int c0 = c0_data[x >> c0_shift_w];
2219 const int c1 = c1_data[x >> c1_shift_w];
2220 const int c2 = c2_data[x >> c2_shift_w];
2224 *(d1_data - c0) =
c1;
2225 *(d2_data - c0) =
c2;
2228 *(d1_data + c0) =
c1;
2229 *(d2_data + c0) =
c2;
2233 if (!c0_shift_h || (y & c0_shift_h))
2234 c0_data += c0_linesize;
2235 if (!c1_shift_h || (y & c1_shift_h))
2236 c1_data += c1_linesize;
2237 if (!c2_shift_h || (y & c2_shift_h))
2238 c2_data += c2_linesize;
2239 d0_data += d0_linesize;
2240 d1_data += d1_linesize;
2241 d2_data += d2_linesize;
2246 #define ACOLOR_FUNC(name, column, mirror) \
2247 static int acolor_##name(AVFilterContext *ctx, \
2248 void *arg, int jobnr, \
2251 WaveformContext *s = ctx->priv; \
2252 ThreadData *td = arg; \
2253 AVFrame *in = td->in; \
2254 AVFrame *out = td->out; \
2255 int component = td->component; \
2256 int offset_y = td->offset_y; \
2257 int offset_x = td->offset_x; \
2259 acolor(s, in, out, component, s->intensity, \
2260 offset_y, offset_x, column, mirror, \
2275 { { {
"16", 16+128 }, {
"16", 16+128 }, {
"16", 16+128 }, {
"0", 0+128 } } },
2276 { { {
"128", 128+128 }, {
"128", 128+128 }, {
"128", 128+128 }, {
"128", 128+128 } } },
2277 { { {
"235", 235+128 }, {
"240", 240+128 }, {
"240", 240+128 }, {
"255", 255+128 } } },
2281 { { {
"32", 32+256 }, {
"32", 32+256 }, {
"32", 32+256 }, {
"0", 0+256 } } },
2282 { { {
"256", 256+256 }, {
"256", 256+256 }, {
"256", 256+256 }, {
"256", 256+256 } } },
2283 { { {
"470", 470+256 }, {
"480", 480+256 }, {
"480", 480+256 }, {
"511", 511+256 } } },
2287 { { {
"64", 64+512 }, {
"64", 64+512 }, {
"64", 64+512 }, {
"0", 0+512 } } },
2288 { { {
"512", 512+512 }, {
"512", 512+512 }, {
"512", 512+512 }, {
"512", 512+512 } } },
2289 { { {
"940", 940+512 }, {
"960", 960+512 }, {
"960", 960+512 }, {
"1023", 1023+512 } } },
2293 { { {
"256", 256+2048 }, {
"256", 256+2048 }, {
"256", 256+2048 }, {
"0", 0+2048 } } },
2294 { { {
"2048", 2048+2048 }, {
"2048", 2048+2048 }, {
"2048", 2048+2048 }, {
"2048", 2048+2048 } } },
2295 { { {
"3760", 3760+2048 }, {
"3840", 3840+2048 }, {
"3840", 3840+2048 }, {
"4095", 4095+2048 } } },
2299 { { {
"0", 16+128 }, {
"0", 16+128 }, {
"0", 16+128 }, {
"0", 0+128 } } },
2300 { { {
"175", 71+128 }, {
"175", 72+128 }, {
"175", 72+128 }, {
"175", 64+128 } } },
2301 { { {
"350", 126+128 }, {
"350", 128+128 }, {
"350", 128+128 }, {
"350", 128+128 } } },
2302 { { {
"525", 180+128 }, {
"525", 184+128 }, {
"525", 184+128 }, {
"525", 192+128 } } },
2303 { { {
"700", 235+128 }, {
"700", 240+128 }, {
"700", 240+128 }, {
"700", 255+128 } } },
2307 { { {
"0", 32+256 }, {
"0", 32+256 }, {
"0", 32+256 }, {
"0", 0+256 } } },
2308 { { {
"175", 142+256 }, {
"175", 144+256 }, {
"175", 144+256 }, {
"175", 128+256 } } },
2309 { { {
"350", 251+256 }, {
"350", 256+256 }, {
"350", 256+256 }, {
"350", 256+256 } } },
2310 { { {
"525", 361+256 }, {
"525", 368+256 }, {
"525", 368+256 }, {
"525", 384+256 } } },
2311 { { {
"700", 470+256 }, {
"700", 480+256 }, {
"700", 480+256 }, {
"700", 511+256 } } },
2315 { { {
"0", 64+512 }, {
"0", 64+512 }, {
"0", 64+512 }, {
"0", 0+512 } } },
2316 { { {
"175", 283+512 }, {
"175", 288+512 }, {
"175", 288+512 }, {
"175", 256+512 } } },
2317 { { {
"350", 502+512 }, {
"350", 512+512 }, {
"350", 512+512 }, {
"350", 512+512 } } },
2318 { { {
"525", 721+512 }, {
"525", 736+512 }, {
"525", 736+512 }, {
"525", 768+512 } } },
2319 { { {
"700", 940+512 }, {
"700", 960+512 }, {
"700", 960+512 }, {
"700", 1023+512 } } },
2323 { { {
"0", 256+2048 }, {
"0", 256+2048 }, {
"0", 256+2048 }, {
"0", 0+2048 } } },
2324 { { {
"175", 1132+2048 }, {
"175", 1152+2048 }, {
"175", 1152+2048 }, {
"175", 1024+2048 } } },
2325 { { {
"350", 2008+2048 }, {
"350", 2048+2048 }, {
"350", 2048+2048 }, {
"350", 2048+2048 } } },
2326 { { {
"525", 2884+2048 }, {
"525", 2944+2048 }, {
"525", 2944+2048 }, {
"525", 3072+2048 } } },
2327 { { {
"700", 3760+2048 }, {
"700", 3840+2048 }, {
"700", 3840+2048 }, {
"700", 4095+2048 } } },
2331 { { {
"-25", -39+128 }, {
"-25", -40+128 }, {
"-25", -40+128 }, {
"-25", -64+128 } } },
2332 { { {
"0", 16+128 }, {
"0", 16+128 }, {
"0", 16+128 }, {
"0", 0+128 } } },
2333 { { {
"25", 71+128 }, {
"25", 72+128 }, {
"25", 72+128 }, {
"25", 64+128 } } },
2334 { { {
"50", 126+128 }, {
"50", 128+128 }, {
"50", 128+128 }, {
"50", 128+128 } } },
2335 { { {
"75", 180+128 }, {
"75", 184+128 }, {
"75", 184+128 }, {
"75", 192+128 } } },
2336 { { {
"100", 235+128 }, {
"100", 240+128 }, {
"100", 240+128 }, {
"100", 256+128 } } },
2337 { { {
"125", 290+128 }, {
"125", 296+128 }, {
"125", 296+128 }, {
"125", 320+128 } } },
2341 { { {
"-25", -78+256 }, {
"-25", -80+256 }, {
"-25", -80+256 }, {
"-25",-128+256 } } },
2342 { { {
"0", 32+256 }, {
"0", 32+256 }, {
"0", 32+256 }, {
"0", 0+256 } } },
2343 { { {
"25", 142+256 }, {
"25", 144+256 }, {
"25", 144+256 }, {
"25", 128+256 } } },
2344 { { {
"50", 251+256 }, {
"50", 256+256 }, {
"50", 256+256 }, {
"50", 256+256 } } },
2345 { { {
"75", 361+256 }, {
"75", 368+256 }, {
"75", 368+256 }, {
"75", 384+256 } } },
2346 { { {
"100", 470+256 }, {
"100", 480+256 }, {
"100", 480+256 }, {
"100", 512+256 } } },
2347 { { {
"125", 580+256 }, {
"125", 592+256 }, {
"125", 592+256 }, {
"125", 640+256 } } },
2351 { { {
"-25",-156+512 }, {
"-25",-160+512 }, {
"-25",-160+512 }, {
"-25", -256+512 } } },
2352 { { {
"0", 64+512 }, {
"0", 64+512 }, {
"0", 64+512 }, {
"0", 0+512 } } },
2353 { { {
"25", 283+512 }, {
"25", 288+512 }, {
"25", 288+512 }, {
"25", 256+512 } } },
2354 { { {
"50", 502+512 }, {
"50", 512+512 }, {
"50", 512+512 }, {
"50", 512+512 } } },
2355 { { {
"75", 721+512 }, {
"75", 736+512 }, {
"75", 736+512 }, {
"75", 768+512 } } },
2356 { { {
"100", 940+512 }, {
"100", 960+512 }, {
"100", 960+512 }, {
"100", 1024+512 } } },
2357 { { {
"125",1160+512 }, {
"125",1184+512 }, {
"125",1184+512 }, {
"125", 1280+512 } } },
2361 { { {
"-25", -624+2048 }, {
"-25", -640+2048 }, {
"-25", -640+2048 }, {
"-25",-1024+2048 } } },
2362 { { {
"0", 256+2048 }, {
"0", 256+2048 }, {
"0", 256+2048 }, {
"0", 0+2048 } } },
2363 { { {
"25", 1132+2048 }, {
"25", 1152+2048 }, {
"25", 1152+2048 }, {
"25", 1024+2048 } } },
2364 { { {
"50", 2008+2048 }, {
"50", 2048+2048 }, {
"50", 2048+2048 }, {
"50", 2048+2048 } } },
2365 { { {
"75", 2884+2048 }, {
"75", 2944+2048 }, {
"75", 2944+2048 }, {
"75", 3072+2048 } } },
2366 { { {
"100", 3760+2048 }, {
"100", 3840+2048 }, {
"100", 3840+2048 }, {
"100", 4096+2048 } } },
2367 { { {
"125", 4640+2048 }, {
"125", 4736+2048 }, {
"125", 4736+2048 }, {
"125", 5120+2048 } } },
2371 { { {
"16", 16+256 }, {
"16", 16+256 }, {
"16", 16+256 }, {
"0", 0+256 } } },
2372 { { {
"128", 128+256 }, {
"128", 128+256 }, {
"128", 128+256 }, {
"128", 128+256 } } },
2373 { { {
"235", 235+256 }, {
"240", 240+256 }, {
"240", 240+256 }, {
"255", 255+256 } } },
2377 { { {
"32", 32+512 }, {
"32", 32+512 }, {
"32", 32+512 }, {
"0", 0+512 } } },
2378 { { {
"256", 256+512 }, {
"256", 256+512 }, {
"256", 256+512 }, {
"256", 256+512 } } },
2379 { { {
"470", 470+512 }, {
"480", 480+512 }, {
"480", 480+512 }, {
"511", 511+512 } } },
2383 { { {
"64", 64+1024 }, {
"64", 64+1024 }, {
"64", 64+1024 }, {
"0", 0+1024 } } },
2384 { { {
"512", 512+1024 }, {
"512", 512+1024 }, {
"512", 512+1024 }, {
"512", 512+1024 } } },
2385 { { {
"940", 940+1024 }, {
"960", 960+1024 }, {
"960", 960+1024 }, {
"1023", 1023+1024 } } },
2389 { { {
"256", 256+4096 }, {
"256", 256+4096 }, {
"256", 256+4096 }, {
"0", 0+4096 } } },
2390 { { {
"2048", 2048+4096 }, {
"2048", 2048+4096 }, {
"2048", 2048+4096 }, {
"2048", 2048+4096 } } },
2391 { { {
"3760", 3760+4096 }, {
"3840", 3840+4096 }, {
"3840", 3840+4096 }, {
"4095", 4095+4096 } } },
2395 { { {
"0", 16+256 }, {
"0", 16+256 }, {
"0", 16+256 }, {
"0", 0+256 } } },
2396 { { {
"175", 71+256 }, {
"175", 72+256 }, {
"175", 72+256 }, {
"175", 64+256 } } },
2397 { { {
"350", 126+256 }, {
"350", 128+256 }, {
"350", 128+256 }, {
"350", 128+256 } } },
2398 { { {
"525", 180+256 }, {
"525", 184+256 }, {
"525", 184+256 }, {
"525", 192+256 } } },
2399 { { {
"700", 235+256 }, {
"700", 240+256 }, {
"700", 240+256 }, {
"700", 255+256 } } },
2403 { { {
"0", 32+512 }, {
"0", 32+512 }, {
"0", 32+512 }, {
"0", 0+512 } } },
2404 { { {
"175", 142+512 }, {
"175", 144+512 }, {
"175", 144+512 }, {
"175", 128+512 } } },
2405 { { {
"350", 251+512 }, {
"350", 256+512 }, {
"350", 256+512 }, {
"350", 256+512 } } },
2406 { { {
"525", 361+512 }, {
"525", 368+512 }, {
"525", 368+512 }, {
"525", 384+512 } } },
2407 { { {
"700", 470+512 }, {
"700", 480+512 }, {
"700", 480+512 }, {
"700", 511+512 } } },
2411 { { {
"0", 64+1024 }, {
"0", 64+1024 }, {
"0", 64+1024 }, {
"0", 0+1024 } } },
2412 { { {
"175", 283+1024 }, {
"175", 288+1024 }, {
"175", 288+1024 }, {
"175", 256+1024 } } },
2413 { { {
"350", 502+1024 }, {
"350", 512+1024 }, {
"350", 512+1024 }, {
"350", 512+1024 } } },
2414 { { {
"525", 721+1024 }, {
"525", 736+1024 }, {
"525", 736+1024 }, {
"525", 768+1024 } } },
2415 { { {
"700", 940+1024 }, {
"700", 960+1024 }, {
"700", 960+1024 }, {
"700", 1023+1024 } } },
2419 { { {
"0", 256+4096 }, {
"0", 256+4096 }, {
"0", 256+4096 }, {
"0", 0+4096 } } },
2420 { { {
"175", 1132+4096 }, {
"175", 1152+4096 }, {
"175", 1152+4096 }, {
"175", 1024+4096 } } },
2421 { { {
"350", 2008+4096 }, {
"350", 2048+4096 }, {
"350", 2048+4096 }, {
"350", 2048+4096 } } },
2422 { { {
"525", 2884+4096 }, {
"525", 2944+4096 }, {
"525", 2944+4096 }, {
"525", 3072+4096 } } },
2423 { { {
"700", 3760+4096 }, {
"700", 3840+4096 }, {
"700", 3840+4096 }, {
"700", 4095+4096 } } },
2427 { { {
"-25", -39+256 }, {
"-25", -40+256 }, {
"-25", -40+256 }, {
"-25", -64+256 } } },
2428 { { {
"0", 16+256 }, {
"0", 16+256 }, {
"0", 16+256 }, {
"0", 0+256 } } },
2429 { { {
"25", 71+256 }, {
"25", 72+256 }, {
"25", 72+256 }, {
"25", 64+256 } } },
2430 { { {
"50", 126+256 }, {
"50", 128+256 }, {
"50", 128+256 }, {
"50", 128+256 } } },
2431 { { {
"75", 180+256 }, {
"75", 184+256 }, {
"75", 184+256 }, {
"75", 192+256 } } },
2432 { { {
"100", 235+256 }, {
"100", 240+256 }, {
"100", 240+256 }, {
"100", 256+256 } } },
2433 { { {
"125", 290+256 }, {
"125", 296+256 }, {
"125", 296+256 }, {
"125", 320+256 } } },
2437 { { {
"-25", -78+512 }, {
"-25", -80+512 }, {
"-25", -80+512 }, {
"-25",-128+512 } } },
2438 { { {
"0", 32+512 }, {
"0", 32+512 }, {
"0", 32+512 }, {
"0", 0+512 } } },
2439 { { {
"25", 142+512 }, {
"25", 144+512 }, {
"25", 144+512 }, {
"25", 128+512 } } },
2440 { { {
"50", 251+512 }, {
"50", 256+512 }, {
"50", 256+512 }, {
"50", 256+512 } } },
2441 { { {
"75", 361+512 }, {
"75", 368+512 }, {
"75", 368+512 }, {
"75", 384+512 } } },
2442 { { {
"100", 470+512 }, {
"100", 480+512 }, {
"100", 480+512 }, {
"100", 512+512 } } },
2443 { { {
"125", 580+512 }, {
"125", 592+512 }, {
"125", 592+512 }, {
"125", 640+512 } } },
2447 { { {
"-25",-156+1024 }, {
"-25",-160+1024 }, {
"-25",-160+1024 }, {
"-25", -256+1024 } } },
2448 { { {
"0", 64+1024 }, {
"0", 64+1024 }, {
"0", 64+1024 }, {
"0", 0+1024 } } },
2449 { { {
"25", 283+1024 }, {
"25", 288+1024 }, {
"25", 288+1024 }, {
"25", 256+1024 } } },
2450 { { {
"50", 502+1024 }, {
"50", 512+1024 }, {
"50", 512+1024 }, {
"50", 512+1024 } } },
2451 { { {
"75", 721+1024 }, {
"75", 736+1024 }, {
"75", 736+1024 }, {
"75", 768+1024 } } },
2452 { { {
"100", 940+1024 }, {
"100", 960+1024 }, {
"100", 960+1024 }, {
"100", 1024+1024 } } },
2453 { { {
"125",1160+1024 }, {
"125",1184+1024 }, {
"125",1184+1024 }, {
"125", 1280+1024 } } },
2457 { { {
"-25", -624+4096 }, {
"-25", -640+4096 }, {
"-25", -640+4096 }, {
"-25",-1024+4096 } } },
2458 { { {
"0", 256+4096 }, {
"0", 256+4096 }, {
"0", 256+4096 }, {
"0", 0+4096 } } },
2459 { { {
"25", 1132+4096 }, {
"25", 1152+4096 }, {
"25", 1152+4096 }, {
"25", 1024+4096 } } },
2460 { { {
"50", 2008+4096 }, {
"50", 2048+4096 }, {
"50", 2048+4096 }, {
"50", 2048+4096 } } },
2461 { { {
"75", 2884+4096 }, {
"75", 2944+4096 }, {
"75", 2944+4096 }, {
"75", 3072+4096 } } },
2462 { { {
"100", 3760+4096 }, {
"100", 3840+4096 }, {
"100", 3840+4096 }, {
"100", 4096+4096 } } },
2463 { { {
"125", 4640+4096 }, {
"125", 4736+4096 }, {
"125", 4736+4096 }, {
"125", 5120+4096 } } },
2467 { { {
"16", 16 }, {
"16", 16 }, {
"16", 16 }, {
"0", 0 } } },
2468 { { {
"128", 128 }, {
"128", 128 }, {
"128", 128 }, {
"128", 128 } } },
2469 { { {
"235", 235 }, {
"240", 240 }, {
"240", 240 }, {
"255", 255 } } },
2473 { { {
"32", 32 }, {
"32", 32 }, {
"32", 32 }, {
"0", 0 } } },
2474 { { {
"256", 256 }, {
"256", 256 }, {
"256", 256 }, {
"256", 256 } } },
2475 { { {
"470", 470 }, {
"480", 480 }, {
"480", 480 }, {
"511", 511 } } },
2479 { { {
"64", 64 }, {
"64", 64 }, {
"64", 64 }, {
"0", 0 } } },
2480 { { {
"512", 512 }, {
"512", 512 }, {
"512", 512 }, {
"512", 512 } } },
2481 { { {
"940", 940 }, {
"960", 960 }, {
"960", 960 }, {
"1023", 1023 } } },
2485 { { {
"256", 256 }, {
"256", 256 }, {
"256", 256 }, {
"0", 0 } } },
2486 { { {
"2048", 2048 }, {
"2048", 2048 }, {
"2048", 2048 }, {
"2048", 2048 } } },
2487 { { {
"3760", 3760 }, {
"3840", 3840 }, {
"3840", 3840 }, {
"4095", 4095 } } },
2491 { { {
"0", 16 }, {
"0", 16 }, {
"0", 16 }, {
"0", 0 } } },
2492 { { {
"175", 71 }, {
"175", 72 }, {
"175", 72 }, {
"175", 64 } } },
2493 { { {
"350", 126 }, {
"350", 128 }, {
"350", 128 }, {
"350", 128 } } },
2494 { { {
"525", 180 }, {
"525", 184 }, {
"525", 184 }, {
"525", 192 } } },
2495 { { {
"700", 235 }, {
"700", 240 }, {
"700", 240 }, {
"700", 255 } } },
2499 { { {
"0", 32 }, {
"0", 32 }, {
"0", 32 }, {
"0", 0 } } },
2500 { { {
"175", 142 }, {
"175", 144 }, {
"175", 144 }, {
"175", 128 } } },
2501 { { {
"350", 251 }, {
"350", 256 }, {
"350", 256 }, {
"350", 256 } } },
2502 { { {
"525", 361 }, {
"525", 368 }, {
"525", 368 }, {
"525", 384 } } },
2503 { { {
"700", 470 }, {
"700", 480 }, {
"700", 480 }, {
"700", 511 } } },
2507 { { {
"0", 64 }, {
"0", 64 }, {
"0", 64 }, {
"0", 0 } } },
2508 { { {
"175", 283 }, {
"175", 288 }, {
"175", 288 }, {
"175", 256 } } },
2509 { { {
"350", 502 }, {
"350", 512 }, {
"350", 512 }, {
"350", 512 } } },
2510 { { {
"525", 721 }, {
"525", 736 }, {
"525", 736 }, {
"525", 768 } } },
2511 { { {
"700", 940 }, {
"700", 960 }, {
"700", 960 }, {
"700", 1023 } } },
2515 { { {
"0", 256 }, {
"0", 256 }, {
"0", 256 }, {
"0", 0 } } },
2516 { { {
"175", 1132 }, {
"175", 1152 }, {
"175", 1152 }, {
"175", 1024 } } },
2517 { { {
"350", 2008 }, {
"350", 2048 }, {
"350", 2048 }, {
"350", 2048 } } },
2518 { { {
"525", 2884 }, {
"525", 2944 }, {
"525", 2944 }, {
"525", 3072 } } },
2519 { { {
"700", 3760 }, {
"700", 3840 }, {
"700", 3840 }, {
"700", 4095 } } },
2523 { { {
"0", 16 }, {
"0", 16 }, {
"0", 16 }, {
"0", 0 } } },
2524 { { {
"25", 71 }, {
"25", 72 }, {
"25", 72 }, {
"25", 64 } } },
2525 { { {
"50", 126 }, {
"50", 128 }, {
"50", 128 }, {
"50", 128 } } },
2526 { { {
"75", 180 }, {
"75", 184 }, {
"75", 184 }, {
"75", 192 } } },
2527 { { {
"100", 235 }, {
"100", 240 }, {
"100", 240 }, {
"100", 255 } } },
2531 { { {
"0", 32 }, {
"0", 32 }, {
"0", 32 }, {
"0", 0 } } },
2532 { { {
"25", 142 }, {
"25", 144 }, {
"25", 144 }, {
"25", 128 } } },
2533 { { {
"50", 251 }, {
"50", 256 }, {
"50", 256 }, {
"50", 256 } } },
2534 { { {
"75", 361 }, {
"75", 368 }, {
"75", 368 }, {
"75", 384 } } },
2535 { { {
"100", 470 }, {
"100", 480 }, {
"100", 480 }, {
"100", 511 } } },
2539 { { {
"0", 64 }, {
"0", 64 }, {
"0", 64 }, {
"0", 0 } } },
2540 { { {
"25", 283 }, {
"25", 288 }, {
"25", 288 }, {
"25", 256 } } },
2541 { { {
"50", 502 }, {
"50", 512 }, {
"50", 512 }, {
"50", 512 } } },
2542 { { {
"75", 721 }, {
"75", 736 }, {
"75", 736 }, {
"75", 768 } } },
2543 { { {
"100", 940 }, {
"100", 960 }, {
"100", 960 }, {
"100", 1023 } } },
2547 { { {
"0", 256 }, {
"0", 256 }, {
"0", 256 }, {
"0", 0 } } },
2548 { { {
"25", 1132 }, {
"25", 1152 }, {
"25", 1152 }, {
"25", 1024 } } },
2549 { { {
"50", 2008 }, {
"50", 2048 }, {
"50", 2048 }, {
"50", 2048 } } },
2550 { { {
"75", 2884 }, {
"75", 2944 }, {
"75", 2944 }, {
"75", 3072 } } },
2551 { { {
"100", 3760 }, {
"100", 3840 }, {
"100", 3840 }, {
"100", 4095 } } },
2555 { { {
"50", 50 }, {
"50", 50 }, {
"50", 50 }, {
"50", 50 } } },
2556 { { {
"100", 100 }, {
"100", 100 }, {
"100", 100 }, {
"100", 100 } } },
2557 { { {
"150", 150 }, {
"150", 150 }, {
"150", 150 }, {
"150", 150 } } },
2558 { { {
"200", 200 }, {
"200", 200 }, {
"200", 200 }, {
"200", 200 } } },
2559 { { {
"255", 255 }, {
"255", 255 }, {
"255", 255 }, {
"255", 255 } } },
2563 { { {
"100", 100 }, {
"100", 100 }, {
"100", 100 }, {
"100", 100 } } },
2564 { { {
"200", 200 }, {
"200", 200 }, {
"200", 200 }, {
"200", 200 } } },
2565 { { {
"300", 300 }, {
"300", 300 }, {
"300", 300 }, {
"300", 300 } } },
2566 { { {
"400", 400 }, {
"400", 400 }, {
"400", 400 }, {
"400", 400 } } },
2567 { { {
"500", 500 }, {
"500", 500 }, {
"500", 500 }, {
"500", 500 } } },
2571 { { {
"200", 200 }, {
"200", 200 }, {
"200", 200 }, {
"200", 200 } } },
2572 { { {
"400", 400 }, {
"400", 400 }, {
"400", 400 }, {
"400", 400 } } },
2573 { { {
"600", 600 }, {
"600", 600 }, {
"600", 600 }, {
"600", 600 } } },
2574 { { {
"800", 800 }, {
"800", 800 }, {
"800", 800 }, {
"800", 800 } } },
2575 { { {
"1000",1000 }, {
"1000",1000 }, {
"1000",1000 }, {
"1000",1000 } } },
2579 { { {
"800", 800 }, {
"800", 800 }, {
"800", 800 }, {
"800", 800 } } },
2580 { { {
"1600", 1600 }, {
"1600", 1600 }, {
"1600", 1600 }, {
"1600", 1600 } } },
2581 { { {
"2400", 2400 }, {
"2400", 2400 }, {
"2400", 2400 }, {
"2400", 2400 } } },
2582 { { {
"3200", 3200 }, {
"3200", 3200 }, {
"3200", 3200 }, {
"3200", 3200 } } },
2583 { { {
"4000", 4000 }, {
"4000", 4000 }, {
"4000", 4000 }, {
"4000", 4000 } } },
2591 dst[0] = v * o1 + dst[0] * o2;
2593 dst += linesize *
step;
2599 uint16_t *dst = (uint16_t *)ddst;
2603 dst[0] = v * o1 + dst[0] * o2;
2605 dst += (linesize / 2) *
step;
2614 dst[x] = v * o1 + dst[x] * o2;
2620 uint16_t *dst = (uint16_t *)ddst;
2624 dst[x] = v * o1 + dst[x] * o2;
2630 const uint8_t *font;
2636 for (plane = 0; plane < 4 &&
out->data[plane]; plane++) {
2637 for (
i = 0; txt[
i];
i++) {
2639 int v =
color[plane];
2641 uint8_t *p =
out->data[plane] + y *
out->linesize[plane] + (x +
i * 8);
2642 for (char_y = 0; char_y < font_height; char_y++) {
2644 if (font[txt[
i] * font_height + char_y] &
mask)
2645 p[0] = p[0] * o2 + v * o1;
2648 p +=
out->linesize[plane] - 8;
2656 const uint8_t *font;
2662 for (plane = 0; plane < 4 &&
out->data[plane]; plane++) {
2663 for (
i = 0; txt[
i];
i++) {
2667 uint16_t *p = (uint16_t *)(
out->data[plane] + y *
out->linesize[plane]) + (x +
i * 8);
2668 for (char_y = 0; char_y < font_height; char_y++) {
2670 if (font[txt[
i] * font_height + char_y] &
mask)
2671 p[0] = p[0] * o2 + v * o1;
2674 p +=
out->linesize[plane] / 2 - 8;
2682 const uint8_t *font;
2688 for (plane = 0; plane < 4 &&
out->data[plane]; plane++) {
2689 for (
i = 0; txt[
i];
i++) {
2691 int v =
color[plane];
2693 for (char_y = font_height - 1; char_y >= 0; char_y--) {
2694 uint8_t *p =
out->data[plane] + (y +
i * 10) *
out->linesize[plane] + x;
2696 if (font[txt[
i] * font_height + font_height - 1 - char_y] &
mask)
2697 p[char_y] = p[char_y] * o2 + v * o1;
2698 p +=
out->linesize[plane];
2707 const uint8_t *font;
2713 for (plane = 0; plane < 4 &&
out->data[plane]; plane++) {
2714 for (
i = 0; txt[
i];
i++) {
2718 for (char_y = 0; char_y < font_height; char_y++) {
2719 uint16_t *p = (uint16_t *)(
out->data[plane] + (y +
i * 10) *
out->linesize[plane]) + x;
2721 if (font[txt[
i] * font_height + font_height - 1 - char_y] &
mask)
2722 p[char_y] = p[char_y] * o2 + v * o1;
2723 p +=
out->linesize[plane] / 2;
2735 dst[0] = (v - dst[0]) * o1 + dst[0] * o2;
2737 dst += linesize *
step;
2743 uint16_t *dst = (uint16_t *)ddst;
2747 dst[0] = (v - dst[0]) * o1 + dst[0] * o2;
2749 dst += (linesize / 2) *
step;
2758 dst[x] = (v - dst[x]) * o1 + dst[x] * o2;
2764 uint16_t *dst = (uint16_t *)ddst;
2768 dst[x] = (v - dst[x]) * o1 + dst[x] * o2;
2774 const uint8_t *font;
2780 for (plane = 0; plane < 4 &&
out->data[plane]; plane++) {
2781 for (
i = 0; txt[
i];
i++) {
2783 int v =
color[plane];
2785 uint8_t *p =
out->data[plane] + y *
out->linesize[plane] + (x +
i * 8);
2786 for (char_y = 0; char_y < font_height; char_y++) {
2788 if (font[txt[
i] * font_height + char_y] &
mask)
2789 p[0] = p[0] * o2 + (v - p[0]) * o1;
2792 p +=
out->linesize[plane] - 8;
2800 const uint8_t *font;
2806 for (plane = 0; plane < 4 &&
out->data[plane]; plane++) {
2807 for (
i = 0; txt[
i];
i++) {
2811 uint16_t *p = (uint16_t *)(
out->data[plane] + y *
out->linesize[plane]) + (x +
i * 8);
2812 for (char_y = 0; char_y < font_height; char_y++) {
2814 if (font[txt[
i] * font_height + char_y] &
mask)
2815 p[0] = p[0] * o2 + (v - p[0]) * o1;
2818 p +=
out->linesize[plane] / 2 - 8;
2826 const uint8_t *font;
2832 for (plane = 0; plane < 4 &&
out->data[plane]; plane++) {
2833 for (
i = 0; txt[
i];
i++) {
2835 int v =
color[plane];
2837 for (char_y = font_height - 1; char_y >= 0; char_y--) {
2838 uint8_t *p =
out->data[plane] + (y +
i * 10) *
out->linesize[plane] + x;
2840 if (font[txt[
i] * font_height + font_height - 1 - char_y] &
mask)
2841 p[char_y] = p[char_y] * o2 + (v - p[char_y]) * o1;
2842 p +=
out->linesize[plane];
2851 const uint8_t *font;
2857 for (plane = 0; plane < 4 &&
out->data[plane]; plane++) {
2858 for (
i = 0; txt[
i];
i++) {
2862 for (char_y = 0; char_y < font_height; char_y++) {
2863 uint16_t *p = (uint16_t *)(
out->data[plane] + (y +
i * 10) *
out->linesize[plane]) + x;
2865 if (font[txt[
i] * font_height + font_height - 1 - char_y] &
mask)
2866 p[char_y] = p[char_y] * o2 + (v - p[char_y]) * o1;
2867 p +=
out->linesize[plane] / 2;
2880 const int step = (
s->flags & 2) + 1;
2881 const float o1 =
s->opacity;
2882 const float o2 = 1. - o1;
2884 int C, k = 0,
c, p, l, offset_x = 0, offset_y = 0;
2886 for (
c = 0;
c <
s->ncomp;
c++) {
2887 if (!((1 <<
c) &
s->pcomp) || (!
s->display && k > 0))
2892 for (p = 0; p <
s->ncomp; p++) {
2893 const int v =
s->grat_yuva_color[p];
2894 for (l = 0; l <
s->nb_glines; l++) {
2895 const uint16_t
pos =
s->glines[l].line[
C].pos;
2896 int x = offset_x + (
s->mirror ?
s->size - 1 -
pos :
pos);
2897 uint8_t *dst =
out->data[p] + offset_y *
out->linesize[p] + x;
2903 for (l = 0; l <
s->nb_glines && (
s->flags & 1); l++) {
2904 const char *
name =
s->glines[l].line[
C].name;
2905 const uint16_t
pos =
s->glines[l].line[
C].pos;
2906 int x = offset_x + (
s->mirror ?
s->size - 1 -
pos :
pos) - 10;
2911 s->draw_text(
out, x, offset_y + 2, 1, o1, o2,
name,
s->grat_yuva_color);
2914 offset_x +=
s->size * (
s->display ==
STACK);
2921 const int step = (
s->flags & 2) + 1;
2922 const float o1 =
s->opacity;
2923 const float o2 = 1. - o1;
2924 const int mult =
s->max / 256;
2926 int C, k = 0,
c, p, l, offset_x = 0, offset_y = 0;
2928 for (
c = 0;
c <
s->ncomp;
c++) {
2929 if (!((1 <<
c) &
s->pcomp) || (!
s->display && k > 0))
2934 for (p = 0; p <
s->ncomp; p++) {
2935 const int v =
s->grat_yuva_color[p] *
mult;
2936 for (l = 0; l <
s->nb_glines ; l++) {
2937 const uint16_t
pos =
s->glines[l].line[
C].pos;
2938 int x = offset_x + (
s->mirror ?
s->size - 1 -
pos :
pos);
2939 uint8_t *dst = (uint8_t *)(
out->data[p] + offset_y *
out->linesize[p]) + x * 2;
2945 for (l = 0; l <
s->nb_glines && (
s->flags & 1); l++) {
2946 const char *
name =
s->glines[l].line[
C].name;
2947 const uint16_t
pos =
s->glines[l].line[
C].pos;
2948 int x = offset_x + (
s->mirror ?
s->size - 1 -
pos :
pos) - 10;
2953 s->draw_text(
out, x, offset_y + 2,
mult, o1, o2,
name,
s->grat_yuva_color);
2956 offset_x +=
s->size * (
s->display ==
STACK);
2963 const int step = (
s->flags & 2) + 1;
2964 const float o1 =
s->opacity;
2965 const float o2 = 1. - o1;
2967 int C, k = 0,
c, p, l, offset_y = 0, offset_x = 0;
2969 for (
c = 0;
c <
s->ncomp;
c++) {
2970 if ((!((1 <<
c) &
s->pcomp) || (!
s->display && k > 0)))
2975 for (p = 0; p <
s->ncomp; p++) {
2976 const int v =
s->grat_yuva_color[p];
2977 for (l = 0; l <
s->nb_glines ; l++) {
2978 const uint16_t
pos =
s->glines[l].line[
C].pos;
2979 int y = offset_y + (
s->mirror ?
s->size - 1 -
pos :
pos);
2980 uint8_t *dst =
out->data[p] + y *
out->linesize[p] + offset_x;
2982 s->blend_line(dst,
width, 1, o1, o2, v,
step);
2986 for (l = 0; l <
s->nb_glines && (
s->flags & 1); l++) {
2987 const char *
name =
s->glines[l].line[
C].name;
2988 const uint16_t
pos =
s->glines[l].line[
C].pos;
2989 int y = offset_y + (
s->mirror ?
s->size - 1 -
pos :
pos) - 10;
2994 s->draw_text(
out, 2 + offset_x, y, 1, o1, o2,
name,
s->grat_yuva_color);
2997 offset_y +=
s->size * (
s->display ==
STACK);
3004 const int step = (
s->flags & 2) + 1;
3005 const float o1 =
s->opacity;
3006 const float o2 = 1. - o1;
3007 const int mult =
s->max / 256;
3009 int C, k = 0,
c, p, l, offset_x = 0, offset_y = 0;
3011 for (
c = 0;
c <
s->ncomp;
c++) {
3012 if ((!((1 <<
c) &
s->pcomp) || (!
s->display && k > 0)))
3017 for (p = 0; p <
s->ncomp; p++) {
3018 const int v =
s->grat_yuva_color[p] *
mult;
3019 for (l = 0; l <
s->nb_glines ; l++) {
3020 const uint16_t
pos =
s->glines[l].line[
C].pos;
3021 int y = offset_y + (
s->mirror ?
s->size - 1 -
pos :
pos);
3022 uint8_t *dst = (uint8_t *)(
out->data[p] + y *
out->linesize[p]) + offset_x * 2;
3024 s->blend_line(dst,
width, 1, o1, o2, v,
step);
3028 for (l = 0; l <
s->nb_glines && (
s->flags & 1); l++) {
3029 const char *
name =
s->glines[l].line[
C].name;
3030 const uint16_t
pos =
s->glines[l].line[
C].pos;
3031 int y = offset_y + (
s->mirror ?
s->size - 1 -
pos:
pos) - 10;
3036 s->draw_text(
out, 2 + offset_x, y,
mult, o1, o2,
name,
s->grat_yuva_color);
3039 offset_y +=
s->size * (
s->display ==
STACK);
3050 s->ncomp =
s->desc->nb_components;
3051 s->bits =
s->desc->comp[0].depth;
3052 s->max = 1 <<
s->bits;
3054 s->shift_w[0] =
s->shift_w[3] = 0;
3055 s->shift_h[0] =
s->shift_h[3] = 0;
3056 s->shift_w[1] =
s->shift_w[2] =
s->desc->log2_chroma_w;
3057 s->shift_h[1] =
s->shift_h[2] =
s->desc->log2_chroma_h;
3061 switch (
s->filter) {
3064 case AFLAT:
s->size = 256 * 2;
break;
3065 case FLAT:
s->size = 256 * 3;
break;
3066 default:
s->size = 256;
break;
3069 switch (
s->filter | ((
s->bits > 8) << 4) |
3070 (
s->mode << 8) | (
s->mirror << 12)) {
3071 case 0x1100:
s->waveform_slice = lowpass_column_mirror;
break;
3072 case 0x1000:
s->waveform_slice = lowpass_row_mirror;
break;
3073 case 0x0100:
s->waveform_slice = lowpass_column;
break;
3074 case 0x0000:
s->waveform_slice = lowpass_row;
break;
3075 case 0x1110:
s->waveform_slice = lowpass16_column_mirror;
break;
3076 case 0x1010:
s->waveform_slice = lowpass16_row_mirror;
break;
3077 case 0x0110:
s->waveform_slice = lowpass16_column;
break;
3078 case 0x0010:
s->waveform_slice = lowpass16_row;
break;
3079 case 0x1101:
s->waveform_slice = flat_column_mirror;
break;
3080 case 0x1001:
s->waveform_slice = flat_row_mirror;
break;
3081 case 0x0101:
s->waveform_slice = flat_column;
break;
3082 case 0x0001:
s->waveform_slice = flat_row;
break;
3083 case 0x1111:
s->waveform_slice = flat16_column_mirror;
break;
3084 case 0x1011:
s->waveform_slice = flat16_row_mirror;
break;
3085 case 0x0111:
s->waveform_slice = flat16_column;
break;
3086 case 0x0011:
s->waveform_slice = flat16_row;
break;
3087 case 0x1102:
s->waveform_slice = aflat_column_mirror;
break;
3088 case 0x1002:
s->waveform_slice = aflat_row_mirror;
break;
3089 case 0x0102:
s->waveform_slice = aflat_column;
break;
3090 case 0x0002:
s->waveform_slice = aflat_row;
break;
3091 case 0x1112:
s->waveform_slice = aflat16_column_mirror;
break;
3092 case 0x1012:
s->waveform_slice = aflat16_row_mirror;
break;
3093 case 0x0112:
s->waveform_slice = aflat16_column;
break;
3094 case 0x0012:
s->waveform_slice = aflat16_row;
break;
3095 case 0x1103:
s->waveform_slice = chroma_column_mirror;
break;
3096 case 0x1003:
s->waveform_slice = chroma_row_mirror;
break;
3097 case 0x0103:
s->waveform_slice = chroma_column;
break;
3098 case 0x0003:
s->waveform_slice = chroma_row;
break;
3099 case 0x1113:
s->waveform_slice = chroma16_column_mirror;
break;
3100 case 0x1013:
s->waveform_slice = chroma16_row_mirror;
break;
3101 case 0x0113:
s->waveform_slice = chroma16_column;
break;
3102 case 0x0013:
s->waveform_slice = chroma16_row;
break;
3103 case 0x1104:
s->waveform_slice = color_column_mirror;
break;
3104 case 0x1004:
s->waveform_slice = color_row_mirror;
break;
3105 case 0x0104:
s->waveform_slice = color_column;
break;
3106 case 0x0004:
s->waveform_slice = color_row;
break;
3107 case 0x1114:
s->waveform_slice = color16_column_mirror;
break;
3108 case 0x1014:
s->waveform_slice = color16_row_mirror;
break;
3109 case 0x0114:
s->waveform_slice = color16_column;
break;
3110 case 0x0014:
s->waveform_slice = color16_row;
break;
3111 case 0x1105:
s->waveform_slice = acolor_column_mirror;
break;
3112 case 0x1005:
s->waveform_slice = acolor_row_mirror;
break;
3113 case 0x0105:
s->waveform_slice = acolor_column;
break;
3114 case 0x0005:
s->waveform_slice = acolor_row;
break;
3115 case 0x1115:
s->waveform_slice = acolor16_column_mirror;
break;
3116 case 0x1015:
s->waveform_slice = acolor16_row_mirror;
break;
3117 case 0x0115:
s->waveform_slice = acolor16_column;
break;
3118 case 0x0015:
s->waveform_slice = acolor16_row;
break;
3119 case 0x1106:
s->waveform_slice = xflat_column_mirror;
break;
3120 case 0x1006:
s->waveform_slice = xflat_row_mirror;
break;
3121 case 0x0106:
s->waveform_slice = xflat_column;
break;
3122 case 0x0006:
s->waveform_slice = xflat_row;
break;
3123 case 0x1116:
s->waveform_slice = xflat16_column_mirror;
break;
3124 case 0x1016:
s->waveform_slice = xflat16_row_mirror;
break;
3125 case 0x0116:
s->waveform_slice = xflat16_column;
break;
3126 case 0x0016:
s->waveform_slice = xflat16_row;
break;
3127 case 0x1107:
s->waveform_slice = yflat_column_mirror;
break;
3128 case 0x1007:
s->waveform_slice = yflat_row_mirror;
break;
3129 case 0x0107:
s->waveform_slice = yflat_column;
break;
3130 case 0x0007:
s->waveform_slice = yflat_row;
break;
3131 case 0x1117:
s->waveform_slice = yflat16_column_mirror;
break;
3132 case 0x1017:
s->waveform_slice = yflat16_row_mirror;
break;
3133 case 0x0117:
s->waveform_slice = yflat16_column;
break;
3134 case 0x0017:
s->waveform_slice = yflat16_row;
break;
3137 s->grat_yuva_color[0] = 255;
3138 s->grat_yuva_color[1] =
s->graticule ==
GRAT_INVERT ? 255 : 0;
3140 s->grat_yuva_color[3] = 255;
3156 switch (
s->filter) {
3167 else if (
s->graticule >
GRAT_NONE &&
s->mode == 0)
3172 switch (
s->filter) {
3291 s->size =
s->size << (
s->bits - 8);
3293 switch (
inlink->format) {
3316 for (
i = 0;
i <
s->ncomp;
i++) {
3317 if ((1 <<
i) &
s->pcomp)
3325 s->dcomp =
s->odesc->nb_components;
3343 for (p = 0; p <
s->ncomp; p++) {
3344 const int plane =
s->desc->comp[p].plane;
3347 if (!((1 << p) &
s->pcomp))
3350 for (k = 0; k < 4; k++) {
3351 s->emax[plane][k] =
s->peak +
size * (plane * 4 + k + 0);
3352 s->emin[plane][k] =
s->peak +
size * (plane * 4 + k + 16);
3357 s->eend[plane] = (
offset +
s->size - 1);
3359 for (k = 0; k < 4; k++) {
3360 s->emax[plane][k][
i] =
s->estart[plane];
3361 s->emin[plane][k][
i] =
s->eend[plane];
3366 switch (
s->fitmode) {
3392 s->intensity =
s->fintensity * (
s->max - 1);
3393 s->bg_color[3] =
s->bgopacity * (
s->max - 1);
3394 s->tint[0] = .5f * (
s->ftint[0] + 1.f) * (
s->size - 1);
3395 s->tint[1] = .5f * (
s->ftint[1] + 1.f) * (
s->size - 1);
3403 for (k = 0; k <
s->dcomp; k++) {
3405 for (
i = 0;
i < outlink->
h ;
i++)
3406 memset(
out->data[
s->odesc->comp[k].plane] +
3407 i *
out->linesize[
s->odesc->comp[k].plane],
3408 s->bg_color[k], outlink->
w);
3410 const int mult =
s->max / 256;
3411 uint16_t *dst = (uint16_t *)
out->data[
s->odesc->comp[k].plane];
3413 for (
i = 0;
i < outlink->
h ;
i++) {
3414 for (j = 0; j < outlink->
w; j++)
3415 dst[j] =
s->bg_color[k] *
mult;
3416 dst +=
out->linesize[
s->odesc->comp[k].plane] / 2;
3421 for (k = 0,
i = 0; k <
s->ncomp; k++) {
3422 if ((1 << k) &
s->pcomp) {
3423 const int plane =
s->desc->comp[k].plane;
3429 offset_x =
s->mode ?
i++ *
inlink->w : 0;
3430 offset_y =
s->mode ? 0 :
i++ *
inlink->h;
3432 offset_y =
s->mode ?
i++ *
s->size * !!
s->display : 0;
3433 offset_x =
s->mode ? 0 :
i++ *
s->size * !!
s->display;
3439 td.offset_y = offset_y;
3440 td.offset_x = offset_x;
3443 switch (
s->filter) {
3454 envelope(
s,
out, plane, plane,
s->mode ? offset_x : offset_y);
3460 envelope(
s,
out, plane, plane,
s->mode ? offset_x : offset_y);
3461 envelope(
s,
out, plane, (plane + 1) %
s->ncomp,
s->mode ? offset_x : offset_y);
3464 envelope16(
s,
out, plane, (plane + 1) %
s->ncomp,
s->mode ? offset_x : offset_y);
3471 envelope(
s,
out, plane, (plane + 0) %
s->ncomp,
s->mode ? offset_x : offset_y);
3472 envelope(
s,
out, plane, (plane + 1) %
s->ncomp,
s->mode ? offset_x : offset_y);
3473 envelope(
s,
out, plane, (plane + 2) %
s->ncomp,
s->mode ? offset_x : offset_y);
3475 envelope16(
s,
out, plane, (plane + 0) %
s->ncomp,
s->mode ? offset_x : offset_y);
3476 envelope16(
s,
out, plane, (plane + 1) %
s->ncomp,
s->mode ? offset_x : offset_y);
3477 envelope16(
s,
out, plane, (plane + 2) %
s->ncomp,
s->mode ? offset_x : offset_y);
3483 s->graticulef(
s,
out);
3520 .priv_class = &waveform_class,