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
325 if (!
ctx->inputs[0]->incfg.formats ||
326 !
ctx->inputs[0]->incfg.formats->nb_formats) {
342 if (!
ctx->inputs[0]->outcfg.formats) {
347 avff =
ctx->inputs[0]->incfg.formats;
348 avff2 =
ctx->inputs[0]->outcfg.formats;
354 depth =
desc->comp[0].depth;
356 if (
ncomp != ncomp2 || depth != depth2)
361 depth !=
desc->comp[0].depth)
373 else if (
rgb && depth == 8 &&
ncomp > 2)
375 else if (
rgb && depth == 9 &&
ncomp > 2)
377 else if (
rgb && depth == 10 &&
ncomp > 2)
379 else if (
rgb && depth == 12 &&
ncomp > 2)
381 else if (depth == 8 &&
ncomp > 2)
383 else if (depth == 9 &&
ncomp > 2)
385 else if (depth == 10 &&
ncomp > 2)
387 else if (depth == 12 &&
ncomp > 2)
399 const int dst_linesize =
out->linesize[component] / 2;
400 const int bg =
s->bg_color[component] * (
s->max / 256);
401 const int limit =
s->max - 1;
402 const int dst_h =
s->display ==
PARADE ?
out->height /
s->acomp :
out->height;
403 const int dst_w =
s->display ==
PARADE ?
out->width /
s->acomp :
out->width;
404 const int start =
s->estart[plane];
405 const int end =
s->eend[plane];
411 for (y = start; y < end; y++) {
412 dst = (uint16_t *)
out->data[component] + y * dst_linesize + x;
418 for (y = end - 1; y >= start; y--) {
419 dst = (uint16_t *)
out->data[component] + y * dst_linesize + x;
428 dst = (uint16_t *)
out->data[component] + y * dst_linesize;
429 for (x = start; x < end; x++) {
435 for (x = end - 1; x >= start; x--) {
447 const int dst_linesize =
out->linesize[component];
448 const uint8_t bg =
s->bg_color[component];
449 const int dst_h =
s->display ==
PARADE ?
out->height /
s->acomp :
out->height;
450 const int dst_w =
s->display ==
PARADE ?
out->width /
s->acomp :
out->width;
451 const int start =
s->estart[plane];
452 const int end =
s->eend[plane];
458 for (y = start; y < end; y++) {
459 dst =
out->data[component] + y * dst_linesize + x;
465 for (y = end - 1; y >= start; y--) {
466 dst =
out->data[component] + y * dst_linesize + x;
475 dst =
out->data[component] + y * dst_linesize;
476 for (x = start; x < end; x++) {
482 for (x = end - 1; x >= start; x--) {
494 const int dst_linesize =
out->linesize[component] / 2;
495 const int bg =
s->bg_color[component] * (
s->max / 256);
496 const int limit =
s->max - 1;
497 const int dst_h =
s->display ==
PARADE ?
out->height /
s->acomp :
out->height;
498 const int dst_w =
s->display ==
PARADE ?
out->width /
s->acomp :
out->width;
499 const int start =
s->estart[plane];
500 const int end =
s->eend[plane];
501 int *
emax =
s->emax[plane][component];
502 int *
emin =
s->emin[plane][component];
508 for (y = start; y < end && y <
emin[x -
offset]; y++) {
509 dst = (uint16_t *)
out->data[component] + y * dst_linesize + x;
515 for (y = end - 1; y >= start && y >=
emax[x -
offset]; y--) {
516 dst = (uint16_t *)
out->data[component] + y * dst_linesize + x;
524 if (
s->envelope == 3)
528 dst = (uint16_t *)
out->data[component] +
emin[x -
offset] * dst_linesize + x;
530 dst = (uint16_t *)
out->data[component] +
emax[x -
offset] * dst_linesize + x;
535 dst = (uint16_t *)
out->data[component] + y * dst_linesize;
542 for (x = end - 1; x >= start && x >=
emax[y -
offset]; x--) {
550 if (
s->envelope == 3)
554 dst = (uint16_t *)
out->data[component] + y * dst_linesize +
emin[y -
offset];
556 dst = (uint16_t *)
out->data[component] + y * dst_linesize +
emax[y -
offset];
564 const int dst_linesize =
out->linesize[component];
565 const int bg =
s->bg_color[component];
566 const int dst_h =
s->display ==
PARADE ?
out->height /
s->acomp :
out->height;
567 const int dst_w =
s->display ==
PARADE ?
out->width /
s->acomp :
out->width;
568 const int start =
s->estart[plane];
569 const int end =
s->eend[plane];
570 int *
emax =
s->emax[plane][component];
571 int *
emin =
s->emin[plane][component];
577 for (y = start; y < end && y <
emin[x -
offset]; y++) {
578 dst =
out->data[component] + y * dst_linesize + x;
584 for (y = end - 1; y >= start && y >=
emax[x -
offset]; y--) {
585 dst =
out->data[component] + y * dst_linesize + x;
593 if (
s->envelope == 3)
597 dst =
out->data[component] +
emin[x -
offset] * dst_linesize + x;
599 dst =
out->data[component] +
emax[x -
offset] * dst_linesize + x;
604 dst =
out->data[component] + y * dst_linesize;
605 for (x = start; x < end && x <
emin[y -
offset]; x++) {
611 for (x = end - 1; x >= start && x >=
emax[y -
offset]; x--) {
619 if (
s->envelope == 3)
623 dst =
out->data[component] + y * dst_linesize +
emin[y -
offset];
625 dst =
out->data[component] + y * dst_linesize +
emax[y -
offset];
633 if (
s->envelope == 0) {
635 }
else if (
s->envelope == 1) {
644 if (
s->envelope == 0) {
646 }
else if (
s->envelope == 1) {
688 int offset_y,
int offset_x,
690 int jobnr,
int nb_jobs)
692 const int plane =
s->desc->comp[component].plane;
693 const int dplane = (
s->rgb ||
s->display ==
OVERLAY) ? plane : 0;
694 const int shift_w =
s->shift_w[component];
695 const int shift_h =
s->shift_h[component];
696 const int src_linesize = in->
linesize[plane] / 2;
697 const int dst_linesize =
out->linesize[dplane] / 2;
698 const int dst_signed_linesize = dst_linesize * (
mirror == 1 ? -1 : 1);
699 const int limit =
s->max - 1;
703 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
704 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
705 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
706 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
708 const uint16_t *src_data = (
const uint16_t *)in->
data[plane] + sliceh_start * src_linesize;
709 uint16_t *dst_data = (uint16_t *)
out->data[dplane] + (offset_y + sliceh_start *
step) * dst_linesize + offset_x;
710 uint16_t *
const dst_bottom_line = dst_data + dst_linesize * (
s->size - 1);
711 uint16_t *
const dst_line = (
mirror ? dst_bottom_line : dst_data);
718 for (y = sliceh_start; y < sliceh_end; y++) {
719 const uint16_t *src_data_end = src_data + slicew_end;
720 uint16_t *dst = dst_line + slicew_start *
step;
722 for (p = src_data + slicew_start; p < src_data_end; p++) {
728 target = dst++ + dst_signed_linesize * v;
730 }
while (++
i <
step);
732 uint16_t *row = dst_data;
735 target = row - v - 1;
740 }
while (++
i <
step);
743 src_data += src_linesize;
744 dst_data += dst_linesize *
step;
747 if (
s->display !=
OVERLAY && column && !
s->rgb) {
748 const int mult =
s->max / 256;
749 const int bg =
s->bg_color[0] *
mult;
750 const int t0 =
s->tint[0];
751 const int t1 =
s->tint[1];
752 uint16_t *dst0, *dst1;
756 src = (
const uint16_t *)(
out->data[0]) + offset_y * dst_linesize + offset_x;
757 dst0 = (uint16_t *)(
out->data[1]) + offset_y * dst_linesize + offset_x;
758 dst1 = (uint16_t *)(
out->data[2]) + offset_y * dst_linesize + offset_x;
759 for (y = 0; y <
s->max; y++) {
760 for (x = slicew_start *
step; x < slicew_end *
step; x++) {
768 dst0 += dst_linesize;
769 dst1 += dst_linesize;
771 }
else if (
s->display !=
OVERLAY && !
s->rgb) {
772 const int mult =
s->max / 256;
773 const int bg =
s->bg_color[0] *
mult;
774 const int t0 =
s->tint[0];
775 const int t1 =
s->tint[1];
776 uint16_t *dst0, *dst1;
780 src = (
const uint16_t *)
out->data[0] + (offset_y + sliceh_start *
step) * dst_linesize + offset_x;
781 dst0 = (uint16_t *)(
out->data[1]) + (offset_y + sliceh_start *
step) * dst_linesize + offset_x;
782 dst1 = (uint16_t *)(
out->data[2]) + (offset_y + sliceh_start *
step) * dst_linesize + offset_x;
783 for (y = sliceh_start *
step; y < sliceh_end *
step; y++) {
784 for (x = 0; x <
s->max; x++) {
792 dst0 += dst_linesize;
793 dst1 += dst_linesize;
798 #define LOWPASS16_FUNC(name, column, mirror) \
799 static int lowpass16_##name(AVFilterContext *ctx, \
800 void *arg, int jobnr, \
803 WaveformContext *s = ctx->priv; \
804 ThreadData *td = arg; \
805 AVFrame *in = td->in; \
806 AVFrame *out = td->out; \
807 int component = td->component; \
808 int offset_y = td->offset_y; \
809 int offset_x = td->offset_x; \
811 lowpass16(s, in, out, component, s->intensity, \
812 offset_y, offset_x, column, mirror, \
826 int offset_y,
int offset_x,
828 int jobnr,
int nb_jobs)
830 const int plane =
s->desc->comp[component].plane;
831 const int dplane = (
s->rgb ||
s->display ==
OVERLAY) ? plane : 0;
832 const int shift_w =
s->shift_w[component];
833 const int shift_h =
s->shift_h[component];
834 const int src_linesize = in->linesize[plane];
835 const int dst_linesize =
out->linesize[dplane];
836 const int dst_signed_linesize = dst_linesize * (
mirror == 1 ? -1 : 1);
840 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
841 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
842 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
843 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
845 const uint8_t *src_data = in->data[plane] + sliceh_start * src_linesize;
846 uint8_t *dst_data =
out->data[dplane] + (offset_y + sliceh_start *
step) * dst_linesize + offset_x;
847 uint8_t *
const dst_bottom_line = dst_data + dst_linesize * (
s->size - 1);
848 uint8_t *
const dst_line = (
mirror ? dst_bottom_line : dst_data);
855 for (y = sliceh_start; y < sliceh_end; y++) {
856 const uint8_t *src_data_end = src_data + slicew_end;
857 uint8_t *dst = dst_line + slicew_start *
step;
859 for (p = src_data + slicew_start; p < src_data_end; p++) {
865 target = dst++ + dst_signed_linesize * *p;
867 }
while (++
i <
step);
869 uint8_t *row = dst_data;
872 target = row - *p - 1;
877 }
while (++
i <
step);
880 src_data += src_linesize;
881 dst_data += dst_linesize *
step;
884 if (
s->display !=
OVERLAY && column && !
s->rgb) {
885 const int bg =
s->bg_color[0];
886 const int dst_h = 256;
887 const int t0 =
s->tint[0];
888 const int t1 =
s->tint[1];
889 uint8_t *dst0, *dst1;
893 src =
out->data[0] + offset_y * dst_linesize + offset_x;
894 dst0 =
out->data[1] + offset_y * dst_linesize + offset_x;
895 dst1 =
out->data[2] + offset_y * dst_linesize + offset_x;
896 for (y = 0; y < dst_h; y++) {
897 for (x = slicew_start *
step; x < slicew_end *
step; x++) {
905 dst0 += dst_linesize;
906 dst1 += dst_linesize;
908 }
else if (
s->display !=
OVERLAY && !
s->rgb) {
909 const int bg =
s->bg_color[0];
910 const int dst_w = 256;
911 const int t0 =
s->tint[0];
912 const int t1 =
s->tint[1];
913 uint8_t *dst0, *dst1;
917 src =
out->data[0] + (offset_y + sliceh_start *
step) * dst_linesize + offset_x;
918 dst0 =
out->data[1] + (offset_y + sliceh_start *
step) * dst_linesize + offset_x;
919 dst1 =
out->data[2] + (offset_y + sliceh_start *
step) * dst_linesize + offset_x;
920 for (y = sliceh_start *
step; y < sliceh_end *
step; y++) {
921 for (x = 0; x < dst_w; x++) {
929 dst0 += dst_linesize;
930 dst1 += dst_linesize;
935 #define LOWPASS_FUNC(name, column, mirror) \
936 static int lowpass_##name(AVFilterContext *ctx, \
937 void *arg, int jobnr, \
940 WaveformContext *s = ctx->priv; \
941 ThreadData *td = arg; \
942 AVFrame *in = td->in; \
943 AVFrame *out = td->out; \
944 int component = td->component; \
945 int offset_y = td->offset_y; \
946 int offset_x = td->offset_x; \
948 lowpass(s, in, out, component, s->intensity, \
949 offset_y, offset_x, column, mirror, \
963 int offset_y,
int offset_x,
965 int jobnr,
int nb_jobs)
967 const int plane =
s->desc->comp[component].plane;
968 const int c0_linesize = in->linesize[ plane + 0 ] / 2;
969 const int c1_linesize = in->linesize[(plane + 1) %
s->ncomp] / 2;
970 const int c2_linesize = in->linesize[(plane + 2) %
s->ncomp] / 2;
971 const int c0_shift_w =
s->shift_w[ component + 0 ];
972 const int c1_shift_w =
s->shift_w[(component + 1) %
s->ncomp];
973 const int c2_shift_w =
s->shift_w[(component + 2) %
s->ncomp];
974 const int c0_shift_h =
s->shift_h[ component + 0 ];
975 const int c1_shift_h =
s->shift_h[(component + 1) %
s->ncomp];
976 const int c2_shift_h =
s->shift_h[(component + 2) %
s->ncomp];
977 const int d0_linesize =
out->linesize[ plane + 0 ] / 2;
978 const int d1_linesize =
out->linesize[(plane + 1) %
s->ncomp] / 2;
979 const int limit =
s->max - 1;
981 const int mid =
s->max / 2;
982 const int src_h = in->height;
983 const int src_w = in->width;
984 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
985 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
986 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
987 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
991 const int d0_signed_linesize = d0_linesize * (
mirror == 1 ? -1 : 1);
992 const int d1_signed_linesize = d1_linesize * (
mirror == 1 ? -1 : 1);
994 for (x = slicew_start; x < slicew_end; x++) {
995 const uint16_t *c0_data = (uint16_t *)in->data[plane + 0];
996 const uint16_t *c1_data = (uint16_t *)in->data[(plane + 1) %
s->ncomp];
997 const uint16_t *c2_data = (uint16_t *)in->data[(plane + 2) %
s->ncomp];
998 uint16_t *d0_data = (uint16_t *)(
out->data[plane]) + offset_y * d0_linesize + offset_x;
999 uint16_t *d1_data = (uint16_t *)(
out->data[(plane + 1) %
s->ncomp]) + offset_y * d1_linesize + offset_x;
1000 uint16_t *
const d0_bottom_line = d0_data + d0_linesize * (
s->size - 1);
1001 uint16_t *
const d0 = (
mirror ? d0_bottom_line : d0_data);
1002 uint16_t *
const d1_bottom_line = d1_data + d1_linesize * (
s->size - 1);
1003 uint16_t *
const d1 = (
mirror ? d1_bottom_line : d1_data);
1005 for (y = 0; y < src_h; y++) {
1006 const int c0 =
FFMIN(c0_data[x >> c0_shift_w],
limit) +
s->max;
1007 const int c1 =
FFMIN(
FFABS(c1_data[x >> c1_shift_w] - mid) +
FFABS(c2_data[x >> c2_shift_w] - mid),
limit);
1010 target = d0 + x + d0_signed_linesize * c0;
1012 target = d1 + x + d1_signed_linesize * (c0 -
c1);
1014 target = d1 + x + d1_signed_linesize * (c0 +
c1);
1017 if (!c0_shift_h || (y & c0_shift_h))
1018 c0_data += c0_linesize;
1019 if (!c1_shift_h || (y & c1_shift_h))
1020 c1_data += c1_linesize;
1021 if (!c2_shift_h || (y & c2_shift_h))
1022 c2_data += c2_linesize;
1023 d0_data += d0_linesize;
1024 d1_data += d1_linesize;
1028 const uint16_t *c0_data = (uint16_t *)(in->data[plane]) + (sliceh_start >> c0_shift_h) * c0_linesize;
1029 const uint16_t *c1_data = (uint16_t *)(in->data[(plane + 1) %
s->ncomp]) + (sliceh_start >> c1_shift_h) * c1_linesize;
1030 const uint16_t *c2_data = (uint16_t *)(in->data[(plane + 2) %
s->ncomp]) + (sliceh_start >> c2_shift_h) * c2_linesize;
1031 uint16_t *d0_data = (uint16_t *)(
out->data[plane]) + (offset_y + sliceh_start) * d0_linesize + offset_x;
1032 uint16_t *d1_data = (uint16_t *)(
out->data[(plane + 1) %
s->ncomp]) + (offset_y + sliceh_start) * d1_linesize + offset_x;
1035 d0_data +=
s->size - 1;
1036 d1_data +=
s->size - 1;
1039 for (y = sliceh_start; y < sliceh_end; y++) {
1040 for (x = 0; x < src_w; x++) {
1041 const int c0 =
FFMIN(c0_data[x >> c0_shift_w],
limit) +
s->max;
1042 const int c1 =
FFMIN(
FFABS(c1_data[x >> c1_shift_w] - mid) +
FFABS(c2_data[x >> c2_shift_w] - mid),
limit);
1046 target = d0_data - c0;
1048 target = d1_data - (c0 -
c1);
1050 target = d1_data - (c0 +
c1);
1053 target = d0_data + c0;
1055 target = d1_data + (c0 -
c1);
1057 target = d1_data + (c0 +
c1);
1062 if (!c0_shift_h || (y & c0_shift_h))
1063 c0_data += c0_linesize;
1064 if (!c1_shift_h || (y & c1_shift_h))
1065 c1_data += c1_linesize;
1066 if (!c2_shift_h || (y & c2_shift_h))
1067 c2_data += c2_linesize;
1068 d0_data += d0_linesize;
1069 d1_data += d1_linesize;
1074 #define FLAT16_FUNC(name, column, mirror) \
1075 static int flat16_##name(AVFilterContext *ctx, \
1076 void *arg, int jobnr, \
1079 WaveformContext *s = ctx->priv; \
1080 ThreadData *td = arg; \
1081 AVFrame *in = td->in; \
1082 AVFrame *out = td->out; \
1083 int component = td->component; \
1084 int offset_y = td->offset_y; \
1085 int offset_x = td->offset_x; \
1087 flat16(s, in, out, component, s->intensity, \
1088 offset_y, offset_x, column, mirror, \
1102 int offset_y,
int offset_x,
1104 int jobnr,
int nb_jobs)
1106 const int plane =
s->desc->comp[component].plane;
1107 const int c0_linesize = in->linesize[ plane + 0 ];
1108 const int c1_linesize = in->linesize[(plane + 1) %
s->ncomp];
1109 const int c2_linesize = in->linesize[(plane + 2) %
s->ncomp];
1110 const int c0_shift_w =
s->shift_w[ component + 0 ];
1111 const int c1_shift_w =
s->shift_w[(component + 1) %
s->ncomp];
1112 const int c2_shift_w =
s->shift_w[(component + 2) %
s->ncomp];
1113 const int c0_shift_h =
s->shift_h[ component + 0 ];
1114 const int c1_shift_h =
s->shift_h[(component + 1) %
s->ncomp];
1115 const int c2_shift_h =
s->shift_h[(component + 2) %
s->ncomp];
1116 const int d0_linesize =
out->linesize[ plane + 0 ];
1117 const int d1_linesize =
out->linesize[(plane + 1) %
s->ncomp];
1119 const int src_h = in->height;
1120 const int src_w = in->width;
1121 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
1122 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
1123 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
1124 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
1128 const int d0_signed_linesize = d0_linesize * (
mirror == 1 ? -1 : 1);
1129 const int d1_signed_linesize = d1_linesize * (
mirror == 1 ? -1 : 1);
1131 for (x = slicew_start; x < slicew_end; x++) {
1132 const uint8_t *c0_data = in->data[plane + 0];
1133 const uint8_t *c1_data = in->data[(plane + 1) %
s->ncomp];
1134 const uint8_t *c2_data = in->data[(plane + 2) %
s->ncomp];
1135 uint8_t *d0_data =
out->data[plane] + offset_y * d0_linesize + offset_x;
1136 uint8_t *d1_data =
out->data[(plane + 1) %
s->ncomp] + offset_y * d1_linesize + offset_x;
1137 uint8_t *
const d0_bottom_line = d0_data + d0_linesize * (
s->size - 1);
1138 uint8_t *
const d0 = (
mirror ? d0_bottom_line : d0_data);
1139 uint8_t *
const d1_bottom_line = d1_data + d1_linesize * (
s->size - 1);
1140 uint8_t *
const d1 = (
mirror ? d1_bottom_line : d1_data);
1142 for (y = 0; y < src_h; y++) {
1143 const int c0 = c0_data[x >> c0_shift_w] + 256;
1144 const int c1 =
FFABS(c1_data[x >> c1_shift_w] - 128) +
FFABS(c2_data[x >> c2_shift_w] - 128);
1147 target = d0 + x + d0_signed_linesize * c0;
1149 target = d1 + x + d1_signed_linesize * (c0 -
c1);
1151 target = d1 + x + d1_signed_linesize * (c0 +
c1);
1154 if (!c0_shift_h || (y & c0_shift_h))
1155 c0_data += c0_linesize;
1156 if (!c1_shift_h || (y & c1_shift_h))
1157 c1_data += c1_linesize;
1158 if (!c2_shift_h || (y & c2_shift_h))
1159 c2_data += c2_linesize;
1160 d0_data += d0_linesize;
1161 d1_data += d1_linesize;
1165 const uint8_t *c0_data = in->data[plane] + (sliceh_start >> c0_shift_h) * c0_linesize;
1166 const uint8_t *c1_data = in->data[(plane + 1) %
s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize;
1167 const uint8_t *c2_data = in->data[(plane + 2) %
s->ncomp] + (sliceh_start >> c2_shift_h) * c2_linesize;
1168 uint8_t *d0_data =
out->data[plane] + (offset_y + sliceh_start) * d0_linesize + offset_x;
1169 uint8_t *d1_data =
out->data[(plane + 1) %
s->ncomp] + (offset_y + sliceh_start) * d1_linesize + offset_x;
1172 d0_data +=
s->size - 1;
1173 d1_data +=
s->size - 1;
1176 for (y = sliceh_start; y < sliceh_end; y++) {
1177 for (x = 0; x < src_w; x++) {
1178 const int c0 = c0_data[x >> c0_shift_w] + 256;
1179 const int c1 =
FFABS(c1_data[x >> c1_shift_w] - 128) +
FFABS(c2_data[x >> c2_shift_w] - 128);
1183 target = d0_data - c0;
1185 target = d1_data - (c0 -
c1);
1187 target = d1_data - (c0 +
c1);
1190 target = d0_data + c0;
1192 target = d1_data + (c0 -
c1);
1194 target = d1_data + (c0 +
c1);
1199 if (!c0_shift_h || (y & c0_shift_h))
1200 c0_data += c0_linesize;
1201 if (!c1_shift_h || (y & c1_shift_h))
1202 c1_data += c1_linesize;
1203 if (!c2_shift_h || (y & c2_shift_h))
1204 c2_data += c2_linesize;
1205 d0_data += d0_linesize;
1206 d1_data += d1_linesize;
1211 #define FLAT_FUNC(name, column, mirror) \
1212 static int flat_##name(AVFilterContext *ctx, \
1213 void *arg, int jobnr, \
1216 WaveformContext *s = ctx->priv; \
1217 ThreadData *td = arg; \
1218 AVFrame *in = td->in; \
1219 AVFrame *out = td->out; \
1220 int component = td->component; \
1221 int offset_y = td->offset_y; \
1222 int offset_x = td->offset_x; \
1224 flat(s, in, out, component, s->intensity, \
1225 offset_y, offset_x, column, mirror, \
1236 #define AFLAT16(name, update_cb, update_cr, column, mirror) \
1237 static int name(AVFilterContext *ctx, \
1238 void *arg, int jobnr, \
1241 WaveformContext *s = ctx->priv; \
1242 ThreadData *td = arg; \
1243 AVFrame *in = td->in; \
1244 AVFrame *out = td->out; \
1245 int component = td->component; \
1246 int offset_y = td->offset_y; \
1247 int offset_x = td->offset_x; \
1248 const int intensity = s->intensity; \
1249 const int plane = s->desc->comp[component].plane; \
1250 const int c0_linesize = in->linesize[ plane + 0 ] / 2; \
1251 const int c1_linesize = in->linesize[(plane + 1) % s->ncomp] / 2; \
1252 const int c2_linesize = in->linesize[(plane + 2) % s->ncomp] / 2; \
1253 const int c0_shift_w = s->shift_w[ component + 0 ]; \
1254 const int c1_shift_w = s->shift_w[(component + 1) % s->ncomp]; \
1255 const int c2_shift_w = s->shift_w[(component + 2) % s->ncomp]; \
1256 const int c0_shift_h = s->shift_h[ component + 0 ]; \
1257 const int c1_shift_h = s->shift_h[(component + 1) % s->ncomp]; \
1258 const int c2_shift_h = s->shift_h[(component + 2) % s->ncomp]; \
1259 const int d0_linesize = out->linesize[ plane + 0 ] / 2; \
1260 const int d1_linesize = out->linesize[(plane + 1) % s->ncomp] / 2; \
1261 const int d2_linesize = out->linesize[(plane + 2) % s->ncomp] / 2; \
1262 const int limit = s->max - 1; \
1263 const int max = limit - intensity; \
1264 const int mid = s->max / 2; \
1265 const int src_h = in->height; \
1266 const int src_w = in->width; \
1267 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0; \
1268 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h; \
1269 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0; \
1270 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w; \
1274 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1); \
1275 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1); \
1276 const int d2_signed_linesize = d2_linesize * (mirror == 1 ? -1 : 1); \
1278 for (x = slicew_start; x < slicew_end; x++) { \
1279 const uint16_t *c0_data = (uint16_t *)in->data[plane + 0]; \
1280 const uint16_t *c1_data = (uint16_t *)in->data[(plane + 1) % s->ncomp]; \
1281 const uint16_t *c2_data = (uint16_t *)in->data[(plane + 2) % s->ncomp]; \
1282 uint16_t *d0_data = (uint16_t *)out->data[plane] + offset_y * d0_linesize + offset_x; \
1283 uint16_t *d1_data = (uint16_t *)out->data[(plane + 1) % s->ncomp] + offset_y * d1_linesize + offset_x; \
1284 uint16_t *d2_data = (uint16_t *)out->data[(plane + 2) % s->ncomp] + offset_y * d2_linesize + offset_x; \
1285 uint16_t * const d0_bottom_line = d0_data + d0_linesize * (s->size - 1); \
1286 uint16_t * const d0 = (mirror ? d0_bottom_line : d0_data); \
1287 uint16_t * const d1_bottom_line = d1_data + d1_linesize * (s->size - 1); \
1288 uint16_t * const d1 = (mirror ? d1_bottom_line : d1_data); \
1289 uint16_t * const d2_bottom_line = d2_data + d2_linesize * (s->size - 1); \
1290 uint16_t * const d2 = (mirror ? d2_bottom_line : d2_data); \
1292 for (y = 0; y < src_h; y++) { \
1293 const int c0 = FFMIN(c0_data[x >> c0_shift_w], limit) + mid; \
1294 const int c1 = FFMIN(c1_data[x >> c1_shift_w], limit) - mid; \
1295 const int c2 = FFMIN(c2_data[x >> c2_shift_w], limit) - mid; \
1298 target = d0 + x + d0_signed_linesize * c0; \
1299 update16(target, max, intensity, limit); \
1301 target = d1 + x + d1_signed_linesize * (c0 + c1); \
1302 update_cb(target, max, intensity, limit); \
1304 target = d2 + x + d2_signed_linesize * (c0 + c2); \
1305 update_cr(target, max, intensity, limit); \
1307 if (!c0_shift_h || (y & c0_shift_h)) \
1308 c0_data += c0_linesize; \
1309 if (!c1_shift_h || (y & c1_shift_h)) \
1310 c1_data += c1_linesize; \
1311 if (!c2_shift_h || (y & c2_shift_h)) \
1312 c2_data += c2_linesize; \
1313 d0_data += d0_linesize; \
1314 d1_data += d1_linesize; \
1315 d2_data += d2_linesize; \
1319 const uint16_t *c0_data = (uint16_t *)in->data[plane] + (sliceh_start >> c0_shift_h) * c0_linesize; \
1320 const uint16_t *c1_data = (uint16_t *)in->data[(plane + 1) % s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize; \
1321 const uint16_t *c2_data = (uint16_t *)in->data[(plane + 2) % s->ncomp] + (sliceh_start >> c2_shift_h) * c2_linesize; \
1322 uint16_t *d0_data = (uint16_t *)out->data[plane] + (offset_y + sliceh_start) * d0_linesize + offset_x; \
1323 uint16_t *d1_data = (uint16_t *)out->data[(plane + 1) % s->ncomp] + (offset_y + sliceh_start) * d1_linesize + offset_x; \
1324 uint16_t *d2_data = (uint16_t *)out->data[(plane + 2) % s->ncomp] + (offset_y + sliceh_start) * d2_linesize + offset_x; \
1327 d0_data += s->size - 1; \
1328 d1_data += s->size - 1; \
1329 d2_data += s->size - 1; \
1332 for (y = sliceh_start; y < sliceh_end; y++) { \
1333 for (x = 0; x < src_w; x++) { \
1334 const int c0 = FFMIN(c0_data[x >> c0_shift_w], limit) + mid; \
1335 const int c1 = FFMIN(c1_data[x >> c1_shift_w], limit) - mid; \
1336 const int c2 = FFMIN(c2_data[x >> c2_shift_w], limit) - mid; \
1340 target = d0_data - c0; \
1341 update16(target, max, intensity, limit); \
1342 target = d1_data - (c0 + c1); \
1343 update_cb(target, max, intensity, limit); \
1344 target = d2_data - (c0 + c2); \
1345 update_cr(target, max, intensity, limit); \
1347 target = d0_data + c0; \
1348 update16(target, max, intensity, limit); \
1349 target = d1_data + (c0 + c1); \
1350 update_cb(target, max, intensity, limit); \
1351 target = d2_data + (c0 + c2); \
1352 update_cr(target, max, intensity, limit); \
1356 if (!c0_shift_h || (y & c0_shift_h)) \
1357 c0_data += c0_linesize; \
1358 if (!c1_shift_h || (y & c1_shift_h)) \
1359 c1_data += c1_linesize; \
1360 if (!c2_shift_h || (y & c2_shift_h)) \
1361 c2_data += c2_linesize; \
1362 d0_data += d0_linesize; \
1363 d1_data += d1_linesize; \
1364 d2_data += d2_linesize; \
1370 #define AFLAT(name, update_cb, update_cr, column, mirror) \
1371 static int name(AVFilterContext *ctx, \
1372 void *arg, int jobnr, \
1375 WaveformContext *s = ctx->priv; \
1376 ThreadData *td = arg; \
1377 AVFrame *in = td->in; \
1378 AVFrame *out = td->out; \
1379 int component = td->component; \
1380 int offset_y = td->offset_y; \
1381 int offset_x = td->offset_x; \
1382 const int src_h = in->height; \
1383 const int src_w = in->width; \
1384 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0; \
1385 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h; \
1386 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0; \
1387 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w; \
1388 const int intensity = s->intensity; \
1389 const int plane = s->desc->comp[component].plane; \
1390 const int c0_linesize = in->linesize[ plane + 0 ]; \
1391 const int c1_linesize = in->linesize[(plane + 1) % s->ncomp]; \
1392 const int c2_linesize = in->linesize[(plane + 2) % s->ncomp]; \
1393 const int c0_shift_w = s->shift_w[ component + 0 ]; \
1394 const int c1_shift_w = s->shift_w[(component + 1) % s->ncomp]; \
1395 const int c2_shift_w = s->shift_w[(component + 2) % s->ncomp]; \
1396 const int c0_shift_h = s->shift_h[ component + 0 ]; \
1397 const int c1_shift_h = s->shift_h[(component + 1) % s->ncomp]; \
1398 const int c2_shift_h = s->shift_h[(component + 2) % s->ncomp]; \
1399 const int d0_linesize = out->linesize[ plane + 0 ]; \
1400 const int d1_linesize = out->linesize[(plane + 1) % s->ncomp]; \
1401 const int d2_linesize = out->linesize[(plane + 2) % s->ncomp]; \
1402 const int max = 255 - intensity; \
1406 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1); \
1407 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1); \
1408 const int d2_signed_linesize = d2_linesize * (mirror == 1 ? -1 : 1); \
1410 for (x = slicew_start; x < slicew_end; x++) { \
1411 const uint8_t *c0_data = in->data[plane + 0]; \
1412 const uint8_t *c1_data = in->data[(plane + 1) % s->ncomp]; \
1413 const uint8_t *c2_data = in->data[(plane + 2) % s->ncomp]; \
1414 uint8_t *d0_data = out->data[plane] + offset_y * d0_linesize + offset_x; \
1415 uint8_t *d1_data = out->data[(plane + 1) % s->ncomp] + offset_y * d1_linesize + offset_x; \
1416 uint8_t *d2_data = out->data[(plane + 2) % s->ncomp] + offset_y * d2_linesize + offset_x; \
1417 uint8_t * const d0_bottom_line = d0_data + d0_linesize * (s->size - 1); \
1418 uint8_t * const d0 = (mirror ? d0_bottom_line : d0_data); \
1419 uint8_t * const d1_bottom_line = d1_data + d1_linesize * (s->size - 1); \
1420 uint8_t * const d1 = (mirror ? d1_bottom_line : d1_data); \
1421 uint8_t * const d2_bottom_line = d2_data + d2_linesize * (s->size - 1); \
1422 uint8_t * const d2 = (mirror ? d2_bottom_line : d2_data); \
1424 for (y = 0; y < src_h; y++) { \
1425 const int c0 = c0_data[x >> c0_shift_w] + 128; \
1426 const int c1 = c1_data[x >> c1_shift_w] - 128; \
1427 const int c2 = c2_data[x >> c2_shift_w] - 128; \
1430 target = d0 + x + d0_signed_linesize * c0; \
1431 update(target, max, intensity); \
1433 target = d1 + x + d1_signed_linesize * (c0 + c1); \
1434 update_cb(target, max, intensity); \
1436 target = d2 + x + d2_signed_linesize * (c0 + c2); \
1437 update_cr(target, max, intensity); \
1439 if (!c0_shift_h || (y & c0_shift_h)) \
1440 c0_data += c0_linesize; \
1441 if (!c1_shift_h || (y & c1_shift_h)) \
1442 c1_data += c1_linesize; \
1443 if (!c2_shift_h || (y & c2_shift_h)) \
1444 c2_data += c2_linesize; \
1445 d0_data += d0_linesize; \
1446 d1_data += d1_linesize; \
1447 d2_data += d2_linesize; \
1451 const uint8_t *c0_data = in->data[plane] + (sliceh_start >> c0_shift_h) * c0_linesize; \
1452 const uint8_t *c1_data = in->data[(plane + 1) % s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize; \
1453 const uint8_t *c2_data = in->data[(plane + 2) % s->ncomp] + (sliceh_start >> c2_shift_h) * c2_linesize; \
1454 uint8_t *d0_data = out->data[plane] + (offset_y + sliceh_start) * d0_linesize + offset_x; \
1455 uint8_t *d1_data = out->data[(plane + 1) % s->ncomp] + (offset_y + sliceh_start) * d1_linesize + offset_x; \
1456 uint8_t *d2_data = out->data[(plane + 2) % s->ncomp] + (offset_y + sliceh_start) * d2_linesize + offset_x; \
1459 d0_data += s->size - 1; \
1460 d1_data += s->size - 1; \
1461 d2_data += s->size - 1; \
1464 for (y = sliceh_start; y < sliceh_end; y++) { \
1465 for (x = 0; x < src_w; x++) { \
1466 const int c0 = c0_data[x >> c0_shift_w] + 128; \
1467 const int c1 = c1_data[x >> c1_shift_w] - 128; \
1468 const int c2 = c2_data[x >> c2_shift_w] - 128; \
1472 target = d0_data - c0; \
1473 update(target, max, intensity); \
1474 target = d1_data - (c0 + c1); \
1475 update_cb(target, max, intensity); \
1476 target = d2_data - (c0 + c2); \
1477 update_cr(target, max, intensity); \
1479 target = d0_data + c0; \
1480 update(target, max, intensity); \
1481 target = d1_data + (c0 + c1); \
1482 update_cb(target, max, intensity); \
1483 target = d2_data + (c0 + c2); \
1484 update_cr(target, max, intensity); \
1488 if (!c0_shift_h || (y & c0_shift_h)) \
1489 c0_data += c0_linesize; \
1490 if (!c1_shift_h || (y & c1_shift_h)) \
1491 c1_data += c1_linesize; \
1492 if (!c2_shift_h || (y & c2_shift_h)) \
1493 c2_data += c2_linesize; \
1494 d0_data += d0_linesize; \
1495 d1_data += d1_linesize; \
1496 d2_data += d2_linesize; \
1531 int offset_y,
int offset_x,
1533 int jobnr,
int nb_jobs)
1535 const int plane =
s->desc->comp[component].plane;
1536 const int c0_linesize = in->linesize[(plane + 1) %
s->ncomp] / 2;
1537 const int c1_linesize = in->linesize[(plane + 2) %
s->ncomp] / 2;
1538 const int dst_linesize =
out->linesize[plane] / 2;
1539 const int limit =
s->max - 1;
1541 const int mid =
s->max / 2;
1542 const int c0_shift_w =
s->shift_w[(component + 1) %
s->ncomp];
1543 const int c1_shift_w =
s->shift_w[(component + 2) %
s->ncomp];
1544 const int c0_shift_h =
s->shift_h[(component + 1) %
s->ncomp];
1545 const int c1_shift_h =
s->shift_h[(component + 2) %
s->ncomp];
1546 const int src_h = in->height;
1547 const int src_w = in->width;
1548 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
1549 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
1550 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
1551 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
1555 const int dst_signed_linesize = dst_linesize * (
mirror == 1 ? -1 : 1);
1557 for (x = slicew_start; x < slicew_end; x++) {
1558 const uint16_t *c0_data = (uint16_t *)in->data[(plane + 1) %
s->ncomp];
1559 const uint16_t *c1_data = (uint16_t *)in->data[(plane + 2) %
s->ncomp];
1560 uint16_t *dst_data = (uint16_t *)
out->data[plane] + offset_y * dst_linesize + offset_x;
1561 uint16_t *
const dst_bottom_line = dst_data + dst_linesize * (
s->size - 1);
1562 uint16_t *
const dst_line = (
mirror ? dst_bottom_line : dst_data);
1563 uint16_t *dst = dst_line;
1565 for (y = 0; y < src_h; y++) {
1566 const int sum =
FFMIN(
FFABS(c0_data[x >> c0_shift_w] - mid) +
FFABS(c1_data[x >> c1_shift_w] - mid - 1),
limit);
1569 target = dst + x + dst_signed_linesize * sum;
1572 if (!c0_shift_h || (y & c0_shift_h))
1573 c0_data += c0_linesize;
1574 if (!c1_shift_h || (y & c1_shift_h))
1575 c1_data += c1_linesize;
1576 dst_data += dst_linesize;
1580 const uint16_t *c0_data = (uint16_t *)in->data[(plane + 1) %
s->ncomp] + (sliceh_start >> c0_shift_h) * c0_linesize;
1581 const uint16_t *c1_data = (uint16_t *)in->data[(plane + 2) %
s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize;
1582 uint16_t *dst_data = (uint16_t *)
out->data[plane] + (offset_y + sliceh_start) * dst_linesize + offset_x;
1585 dst_data +=
s->size - 1;
1586 for (y = sliceh_start; y < sliceh_end; y++) {
1587 for (x = 0; x < src_w; x++) {
1588 const int sum =
FFMIN(
FFABS(c0_data[x >> c0_shift_w] - mid) +
FFABS(c1_data[x >> c1_shift_w] - mid - 1),
limit);
1592 target = dst_data - sum;
1595 target = dst_data + sum;
1600 if (!c0_shift_h || (y & c0_shift_h))
1601 c0_data += c0_linesize;
1602 if (!c1_shift_h || (y & c1_shift_h))
1603 c1_data += c1_linesize;
1604 dst_data += dst_linesize;
1609 #define CHROMA16_FUNC(name, column, mirror) \
1610 static int chroma16_##name(AVFilterContext *ctx, \
1611 void *arg, int jobnr, \
1614 WaveformContext *s = ctx->priv; \
1615 ThreadData *td = arg; \
1616 AVFrame *in = td->in; \
1617 AVFrame *out = td->out; \
1618 int component = td->component; \
1619 int offset_y = td->offset_y; \
1620 int offset_x = td->offset_x; \
1622 chroma16(s, in, out, component, s->intensity,\
1623 offset_y, offset_x, column, mirror, \
1637 int offset_y,
int offset_x,
1639 int jobnr,
int nb_jobs)
1641 const int plane =
s->desc->comp[component].plane;
1642 const int src_h = in->height;
1643 const int src_w = in->width;
1644 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
1645 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
1646 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
1647 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
1648 const int c0_linesize = in->linesize[(plane + 1) %
s->ncomp];
1649 const int c1_linesize = in->linesize[(plane + 2) %
s->ncomp];
1650 const int dst_linesize =
out->linesize[plane];
1652 const int c0_shift_w =
s->shift_w[(component + 1) %
s->ncomp];
1653 const int c1_shift_w =
s->shift_w[(component + 2) %
s->ncomp];
1654 const int c0_shift_h =
s->shift_h[(component + 1) %
s->ncomp];
1655 const int c1_shift_h =
s->shift_h[(component + 2) %
s->ncomp];
1659 const int dst_signed_linesize = dst_linesize * (
mirror == 1 ? -1 : 1);
1661 for (x = slicew_start; x < slicew_end; x++) {
1662 const uint8_t *c0_data = in->data[(plane + 1) %
s->ncomp];
1663 const uint8_t *c1_data = in->data[(plane + 2) %
s->ncomp];
1664 uint8_t *dst_data =
out->data[plane] + offset_y * dst_linesize + offset_x;
1665 uint8_t *
const dst_bottom_line = dst_data + dst_linesize * (
s->size - 1);
1666 uint8_t *
const dst_line = (
mirror ? dst_bottom_line : dst_data);
1667 uint8_t *dst = dst_line;
1669 for (y = 0; y < src_h; y++) {
1670 const int sum =
FFABS(c0_data[x >> c0_shift_w] - 128) +
FFABS(c1_data[x >> c1_shift_w] - 127);
1673 target = dst + x + dst_signed_linesize * sum;
1676 if (!c0_shift_h || (y & c0_shift_h))
1677 c0_data += c0_linesize;
1678 if (!c1_shift_h || (y & c1_shift_h))
1679 c1_data += c1_linesize;
1680 dst_data += dst_linesize;
1684 const uint8_t *c0_data = in->data[(plane + 1) %
s->ncomp] + (sliceh_start >> c0_shift_h) * c0_linesize;
1685 const uint8_t *c1_data = in->data[(plane + 2) %
s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize;
1686 uint8_t *dst_data =
out->data[plane] + (offset_y + sliceh_start) * dst_linesize + offset_x;
1689 dst_data +=
s->size - 1;
1690 for (y = sliceh_start; y < sliceh_end; y++) {
1691 for (x = 0; x < src_w; x++) {
1692 const int sum =
FFABS(c0_data[x >> c0_shift_w] - 128) +
FFABS(c1_data[x >> c1_shift_w] - 127);
1696 target = dst_data - sum;
1699 target = dst_data + sum;
1704 if (!c0_shift_h || (y & c0_shift_h))
1705 c0_data += c0_linesize;
1706 if (!c1_shift_h || (y & c1_shift_h))
1707 c1_data += c1_linesize;
1708 dst_data += dst_linesize;
1713 #define CHROMA_FUNC(name, column, mirror) \
1714 static int chroma_##name(AVFilterContext *ctx, \
1715 void *arg, int jobnr, \
1718 WaveformContext *s = ctx->priv; \
1719 ThreadData *td = arg; \
1720 AVFrame *in = td->in; \
1721 AVFrame *out = td->out; \
1722 int component = td->component; \
1723 int offset_y = td->offset_y; \
1724 int offset_x = td->offset_x; \
1726 chroma(s, in, out, component, s->intensity, \
1727 offset_y, offset_x, column, mirror, \
1741 int offset_y,
int offset_x,
1743 int jobnr,
int nb_jobs)
1745 const int plane =
s->desc->comp[component].plane;
1746 const int limit =
s->max - 1;
1747 const int src_h = in->height;
1748 const int src_w = in->width;
1749 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
1750 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
1751 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
1752 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
1753 const int c0_linesize = in->linesize[ plane + 0 ] / 2;
1754 const int c1_linesize = in->linesize[(plane + 1) %
s->ncomp] / 2;
1755 const int c2_linesize = in->linesize[(plane + 2) %
s->ncomp] / 2;
1756 const int c0_shift_h =
s->shift_h[ component + 0 ];
1757 const int c1_shift_h =
s->shift_h[(component + 1) %
s->ncomp];
1758 const int c2_shift_h =
s->shift_h[(component + 2) %
s->ncomp];
1759 const uint16_t *c0_data = (
const uint16_t *)in->data[plane + 0] + (sliceh_start >> c0_shift_h) * c0_linesize;
1760 const uint16_t *c1_data = (
const uint16_t *)in->data[(plane + 1) %
s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize;
1761 const uint16_t *c2_data = (
const uint16_t *)in->data[(plane + 2) %
s->ncomp] + (sliceh_start >> c2_shift_h) * c2_linesize;
1762 const int d0_linesize =
out->linesize[ plane + 0 ] / 2;
1763 const int d1_linesize =
out->linesize[(plane + 1) %
s->ncomp] / 2;
1764 const int d2_linesize =
out->linesize[(plane + 2) %
s->ncomp] / 2;
1765 const int c0_shift_w =
s->shift_w[ component + 0 ];
1766 const int c1_shift_w =
s->shift_w[(component + 1) %
s->ncomp];
1767 const int c2_shift_w =
s->shift_w[(component + 2) %
s->ncomp];
1771 const int d0_signed_linesize = d0_linesize * (
mirror == 1 ? -1 : 1);
1772 const int d1_signed_linesize = d1_linesize * (
mirror == 1 ? -1 : 1);
1773 const int d2_signed_linesize = d2_linesize * (
mirror == 1 ? -1 : 1);
1774 uint16_t *d0_data = (uint16_t *)
out->data[plane] + offset_y * d0_linesize + offset_x;
1775 uint16_t *d1_data = (uint16_t *)
out->data[(plane + 1) %
s->ncomp] + offset_y * d1_linesize + offset_x;
1776 uint16_t *d2_data = (uint16_t *)
out->data[(plane + 2) %
s->ncomp] + offset_y * d2_linesize + offset_x;
1777 uint16_t *
const d0_bottom_line = d0_data + d0_linesize * (
s->size - 1);
1778 uint16_t *
const d0 = (
mirror ? d0_bottom_line : d0_data);
1779 uint16_t *
const d1_bottom_line = d1_data + d1_linesize * (
s->size - 1);
1780 uint16_t *
const d1 = (
mirror ? d1_bottom_line : d1_data);
1781 uint16_t *
const d2_bottom_line = d2_data + d2_linesize * (
s->size - 1);
1782 uint16_t *
const d2 = (
mirror ? d2_bottom_line : d2_data);
1784 for (y = 0; y < src_h; y++) {
1785 for (x = slicew_start; x < slicew_end; x++) {
1786 const int c0 =
FFMIN(c0_data[x >> c0_shift_w],
limit);
1787 const int c1 = c1_data[x >> c1_shift_w];
1788 const int c2 = c2_data[x >> c2_shift_w];
1790 *(d0 + d0_signed_linesize * c0 + x) = c0;
1791 *(d1 + d1_signed_linesize * c0 + x) =
c1;
1792 *(d2 + d2_signed_linesize * c0 + x) =
c2;
1795 if (!c0_shift_h || (y & c0_shift_h))
1796 c0_data += c0_linesize;
1797 if (!c1_shift_h || (y & c1_shift_h))
1798 c1_data += c1_linesize;
1799 if (!c2_shift_h || (y & c2_shift_h))
1800 c2_data += c2_linesize;
1801 d0_data += d0_linesize;
1802 d1_data += d1_linesize;
1803 d2_data += d2_linesize;
1806 uint16_t *d0_data = (uint16_t *)
out->data[plane] + (offset_y + sliceh_start) * d0_linesize + offset_x;
1807 uint16_t *d1_data = (uint16_t *)
out->data[(plane + 1) %
s->ncomp] + (offset_y + sliceh_start) * d1_linesize + offset_x;
1808 uint16_t *d2_data = (uint16_t *)
out->data[(plane + 2) %
s->ncomp] + (offset_y + sliceh_start) * d2_linesize + offset_x;
1811 d0_data +=
s->size - 1;
1812 d1_data +=
s->size - 1;
1813 d2_data +=
s->size - 1;
1816 for (y = sliceh_start; y < sliceh_end; y++) {
1817 for (x = 0; x < src_w; x++) {
1818 const int c0 =
FFMIN(c0_data[x >> c0_shift_w],
limit);
1819 const int c1 = c1_data[x >> c1_shift_w];
1820 const int c2 = c2_data[x >> c2_shift_w];
1823 *(d0_data - c0) = c0;
1824 *(d1_data - c0) =
c1;
1825 *(d2_data - c0) =
c2;
1827 *(d0_data + c0) = c0;
1828 *(d1_data + c0) =
c1;
1829 *(d2_data + c0) =
c2;
1833 if (!c0_shift_h || (y & c0_shift_h))
1834 c0_data += c0_linesize;
1835 if (!c1_shift_h || (y & c1_shift_h))
1836 c1_data += c1_linesize;
1837 if (!c2_shift_h || (y & c2_shift_h))
1838 c2_data += c2_linesize;
1839 d0_data += d0_linesize;
1840 d1_data += d1_linesize;
1841 d2_data += d2_linesize;
1846 #define COLOR16_FUNC(name, column, mirror) \
1847 static int color16_##name(AVFilterContext *ctx, \
1848 void *arg, int jobnr, \
1851 WaveformContext *s = ctx->priv; \
1852 ThreadData *td = arg; \
1853 AVFrame *in = td->in; \
1854 AVFrame *out = td->out; \
1855 int component = td->component; \
1856 int offset_y = td->offset_y; \
1857 int offset_x = td->offset_x; \
1859 color16(s, in, out, component, s->intensity, \
1860 offset_y, offset_x, column, mirror, \
1874 int offset_y,
int offset_x,
1876 int jobnr,
int nb_jobs)
1878 const int plane =
s->desc->comp[component].plane;
1879 const int src_h = in->height;
1880 const int src_w = in->width;
1881 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
1882 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
1883 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
1884 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
1885 const int c0_linesize = in->linesize[ plane + 0 ];
1886 const int c1_linesize = in->linesize[(plane + 1) %
s->ncomp];
1887 const int c2_linesize = in->linesize[(plane + 2) %
s->ncomp];
1888 const int c0_shift_h =
s->shift_h[ component + 0 ];
1889 const int c1_shift_h =
s->shift_h[(component + 1) %
s->ncomp];
1890 const int c2_shift_h =
s->shift_h[(component + 2) %
s->ncomp];
1891 const uint8_t *c0_data = in->data[plane] + (sliceh_start >> c0_shift_h) * c0_linesize;
1892 const uint8_t *c1_data = in->data[(plane + 1) %
s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize;
1893 const uint8_t *c2_data = in->data[(plane + 2) %
s->ncomp] + (sliceh_start >> c2_shift_h) * c2_linesize;
1894 const int d0_linesize =
out->linesize[ plane + 0 ];
1895 const int d1_linesize =
out->linesize[(plane + 1) %
s->ncomp];
1896 const int d2_linesize =
out->linesize[(plane + 2) %
s->ncomp];
1897 const int c0_shift_w =
s->shift_w[ component + 0 ];
1898 const int c1_shift_w =
s->shift_w[(component + 1) %
s->ncomp];
1899 const int c2_shift_w =
s->shift_w[(component + 2) %
s->ncomp];
1903 const int d0_signed_linesize = d0_linesize * (
mirror == 1 ? -1 : 1);
1904 const int d1_signed_linesize = d1_linesize * (
mirror == 1 ? -1 : 1);
1905 const int d2_signed_linesize = d2_linesize * (
mirror == 1 ? -1 : 1);
1906 uint8_t *d0_data =
out->data[plane] + offset_y * d0_linesize + offset_x;
1907 uint8_t *d1_data =
out->data[(plane + 1) %
s->ncomp] + offset_y * d1_linesize + offset_x;
1908 uint8_t *d2_data =
out->data[(plane + 2) %
s->ncomp] + offset_y * d2_linesize + offset_x;
1909 uint8_t *
const d0_bottom_line = d0_data + d0_linesize * (
s->size - 1);
1910 uint8_t *
const d0 = (
mirror ? d0_bottom_line : d0_data);
1911 uint8_t *
const d1_bottom_line = d1_data + d1_linesize * (
s->size - 1);
1912 uint8_t *
const d1 = (
mirror ? d1_bottom_line : d1_data);
1913 uint8_t *
const d2_bottom_line = d2_data + d2_linesize * (
s->size - 1);
1914 uint8_t *
const d2 = (
mirror ? d2_bottom_line : d2_data);
1916 for (y = 0; y < src_h; y++) {
1917 for (x = slicew_start; x < slicew_end; x++) {
1918 const int c0 = c0_data[x >> c0_shift_w];
1919 const int c1 = c1_data[x >> c1_shift_w];
1920 const int c2 = c2_data[x >> c2_shift_w];
1922 *(d0 + d0_signed_linesize * c0 + x) = c0;
1923 *(d1 + d1_signed_linesize * c0 + x) =
c1;
1924 *(d2 + d2_signed_linesize * c0 + x) =
c2;
1927 if (!c0_shift_h || (y & c0_shift_h))
1928 c0_data += c0_linesize;
1929 if (!c1_shift_h || (y & c1_shift_h))
1930 c1_data += c1_linesize;
1931 if (!c2_shift_h || (y & c2_shift_h))
1932 c2_data += c2_linesize;
1933 d0_data += d0_linesize;
1934 d1_data += d1_linesize;
1935 d2_data += d2_linesize;
1938 uint8_t *d0_data =
out->data[plane] + (offset_y + sliceh_start) * d0_linesize + offset_x;
1939 uint8_t *d1_data =
out->data[(plane + 1) %
s->ncomp] + (offset_y + sliceh_start) * d1_linesize + offset_x;
1940 uint8_t *d2_data =
out->data[(plane + 2) %
s->ncomp] + (offset_y + sliceh_start) * d2_linesize + offset_x;
1943 d0_data +=
s->size - 1;
1944 d1_data +=
s->size - 1;
1945 d2_data +=
s->size - 1;
1948 for (y = sliceh_start; y < sliceh_end; y++) {
1949 for (x = 0; x < src_w; x++) {
1950 const int c0 = c0_data[x >> c0_shift_w];
1951 const int c1 = c1_data[x >> c1_shift_w];
1952 const int c2 = c2_data[x >> c2_shift_w];
1955 *(d0_data - c0) = c0;
1956 *(d1_data - c0) =
c1;
1957 *(d2_data - c0) =
c2;
1959 *(d0_data + c0) = c0;
1960 *(d1_data + c0) =
c1;
1961 *(d2_data + c0) =
c2;
1965 if (!c0_shift_h || (y & c0_shift_h))
1966 c0_data += c0_linesize;
1967 if (!c1_shift_h || (y & c1_shift_h))
1968 c1_data += c1_linesize;
1969 if (!c2_shift_h || (y & c2_shift_h))
1970 c2_data += c2_linesize;
1971 d0_data += d0_linesize;
1972 d1_data += d1_linesize;
1973 d2_data += d2_linesize;
1978 #define COLOR_FUNC(name, column, mirror) \
1979 static int color_##name(AVFilterContext *ctx, \
1980 void *arg, int jobnr, \
1983 WaveformContext *s = ctx->priv; \
1984 ThreadData *td = arg; \
1985 AVFrame *in = td->in; \
1986 AVFrame *out = td->out; \
1987 int component = td->component; \
1988 int offset_y = td->offset_y; \
1989 int offset_x = td->offset_x; \
1991 color(s, in, out, component, s->intensity, \
1992 offset_y, offset_x, column, mirror, \
2006 int offset_y,
int offset_x,
2008 int jobnr,
int nb_jobs)
2010 const int plane =
s->desc->comp[component].plane;
2011 const int limit =
s->max - 1;
2013 const int src_h = in->height;
2014 const int src_w = in->width;
2015 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
2016 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
2017 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
2018 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
2019 const int c0_shift_h =
s->shift_h[ component + 0 ];
2020 const int c1_shift_h =
s->shift_h[(component + 1) %
s->ncomp];
2021 const int c2_shift_h =
s->shift_h[(component + 2) %
s->ncomp];
2022 const int c0_linesize = in->linesize[ plane + 0 ] / 2;
2023 const int c1_linesize = in->linesize[(plane + 1) %
s->ncomp] / 2;
2024 const int c2_linesize = in->linesize[(plane + 2) %
s->ncomp] / 2;
2025 const uint16_t *c0_data = (
const uint16_t *)in->data[plane + 0] + (sliceh_start >> c0_shift_h) * c0_linesize;
2026 const uint16_t *c1_data = (
const uint16_t *)in->data[(plane + 1) %
s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize;
2027 const uint16_t *c2_data = (
const uint16_t *)in->data[(plane + 2) %
s->ncomp] + (sliceh_start >> c2_shift_h) * c2_linesize;
2028 const int d0_linesize =
out->linesize[ plane + 0 ] / 2;
2029 const int d1_linesize =
out->linesize[(plane + 1) %
s->ncomp] / 2;
2030 const int d2_linesize =
out->linesize[(plane + 2) %
s->ncomp] / 2;
2031 const int c0_shift_w =
s->shift_w[ component + 0 ];
2032 const int c1_shift_w =
s->shift_w[(component + 1) %
s->ncomp];
2033 const int c2_shift_w =
s->shift_w[(component + 2) %
s->ncomp];
2037 const int d0_signed_linesize = d0_linesize * (
mirror == 1 ? -1 : 1);
2038 const int d1_signed_linesize = d1_linesize * (
mirror == 1 ? -1 : 1);
2039 const int d2_signed_linesize = d2_linesize * (
mirror == 1 ? -1 : 1);
2040 uint16_t *d0_data = (uint16_t *)
out->data[plane] + offset_y * d0_linesize + offset_x;
2041 uint16_t *d1_data = (uint16_t *)
out->data[(plane + 1) %
s->ncomp] + offset_y * d1_linesize + offset_x;
2042 uint16_t *d2_data = (uint16_t *)
out->data[(plane + 2) %
s->ncomp] + offset_y * d2_linesize + offset_x;
2043 uint16_t *
const d0_bottom_line = d0_data + d0_linesize * (
s->size - 1);
2044 uint16_t *
const d0 = (
mirror ? d0_bottom_line : d0_data);
2045 uint16_t *
const d1_bottom_line = d1_data + d1_linesize * (
s->size - 1);
2046 uint16_t *
const d1 = (
mirror ? d1_bottom_line : d1_data);
2047 uint16_t *
const d2_bottom_line = d2_data + d2_linesize * (
s->size - 1);
2048 uint16_t *
const d2 = (
mirror ? d2_bottom_line : d2_data);
2050 for (y = 0; y < src_h; y++) {
2051 for (x = slicew_start; x < slicew_end; x++) {
2052 const int c0 =
FFMIN(c0_data[x >> c0_shift_w],
limit);
2053 const int c1 = c1_data[x >> c1_shift_w];
2054 const int c2 = c2_data[x >> c2_shift_w];
2057 *(d1 + d1_signed_linesize * c0 + x) =
c1;
2058 *(d2 + d2_signed_linesize * c0 + x) =
c2;
2061 if (!c0_shift_h || (y & c0_shift_h))
2062 c0_data += c0_linesize;
2063 if (!c1_shift_h || (y & c1_shift_h))
2064 c1_data += c1_linesize;
2065 if (!c2_shift_h || (y & c2_shift_h))
2066 c2_data += c2_linesize;
2067 d0_data += d0_linesize;
2068 d1_data += d1_linesize;
2069 d2_data += d2_linesize;
2072 uint16_t *d0_data = (uint16_t *)
out->data[plane] + (offset_y + sliceh_start) * d0_linesize + offset_x;
2073 uint16_t *d1_data = (uint16_t *)
out->data[(plane + 1) %
s->ncomp] + (offset_y + sliceh_start) * d1_linesize + offset_x;
2074 uint16_t *d2_data = (uint16_t *)
out->data[(plane + 2) %
s->ncomp] + (offset_y + sliceh_start) * d2_linesize + offset_x;
2077 d0_data +=
s->size - 1;
2078 d1_data +=
s->size - 1;
2079 d2_data +=
s->size - 1;
2082 for (y = sliceh_start; y < sliceh_end; y++) {
2083 for (x = 0; x < src_w; x++) {
2084 const int c0 =
FFMIN(c0_data[x >> c0_shift_w],
limit);
2085 const int c1 = c1_data[x >> c1_shift_w];
2086 const int c2 = c2_data[x >> c2_shift_w];
2090 *(d1_data - c0) =
c1;
2091 *(d2_data - c0) =
c2;
2094 *(d1_data + c0) =
c1;
2095 *(d2_data + c0) =
c2;
2099 if (!c0_shift_h || (y & c0_shift_h))
2100 c0_data += c0_linesize;
2101 if (!c1_shift_h || (y & c1_shift_h))
2102 c1_data += c1_linesize;
2103 if (!c2_shift_h || (y & c2_shift_h))
2104 c2_data += c2_linesize;
2105 d0_data += d0_linesize;
2106 d1_data += d1_linesize;
2107 d2_data += d2_linesize;
2112 #define ACOLOR16_FUNC(name, column, mirror) \
2113 static int acolor16_##name(AVFilterContext *ctx, \
2114 void *arg, int jobnr, \
2117 WaveformContext *s = ctx->priv; \
2118 ThreadData *td = arg; \
2119 AVFrame *in = td->in; \
2120 AVFrame *out = td->out; \
2121 int component = td->component; \
2122 int offset_y = td->offset_y; \
2123 int offset_x = td->offset_x; \
2125 acolor16(s, in, out, component, s->intensity,\
2126 offset_y, offset_x, column, mirror, \
2140 int offset_y,
int offset_x,
2142 int jobnr,
int nb_jobs)
2144 const int plane =
s->desc->comp[component].plane;
2145 const int src_h = in->height;
2146 const int src_w = in->width;
2147 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
2148 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
2149 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
2150 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
2151 const int c0_shift_w =
s->shift_w[ component + 0 ];
2152 const int c1_shift_w =
s->shift_w[(component + 1) %
s->ncomp];
2153 const int c2_shift_w =
s->shift_w[(component + 2) %
s->ncomp];
2154 const int c0_shift_h =
s->shift_h[ component + 0 ];
2155 const int c1_shift_h =
s->shift_h[(component + 1) %
s->ncomp];
2156 const int c2_shift_h =
s->shift_h[(component + 2) %
s->ncomp];
2157 const int c0_linesize = in->linesize[ plane + 0 ];
2158 const int c1_linesize = in->linesize[(plane + 1) %
s->ncomp];
2159 const int c2_linesize = in->linesize[(plane + 2) %
s->ncomp];
2160 const uint8_t *c0_data = in->data[plane + 0] + (sliceh_start >> c0_shift_h) * c0_linesize;
2161 const uint8_t *c1_data = in->data[(plane + 1) %
s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize;
2162 const uint8_t *c2_data = in->data[(plane + 2) %
s->ncomp] + (sliceh_start >> c2_shift_h) * c2_linesize;
2163 const int d0_linesize =
out->linesize[ plane + 0 ];
2164 const int d1_linesize =
out->linesize[(plane + 1) %
s->ncomp];
2165 const int d2_linesize =
out->linesize[(plane + 2) %
s->ncomp];
2170 const int d0_signed_linesize = d0_linesize * (
mirror == 1 ? -1 : 1);
2171 const int d1_signed_linesize = d1_linesize * (
mirror == 1 ? -1 : 1);
2172 const int d2_signed_linesize = d2_linesize * (
mirror == 1 ? -1 : 1);
2173 uint8_t *d0_data =
out->data[plane] + offset_y * d0_linesize + offset_x;
2174 uint8_t *d1_data =
out->data[(plane + 1) %
s->ncomp] + offset_y * d1_linesize + offset_x;
2175 uint8_t *d2_data =
out->data[(plane + 2) %
s->ncomp] + offset_y * d2_linesize + offset_x;
2176 uint8_t *
const d0_bottom_line = d0_data + d0_linesize * (
s->size - 1);
2177 uint8_t *
const d0 = (
mirror ? d0_bottom_line : d0_data);
2178 uint8_t *
const d1_bottom_line = d1_data + d1_linesize * (
s->size - 1);
2179 uint8_t *
const d1 = (
mirror ? d1_bottom_line : d1_data);
2180 uint8_t *
const d2_bottom_line = d2_data + d2_linesize * (
s->size - 1);
2181 uint8_t *
const d2 = (
mirror ? d2_bottom_line : d2_data);
2183 for (y = 0; y < src_h; y++) {
2184 for (x = slicew_start; x < slicew_end; x++) {
2185 const int c0 = c0_data[x >> c0_shift_w];
2186 const int c1 = c1_data[x >> c1_shift_w];
2187 const int c2 = c2_data[x >> c2_shift_w];
2190 *(d1 + d1_signed_linesize * c0 + x) =
c1;
2191 *(d2 + d2_signed_linesize * c0 + x) =
c2;
2194 if (!c0_shift_h || (y & c0_shift_h))
2195 c0_data += c0_linesize;
2196 if (!c1_shift_h || (y & c1_shift_h))
2197 c1_data += c1_linesize;
2198 if (!c2_shift_h || (y & c2_shift_h))
2199 c2_data += c2_linesize;
2200 d0_data += d0_linesize;
2201 d1_data += d1_linesize;
2202 d2_data += d2_linesize;
2205 uint8_t *d0_data =
out->data[plane] + (offset_y + sliceh_start) * d0_linesize + offset_x;
2206 uint8_t *d1_data =
out->data[(plane + 1) %
s->ncomp] + (offset_y + sliceh_start) * d1_linesize + offset_x;
2207 uint8_t *d2_data =
out->data[(plane + 2) %
s->ncomp] + (offset_y + sliceh_start) * d2_linesize + offset_x;
2210 d0_data +=
s->size - 1;
2211 d1_data +=
s->size - 1;
2212 d2_data +=
s->size - 1;
2215 for (y = sliceh_start; y < sliceh_end; y++) {
2216 for (x = 0; x < src_w; x++) {
2217 const int c0 = c0_data[x >> c0_shift_w];
2218 const int c1 = c1_data[x >> c1_shift_w];
2219 const int c2 = c2_data[x >> c2_shift_w];
2223 *(d1_data - c0) =
c1;
2224 *(d2_data - c0) =
c2;
2227 *(d1_data + c0) =
c1;
2228 *(d2_data + c0) =
c2;
2232 if (!c0_shift_h || (y & c0_shift_h))
2233 c0_data += c0_linesize;
2234 if (!c1_shift_h || (y & c1_shift_h))
2235 c1_data += c1_linesize;
2236 if (!c2_shift_h || (y & c2_shift_h))
2237 c2_data += c2_linesize;
2238 d0_data += d0_linesize;
2239 d1_data += d1_linesize;
2240 d2_data += d2_linesize;
2245 #define ACOLOR_FUNC(name, column, mirror) \
2246 static int acolor_##name(AVFilterContext *ctx, \
2247 void *arg, int jobnr, \
2250 WaveformContext *s = ctx->priv; \
2251 ThreadData *td = arg; \
2252 AVFrame *in = td->in; \
2253 AVFrame *out = td->out; \
2254 int component = td->component; \
2255 int offset_y = td->offset_y; \
2256 int offset_x = td->offset_x; \
2258 acolor(s, in, out, component, s->intensity, \
2259 offset_y, offset_x, column, mirror, \
2274 { { {
"16", 16+128 }, {
"16", 16+128 }, {
"16", 16+128 }, {
"0", 0+128 } } },
2275 { { {
"128", 128+128 }, {
"128", 128+128 }, {
"128", 128+128 }, {
"128", 128+128 } } },
2276 { { {
"235", 235+128 }, {
"240", 240+128 }, {
"240", 240+128 }, {
"255", 255+128 } } },
2280 { { {
"32", 32+256 }, {
"32", 32+256 }, {
"32", 32+256 }, {
"0", 0+256 } } },
2281 { { {
"256", 256+256 }, {
"256", 256+256 }, {
"256", 256+256 }, {
"256", 256+256 } } },
2282 { { {
"470", 470+256 }, {
"480", 480+256 }, {
"480", 480+256 }, {
"511", 511+256 } } },
2286 { { {
"64", 64+512 }, {
"64", 64+512 }, {
"64", 64+512 }, {
"0", 0+512 } } },
2287 { { {
"512", 512+512 }, {
"512", 512+512 }, {
"512", 512+512 }, {
"512", 512+512 } } },
2288 { { {
"940", 940+512 }, {
"960", 960+512 }, {
"960", 960+512 }, {
"1023", 1023+512 } } },
2292 { { {
"256", 256+2048 }, {
"256", 256+2048 }, {
"256", 256+2048 }, {
"0", 0+2048 } } },
2293 { { {
"2048", 2048+2048 }, {
"2048", 2048+2048 }, {
"2048", 2048+2048 }, {
"2048", 2048+2048 } } },
2294 { { {
"3760", 3760+2048 }, {
"3840", 3840+2048 }, {
"3840", 3840+2048 }, {
"4095", 4095+2048 } } },
2298 { { {
"0", 16+128 }, {
"0", 16+128 }, {
"0", 16+128 }, {
"0", 0+128 } } },
2299 { { {
"175", 71+128 }, {
"175", 72+128 }, {
"175", 72+128 }, {
"175", 64+128 } } },
2300 { { {
"350", 126+128 }, {
"350", 128+128 }, {
"350", 128+128 }, {
"350", 128+128 } } },
2301 { { {
"525", 180+128 }, {
"525", 184+128 }, {
"525", 184+128 }, {
"525", 192+128 } } },
2302 { { {
"700", 235+128 }, {
"700", 240+128 }, {
"700", 240+128 }, {
"700", 255+128 } } },
2306 { { {
"0", 32+256 }, {
"0", 32+256 }, {
"0", 32+256 }, {
"0", 0+256 } } },
2307 { { {
"175", 142+256 }, {
"175", 144+256 }, {
"175", 144+256 }, {
"175", 128+256 } } },
2308 { { {
"350", 251+256 }, {
"350", 256+256 }, {
"350", 256+256 }, {
"350", 256+256 } } },
2309 { { {
"525", 361+256 }, {
"525", 368+256 }, {
"525", 368+256 }, {
"525", 384+256 } } },
2310 { { {
"700", 470+256 }, {
"700", 480+256 }, {
"700", 480+256 }, {
"700", 511+256 } } },
2314 { { {
"0", 64+512 }, {
"0", 64+512 }, {
"0", 64+512 }, {
"0", 0+512 } } },
2315 { { {
"175", 283+512 }, {
"175", 288+512 }, {
"175", 288+512 }, {
"175", 256+512 } } },
2316 { { {
"350", 502+512 }, {
"350", 512+512 }, {
"350", 512+512 }, {
"350", 512+512 } } },
2317 { { {
"525", 721+512 }, {
"525", 736+512 }, {
"525", 736+512 }, {
"525", 768+512 } } },
2318 { { {
"700", 940+512 }, {
"700", 960+512 }, {
"700", 960+512 }, {
"700", 1023+512 } } },
2322 { { {
"0", 256+2048 }, {
"0", 256+2048 }, {
"0", 256+2048 }, {
"0", 0+2048 } } },
2323 { { {
"175", 1132+2048 }, {
"175", 1152+2048 }, {
"175", 1152+2048 }, {
"175", 1024+2048 } } },
2324 { { {
"350", 2008+2048 }, {
"350", 2048+2048 }, {
"350", 2048+2048 }, {
"350", 2048+2048 } } },
2325 { { {
"525", 2884+2048 }, {
"525", 2944+2048 }, {
"525", 2944+2048 }, {
"525", 3072+2048 } } },
2326 { { {
"700", 3760+2048 }, {
"700", 3840+2048 }, {
"700", 3840+2048 }, {
"700", 4095+2048 } } },
2330 { { {
"-25", -39+128 }, {
"-25", -40+128 }, {
"-25", -40+128 }, {
"-25", -64+128 } } },
2331 { { {
"0", 16+128 }, {
"0", 16+128 }, {
"0", 16+128 }, {
"0", 0+128 } } },
2332 { { {
"25", 71+128 }, {
"25", 72+128 }, {
"25", 72+128 }, {
"25", 64+128 } } },
2333 { { {
"50", 126+128 }, {
"50", 128+128 }, {
"50", 128+128 }, {
"50", 128+128 } } },
2334 { { {
"75", 180+128 }, {
"75", 184+128 }, {
"75", 184+128 }, {
"75", 192+128 } } },
2335 { { {
"100", 235+128 }, {
"100", 240+128 }, {
"100", 240+128 }, {
"100", 256+128 } } },
2336 { { {
"125", 290+128 }, {
"125", 296+128 }, {
"125", 296+128 }, {
"125", 320+128 } } },
2340 { { {
"-25", -78+256 }, {
"-25", -80+256 }, {
"-25", -80+256 }, {
"-25",-128+256 } } },
2341 { { {
"0", 32+256 }, {
"0", 32+256 }, {
"0", 32+256 }, {
"0", 0+256 } } },
2342 { { {
"25", 142+256 }, {
"25", 144+256 }, {
"25", 144+256 }, {
"25", 128+256 } } },
2343 { { {
"50", 251+256 }, {
"50", 256+256 }, {
"50", 256+256 }, {
"50", 256+256 } } },
2344 { { {
"75", 361+256 }, {
"75", 368+256 }, {
"75", 368+256 }, {
"75", 384+256 } } },
2345 { { {
"100", 470+256 }, {
"100", 480+256 }, {
"100", 480+256 }, {
"100", 512+256 } } },
2346 { { {
"125", 580+256 }, {
"125", 592+256 }, {
"125", 592+256 }, {
"125", 640+256 } } },
2350 { { {
"-25",-156+512 }, {
"-25",-160+512 }, {
"-25",-160+512 }, {
"-25", -256+512 } } },
2351 { { {
"0", 64+512 }, {
"0", 64+512 }, {
"0", 64+512 }, {
"0", 0+512 } } },
2352 { { {
"25", 283+512 }, {
"25", 288+512 }, {
"25", 288+512 }, {
"25", 256+512 } } },
2353 { { {
"50", 502+512 }, {
"50", 512+512 }, {
"50", 512+512 }, {
"50", 512+512 } } },
2354 { { {
"75", 721+512 }, {
"75", 736+512 }, {
"75", 736+512 }, {
"75", 768+512 } } },
2355 { { {
"100", 940+512 }, {
"100", 960+512 }, {
"100", 960+512 }, {
"100", 1024+512 } } },
2356 { { {
"125",1160+512 }, {
"125",1184+512 }, {
"125",1184+512 }, {
"125", 1280+512 } } },
2360 { { {
"-25", -624+2048 }, {
"-25", -640+2048 }, {
"-25", -640+2048 }, {
"-25",-1024+2048 } } },
2361 { { {
"0", 256+2048 }, {
"0", 256+2048 }, {
"0", 256+2048 }, {
"0", 0+2048 } } },
2362 { { {
"25", 1132+2048 }, {
"25", 1152+2048 }, {
"25", 1152+2048 }, {
"25", 1024+2048 } } },
2363 { { {
"50", 2008+2048 }, {
"50", 2048+2048 }, {
"50", 2048+2048 }, {
"50", 2048+2048 } } },
2364 { { {
"75", 2884+2048 }, {
"75", 2944+2048 }, {
"75", 2944+2048 }, {
"75", 3072+2048 } } },
2365 { { {
"100", 3760+2048 }, {
"100", 3840+2048 }, {
"100", 3840+2048 }, {
"100", 4096+2048 } } },
2366 { { {
"125", 4640+2048 }, {
"125", 4736+2048 }, {
"125", 4736+2048 }, {
"125", 5120+2048 } } },
2370 { { {
"16", 16+256 }, {
"16", 16+256 }, {
"16", 16+256 }, {
"0", 0+256 } } },
2371 { { {
"128", 128+256 }, {
"128", 128+256 }, {
"128", 128+256 }, {
"128", 128+256 } } },
2372 { { {
"235", 235+256 }, {
"240", 240+256 }, {
"240", 240+256 }, {
"255", 255+256 } } },
2376 { { {
"32", 32+512 }, {
"32", 32+512 }, {
"32", 32+512 }, {
"0", 0+512 } } },
2377 { { {
"256", 256+512 }, {
"256", 256+512 }, {
"256", 256+512 }, {
"256", 256+512 } } },
2378 { { {
"470", 470+512 }, {
"480", 480+512 }, {
"480", 480+512 }, {
"511", 511+512 } } },
2382 { { {
"64", 64+1024 }, {
"64", 64+1024 }, {
"64", 64+1024 }, {
"0", 0+1024 } } },
2383 { { {
"512", 512+1024 }, {
"512", 512+1024 }, {
"512", 512+1024 }, {
"512", 512+1024 } } },
2384 { { {
"940", 940+1024 }, {
"960", 960+1024 }, {
"960", 960+1024 }, {
"1023", 1023+1024 } } },
2388 { { {
"256", 256+4096 }, {
"256", 256+4096 }, {
"256", 256+4096 }, {
"0", 0+4096 } } },
2389 { { {
"2048", 2048+4096 }, {
"2048", 2048+4096 }, {
"2048", 2048+4096 }, {
"2048", 2048+4096 } } },
2390 { { {
"3760", 3760+4096 }, {
"3840", 3840+4096 }, {
"3840", 3840+4096 }, {
"4095", 4095+4096 } } },
2394 { { {
"0", 16+256 }, {
"0", 16+256 }, {
"0", 16+256 }, {
"0", 0+256 } } },
2395 { { {
"175", 71+256 }, {
"175", 72+256 }, {
"175", 72+256 }, {
"175", 64+256 } } },
2396 { { {
"350", 126+256 }, {
"350", 128+256 }, {
"350", 128+256 }, {
"350", 128+256 } } },
2397 { { {
"525", 180+256 }, {
"525", 184+256 }, {
"525", 184+256 }, {
"525", 192+256 } } },
2398 { { {
"700", 235+256 }, {
"700", 240+256 }, {
"700", 240+256 }, {
"700", 255+256 } } },
2402 { { {
"0", 32+512 }, {
"0", 32+512 }, {
"0", 32+512 }, {
"0", 0+512 } } },
2403 { { {
"175", 142+512 }, {
"175", 144+512 }, {
"175", 144+512 }, {
"175", 128+512 } } },
2404 { { {
"350", 251+512 }, {
"350", 256+512 }, {
"350", 256+512 }, {
"350", 256+512 } } },
2405 { { {
"525", 361+512 }, {
"525", 368+512 }, {
"525", 368+512 }, {
"525", 384+512 } } },
2406 { { {
"700", 470+512 }, {
"700", 480+512 }, {
"700", 480+512 }, {
"700", 511+512 } } },
2410 { { {
"0", 64+1024 }, {
"0", 64+1024 }, {
"0", 64+1024 }, {
"0", 0+1024 } } },
2411 { { {
"175", 283+1024 }, {
"175", 288+1024 }, {
"175", 288+1024 }, {
"175", 256+1024 } } },
2412 { { {
"350", 502+1024 }, {
"350", 512+1024 }, {
"350", 512+1024 }, {
"350", 512+1024 } } },
2413 { { {
"525", 721+1024 }, {
"525", 736+1024 }, {
"525", 736+1024 }, {
"525", 768+1024 } } },
2414 { { {
"700", 940+1024 }, {
"700", 960+1024 }, {
"700", 960+1024 }, {
"700", 1023+1024 } } },
2418 { { {
"0", 256+4096 }, {
"0", 256+4096 }, {
"0", 256+4096 }, {
"0", 0+4096 } } },
2419 { { {
"175", 1132+4096 }, {
"175", 1152+4096 }, {
"175", 1152+4096 }, {
"175", 1024+4096 } } },
2420 { { {
"350", 2008+4096 }, {
"350", 2048+4096 }, {
"350", 2048+4096 }, {
"350", 2048+4096 } } },
2421 { { {
"525", 2884+4096 }, {
"525", 2944+4096 }, {
"525", 2944+4096 }, {
"525", 3072+4096 } } },
2422 { { {
"700", 3760+4096 }, {
"700", 3840+4096 }, {
"700", 3840+4096 }, {
"700", 4095+4096 } } },
2426 { { {
"-25", -39+256 }, {
"-25", -40+256 }, {
"-25", -40+256 }, {
"-25", -64+256 } } },
2427 { { {
"0", 16+256 }, {
"0", 16+256 }, {
"0", 16+256 }, {
"0", 0+256 } } },
2428 { { {
"25", 71+256 }, {
"25", 72+256 }, {
"25", 72+256 }, {
"25", 64+256 } } },
2429 { { {
"50", 126+256 }, {
"50", 128+256 }, {
"50", 128+256 }, {
"50", 128+256 } } },
2430 { { {
"75", 180+256 }, {
"75", 184+256 }, {
"75", 184+256 }, {
"75", 192+256 } } },
2431 { { {
"100", 235+256 }, {
"100", 240+256 }, {
"100", 240+256 }, {
"100", 256+256 } } },
2432 { { {
"125", 290+256 }, {
"125", 296+256 }, {
"125", 296+256 }, {
"125", 320+256 } } },
2436 { { {
"-25", -78+512 }, {
"-25", -80+512 }, {
"-25", -80+512 }, {
"-25",-128+512 } } },
2437 { { {
"0", 32+512 }, {
"0", 32+512 }, {
"0", 32+512 }, {
"0", 0+512 } } },
2438 { { {
"25", 142+512 }, {
"25", 144+512 }, {
"25", 144+512 }, {
"25", 128+512 } } },
2439 { { {
"50", 251+512 }, {
"50", 256+512 }, {
"50", 256+512 }, {
"50", 256+512 } } },
2440 { { {
"75", 361+512 }, {
"75", 368+512 }, {
"75", 368+512 }, {
"75", 384+512 } } },
2441 { { {
"100", 470+512 }, {
"100", 480+512 }, {
"100", 480+512 }, {
"100", 512+512 } } },
2442 { { {
"125", 580+512 }, {
"125", 592+512 }, {
"125", 592+512 }, {
"125", 640+512 } } },
2446 { { {
"-25",-156+1024 }, {
"-25",-160+1024 }, {
"-25",-160+1024 }, {
"-25", -256+1024 } } },
2447 { { {
"0", 64+1024 }, {
"0", 64+1024 }, {
"0", 64+1024 }, {
"0", 0+1024 } } },
2448 { { {
"25", 283+1024 }, {
"25", 288+1024 }, {
"25", 288+1024 }, {
"25", 256+1024 } } },
2449 { { {
"50", 502+1024 }, {
"50", 512+1024 }, {
"50", 512+1024 }, {
"50", 512+1024 } } },
2450 { { {
"75", 721+1024 }, {
"75", 736+1024 }, {
"75", 736+1024 }, {
"75", 768+1024 } } },
2451 { { {
"100", 940+1024 }, {
"100", 960+1024 }, {
"100", 960+1024 }, {
"100", 1024+1024 } } },
2452 { { {
"125",1160+1024 }, {
"125",1184+1024 }, {
"125",1184+1024 }, {
"125", 1280+1024 } } },
2456 { { {
"-25", -624+4096 }, {
"-25", -640+4096 }, {
"-25", -640+4096 }, {
"-25",-1024+4096 } } },
2457 { { {
"0", 256+4096 }, {
"0", 256+4096 }, {
"0", 256+4096 }, {
"0", 0+4096 } } },
2458 { { {
"25", 1132+4096 }, {
"25", 1152+4096 }, {
"25", 1152+4096 }, {
"25", 1024+4096 } } },
2459 { { {
"50", 2008+4096 }, {
"50", 2048+4096 }, {
"50", 2048+4096 }, {
"50", 2048+4096 } } },
2460 { { {
"75", 2884+4096 }, {
"75", 2944+4096 }, {
"75", 2944+4096 }, {
"75", 3072+4096 } } },
2461 { { {
"100", 3760+4096 }, {
"100", 3840+4096 }, {
"100", 3840+4096 }, {
"100", 4096+4096 } } },
2462 { { {
"125", 4640+4096 }, {
"125", 4736+4096 }, {
"125", 4736+4096 }, {
"125", 5120+4096 } } },
2466 { { {
"16", 16 }, {
"16", 16 }, {
"16", 16 }, {
"0", 0 } } },
2467 { { {
"128", 128 }, {
"128", 128 }, {
"128", 128 }, {
"128", 128 } } },
2468 { { {
"235", 235 }, {
"240", 240 }, {
"240", 240 }, {
"255", 255 } } },
2472 { { {
"32", 32 }, {
"32", 32 }, {
"32", 32 }, {
"0", 0 } } },
2473 { { {
"256", 256 }, {
"256", 256 }, {
"256", 256 }, {
"256", 256 } } },
2474 { { {
"470", 470 }, {
"480", 480 }, {
"480", 480 }, {
"511", 511 } } },
2478 { { {
"64", 64 }, {
"64", 64 }, {
"64", 64 }, {
"0", 0 } } },
2479 { { {
"512", 512 }, {
"512", 512 }, {
"512", 512 }, {
"512", 512 } } },
2480 { { {
"940", 940 }, {
"960", 960 }, {
"960", 960 }, {
"1023", 1023 } } },
2484 { { {
"256", 256 }, {
"256", 256 }, {
"256", 256 }, {
"0", 0 } } },
2485 { { {
"2048", 2048 }, {
"2048", 2048 }, {
"2048", 2048 }, {
"2048", 2048 } } },
2486 { { {
"3760", 3760 }, {
"3840", 3840 }, {
"3840", 3840 }, {
"4095", 4095 } } },
2490 { { {
"0", 16 }, {
"0", 16 }, {
"0", 16 }, {
"0", 0 } } },
2491 { { {
"175", 71 }, {
"175", 72 }, {
"175", 72 }, {
"175", 64 } } },
2492 { { {
"350", 126 }, {
"350", 128 }, {
"350", 128 }, {
"350", 128 } } },
2493 { { {
"525", 180 }, {
"525", 184 }, {
"525", 184 }, {
"525", 192 } } },
2494 { { {
"700", 235 }, {
"700", 240 }, {
"700", 240 }, {
"700", 255 } } },
2498 { { {
"0", 32 }, {
"0", 32 }, {
"0", 32 }, {
"0", 0 } } },
2499 { { {
"175", 142 }, {
"175", 144 }, {
"175", 144 }, {
"175", 128 } } },
2500 { { {
"350", 251 }, {
"350", 256 }, {
"350", 256 }, {
"350", 256 } } },
2501 { { {
"525", 361 }, {
"525", 368 }, {
"525", 368 }, {
"525", 384 } } },
2502 { { {
"700", 470 }, {
"700", 480 }, {
"700", 480 }, {
"700", 511 } } },
2506 { { {
"0", 64 }, {
"0", 64 }, {
"0", 64 }, {
"0", 0 } } },
2507 { { {
"175", 283 }, {
"175", 288 }, {
"175", 288 }, {
"175", 256 } } },
2508 { { {
"350", 502 }, {
"350", 512 }, {
"350", 512 }, {
"350", 512 } } },
2509 { { {
"525", 721 }, {
"525", 736 }, {
"525", 736 }, {
"525", 768 } } },
2510 { { {
"700", 940 }, {
"700", 960 }, {
"700", 960 }, {
"700", 1023 } } },
2514 { { {
"0", 256 }, {
"0", 256 }, {
"0", 256 }, {
"0", 0 } } },
2515 { { {
"175", 1132 }, {
"175", 1152 }, {
"175", 1152 }, {
"175", 1024 } } },
2516 { { {
"350", 2008 }, {
"350", 2048 }, {
"350", 2048 }, {
"350", 2048 } } },
2517 { { {
"525", 2884 }, {
"525", 2944 }, {
"525", 2944 }, {
"525", 3072 } } },
2518 { { {
"700", 3760 }, {
"700", 3840 }, {
"700", 3840 }, {
"700", 4095 } } },
2522 { { {
"0", 16 }, {
"0", 16 }, {
"0", 16 }, {
"0", 0 } } },
2523 { { {
"25", 71 }, {
"25", 72 }, {
"25", 72 }, {
"25", 64 } } },
2524 { { {
"50", 126 }, {
"50", 128 }, {
"50", 128 }, {
"50", 128 } } },
2525 { { {
"75", 180 }, {
"75", 184 }, {
"75", 184 }, {
"75", 192 } } },
2526 { { {
"100", 235 }, {
"100", 240 }, {
"100", 240 }, {
"100", 255 } } },
2530 { { {
"0", 32 }, {
"0", 32 }, {
"0", 32 }, {
"0", 0 } } },
2531 { { {
"25", 142 }, {
"25", 144 }, {
"25", 144 }, {
"25", 128 } } },
2532 { { {
"50", 251 }, {
"50", 256 }, {
"50", 256 }, {
"50", 256 } } },
2533 { { {
"75", 361 }, {
"75", 368 }, {
"75", 368 }, {
"75", 384 } } },
2534 { { {
"100", 470 }, {
"100", 480 }, {
"100", 480 }, {
"100", 511 } } },
2538 { { {
"0", 64 }, {
"0", 64 }, {
"0", 64 }, {
"0", 0 } } },
2539 { { {
"25", 283 }, {
"25", 288 }, {
"25", 288 }, {
"25", 256 } } },
2540 { { {
"50", 502 }, {
"50", 512 }, {
"50", 512 }, {
"50", 512 } } },
2541 { { {
"75", 721 }, {
"75", 736 }, {
"75", 736 }, {
"75", 768 } } },
2542 { { {
"100", 940 }, {
"100", 960 }, {
"100", 960 }, {
"100", 1023 } } },
2546 { { {
"0", 256 }, {
"0", 256 }, {
"0", 256 }, {
"0", 0 } } },
2547 { { {
"25", 1132 }, {
"25", 1152 }, {
"25", 1152 }, {
"25", 1024 } } },
2548 { { {
"50", 2008 }, {
"50", 2048 }, {
"50", 2048 }, {
"50", 2048 } } },
2549 { { {
"75", 2884 }, {
"75", 2944 }, {
"75", 2944 }, {
"75", 3072 } } },
2550 { { {
"100", 3760 }, {
"100", 3840 }, {
"100", 3840 }, {
"100", 4095 } } },
2554 { { {
"50", 50 }, {
"50", 50 }, {
"50", 50 }, {
"50", 50 } } },
2555 { { {
"100", 100 }, {
"100", 100 }, {
"100", 100 }, {
"100", 100 } } },
2556 { { {
"150", 150 }, {
"150", 150 }, {
"150", 150 }, {
"150", 150 } } },
2557 { { {
"200", 200 }, {
"200", 200 }, {
"200", 200 }, {
"200", 200 } } },
2558 { { {
"255", 255 }, {
"255", 255 }, {
"255", 255 }, {
"255", 255 } } },
2562 { { {
"100", 100 }, {
"100", 100 }, {
"100", 100 }, {
"100", 100 } } },
2563 { { {
"200", 200 }, {
"200", 200 }, {
"200", 200 }, {
"200", 200 } } },
2564 { { {
"300", 300 }, {
"300", 300 }, {
"300", 300 }, {
"300", 300 } } },
2565 { { {
"400", 400 }, {
"400", 400 }, {
"400", 400 }, {
"400", 400 } } },
2566 { { {
"500", 500 }, {
"500", 500 }, {
"500", 500 }, {
"500", 500 } } },
2570 { { {
"200", 200 }, {
"200", 200 }, {
"200", 200 }, {
"200", 200 } } },
2571 { { {
"400", 400 }, {
"400", 400 }, {
"400", 400 }, {
"400", 400 } } },
2572 { { {
"600", 600 }, {
"600", 600 }, {
"600", 600 }, {
"600", 600 } } },
2573 { { {
"800", 800 }, {
"800", 800 }, {
"800", 800 }, {
"800", 800 } } },
2574 { { {
"1000",1000 }, {
"1000",1000 }, {
"1000",1000 }, {
"1000",1000 } } },
2578 { { {
"800", 800 }, {
"800", 800 }, {
"800", 800 }, {
"800", 800 } } },
2579 { { {
"1600", 1600 }, {
"1600", 1600 }, {
"1600", 1600 }, {
"1600", 1600 } } },
2580 { { {
"2400", 2400 }, {
"2400", 2400 }, {
"2400", 2400 }, {
"2400", 2400 } } },
2581 { { {
"3200", 3200 }, {
"3200", 3200 }, {
"3200", 3200 }, {
"3200", 3200 } } },
2582 { { {
"4000", 4000 }, {
"4000", 4000 }, {
"4000", 4000 }, {
"4000", 4000 } } },
2590 dst[0] = v * o1 + dst[0] * o2;
2592 dst += linesize *
step;
2598 uint16_t *dst = (uint16_t *)ddst;
2602 dst[0] = v * o1 + dst[0] * o2;
2604 dst += (linesize / 2) *
step;
2613 dst[x] = v * o1 + dst[x] * o2;
2619 uint16_t *dst = (uint16_t *)ddst;
2623 dst[x] = v * o1 + dst[x] * o2;
2629 const uint8_t *font;
2635 for (plane = 0; plane < 4 &&
out->data[plane]; plane++) {
2636 for (
i = 0; txt[
i];
i++) {
2638 int v =
color[plane];
2640 uint8_t *p =
out->data[plane] + y *
out->linesize[plane] + (x +
i * 8);
2641 for (char_y = 0; char_y < font_height; char_y++) {
2643 if (font[txt[
i] * font_height + char_y] &
mask)
2644 p[0] = p[0] * o2 + v * o1;
2647 p +=
out->linesize[plane] - 8;
2655 const uint8_t *font;
2661 for (plane = 0; plane < 4 &&
out->data[plane]; plane++) {
2662 for (
i = 0; txt[
i];
i++) {
2666 uint16_t *p = (uint16_t *)(
out->data[plane] + y *
out->linesize[plane]) + (x +
i * 8);
2667 for (char_y = 0; char_y < font_height; char_y++) {
2669 if (font[txt[
i] * font_height + char_y] &
mask)
2670 p[0] = p[0] * o2 + v * o1;
2673 p +=
out->linesize[plane] / 2 - 8;
2681 const uint8_t *font;
2687 for (plane = 0; plane < 4 &&
out->data[plane]; plane++) {
2688 for (
i = 0; txt[
i];
i++) {
2690 int v =
color[plane];
2692 for (char_y = font_height - 1; char_y >= 0; char_y--) {
2693 uint8_t *p =
out->data[plane] + (y +
i * 10) *
out->linesize[plane] + x;
2695 if (font[txt[
i] * font_height + font_height - 1 - char_y] &
mask)
2696 p[char_y] = p[char_y] * o2 + v * o1;
2697 p +=
out->linesize[plane];
2706 const uint8_t *font;
2712 for (plane = 0; plane < 4 &&
out->data[plane]; plane++) {
2713 for (
i = 0; txt[
i];
i++) {
2717 for (char_y = 0; char_y < font_height; char_y++) {
2718 uint16_t *p = (uint16_t *)(
out->data[plane] + (y +
i * 10) *
out->linesize[plane]) + x;
2720 if (font[txt[
i] * font_height + font_height - 1 - char_y] &
mask)
2721 p[char_y] = p[char_y] * o2 + v * o1;
2722 p +=
out->linesize[plane] / 2;
2734 dst[0] = (v - dst[0]) * o1 + dst[0] * o2;
2736 dst += linesize *
step;
2742 uint16_t *dst = (uint16_t *)ddst;
2746 dst[0] = (v - dst[0]) * o1 + dst[0] * o2;
2748 dst += (linesize / 2) *
step;
2757 dst[x] = (v - dst[x]) * o1 + dst[x] * o2;
2763 uint16_t *dst = (uint16_t *)ddst;
2767 dst[x] = (v - dst[x]) * o1 + dst[x] * o2;
2773 const uint8_t *font;
2779 for (plane = 0; plane < 4 &&
out->data[plane]; plane++) {
2780 for (
i = 0; txt[
i];
i++) {
2782 int v =
color[plane];
2784 uint8_t *p =
out->data[plane] + y *
out->linesize[plane] + (x +
i * 8);
2785 for (char_y = 0; char_y < font_height; char_y++) {
2787 if (font[txt[
i] * font_height + char_y] &
mask)
2788 p[0] = p[0] * o2 + (v - p[0]) * o1;
2791 p +=
out->linesize[plane] - 8;
2799 const uint8_t *font;
2805 for (plane = 0; plane < 4 &&
out->data[plane]; plane++) {
2806 for (
i = 0; txt[
i];
i++) {
2810 uint16_t *p = (uint16_t *)(
out->data[plane] + y *
out->linesize[plane]) + (x +
i * 8);
2811 for (char_y = 0; char_y < font_height; char_y++) {
2813 if (font[txt[
i] * font_height + char_y] &
mask)
2814 p[0] = p[0] * o2 + (v - p[0]) * o1;
2817 p +=
out->linesize[plane] / 2 - 8;
2825 const uint8_t *font;
2831 for (plane = 0; plane < 4 &&
out->data[plane]; plane++) {
2832 for (
i = 0; txt[
i];
i++) {
2834 int v =
color[plane];
2836 for (char_y = font_height - 1; char_y >= 0; char_y--) {
2837 uint8_t *p =
out->data[plane] + (y +
i * 10) *
out->linesize[plane] + x;
2839 if (font[txt[
i] * font_height + font_height - 1 - char_y] &
mask)
2840 p[char_y] = p[char_y] * o2 + (v - p[char_y]) * o1;
2841 p +=
out->linesize[plane];
2850 const uint8_t *font;
2856 for (plane = 0; plane < 4 &&
out->data[plane]; plane++) {
2857 for (
i = 0; txt[
i];
i++) {
2861 for (char_y = 0; char_y < font_height; char_y++) {
2862 uint16_t *p = (uint16_t *)(
out->data[plane] + (y +
i * 10) *
out->linesize[plane]) + x;
2864 if (font[txt[
i] * font_height + font_height - 1 - char_y] &
mask)
2865 p[char_y] = p[char_y] * o2 + (v - p[char_y]) * o1;
2866 p +=
out->linesize[plane] / 2;
2879 const int step = (
s->flags & 2) + 1;
2880 const float o1 =
s->opacity;
2881 const float o2 = 1. - o1;
2883 int C, k = 0,
c, p, l, offset_x = 0, offset_y = 0;
2885 for (
c = 0;
c <
s->ncomp;
c++) {
2886 if (!((1 <<
c) &
s->pcomp) || (!
s->display && k > 0))
2891 for (p = 0; p <
s->ncomp; p++) {
2892 const int v =
s->grat_yuva_color[p];
2893 for (l = 0; l <
s->nb_glines; l++) {
2894 const uint16_t
pos =
s->glines[l].line[
C].pos;
2895 int x = offset_x + (
s->mirror ?
s->size - 1 -
pos :
pos);
2896 uint8_t *dst =
out->data[p] + offset_y *
out->linesize[p] + x;
2902 for (l = 0; l <
s->nb_glines && (
s->flags & 1); l++) {
2903 const char *
name =
s->glines[l].line[
C].name;
2904 const uint16_t
pos =
s->glines[l].line[
C].pos;
2905 int x = offset_x + (
s->mirror ?
s->size - 1 -
pos :
pos) - 10;
2910 s->draw_text(
out, x, offset_y + 2, 1, o1, o2,
name,
s->grat_yuva_color);
2913 offset_x +=
s->size * (
s->display ==
STACK);
2920 const int step = (
s->flags & 2) + 1;
2921 const float o1 =
s->opacity;
2922 const float o2 = 1. - o1;
2923 const int mult =
s->max / 256;
2925 int C, k = 0,
c, p, l, offset_x = 0, offset_y = 0;
2927 for (
c = 0;
c <
s->ncomp;
c++) {
2928 if (!((1 <<
c) &
s->pcomp) || (!
s->display && k > 0))
2933 for (p = 0; p <
s->ncomp; p++) {
2934 const int v =
s->grat_yuva_color[p] *
mult;
2935 for (l = 0; l <
s->nb_glines ; l++) {
2936 const uint16_t
pos =
s->glines[l].line[
C].pos;
2937 int x = offset_x + (
s->mirror ?
s->size - 1 -
pos :
pos);
2938 uint8_t *dst = (uint8_t *)(
out->data[p] + offset_y *
out->linesize[p]) + x * 2;
2944 for (l = 0; l <
s->nb_glines && (
s->flags & 1); l++) {
2945 const char *
name =
s->glines[l].line[
C].name;
2946 const uint16_t
pos =
s->glines[l].line[
C].pos;
2947 int x = offset_x + (
s->mirror ?
s->size - 1 -
pos :
pos) - 10;
2952 s->draw_text(
out, x, offset_y + 2,
mult, o1, o2,
name,
s->grat_yuva_color);
2955 offset_x +=
s->size * (
s->display ==
STACK);
2962 const int step = (
s->flags & 2) + 1;
2963 const float o1 =
s->opacity;
2964 const float o2 = 1. - o1;
2966 int C, k = 0,
c, p, l, offset_y = 0, offset_x = 0;
2968 for (
c = 0;
c <
s->ncomp;
c++) {
2969 if ((!((1 <<
c) &
s->pcomp) || (!
s->display && k > 0)))
2974 for (p = 0; p <
s->ncomp; p++) {
2975 const int v =
s->grat_yuva_color[p];
2976 for (l = 0; l <
s->nb_glines ; l++) {
2977 const uint16_t
pos =
s->glines[l].line[
C].pos;
2978 int y = offset_y + (
s->mirror ?
s->size - 1 -
pos :
pos);
2979 uint8_t *dst =
out->data[p] + y *
out->linesize[p] + offset_x;
2981 s->blend_line(dst,
width, 1, o1, o2, v,
step);
2985 for (l = 0; l <
s->nb_glines && (
s->flags & 1); l++) {
2986 const char *
name =
s->glines[l].line[
C].name;
2987 const uint16_t
pos =
s->glines[l].line[
C].pos;
2988 int y = offset_y + (
s->mirror ?
s->size - 1 -
pos :
pos) - 10;
2993 s->draw_text(
out, 2 + offset_x, y, 1, o1, o2,
name,
s->grat_yuva_color);
2996 offset_y +=
s->size * (
s->display ==
STACK);
3003 const int step = (
s->flags & 2) + 1;
3004 const float o1 =
s->opacity;
3005 const float o2 = 1. - o1;
3006 const int mult =
s->max / 256;
3008 int C, k = 0,
c, p, l, offset_x = 0, offset_y = 0;
3010 for (
c = 0;
c <
s->ncomp;
c++) {
3011 if ((!((1 <<
c) &
s->pcomp) || (!
s->display && k > 0)))
3016 for (p = 0; p <
s->ncomp; p++) {
3017 const int v =
s->grat_yuva_color[p] *
mult;
3018 for (l = 0; l <
s->nb_glines ; l++) {
3019 const uint16_t
pos =
s->glines[l].line[
C].pos;
3020 int y = offset_y + (
s->mirror ?
s->size - 1 -
pos :
pos);
3021 uint8_t *dst = (uint8_t *)(
out->data[p] + y *
out->linesize[p]) + offset_x * 2;
3023 s->blend_line(dst,
width, 1, o1, o2, v,
step);
3027 for (l = 0; l <
s->nb_glines && (
s->flags & 1); l++) {
3028 const char *
name =
s->glines[l].line[
C].name;
3029 const uint16_t
pos =
s->glines[l].line[
C].pos;
3030 int y = offset_y + (
s->mirror ?
s->size - 1 -
pos:
pos) - 10;
3035 s->draw_text(
out, 2 + offset_x, y,
mult, o1, o2,
name,
s->grat_yuva_color);
3038 offset_y +=
s->size * (
s->display ==
STACK);
3049 s->ncomp =
s->desc->nb_components;
3050 s->bits =
s->desc->comp[0].depth;
3051 s->max = 1 <<
s->bits;
3052 s->intensity =
s->fintensity * (
s->max - 1);
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 s->tint[0] = .5f * (
s->ftint[0] + 1.f) * (
s->size - 1);
3294 s->tint[1] = .5f * (
s->ftint[1] + 1.f) * (
s->size - 1);
3296 switch (
inlink->format) {
3309 s->bg_color[3] *=
s->bgopacity;
3321 for (
i = 0;
i <
s->ncomp;
i++) {
3322 if ((1 <<
i) &
s->pcomp)
3330 s->dcomp =
s->odesc->nb_components;
3348 for (p = 0; p <
s->ncomp; p++) {
3349 const int plane =
s->desc->comp[p].plane;
3352 if (!((1 << p) &
s->pcomp))
3355 for (k = 0; k < 4; k++) {
3356 s->emax[plane][k] =
s->peak +
size * (plane * 4 + k + 0);
3357 s->emin[plane][k] =
s->peak +
size * (plane * 4 + k + 16);
3362 s->eend[plane] = (
offset +
s->size - 1);
3364 for (k = 0; k < 4; k++) {
3365 s->emax[plane][k][
i] =
s->estart[plane];
3366 s->emin[plane][k][
i] =
s->eend[plane];
3371 switch (
s->fitmode) {
3405 for (k = 0; k <
s->dcomp; k++) {
3407 for (
i = 0;
i < outlink->
h ;
i++)
3408 memset(
out->data[
s->odesc->comp[k].plane] +
3409 i *
out->linesize[
s->odesc->comp[k].plane],
3410 s->bg_color[k], outlink->
w);
3412 const int mult =
s->max / 256;
3413 uint16_t *dst = (uint16_t *)
out->data[
s->odesc->comp[k].plane];
3415 for (
i = 0;
i < outlink->
h ;
i++) {
3416 for (j = 0; j < outlink->
w; j++)
3417 dst[j] =
s->bg_color[k] *
mult;
3418 dst +=
out->linesize[
s->odesc->comp[k].plane] / 2;
3423 for (k = 0,
i = 0; k <
s->ncomp; k++) {
3424 if ((1 << k) &
s->pcomp) {
3425 const int plane =
s->desc->comp[k].plane;
3431 offset_x =
s->mode ?
i++ *
inlink->w : 0;
3432 offset_y =
s->mode ? 0 :
i++ *
inlink->h;
3434 offset_y =
s->mode ?
i++ *
s->size * !!
s->display : 0;
3435 offset_x =
s->mode ? 0 :
i++ *
s->size * !!
s->display;
3441 td.offset_y = offset_y;
3442 td.offset_x = offset_x;
3445 switch (
s->filter) {
3456 envelope(
s,
out, plane, plane,
s->mode ? offset_x : offset_y);
3462 envelope(
s,
out, plane, plane,
s->mode ? offset_x : offset_y);
3463 envelope(
s,
out, plane, (plane + 1) %
s->ncomp,
s->mode ? offset_x : offset_y);
3466 envelope16(
s,
out, plane, (plane + 1) %
s->ncomp,
s->mode ? offset_x : offset_y);
3473 envelope(
s,
out, plane, (plane + 0) %
s->ncomp,
s->mode ? offset_x : offset_y);
3474 envelope(
s,
out, plane, (plane + 1) %
s->ncomp,
s->mode ? offset_x : offset_y);
3475 envelope(
s,
out, plane, (plane + 2) %
s->ncomp,
s->mode ? offset_x : offset_y);
3477 envelope16(
s,
out, plane, (plane + 0) %
s->ncomp,
s->mode ? offset_x : offset_y);
3478 envelope16(
s,
out, plane, (plane + 1) %
s->ncomp,
s->mode ? offset_x : offset_y);
3479 envelope16(
s,
out, plane, (plane + 2) %
s->ncomp,
s->mode ? offset_x : offset_y);
3485 s->graticulef(
s,
out);
3520 .priv_class = &waveform_class,