119 int jobnr,
int nb_jobs);
124 float o1,
float o2,
const char *txt,
130 #define OFFSET(x) offsetof(WaveformContext, x)
131 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
315 if (!
ctx->inputs[0]->incfg.formats ||
316 !
ctx->inputs[0]->incfg.formats->nb_formats) {
332 if (!
ctx->inputs[0]->outcfg.formats) {
337 avff =
ctx->inputs[0]->incfg.formats;
338 avff2 =
ctx->inputs[0]->outcfg.formats;
344 depth =
desc->comp[0].depth;
346 if (
ncomp != ncomp2 || depth != depth2)
351 depth !=
desc->comp[0].depth)
363 else if (
rgb && depth == 8 &&
ncomp > 2)
365 else if (
rgb && depth == 9 &&
ncomp > 2)
367 else if (
rgb && depth == 10 &&
ncomp > 2)
369 else if (
rgb && depth == 12 &&
ncomp > 2)
371 else if (depth == 8 &&
ncomp > 2)
373 else if (depth == 9 &&
ncomp > 2)
375 else if (depth == 10 &&
ncomp > 2)
377 else if (depth == 12 &&
ncomp > 2)
389 const int dst_linesize =
out->linesize[component] / 2;
390 const int bg =
s->bg_color[component] * (
s->max / 256);
391 const int limit =
s->max - 1;
392 const int dst_h =
s->display ==
PARADE ?
out->height /
s->acomp :
out->height;
393 const int dst_w =
s->display ==
PARADE ?
out->width /
s->acomp :
out->width;
394 const int start =
s->estart[plane];
395 const int end =
s->eend[plane];
401 for (y = start; y < end; y++) {
402 dst = (uint16_t *)
out->data[component] + y * dst_linesize + x;
408 for (y = end - 1; y >= start; y--) {
409 dst = (uint16_t *)
out->data[component] + y * dst_linesize + x;
418 dst = (uint16_t *)
out->data[component] + y * dst_linesize;
419 for (x = start; x < end; x++) {
425 for (x = end - 1; x >= start; x--) {
437 const int dst_linesize =
out->linesize[component];
438 const uint8_t bg =
s->bg_color[component];
439 const int dst_h =
s->display ==
PARADE ?
out->height /
s->acomp :
out->height;
440 const int dst_w =
s->display ==
PARADE ?
out->width /
s->acomp :
out->width;
441 const int start =
s->estart[plane];
442 const int end =
s->eend[plane];
448 for (y = start; y < end; y++) {
449 dst =
out->data[component] + y * dst_linesize + x;
455 for (y = end - 1; y >= start; y--) {
456 dst =
out->data[component] + y * dst_linesize + x;
465 dst =
out->data[component] + y * dst_linesize;
466 for (x = start; x < end; x++) {
472 for (x = end - 1; x >= start; x--) {
484 const int dst_linesize =
out->linesize[component] / 2;
485 const int bg =
s->bg_color[component] * (
s->max / 256);
486 const int limit =
s->max - 1;
487 const int dst_h =
s->display ==
PARADE ?
out->height /
s->acomp :
out->height;
488 const int dst_w =
s->display ==
PARADE ?
out->width /
s->acomp :
out->width;
489 const int start =
s->estart[plane];
490 const int end =
s->eend[plane];
491 int *
emax =
s->emax[plane][component];
492 int *
emin =
s->emin[plane][component];
498 for (y = start; y < end && y <
emin[x -
offset]; y++) {
499 dst = (uint16_t *)
out->data[component] + y * dst_linesize + x;
505 for (y = end - 1; y >= start && y >=
emax[x -
offset]; y--) {
506 dst = (uint16_t *)
out->data[component] + y * dst_linesize + x;
514 if (
s->envelope == 3)
518 dst = (uint16_t *)
out->data[component] +
emin[x -
offset] * dst_linesize + x;
520 dst = (uint16_t *)
out->data[component] +
emax[x -
offset] * dst_linesize + x;
525 dst = (uint16_t *)
out->data[component] + y * dst_linesize;
532 for (x = end - 1; x >= start && x >=
emax[y -
offset]; x--) {
540 if (
s->envelope == 3)
544 dst = (uint16_t *)
out->data[component] + y * dst_linesize +
emin[y -
offset];
546 dst = (uint16_t *)
out->data[component] + y * dst_linesize +
emax[y -
offset];
554 const int dst_linesize =
out->linesize[component];
555 const int bg =
s->bg_color[component];
556 const int dst_h =
s->display ==
PARADE ?
out->height /
s->acomp :
out->height;
557 const int dst_w =
s->display ==
PARADE ?
out->width /
s->acomp :
out->width;
558 const int start =
s->estart[plane];
559 const int end =
s->eend[plane];
560 int *
emax =
s->emax[plane][component];
561 int *
emin =
s->emin[plane][component];
567 for (y = start; y < end && y <
emin[x -
offset]; y++) {
568 dst =
out->data[component] + y * dst_linesize + x;
574 for (y = end - 1; y >= start && y >=
emax[x -
offset]; y--) {
575 dst =
out->data[component] + y * dst_linesize + x;
583 if (
s->envelope == 3)
587 dst =
out->data[component] +
emin[x -
offset] * dst_linesize + x;
589 dst =
out->data[component] +
emax[x -
offset] * dst_linesize + x;
594 dst =
out->data[component] + y * dst_linesize;
595 for (x = start; x < end && x <
emin[y -
offset]; x++) {
601 for (x = end - 1; x >= start && x >=
emax[y -
offset]; x--) {
609 if (
s->envelope == 3)
613 dst =
out->data[component] + y * dst_linesize +
emin[y -
offset];
615 dst =
out->data[component] + y * dst_linesize +
emax[y -
offset];
623 if (
s->envelope == 0) {
625 }
else if (
s->envelope == 1) {
634 if (
s->envelope == 0) {
636 }
else if (
s->envelope == 1) {
678 int offset_y,
int offset_x,
680 int jobnr,
int nb_jobs)
682 const int plane =
s->desc->comp[component].plane;
683 const int dplane = (
s->rgb ||
s->display ==
OVERLAY) ? plane : 0;
684 const int shift_w =
s->shift_w[component];
685 const int shift_h =
s->shift_h[component];
686 const int src_linesize =
in->linesize[plane] / 2;
687 const int dst_linesize =
out->linesize[dplane] / 2;
688 const int dst_signed_linesize = dst_linesize * (
mirror == 1 ? -1 : 1);
689 const int limit =
s->max - 1;
693 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
694 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
695 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
696 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
698 const uint16_t *src_data = (
const uint16_t *)
in->data[plane] + sliceh_start * src_linesize;
699 uint16_t *dst_data = (uint16_t *)
out->data[dplane] + (offset_y + sliceh_start *
step) * dst_linesize + offset_x;
700 uint16_t *
const dst_bottom_line = dst_data + dst_linesize * (
s->size - 1);
701 uint16_t *
const dst_line = (
mirror ? dst_bottom_line : dst_data);
708 for (y = sliceh_start; y < sliceh_end; y++) {
709 const uint16_t *src_data_end = src_data + slicew_end;
710 uint16_t *dst = dst_line + slicew_start *
step;
712 for (p = src_data + slicew_start; p < src_data_end; p++) {
714 int i = 0, v =
FFMIN(*p, limit);
718 target = dst++ + dst_signed_linesize * v;
720 }
while (++
i <
step);
722 uint16_t *row = dst_data;
725 target = row - v - 1;
730 }
while (++
i <
step);
733 src_data += src_linesize;
734 dst_data += dst_linesize *
step;
737 if (
s->display !=
OVERLAY && column && !
s->rgb) {
738 const int mult =
s->max / 256;
739 const int bg =
s->bg_color[0] *
mult;
740 const int t0 =
s->tint[0];
741 const int t1 =
s->tint[1];
742 uint16_t *dst0, *dst1;
746 src = (
const uint16_t *)(
out->data[0]) + offset_y * dst_linesize + offset_x;
747 dst0 = (uint16_t *)(
out->data[1]) + offset_y * dst_linesize + offset_x;
748 dst1 = (uint16_t *)(
out->data[2]) + offset_y * dst_linesize + offset_x;
749 for (y = 0; y <
s->max; y++) {
750 for (x = slicew_start *
step; x < slicew_end *
step; x++) {
758 dst0 += dst_linesize;
759 dst1 += dst_linesize;
761 }
else if (
s->display !=
OVERLAY && !
s->rgb) {
762 const int mult =
s->max / 256;
763 const int bg =
s->bg_color[0] *
mult;
764 const int t0 =
s->tint[0];
765 const int t1 =
s->tint[1];
766 uint16_t *dst0, *dst1;
770 src = (
const uint16_t *)
out->data[0] + (offset_y + sliceh_start *
step) * dst_linesize + offset_x;
771 dst0 = (uint16_t *)(
out->data[1]) + (offset_y + sliceh_start *
step) * dst_linesize + offset_x;
772 dst1 = (uint16_t *)(
out->data[2]) + (offset_y + sliceh_start *
step) * dst_linesize + offset_x;
773 for (y = sliceh_start *
step; y < sliceh_end *
step; y++) {
774 for (x = 0; x <
s->max; x++) {
782 dst0 += dst_linesize;
783 dst1 += dst_linesize;
788 #define LOWPASS16_FUNC(name, column, mirror) \
789 static int lowpass16_##name(AVFilterContext *ctx, \
790 void *arg, int jobnr, \
793 WaveformContext *s = ctx->priv; \
794 ThreadData *td = arg; \
795 AVFrame *in = td->in; \
796 AVFrame *out = td->out; \
797 int component = td->component; \
798 int offset_y = td->offset_y; \
799 int offset_x = td->offset_x; \
801 lowpass16(s, in, out, component, s->intensity, \
802 offset_y, offset_x, column, mirror, \
816 int offset_y,
int offset_x,
818 int jobnr,
int nb_jobs)
820 const int plane =
s->desc->comp[component].plane;
821 const int dplane = (
s->rgb ||
s->display ==
OVERLAY) ? plane : 0;
822 const int shift_w =
s->shift_w[component];
823 const int shift_h =
s->shift_h[component];
824 const int src_linesize =
in->linesize[plane];
825 const int dst_linesize =
out->linesize[dplane];
826 const int dst_signed_linesize = dst_linesize * (
mirror == 1 ? -1 : 1);
830 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
831 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
832 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
833 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
835 const uint8_t *src_data =
in->data[plane] + sliceh_start * src_linesize;
836 uint8_t *dst_data =
out->data[dplane] + (offset_y + sliceh_start *
step) * dst_linesize + offset_x;
837 uint8_t *
const dst_bottom_line = dst_data + dst_linesize * (
s->size - 1);
838 uint8_t *
const dst_line = (
mirror ? dst_bottom_line : dst_data);
845 for (y = sliceh_start; y < sliceh_end; y++) {
846 const uint8_t *src_data_end = src_data + slicew_end;
849 for (p = src_data + slicew_start; p < src_data_end; p++) {
855 target = dst++ + dst_signed_linesize * *p;
857 }
while (++
i <
step);
862 target = row - *p - 1;
867 }
while (++
i <
step);
870 src_data += src_linesize;
871 dst_data += dst_linesize *
step;
874 if (
s->display !=
OVERLAY && column && !
s->rgb) {
875 const int bg =
s->bg_color[0];
876 const int dst_h = 256;
877 const int t0 =
s->tint[0];
878 const int t1 =
s->tint[1];
883 src =
out->data[0] + offset_y * dst_linesize + offset_x;
884 dst0 =
out->data[1] + offset_y * dst_linesize + offset_x;
885 dst1 =
out->data[2] + offset_y * dst_linesize + offset_x;
886 for (y = 0; y < dst_h; y++) {
887 for (x = slicew_start *
step; x < slicew_end *
step; x++) {
895 dst0 += dst_linesize;
896 dst1 += dst_linesize;
898 }
else if (
s->display !=
OVERLAY && !
s->rgb) {
899 const int bg =
s->bg_color[0];
900 const int dst_w = 256;
901 const int t0 =
s->tint[0];
902 const int t1 =
s->tint[1];
907 src =
out->data[0] + (offset_y + sliceh_start *
step) * dst_linesize + offset_x;
908 dst0 =
out->data[1] + (offset_y + sliceh_start *
step) * dst_linesize + offset_x;
909 dst1 =
out->data[2] + (offset_y + sliceh_start *
step) * dst_linesize + offset_x;
910 for (y = sliceh_start *
step; y < sliceh_end *
step; y++) {
911 for (x = 0; x < dst_w; x++) {
919 dst0 += dst_linesize;
920 dst1 += dst_linesize;
925 #define LOWPASS_FUNC(name, column, mirror) \
926 static int lowpass_##name(AVFilterContext *ctx, \
927 void *arg, int jobnr, \
930 WaveformContext *s = ctx->priv; \
931 ThreadData *td = arg; \
932 AVFrame *in = td->in; \
933 AVFrame *out = td->out; \
934 int component = td->component; \
935 int offset_y = td->offset_y; \
936 int offset_x = td->offset_x; \
938 lowpass(s, in, out, component, s->intensity, \
939 offset_y, offset_x, column, mirror, \
953 int offset_y,
int offset_x,
955 int jobnr,
int nb_jobs)
957 const int plane =
s->desc->comp[component].plane;
958 const int c0_linesize =
in->linesize[ plane + 0 ] / 2;
959 const int c1_linesize =
in->linesize[(plane + 1) %
s->ncomp] / 2;
960 const int c2_linesize =
in->linesize[(plane + 2) %
s->ncomp] / 2;
961 const int c0_shift_w =
s->shift_w[ component + 0 ];
962 const int c1_shift_w =
s->shift_w[(component + 1) %
s->ncomp];
963 const int c2_shift_w =
s->shift_w[(component + 2) %
s->ncomp];
964 const int c0_shift_h =
s->shift_h[ component + 0 ];
965 const int c1_shift_h =
s->shift_h[(component + 1) %
s->ncomp];
966 const int c2_shift_h =
s->shift_h[(component + 2) %
s->ncomp];
967 const int d0_linesize =
out->linesize[ plane + 0 ] / 2;
968 const int d1_linesize =
out->linesize[(plane + 1) %
s->ncomp] / 2;
969 const int limit =
s->max - 1;
971 const int mid =
s->max / 2;
972 const int src_h =
in->height;
973 const int src_w =
in->width;
974 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
975 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
976 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
977 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
981 const int d0_signed_linesize = d0_linesize * (
mirror == 1 ? -1 : 1);
982 const int d1_signed_linesize = d1_linesize * (
mirror == 1 ? -1 : 1);
984 for (x = slicew_start; x < slicew_end; x++) {
985 const uint16_t *c0_data = (uint16_t *)
in->data[plane + 0];
986 const uint16_t *c1_data = (uint16_t *)
in->data[(plane + 1) %
s->ncomp];
987 const uint16_t *c2_data = (uint16_t *)
in->data[(plane + 2) %
s->ncomp];
988 uint16_t *d0_data = (uint16_t *)(
out->data[plane]) + offset_y * d0_linesize + offset_x;
989 uint16_t *d1_data = (uint16_t *)(
out->data[(plane + 1) %
s->ncomp]) + offset_y * d1_linesize + offset_x;
990 uint16_t *
const d0_bottom_line = d0_data + d0_linesize * (
s->size - 1);
991 uint16_t *
const d0 = (
mirror ? d0_bottom_line : d0_data);
992 uint16_t *
const d1_bottom_line = d1_data + d1_linesize * (
s->size - 1);
993 uint16_t *
const d1 = (
mirror ? d1_bottom_line : d1_data);
995 for (y = 0; y < src_h; y++) {
996 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit) +
s->max;
997 const int c1 =
FFMIN(
FFABS(c1_data[x >> c1_shift_w] - mid) +
FFABS(c2_data[x >> c2_shift_w] - mid), limit);
1000 target = d0 + x + d0_signed_linesize * c0;
1002 target = d1 + x + d1_signed_linesize * (c0 -
c1);
1004 target = d1 + x + d1_signed_linesize * (c0 +
c1);
1007 if (!c0_shift_h || (y & c0_shift_h))
1008 c0_data += c0_linesize;
1009 if (!c1_shift_h || (y & c1_shift_h))
1010 c1_data += c1_linesize;
1011 if (!c2_shift_h || (y & c2_shift_h))
1012 c2_data += c2_linesize;
1013 d0_data += d0_linesize;
1014 d1_data += d1_linesize;
1018 const uint16_t *c0_data = (uint16_t *)(
in->data[plane]) + (sliceh_start >> c0_shift_h) * c0_linesize;
1019 const uint16_t *c1_data = (uint16_t *)(
in->data[(plane + 1) %
s->ncomp]) + (sliceh_start >> c1_shift_h) * c1_linesize;
1020 const uint16_t *c2_data = (uint16_t *)(
in->data[(plane + 2) %
s->ncomp]) + (sliceh_start >> c2_shift_h) * c2_linesize;
1021 uint16_t *d0_data = (uint16_t *)(
out->data[plane]) + (offset_y + sliceh_start) * d0_linesize + offset_x;
1022 uint16_t *d1_data = (uint16_t *)(
out->data[(plane + 1) %
s->ncomp]) + (offset_y + sliceh_start) * d1_linesize + offset_x;
1025 d0_data +=
s->size - 1;
1026 d1_data +=
s->size - 1;
1029 for (y = sliceh_start; y < sliceh_end; y++) {
1030 for (x = 0; x < src_w; x++) {
1031 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit) +
s->max;
1032 const int c1 =
FFMIN(
FFABS(c1_data[x >> c1_shift_w] - mid) +
FFABS(c2_data[x >> c2_shift_w] - mid), limit);
1036 target = d0_data - c0;
1038 target = d1_data - (c0 -
c1);
1040 target = d1_data - (c0 +
c1);
1043 target = d0_data + c0;
1045 target = d1_data + (c0 -
c1);
1047 target = d1_data + (c0 +
c1);
1052 if (!c0_shift_h || (y & c0_shift_h))
1053 c0_data += c0_linesize;
1054 if (!c1_shift_h || (y & c1_shift_h))
1055 c1_data += c1_linesize;
1056 if (!c2_shift_h || (y & c2_shift_h))
1057 c2_data += c2_linesize;
1058 d0_data += d0_linesize;
1059 d1_data += d1_linesize;
1064 #define FLAT16_FUNC(name, column, mirror) \
1065 static int flat16_##name(AVFilterContext *ctx, \
1066 void *arg, int jobnr, \
1069 WaveformContext *s = ctx->priv; \
1070 ThreadData *td = arg; \
1071 AVFrame *in = td->in; \
1072 AVFrame *out = td->out; \
1073 int component = td->component; \
1074 int offset_y = td->offset_y; \
1075 int offset_x = td->offset_x; \
1077 flat16(s, in, out, component, s->intensity, \
1078 offset_y, offset_x, column, mirror, \
1092 int offset_y,
int offset_x,
1094 int jobnr,
int nb_jobs)
1096 const int plane =
s->desc->comp[component].plane;
1097 const int c0_linesize =
in->linesize[ plane + 0 ];
1098 const int c1_linesize =
in->linesize[(plane + 1) %
s->ncomp];
1099 const int c2_linesize =
in->linesize[(plane + 2) %
s->ncomp];
1100 const int c0_shift_w =
s->shift_w[ component + 0 ];
1101 const int c1_shift_w =
s->shift_w[(component + 1) %
s->ncomp];
1102 const int c2_shift_w =
s->shift_w[(component + 2) %
s->ncomp];
1103 const int c0_shift_h =
s->shift_h[ component + 0 ];
1104 const int c1_shift_h =
s->shift_h[(component + 1) %
s->ncomp];
1105 const int c2_shift_h =
s->shift_h[(component + 2) %
s->ncomp];
1106 const int d0_linesize =
out->linesize[ plane + 0 ];
1107 const int d1_linesize =
out->linesize[(plane + 1) %
s->ncomp];
1109 const int src_h =
in->height;
1110 const int src_w =
in->width;
1111 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
1112 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
1113 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
1114 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
1118 const int d0_signed_linesize = d0_linesize * (
mirror == 1 ? -1 : 1);
1119 const int d1_signed_linesize = d1_linesize * (
mirror == 1 ? -1 : 1);
1121 for (x = slicew_start; x < slicew_end; x++) {
1122 const uint8_t *c0_data =
in->data[plane + 0];
1123 const uint8_t *c1_data =
in->data[(plane + 1) %
s->ncomp];
1124 const uint8_t *c2_data =
in->data[(plane + 2) %
s->ncomp];
1125 uint8_t *d0_data =
out->data[plane] + offset_y * d0_linesize + offset_x;
1126 uint8_t *d1_data =
out->data[(plane + 1) %
s->ncomp] + offset_y * d1_linesize + offset_x;
1127 uint8_t *
const d0_bottom_line = d0_data + d0_linesize * (
s->size - 1);
1129 uint8_t *
const d1_bottom_line = d1_data + d1_linesize * (
s->size - 1);
1132 for (y = 0; y < src_h; y++) {
1133 const int c0 = c0_data[x >> c0_shift_w] + 256;
1134 const int c1 =
FFABS(c1_data[x >> c1_shift_w] - 128) +
FFABS(c2_data[x >> c2_shift_w] - 128);
1137 target = d0 + x + d0_signed_linesize * c0;
1139 target = d1 + x + d1_signed_linesize * (c0 -
c1);
1141 target = d1 + x + d1_signed_linesize * (c0 +
c1);
1144 if (!c0_shift_h || (y & c0_shift_h))
1145 c0_data += c0_linesize;
1146 if (!c1_shift_h || (y & c1_shift_h))
1147 c1_data += c1_linesize;
1148 if (!c2_shift_h || (y & c2_shift_h))
1149 c2_data += c2_linesize;
1150 d0_data += d0_linesize;
1151 d1_data += d1_linesize;
1155 const uint8_t *c0_data =
in->data[plane] + (sliceh_start >> c0_shift_h) * c0_linesize;
1156 const uint8_t *c1_data =
in->data[(plane + 1) %
s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize;
1157 const uint8_t *c2_data =
in->data[(plane + 2) %
s->ncomp] + (sliceh_start >> c2_shift_h) * c2_linesize;
1158 uint8_t *d0_data =
out->data[plane] + (offset_y + sliceh_start) * d0_linesize + offset_x;
1159 uint8_t *d1_data =
out->data[(plane + 1) %
s->ncomp] + (offset_y + sliceh_start) * d1_linesize + offset_x;
1162 d0_data +=
s->size - 1;
1163 d1_data +=
s->size - 1;
1166 for (y = sliceh_start; y < sliceh_end; y++) {
1167 for (x = 0; x < src_w; x++) {
1168 const int c0 = c0_data[x >> c0_shift_w] + 256;
1169 const int c1 =
FFABS(c1_data[x >> c1_shift_w] - 128) +
FFABS(c2_data[x >> c2_shift_w] - 128);
1173 target = d0_data - c0;
1175 target = d1_data - (c0 -
c1);
1177 target = d1_data - (c0 +
c1);
1180 target = d0_data + c0;
1182 target = d1_data + (c0 -
c1);
1184 target = d1_data + (c0 +
c1);
1189 if (!c0_shift_h || (y & c0_shift_h))
1190 c0_data += c0_linesize;
1191 if (!c1_shift_h || (y & c1_shift_h))
1192 c1_data += c1_linesize;
1193 if (!c2_shift_h || (y & c2_shift_h))
1194 c2_data += c2_linesize;
1195 d0_data += d0_linesize;
1196 d1_data += d1_linesize;
1201 #define FLAT_FUNC(name, column, mirror) \
1202 static int flat_##name(AVFilterContext *ctx, \
1203 void *arg, int jobnr, \
1206 WaveformContext *s = ctx->priv; \
1207 ThreadData *td = arg; \
1208 AVFrame *in = td->in; \
1209 AVFrame *out = td->out; \
1210 int component = td->component; \
1211 int offset_y = td->offset_y; \
1212 int offset_x = td->offset_x; \
1214 flat(s, in, out, component, s->intensity, \
1215 offset_y, offset_x, column, mirror, \
1226 #define AFLAT16(name, update_cb, update_cr, column, mirror) \
1227 static int name(AVFilterContext *ctx, \
1228 void *arg, int jobnr, \
1231 WaveformContext *s = ctx->priv; \
1232 ThreadData *td = arg; \
1233 AVFrame *in = td->in; \
1234 AVFrame *out = td->out; \
1235 int component = td->component; \
1236 int offset_y = td->offset_y; \
1237 int offset_x = td->offset_x; \
1238 const int intensity = s->intensity; \
1239 const int plane = s->desc->comp[component].plane; \
1240 const int c0_linesize = in->linesize[ plane + 0 ] / 2; \
1241 const int c1_linesize = in->linesize[(plane + 1) % s->ncomp] / 2; \
1242 const int c2_linesize = in->linesize[(plane + 2) % s->ncomp] / 2; \
1243 const int c0_shift_w = s->shift_w[ component + 0 ]; \
1244 const int c1_shift_w = s->shift_w[(component + 1) % s->ncomp]; \
1245 const int c2_shift_w = s->shift_w[(component + 2) % s->ncomp]; \
1246 const int c0_shift_h = s->shift_h[ component + 0 ]; \
1247 const int c1_shift_h = s->shift_h[(component + 1) % s->ncomp]; \
1248 const int c2_shift_h = s->shift_h[(component + 2) % s->ncomp]; \
1249 const int d0_linesize = out->linesize[ plane + 0 ] / 2; \
1250 const int d1_linesize = out->linesize[(plane + 1) % s->ncomp] / 2; \
1251 const int d2_linesize = out->linesize[(plane + 2) % s->ncomp] / 2; \
1252 const int limit = s->max - 1; \
1253 const int max = limit - intensity; \
1254 const int mid = s->max / 2; \
1255 const int src_h = in->height; \
1256 const int src_w = in->width; \
1257 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0; \
1258 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h; \
1259 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0; \
1260 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w; \
1264 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1); \
1265 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1); \
1266 const int d2_signed_linesize = d2_linesize * (mirror == 1 ? -1 : 1); \
1268 for (x = slicew_start; x < slicew_end; x++) { \
1269 const uint16_t *c0_data = (uint16_t *)in->data[plane + 0]; \
1270 const uint16_t *c1_data = (uint16_t *)in->data[(plane + 1) % s->ncomp]; \
1271 const uint16_t *c2_data = (uint16_t *)in->data[(plane + 2) % s->ncomp]; \
1272 uint16_t *d0_data = (uint16_t *)out->data[plane] + offset_y * d0_linesize + offset_x; \
1273 uint16_t *d1_data = (uint16_t *)out->data[(plane + 1) % s->ncomp] + offset_y * d1_linesize + offset_x; \
1274 uint16_t *d2_data = (uint16_t *)out->data[(plane + 2) % s->ncomp] + offset_y * d2_linesize + offset_x; \
1275 uint16_t * const d0_bottom_line = d0_data + d0_linesize * (s->size - 1); \
1276 uint16_t * const d0 = (mirror ? d0_bottom_line : d0_data); \
1277 uint16_t * const d1_bottom_line = d1_data + d1_linesize * (s->size - 1); \
1278 uint16_t * const d1 = (mirror ? d1_bottom_line : d1_data); \
1279 uint16_t * const d2_bottom_line = d2_data + d2_linesize * (s->size - 1); \
1280 uint16_t * const d2 = (mirror ? d2_bottom_line : d2_data); \
1282 for (y = 0; y < src_h; y++) { \
1283 const int c0 = FFMIN(c0_data[x >> c0_shift_w], limit) + mid; \
1284 const int c1 = FFMIN(c1_data[x >> c1_shift_w], limit) - mid; \
1285 const int c2 = FFMIN(c2_data[x >> c2_shift_w], limit) - mid; \
1288 target = d0 + x + d0_signed_linesize * c0; \
1289 update16(target, max, intensity, limit); \
1291 target = d1 + x + d1_signed_linesize * (c0 + c1); \
1292 update_cb(target, max, intensity, limit); \
1294 target = d2 + x + d2_signed_linesize * (c0 + c2); \
1295 update_cr(target, max, intensity, limit); \
1297 if (!c0_shift_h || (y & c0_shift_h)) \
1298 c0_data += c0_linesize; \
1299 if (!c1_shift_h || (y & c1_shift_h)) \
1300 c1_data += c1_linesize; \
1301 if (!c2_shift_h || (y & c2_shift_h)) \
1302 c2_data += c2_linesize; \
1303 d0_data += d0_linesize; \
1304 d1_data += d1_linesize; \
1305 d2_data += d2_linesize; \
1309 const uint16_t *c0_data = (uint16_t *)in->data[plane] + (sliceh_start >> c0_shift_h) * c0_linesize; \
1310 const uint16_t *c1_data = (uint16_t *)in->data[(plane + 1) % s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize; \
1311 const uint16_t *c2_data = (uint16_t *)in->data[(plane + 2) % s->ncomp] + (sliceh_start >> c2_shift_h) * c2_linesize; \
1312 uint16_t *d0_data = (uint16_t *)out->data[plane] + (offset_y + sliceh_start) * d0_linesize + offset_x; \
1313 uint16_t *d1_data = (uint16_t *)out->data[(plane + 1) % s->ncomp] + (offset_y + sliceh_start) * d1_linesize + offset_x; \
1314 uint16_t *d2_data = (uint16_t *)out->data[(plane + 2) % s->ncomp] + (offset_y + sliceh_start) * d2_linesize + offset_x; \
1317 d0_data += s->size - 1; \
1318 d1_data += s->size - 1; \
1319 d2_data += s->size - 1; \
1322 for (y = sliceh_start; y < sliceh_end; y++) { \
1323 for (x = 0; x < src_w; x++) { \
1324 const int c0 = FFMIN(c0_data[x >> c0_shift_w], limit) + mid; \
1325 const int c1 = FFMIN(c1_data[x >> c1_shift_w], limit) - mid; \
1326 const int c2 = FFMIN(c2_data[x >> c2_shift_w], limit) - mid; \
1330 target = d0_data - c0; \
1331 update16(target, max, intensity, limit); \
1332 target = d1_data - (c0 + c1); \
1333 update_cb(target, max, intensity, limit); \
1334 target = d2_data - (c0 + c2); \
1335 update_cr(target, max, intensity, limit); \
1337 target = d0_data + c0; \
1338 update16(target, max, intensity, limit); \
1339 target = d1_data + (c0 + c1); \
1340 update_cb(target, max, intensity, limit); \
1341 target = d2_data + (c0 + c2); \
1342 update_cr(target, max, intensity, limit); \
1346 if (!c0_shift_h || (y & c0_shift_h)) \
1347 c0_data += c0_linesize; \
1348 if (!c1_shift_h || (y & c1_shift_h)) \
1349 c1_data += c1_linesize; \
1350 if (!c2_shift_h || (y & c2_shift_h)) \
1351 c2_data += c2_linesize; \
1352 d0_data += d0_linesize; \
1353 d1_data += d1_linesize; \
1354 d2_data += d2_linesize; \
1360 #define AFLAT(name, update_cb, update_cr, column, mirror) \
1361 static int name(AVFilterContext *ctx, \
1362 void *arg, int jobnr, \
1365 WaveformContext *s = ctx->priv; \
1366 ThreadData *td = arg; \
1367 AVFrame *in = td->in; \
1368 AVFrame *out = td->out; \
1369 int component = td->component; \
1370 int offset_y = td->offset_y; \
1371 int offset_x = td->offset_x; \
1372 const int src_h = in->height; \
1373 const int src_w = in->width; \
1374 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0; \
1375 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h; \
1376 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0; \
1377 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w; \
1378 const int intensity = s->intensity; \
1379 const int plane = s->desc->comp[component].plane; \
1380 const int c0_linesize = in->linesize[ plane + 0 ]; \
1381 const int c1_linesize = in->linesize[(plane + 1) % s->ncomp]; \
1382 const int c2_linesize = in->linesize[(plane + 2) % s->ncomp]; \
1383 const int c0_shift_w = s->shift_w[ component + 0 ]; \
1384 const int c1_shift_w = s->shift_w[(component + 1) % s->ncomp]; \
1385 const int c2_shift_w = s->shift_w[(component + 2) % s->ncomp]; \
1386 const int c0_shift_h = s->shift_h[ component + 0 ]; \
1387 const int c1_shift_h = s->shift_h[(component + 1) % s->ncomp]; \
1388 const int c2_shift_h = s->shift_h[(component + 2) % s->ncomp]; \
1389 const int d0_linesize = out->linesize[ plane + 0 ]; \
1390 const int d1_linesize = out->linesize[(plane + 1) % s->ncomp]; \
1391 const int d2_linesize = out->linesize[(plane + 2) % s->ncomp]; \
1392 const int max = 255 - intensity; \
1396 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1); \
1397 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1); \
1398 const int d2_signed_linesize = d2_linesize * (mirror == 1 ? -1 : 1); \
1400 for (x = slicew_start; x < slicew_end; x++) { \
1401 const uint8_t *c0_data = in->data[plane + 0]; \
1402 const uint8_t *c1_data = in->data[(plane + 1) % s->ncomp]; \
1403 const uint8_t *c2_data = in->data[(plane + 2) % s->ncomp]; \
1404 uint8_t *d0_data = out->data[plane] + offset_y * d0_linesize + offset_x; \
1405 uint8_t *d1_data = out->data[(plane + 1) % s->ncomp] + offset_y * d1_linesize + offset_x; \
1406 uint8_t *d2_data = out->data[(plane + 2) % s->ncomp] + offset_y * d2_linesize + offset_x; \
1407 uint8_t * const d0_bottom_line = d0_data + d0_linesize * (s->size - 1); \
1408 uint8_t * const d0 = (mirror ? d0_bottom_line : d0_data); \
1409 uint8_t * const d1_bottom_line = d1_data + d1_linesize * (s->size - 1); \
1410 uint8_t * const d1 = (mirror ? d1_bottom_line : d1_data); \
1411 uint8_t * const d2_bottom_line = d2_data + d2_linesize * (s->size - 1); \
1412 uint8_t * const d2 = (mirror ? d2_bottom_line : d2_data); \
1414 for (y = 0; y < src_h; y++) { \
1415 const int c0 = c0_data[x >> c0_shift_w] + 128; \
1416 const int c1 = c1_data[x >> c1_shift_w] - 128; \
1417 const int c2 = c2_data[x >> c2_shift_w] - 128; \
1420 target = d0 + x + d0_signed_linesize * c0; \
1421 update(target, max, intensity); \
1423 target = d1 + x + d1_signed_linesize * (c0 + c1); \
1424 update_cb(target, max, intensity); \
1426 target = d2 + x + d2_signed_linesize * (c0 + c2); \
1427 update_cr(target, max, intensity); \
1429 if (!c0_shift_h || (y & c0_shift_h)) \
1430 c0_data += c0_linesize; \
1431 if (!c1_shift_h || (y & c1_shift_h)) \
1432 c1_data += c1_linesize; \
1433 if (!c2_shift_h || (y & c2_shift_h)) \
1434 c2_data += c2_linesize; \
1435 d0_data += d0_linesize; \
1436 d1_data += d1_linesize; \
1437 d2_data += d2_linesize; \
1441 const uint8_t *c0_data = in->data[plane] + (sliceh_start >> c0_shift_h) * c0_linesize; \
1442 const uint8_t *c1_data = in->data[(plane + 1) % s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize; \
1443 const uint8_t *c2_data = in->data[(plane + 2) % s->ncomp] + (sliceh_start >> c2_shift_h) * c2_linesize; \
1444 uint8_t *d0_data = out->data[plane] + (offset_y + sliceh_start) * d0_linesize + offset_x; \
1445 uint8_t *d1_data = out->data[(plane + 1) % s->ncomp] + (offset_y + sliceh_start) * d1_linesize + offset_x; \
1446 uint8_t *d2_data = out->data[(plane + 2) % s->ncomp] + (offset_y + sliceh_start) * d2_linesize + offset_x; \
1449 d0_data += s->size - 1; \
1450 d1_data += s->size - 1; \
1451 d2_data += s->size - 1; \
1454 for (y = sliceh_start; y < sliceh_end; y++) { \
1455 for (x = 0; x < src_w; x++) { \
1456 const int c0 = c0_data[x >> c0_shift_w] + 128; \
1457 const int c1 = c1_data[x >> c1_shift_w] - 128; \
1458 const int c2 = c2_data[x >> c2_shift_w] - 128; \
1462 target = d0_data - c0; \
1463 update(target, max, intensity); \
1464 target = d1_data - (c0 + c1); \
1465 update_cb(target, max, intensity); \
1466 target = d2_data - (c0 + c2); \
1467 update_cr(target, max, intensity); \
1469 target = d0_data + c0; \
1470 update(target, max, intensity); \
1471 target = d1_data + (c0 + c1); \
1472 update_cb(target, max, intensity); \
1473 target = d2_data + (c0 + c2); \
1474 update_cr(target, max, intensity); \
1478 if (!c0_shift_h || (y & c0_shift_h)) \
1479 c0_data += c0_linesize; \
1480 if (!c1_shift_h || (y & c1_shift_h)) \
1481 c1_data += c1_linesize; \
1482 if (!c2_shift_h || (y & c2_shift_h)) \
1483 c2_data += c2_linesize; \
1484 d0_data += d0_linesize; \
1485 d1_data += d1_linesize; \
1486 d2_data += d2_linesize; \
1521 int offset_y,
int offset_x,
1523 int jobnr,
int nb_jobs)
1525 const int plane =
s->desc->comp[component].plane;
1526 const int c0_linesize =
in->linesize[(plane + 1) %
s->ncomp] / 2;
1527 const int c1_linesize =
in->linesize[(plane + 2) %
s->ncomp] / 2;
1528 const int dst_linesize =
out->linesize[plane] / 2;
1529 const int limit =
s->max - 1;
1531 const int mid =
s->max / 2;
1532 const int c0_shift_w =
s->shift_w[(component + 1) %
s->ncomp];
1533 const int c1_shift_w =
s->shift_w[(component + 2) %
s->ncomp];
1534 const int c0_shift_h =
s->shift_h[(component + 1) %
s->ncomp];
1535 const int c1_shift_h =
s->shift_h[(component + 2) %
s->ncomp];
1536 const int src_h =
in->height;
1537 const int src_w =
in->width;
1538 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
1539 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
1540 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
1541 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
1545 const int dst_signed_linesize = dst_linesize * (
mirror == 1 ? -1 : 1);
1547 for (x = slicew_start; x < slicew_end; x++) {
1548 const uint16_t *c0_data = (uint16_t *)
in->data[(plane + 1) %
s->ncomp];
1549 const uint16_t *c1_data = (uint16_t *)
in->data[(plane + 2) %
s->ncomp];
1550 uint16_t *dst_data = (uint16_t *)
out->data[plane] + offset_y * dst_linesize + offset_x;
1551 uint16_t *
const dst_bottom_line = dst_data + dst_linesize * (
s->size - 1);
1552 uint16_t *
const dst_line = (
mirror ? dst_bottom_line : dst_data);
1553 uint16_t *dst = dst_line;
1555 for (y = 0; y < src_h; y++) {
1556 const int sum =
FFMIN(
FFABS(c0_data[x >> c0_shift_w] - mid) +
FFABS(c1_data[x >> c1_shift_w] - mid - 1), limit);
1559 target = dst + x + dst_signed_linesize * sum;
1562 if (!c0_shift_h || (y & c0_shift_h))
1563 c0_data += c0_linesize;
1564 if (!c1_shift_h || (y & c1_shift_h))
1565 c1_data += c1_linesize;
1566 dst_data += dst_linesize;
1570 const uint16_t *c0_data = (uint16_t *)
in->data[(plane + 1) %
s->ncomp] + (sliceh_start >> c0_shift_h) * c0_linesize;
1571 const uint16_t *c1_data = (uint16_t *)
in->data[(plane + 2) %
s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize;
1572 uint16_t *dst_data = (uint16_t *)
out->data[plane] + (offset_y + sliceh_start) * dst_linesize + offset_x;
1575 dst_data +=
s->size - 1;
1576 for (y = sliceh_start; y < sliceh_end; y++) {
1577 for (x = 0; x < src_w; x++) {
1578 const int sum =
FFMIN(
FFABS(c0_data[x >> c0_shift_w] - mid) +
FFABS(c1_data[x >> c1_shift_w] - mid - 1), limit);
1582 target = dst_data - sum;
1585 target = dst_data + sum;
1590 if (!c0_shift_h || (y & c0_shift_h))
1591 c0_data += c0_linesize;
1592 if (!c1_shift_h || (y & c1_shift_h))
1593 c1_data += c1_linesize;
1594 dst_data += dst_linesize;
1599 #define CHROMA16_FUNC(name, column, mirror) \
1600 static int chroma16_##name(AVFilterContext *ctx, \
1601 void *arg, int jobnr, \
1604 WaveformContext *s = ctx->priv; \
1605 ThreadData *td = arg; \
1606 AVFrame *in = td->in; \
1607 AVFrame *out = td->out; \
1608 int component = td->component; \
1609 int offset_y = td->offset_y; \
1610 int offset_x = td->offset_x; \
1612 chroma16(s, in, out, component, s->intensity,\
1613 offset_y, offset_x, column, mirror, \
1627 int offset_y,
int offset_x,
1629 int jobnr,
int nb_jobs)
1631 const int plane =
s->desc->comp[component].plane;
1632 const int src_h =
in->height;
1633 const int src_w =
in->width;
1634 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
1635 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
1636 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
1637 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
1638 const int c0_linesize =
in->linesize[(plane + 1) %
s->ncomp];
1639 const int c1_linesize =
in->linesize[(plane + 2) %
s->ncomp];
1640 const int dst_linesize =
out->linesize[plane];
1642 const int c0_shift_w =
s->shift_w[(component + 1) %
s->ncomp];
1643 const int c1_shift_w =
s->shift_w[(component + 2) %
s->ncomp];
1644 const int c0_shift_h =
s->shift_h[(component + 1) %
s->ncomp];
1645 const int c1_shift_h =
s->shift_h[(component + 2) %
s->ncomp];
1649 const int dst_signed_linesize = dst_linesize * (
mirror == 1 ? -1 : 1);
1651 for (x = slicew_start; x < slicew_end; x++) {
1652 const uint8_t *c0_data =
in->data[(plane + 1) %
s->ncomp];
1653 const uint8_t *c1_data =
in->data[(plane + 2) %
s->ncomp];
1654 uint8_t *dst_data =
out->data[plane] + offset_y * dst_linesize + offset_x;
1655 uint8_t *
const dst_bottom_line = dst_data + dst_linesize * (
s->size - 1);
1656 uint8_t *
const dst_line = (
mirror ? dst_bottom_line : dst_data);
1659 for (y = 0; y < src_h; y++) {
1660 const int sum =
FFABS(c0_data[x >> c0_shift_w] - 128) +
FFABS(c1_data[x >> c1_shift_w] - 127);
1663 target = dst + x + dst_signed_linesize * sum;
1666 if (!c0_shift_h || (y & c0_shift_h))
1667 c0_data += c0_linesize;
1668 if (!c1_shift_h || (y & c1_shift_h))
1669 c1_data += c1_linesize;
1670 dst_data += dst_linesize;
1674 const uint8_t *c0_data =
in->data[(plane + 1) %
s->ncomp] + (sliceh_start >> c0_shift_h) * c0_linesize;
1675 const uint8_t *c1_data =
in->data[(plane + 2) %
s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize;
1676 uint8_t *dst_data =
out->data[plane] + (offset_y + sliceh_start) * dst_linesize + offset_x;
1679 dst_data +=
s->size - 1;
1680 for (y = sliceh_start; y < sliceh_end; y++) {
1681 for (x = 0; x < src_w; x++) {
1682 const int sum =
FFABS(c0_data[x >> c0_shift_w] - 128) +
FFABS(c1_data[x >> c1_shift_w] - 127);
1686 target = dst_data - sum;
1689 target = dst_data + sum;
1694 if (!c0_shift_h || (y & c0_shift_h))
1695 c0_data += c0_linesize;
1696 if (!c1_shift_h || (y & c1_shift_h))
1697 c1_data += c1_linesize;
1698 dst_data += dst_linesize;
1703 #define CHROMA_FUNC(name, column, mirror) \
1704 static int chroma_##name(AVFilterContext *ctx, \
1705 void *arg, int jobnr, \
1708 WaveformContext *s = ctx->priv; \
1709 ThreadData *td = arg; \
1710 AVFrame *in = td->in; \
1711 AVFrame *out = td->out; \
1712 int component = td->component; \
1713 int offset_y = td->offset_y; \
1714 int offset_x = td->offset_x; \
1716 chroma(s, in, out, component, s->intensity, \
1717 offset_y, offset_x, column, mirror, \
1731 int offset_y,
int offset_x,
1733 int jobnr,
int nb_jobs)
1735 const int plane =
s->desc->comp[component].plane;
1736 const int limit =
s->max - 1;
1737 const int src_h =
in->height;
1738 const int src_w =
in->width;
1739 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
1740 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
1741 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
1742 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
1743 const int c0_linesize =
in->linesize[ plane + 0 ] / 2;
1744 const int c1_linesize =
in->linesize[(plane + 1) %
s->ncomp] / 2;
1745 const int c2_linesize =
in->linesize[(plane + 2) %
s->ncomp] / 2;
1746 const int c0_shift_h =
s->shift_h[ component + 0 ];
1747 const int c1_shift_h =
s->shift_h[(component + 1) %
s->ncomp];
1748 const int c2_shift_h =
s->shift_h[(component + 2) %
s->ncomp];
1749 const uint16_t *c0_data = (
const uint16_t *)
in->data[plane + 0] + (sliceh_start >> c0_shift_h) * c0_linesize;
1750 const uint16_t *c1_data = (
const uint16_t *)
in->data[(plane + 1) %
s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize;
1751 const uint16_t *c2_data = (
const uint16_t *)
in->data[(plane + 2) %
s->ncomp] + (sliceh_start >> c2_shift_h) * c2_linesize;
1752 const int d0_linesize =
out->linesize[ plane + 0 ] / 2;
1753 const int d1_linesize =
out->linesize[(plane + 1) %
s->ncomp] / 2;
1754 const int d2_linesize =
out->linesize[(plane + 2) %
s->ncomp] / 2;
1755 const int c0_shift_w =
s->shift_w[ component + 0 ];
1756 const int c1_shift_w =
s->shift_w[(component + 1) %
s->ncomp];
1757 const int c2_shift_w =
s->shift_w[(component + 2) %
s->ncomp];
1761 const int d0_signed_linesize = d0_linesize * (
mirror == 1 ? -1 : 1);
1762 const int d1_signed_linesize = d1_linesize * (
mirror == 1 ? -1 : 1);
1763 const int d2_signed_linesize = d2_linesize * (
mirror == 1 ? -1 : 1);
1764 uint16_t *d0_data = (uint16_t *)
out->data[plane] + offset_y * d0_linesize + offset_x;
1765 uint16_t *d1_data = (uint16_t *)
out->data[(plane + 1) %
s->ncomp] + offset_y * d1_linesize + offset_x;
1766 uint16_t *d2_data = (uint16_t *)
out->data[(plane + 2) %
s->ncomp] + offset_y * d2_linesize + offset_x;
1767 uint16_t *
const d0_bottom_line = d0_data + d0_linesize * (
s->size - 1);
1768 uint16_t *
const d0 = (
mirror ? d0_bottom_line : d0_data);
1769 uint16_t *
const d1_bottom_line = d1_data + d1_linesize * (
s->size - 1);
1770 uint16_t *
const d1 = (
mirror ? d1_bottom_line : d1_data);
1771 uint16_t *
const d2_bottom_line = d2_data + d2_linesize * (
s->size - 1);
1772 uint16_t *
const d2 = (
mirror ? d2_bottom_line : d2_data);
1774 for (y = 0; y < src_h; y++) {
1775 for (x = slicew_start; x < slicew_end; x++) {
1776 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit);
1777 const int c1 = c1_data[x >> c1_shift_w];
1778 const int c2 = c2_data[x >> c2_shift_w];
1780 *(d0 + d0_signed_linesize * c0 + x) = c0;
1781 *(d1 + d1_signed_linesize * c0 + x) =
c1;
1782 *(d2 + d2_signed_linesize * c0 + x) =
c2;
1785 if (!c0_shift_h || (y & c0_shift_h))
1786 c0_data += c0_linesize;
1787 if (!c1_shift_h || (y & c1_shift_h))
1788 c1_data += c1_linesize;
1789 if (!c2_shift_h || (y & c2_shift_h))
1790 c2_data += c2_linesize;
1791 d0_data += d0_linesize;
1792 d1_data += d1_linesize;
1793 d2_data += d2_linesize;
1796 uint16_t *d0_data = (uint16_t *)
out->data[plane] + (offset_y + sliceh_start) * d0_linesize + offset_x;
1797 uint16_t *d1_data = (uint16_t *)
out->data[(plane + 1) %
s->ncomp] + (offset_y + sliceh_start) * d1_linesize + offset_x;
1798 uint16_t *d2_data = (uint16_t *)
out->data[(plane + 2) %
s->ncomp] + (offset_y + sliceh_start) * d2_linesize + offset_x;
1801 d0_data +=
s->size - 1;
1802 d1_data +=
s->size - 1;
1803 d2_data +=
s->size - 1;
1806 for (y = sliceh_start; y < sliceh_end; y++) {
1807 for (x = 0; x < src_w; x++) {
1808 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit);
1809 const int c1 = c1_data[x >> c1_shift_w];
1810 const int c2 = c2_data[x >> c2_shift_w];
1813 *(d0_data - c0) = c0;
1814 *(d1_data - c0) =
c1;
1815 *(d2_data - c0) =
c2;
1817 *(d0_data + c0) = c0;
1818 *(d1_data + c0) =
c1;
1819 *(d2_data + c0) =
c2;
1823 if (!c0_shift_h || (y & c0_shift_h))
1824 c0_data += c0_linesize;
1825 if (!c1_shift_h || (y & c1_shift_h))
1826 c1_data += c1_linesize;
1827 if (!c2_shift_h || (y & c2_shift_h))
1828 c2_data += c2_linesize;
1829 d0_data += d0_linesize;
1830 d1_data += d1_linesize;
1831 d2_data += d2_linesize;
1836 #define COLOR16_FUNC(name, column, mirror) \
1837 static int color16_##name(AVFilterContext *ctx, \
1838 void *arg, int jobnr, \
1841 WaveformContext *s = ctx->priv; \
1842 ThreadData *td = arg; \
1843 AVFrame *in = td->in; \
1844 AVFrame *out = td->out; \
1845 int component = td->component; \
1846 int offset_y = td->offset_y; \
1847 int offset_x = td->offset_x; \
1849 color16(s, in, out, component, s->intensity, \
1850 offset_y, offset_x, column, mirror, \
1864 int offset_y,
int offset_x,
1866 int jobnr,
int nb_jobs)
1868 const int plane =
s->desc->comp[component].plane;
1869 const int src_h =
in->height;
1870 const int src_w =
in->width;
1871 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
1872 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
1873 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
1874 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
1875 const int c0_linesize =
in->linesize[ plane + 0 ];
1876 const int c1_linesize =
in->linesize[(plane + 1) %
s->ncomp];
1877 const int c2_linesize =
in->linesize[(plane + 2) %
s->ncomp];
1878 const int c0_shift_h =
s->shift_h[ component + 0 ];
1879 const int c1_shift_h =
s->shift_h[(component + 1) %
s->ncomp];
1880 const int c2_shift_h =
s->shift_h[(component + 2) %
s->ncomp];
1881 const uint8_t *c0_data =
in->data[plane] + (sliceh_start >> c0_shift_h) * c0_linesize;
1882 const uint8_t *c1_data =
in->data[(plane + 1) %
s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize;
1883 const uint8_t *c2_data =
in->data[(plane + 2) %
s->ncomp] + (sliceh_start >> c2_shift_h) * c2_linesize;
1884 const int d0_linesize =
out->linesize[ plane + 0 ];
1885 const int d1_linesize =
out->linesize[(plane + 1) %
s->ncomp];
1886 const int d2_linesize =
out->linesize[(plane + 2) %
s->ncomp];
1887 const int c0_shift_w =
s->shift_w[ component + 0 ];
1888 const int c1_shift_w =
s->shift_w[(component + 1) %
s->ncomp];
1889 const int c2_shift_w =
s->shift_w[(component + 2) %
s->ncomp];
1893 const int d0_signed_linesize = d0_linesize * (
mirror == 1 ? -1 : 1);
1894 const int d1_signed_linesize = d1_linesize * (
mirror == 1 ? -1 : 1);
1895 const int d2_signed_linesize = d2_linesize * (
mirror == 1 ? -1 : 1);
1896 uint8_t *d0_data =
out->data[plane] + offset_y * d0_linesize + offset_x;
1897 uint8_t *d1_data =
out->data[(plane + 1) %
s->ncomp] + offset_y * d1_linesize + offset_x;
1898 uint8_t *d2_data =
out->data[(plane + 2) %
s->ncomp] + offset_y * d2_linesize + offset_x;
1899 uint8_t *
const d0_bottom_line = d0_data + d0_linesize * (
s->size - 1);
1901 uint8_t *
const d1_bottom_line = d1_data + d1_linesize * (
s->size - 1);
1903 uint8_t *
const d2_bottom_line = d2_data + d2_linesize * (
s->size - 1);
1906 for (y = 0; y < src_h; y++) {
1907 for (x = slicew_start; x < slicew_end; x++) {
1908 const int c0 = c0_data[x >> c0_shift_w];
1909 const int c1 = c1_data[x >> c1_shift_w];
1910 const int c2 = c2_data[x >> c2_shift_w];
1912 *(d0 + d0_signed_linesize * c0 + x) = c0;
1913 *(d1 + d1_signed_linesize * c0 + x) =
c1;
1914 *(d2 + d2_signed_linesize * c0 + x) =
c2;
1917 if (!c0_shift_h || (y & c0_shift_h))
1918 c0_data += c0_linesize;
1919 if (!c1_shift_h || (y & c1_shift_h))
1920 c1_data += c1_linesize;
1921 if (!c2_shift_h || (y & c2_shift_h))
1922 c2_data += c2_linesize;
1923 d0_data += d0_linesize;
1924 d1_data += d1_linesize;
1925 d2_data += d2_linesize;
1928 uint8_t *d0_data =
out->data[plane] + (offset_y + sliceh_start) * d0_linesize + offset_x;
1929 uint8_t *d1_data =
out->data[(plane + 1) %
s->ncomp] + (offset_y + sliceh_start) * d1_linesize + offset_x;
1930 uint8_t *d2_data =
out->data[(plane + 2) %
s->ncomp] + (offset_y + sliceh_start) * d2_linesize + offset_x;
1933 d0_data +=
s->size - 1;
1934 d1_data +=
s->size - 1;
1935 d2_data +=
s->size - 1;
1938 for (y = sliceh_start; y < sliceh_end; y++) {
1939 for (x = 0; x < src_w; x++) {
1940 const int c0 = c0_data[x >> c0_shift_w];
1941 const int c1 = c1_data[x >> c1_shift_w];
1942 const int c2 = c2_data[x >> c2_shift_w];
1945 *(d0_data - c0) = c0;
1946 *(d1_data - c0) =
c1;
1947 *(d2_data - c0) =
c2;
1949 *(d0_data + c0) = c0;
1950 *(d1_data + c0) =
c1;
1951 *(d2_data + c0) =
c2;
1955 if (!c0_shift_h || (y & c0_shift_h))
1956 c0_data += c0_linesize;
1957 if (!c1_shift_h || (y & c1_shift_h))
1958 c1_data += c1_linesize;
1959 if (!c2_shift_h || (y & c2_shift_h))
1960 c2_data += c2_linesize;
1961 d0_data += d0_linesize;
1962 d1_data += d1_linesize;
1963 d2_data += d2_linesize;
1968 #define COLOR_FUNC(name, column, mirror) \
1969 static int color_##name(AVFilterContext *ctx, \
1970 void *arg, int jobnr, \
1973 WaveformContext *s = ctx->priv; \
1974 ThreadData *td = arg; \
1975 AVFrame *in = td->in; \
1976 AVFrame *out = td->out; \
1977 int component = td->component; \
1978 int offset_y = td->offset_y; \
1979 int offset_x = td->offset_x; \
1981 color(s, in, out, component, s->intensity, \
1982 offset_y, offset_x, column, mirror, \
1996 int offset_y,
int offset_x,
1998 int jobnr,
int nb_jobs)
2000 const int plane =
s->desc->comp[component].plane;
2001 const int limit =
s->max - 1;
2003 const int src_h =
in->height;
2004 const int src_w =
in->width;
2005 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
2006 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
2007 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
2008 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
2009 const int c0_shift_h =
s->shift_h[ component + 0 ];
2010 const int c1_shift_h =
s->shift_h[(component + 1) %
s->ncomp];
2011 const int c2_shift_h =
s->shift_h[(component + 2) %
s->ncomp];
2012 const int c0_linesize =
in->linesize[ plane + 0 ] / 2;
2013 const int c1_linesize =
in->linesize[(plane + 1) %
s->ncomp] / 2;
2014 const int c2_linesize =
in->linesize[(plane + 2) %
s->ncomp] / 2;
2015 const uint16_t *c0_data = (
const uint16_t *)
in->data[plane + 0] + (sliceh_start >> c0_shift_h) * c0_linesize;
2016 const uint16_t *c1_data = (
const uint16_t *)
in->data[(plane + 1) %
s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize;
2017 const uint16_t *c2_data = (
const uint16_t *)
in->data[(plane + 2) %
s->ncomp] + (sliceh_start >> c2_shift_h) * c2_linesize;
2018 const int d0_linesize =
out->linesize[ plane + 0 ] / 2;
2019 const int d1_linesize =
out->linesize[(plane + 1) %
s->ncomp] / 2;
2020 const int d2_linesize =
out->linesize[(plane + 2) %
s->ncomp] / 2;
2021 const int c0_shift_w =
s->shift_w[ component + 0 ];
2022 const int c1_shift_w =
s->shift_w[(component + 1) %
s->ncomp];
2023 const int c2_shift_w =
s->shift_w[(component + 2) %
s->ncomp];
2027 const int d0_signed_linesize = d0_linesize * (
mirror == 1 ? -1 : 1);
2028 const int d1_signed_linesize = d1_linesize * (
mirror == 1 ? -1 : 1);
2029 const int d2_signed_linesize = d2_linesize * (
mirror == 1 ? -1 : 1);
2030 uint16_t *d0_data = (uint16_t *)
out->data[plane] + offset_y * d0_linesize + offset_x;
2031 uint16_t *d1_data = (uint16_t *)
out->data[(plane + 1) %
s->ncomp] + offset_y * d1_linesize + offset_x;
2032 uint16_t *d2_data = (uint16_t *)
out->data[(plane + 2) %
s->ncomp] + offset_y * d2_linesize + offset_x;
2033 uint16_t *
const d0_bottom_line = d0_data + d0_linesize * (
s->size - 1);
2034 uint16_t *
const d0 = (
mirror ? d0_bottom_line : d0_data);
2035 uint16_t *
const d1_bottom_line = d1_data + d1_linesize * (
s->size - 1);
2036 uint16_t *
const d1 = (
mirror ? d1_bottom_line : d1_data);
2037 uint16_t *
const d2_bottom_line = d2_data + d2_linesize * (
s->size - 1);
2038 uint16_t *
const d2 = (
mirror ? d2_bottom_line : d2_data);
2040 for (y = 0; y < src_h; y++) {
2041 for (x = slicew_start; x < slicew_end; x++) {
2042 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit);
2043 const int c1 = c1_data[x >> c1_shift_w];
2044 const int c2 = c2_data[x >> c2_shift_w];
2047 *(d1 + d1_signed_linesize * c0 + x) =
c1;
2048 *(d2 + d2_signed_linesize * c0 + x) =
c2;
2051 if (!c0_shift_h || (y & c0_shift_h))
2052 c0_data += c0_linesize;
2053 if (!c1_shift_h || (y & c1_shift_h))
2054 c1_data += c1_linesize;
2055 if (!c2_shift_h || (y & c2_shift_h))
2056 c2_data += c2_linesize;
2057 d0_data += d0_linesize;
2058 d1_data += d1_linesize;
2059 d2_data += d2_linesize;
2062 uint16_t *d0_data = (uint16_t *)
out->data[plane] + (offset_y + sliceh_start) * d0_linesize + offset_x;
2063 uint16_t *d1_data = (uint16_t *)
out->data[(plane + 1) %
s->ncomp] + (offset_y + sliceh_start) * d1_linesize + offset_x;
2064 uint16_t *d2_data = (uint16_t *)
out->data[(plane + 2) %
s->ncomp] + (offset_y + sliceh_start) * d2_linesize + offset_x;
2067 d0_data +=
s->size - 1;
2068 d1_data +=
s->size - 1;
2069 d2_data +=
s->size - 1;
2072 for (y = sliceh_start; y < sliceh_end; y++) {
2073 for (x = 0; x < src_w; x++) {
2074 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit);
2075 const int c1 = c1_data[x >> c1_shift_w];
2076 const int c2 = c2_data[x >> c2_shift_w];
2080 *(d1_data - c0) =
c1;
2081 *(d2_data - c0) =
c2;
2084 *(d1_data + c0) =
c1;
2085 *(d2_data + c0) =
c2;
2089 if (!c0_shift_h || (y & c0_shift_h))
2090 c0_data += c0_linesize;
2091 if (!c1_shift_h || (y & c1_shift_h))
2092 c1_data += c1_linesize;
2093 if (!c2_shift_h || (y & c2_shift_h))
2094 c2_data += c2_linesize;
2095 d0_data += d0_linesize;
2096 d1_data += d1_linesize;
2097 d2_data += d2_linesize;
2102 #define ACOLOR16_FUNC(name, column, mirror) \
2103 static int acolor16_##name(AVFilterContext *ctx, \
2104 void *arg, int jobnr, \
2107 WaveformContext *s = ctx->priv; \
2108 ThreadData *td = arg; \
2109 AVFrame *in = td->in; \
2110 AVFrame *out = td->out; \
2111 int component = td->component; \
2112 int offset_y = td->offset_y; \
2113 int offset_x = td->offset_x; \
2115 acolor16(s, in, out, component, s->intensity,\
2116 offset_y, offset_x, column, mirror, \
2130 int offset_y,
int offset_x,
2132 int jobnr,
int nb_jobs)
2134 const int plane =
s->desc->comp[component].plane;
2135 const int src_h =
in->height;
2136 const int src_w =
in->width;
2137 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
2138 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
2139 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
2140 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
2141 const int c0_shift_w =
s->shift_w[ component + 0 ];
2142 const int c1_shift_w =
s->shift_w[(component + 1) %
s->ncomp];
2143 const int c2_shift_w =
s->shift_w[(component + 2) %
s->ncomp];
2144 const int c0_shift_h =
s->shift_h[ component + 0 ];
2145 const int c1_shift_h =
s->shift_h[(component + 1) %
s->ncomp];
2146 const int c2_shift_h =
s->shift_h[(component + 2) %
s->ncomp];
2147 const int c0_linesize =
in->linesize[ plane + 0 ];
2148 const int c1_linesize =
in->linesize[(plane + 1) %
s->ncomp];
2149 const int c2_linesize =
in->linesize[(plane + 2) %
s->ncomp];
2150 const uint8_t *c0_data =
in->data[plane + 0] + (sliceh_start >> c0_shift_h) * c0_linesize;
2151 const uint8_t *c1_data =
in->data[(plane + 1) %
s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize;
2152 const uint8_t *c2_data =
in->data[(plane + 2) %
s->ncomp] + (sliceh_start >> c2_shift_h) * c2_linesize;
2153 const int d0_linesize =
out->linesize[ plane + 0 ];
2154 const int d1_linesize =
out->linesize[(plane + 1) %
s->ncomp];
2155 const int d2_linesize =
out->linesize[(plane + 2) %
s->ncomp];
2160 const int d0_signed_linesize = d0_linesize * (
mirror == 1 ? -1 : 1);
2161 const int d1_signed_linesize = d1_linesize * (
mirror == 1 ? -1 : 1);
2162 const int d2_signed_linesize = d2_linesize * (
mirror == 1 ? -1 : 1);
2163 uint8_t *d0_data =
out->data[plane] + offset_y * d0_linesize + offset_x;
2164 uint8_t *d1_data =
out->data[(plane + 1) %
s->ncomp] + offset_y * d1_linesize + offset_x;
2165 uint8_t *d2_data =
out->data[(plane + 2) %
s->ncomp] + offset_y * d2_linesize + offset_x;
2166 uint8_t *
const d0_bottom_line = d0_data + d0_linesize * (
s->size - 1);
2168 uint8_t *
const d1_bottom_line = d1_data + d1_linesize * (
s->size - 1);
2170 uint8_t *
const d2_bottom_line = d2_data + d2_linesize * (
s->size - 1);
2173 for (y = 0; y < src_h; y++) {
2174 for (x = slicew_start; x < slicew_end; x++) {
2175 const int c0 = c0_data[x >> c0_shift_w];
2176 const int c1 = c1_data[x >> c1_shift_w];
2177 const int c2 = c2_data[x >> c2_shift_w];
2180 *(d1 + d1_signed_linesize * c0 + x) =
c1;
2181 *(d2 + d2_signed_linesize * c0 + x) =
c2;
2184 if (!c0_shift_h || (y & c0_shift_h))
2185 c0_data += c0_linesize;
2186 if (!c1_shift_h || (y & c1_shift_h))
2187 c1_data += c1_linesize;
2188 if (!c2_shift_h || (y & c2_shift_h))
2189 c2_data += c2_linesize;
2190 d0_data += d0_linesize;
2191 d1_data += d1_linesize;
2192 d2_data += d2_linesize;
2195 uint8_t *d0_data =
out->data[plane] + (offset_y + sliceh_start) * d0_linesize + offset_x;
2196 uint8_t *d1_data =
out->data[(plane + 1) %
s->ncomp] + (offset_y + sliceh_start) * d1_linesize + offset_x;
2197 uint8_t *d2_data =
out->data[(plane + 2) %
s->ncomp] + (offset_y + sliceh_start) * d2_linesize + offset_x;
2200 d0_data +=
s->size - 1;
2201 d1_data +=
s->size - 1;
2202 d2_data +=
s->size - 1;
2205 for (y = sliceh_start; y < sliceh_end; y++) {
2206 for (x = 0; x < src_w; x++) {
2207 const int c0 = c0_data[x >> c0_shift_w];
2208 const int c1 = c1_data[x >> c1_shift_w];
2209 const int c2 = c2_data[x >> c2_shift_w];
2213 *(d1_data - c0) =
c1;
2214 *(d2_data - c0) =
c2;
2217 *(d1_data + c0) =
c1;
2218 *(d2_data + c0) =
c2;
2222 if (!c0_shift_h || (y & c0_shift_h))
2223 c0_data += c0_linesize;
2224 if (!c1_shift_h || (y & c1_shift_h))
2225 c1_data += c1_linesize;
2226 if (!c2_shift_h || (y & c2_shift_h))
2227 c2_data += c2_linesize;
2228 d0_data += d0_linesize;
2229 d1_data += d1_linesize;
2230 d2_data += d2_linesize;
2235 #define ACOLOR_FUNC(name, column, mirror) \
2236 static int acolor_##name(AVFilterContext *ctx, \
2237 void *arg, int jobnr, \
2240 WaveformContext *s = ctx->priv; \
2241 ThreadData *td = arg; \
2242 AVFrame *in = td->in; \
2243 AVFrame *out = td->out; \
2244 int component = td->component; \
2245 int offset_y = td->offset_y; \
2246 int offset_x = td->offset_x; \
2248 acolor(s, in, out, component, s->intensity, \
2249 offset_y, offset_x, column, mirror, \
2264 { { {
"16", 16+128 }, {
"16", 16+128 }, {
"16", 16+128 }, {
"0", 0+128 } } },
2265 { { {
"128", 128+128 }, {
"128", 128+128 }, {
"128", 128+128 }, {
"128", 128+128 } } },
2266 { { {
"235", 235+128 }, {
"240", 240+128 }, {
"240", 240+128 }, {
"255", 255+128 } } },
2270 { { {
"32", 32+256 }, {
"32", 32+256 }, {
"32", 32+256 }, {
"0", 0+256 } } },
2271 { { {
"256", 256+256 }, {
"256", 256+256 }, {
"256", 256+256 }, {
"256", 256+256 } } },
2272 { { {
"470", 470+256 }, {
"480", 480+256 }, {
"480", 480+256 }, {
"511", 511+256 } } },
2276 { { {
"64", 64+512 }, {
"64", 64+512 }, {
"64", 64+512 }, {
"0", 0+512 } } },
2277 { { {
"512", 512+512 }, {
"512", 512+512 }, {
"512", 512+512 }, {
"512", 512+512 } } },
2278 { { {
"940", 940+512 }, {
"960", 960+512 }, {
"960", 960+512 }, {
"1023", 1023+512 } } },
2282 { { {
"256", 256+2048 }, {
"256", 256+2048 }, {
"256", 256+2048 }, {
"0", 0+2048 } } },
2283 { { {
"2048", 2048+2048 }, {
"2048", 2048+2048 }, {
"2048", 2048+2048 }, {
"2048", 2048+2048 } } },
2284 { { {
"3760", 3760+2048 }, {
"3840", 3840+2048 }, {
"3840", 3840+2048 }, {
"4095", 4095+2048 } } },
2288 { { {
"0", 16+128 }, {
"0", 16+128 }, {
"0", 16+128 }, {
"0", 0+128 } } },
2289 { { {
"175", 71+128 }, {
"175", 72+128 }, {
"175", 72+128 }, {
"175", 64+128 } } },
2290 { { {
"350", 126+128 }, {
"350", 128+128 }, {
"350", 128+128 }, {
"350", 128+128 } } },
2291 { { {
"525", 180+128 }, {
"525", 184+128 }, {
"525", 184+128 }, {
"525", 192+128 } } },
2292 { { {
"700", 235+128 }, {
"700", 240+128 }, {
"700", 240+128 }, {
"700", 255+128 } } },
2296 { { {
"0", 32+256 }, {
"0", 32+256 }, {
"0", 32+256 }, {
"0", 0+256 } } },
2297 { { {
"175", 142+256 }, {
"175", 144+256 }, {
"175", 144+256 }, {
"175", 128+256 } } },
2298 { { {
"350", 251+256 }, {
"350", 256+256 }, {
"350", 256+256 }, {
"350", 256+256 } } },
2299 { { {
"525", 361+256 }, {
"525", 368+256 }, {
"525", 368+256 }, {
"525", 384+256 } } },
2300 { { {
"700", 470+256 }, {
"700", 480+256 }, {
"700", 480+256 }, {
"700", 511+256 } } },
2304 { { {
"0", 64+512 }, {
"0", 64+512 }, {
"0", 64+512 }, {
"0", 0+512 } } },
2305 { { {
"175", 283+512 }, {
"175", 288+512 }, {
"175", 288+512 }, {
"175", 256+512 } } },
2306 { { {
"350", 502+512 }, {
"350", 512+512 }, {
"350", 512+512 }, {
"350", 512+512 } } },
2307 { { {
"525", 721+512 }, {
"525", 736+512 }, {
"525", 736+512 }, {
"525", 768+512 } } },
2308 { { {
"700", 940+512 }, {
"700", 960+512 }, {
"700", 960+512 }, {
"700", 1023+512 } } },
2312 { { {
"0", 256+2048 }, {
"0", 256+2048 }, {
"0", 256+2048 }, {
"0", 0+2048 } } },
2313 { { {
"175", 1132+2048 }, {
"175", 1152+2048 }, {
"175", 1152+2048 }, {
"175", 1024+2048 } } },
2314 { { {
"350", 2008+2048 }, {
"350", 2048+2048 }, {
"350", 2048+2048 }, {
"350", 2048+2048 } } },
2315 { { {
"525", 2884+2048 }, {
"525", 2944+2048 }, {
"525", 2944+2048 }, {
"525", 3072+2048 } } },
2316 { { {
"700", 3760+2048 }, {
"700", 3840+2048 }, {
"700", 3840+2048 }, {
"700", 4095+2048 } } },
2320 { { {
"-25", -39+128 }, {
"-25", -40+128 }, {
"-25", -40+128 }, {
"-25", -64+128 } } },
2321 { { {
"0", 16+128 }, {
"0", 16+128 }, {
"0", 16+128 }, {
"0", 0+128 } } },
2322 { { {
"25", 71+128 }, {
"25", 72+128 }, {
"25", 72+128 }, {
"25", 64+128 } } },
2323 { { {
"50", 126+128 }, {
"50", 128+128 }, {
"50", 128+128 }, {
"50", 128+128 } } },
2324 { { {
"75", 180+128 }, {
"75", 184+128 }, {
"75", 184+128 }, {
"75", 192+128 } } },
2325 { { {
"100", 235+128 }, {
"100", 240+128 }, {
"100", 240+128 }, {
"100", 256+128 } } },
2326 { { {
"125", 290+128 }, {
"125", 296+128 }, {
"125", 296+128 }, {
"125", 320+128 } } },
2330 { { {
"-25", -78+256 }, {
"-25", -80+256 }, {
"-25", -80+256 }, {
"-25",-128+256 } } },
2331 { { {
"0", 32+256 }, {
"0", 32+256 }, {
"0", 32+256 }, {
"0", 0+256 } } },
2332 { { {
"25", 142+256 }, {
"25", 144+256 }, {
"25", 144+256 }, {
"25", 128+256 } } },
2333 { { {
"50", 251+256 }, {
"50", 256+256 }, {
"50", 256+256 }, {
"50", 256+256 } } },
2334 { { {
"75", 361+256 }, {
"75", 368+256 }, {
"75", 368+256 }, {
"75", 384+256 } } },
2335 { { {
"100", 470+256 }, {
"100", 480+256 }, {
"100", 480+256 }, {
"100", 512+256 } } },
2336 { { {
"125", 580+256 }, {
"125", 592+256 }, {
"125", 592+256 }, {
"125", 640+256 } } },
2340 { { {
"-25",-156+512 }, {
"-25",-160+512 }, {
"-25",-160+512 }, {
"-25", -256+512 } } },
2341 { { {
"0", 64+512 }, {
"0", 64+512 }, {
"0", 64+512 }, {
"0", 0+512 } } },
2342 { { {
"25", 283+512 }, {
"25", 288+512 }, {
"25", 288+512 }, {
"25", 256+512 } } },
2343 { { {
"50", 502+512 }, {
"50", 512+512 }, {
"50", 512+512 }, {
"50", 512+512 } } },
2344 { { {
"75", 721+512 }, {
"75", 736+512 }, {
"75", 736+512 }, {
"75", 768+512 } } },
2345 { { {
"100", 940+512 }, {
"100", 960+512 }, {
"100", 960+512 }, {
"100", 1024+512 } } },
2346 { { {
"125",1160+512 }, {
"125",1184+512 }, {
"125",1184+512 }, {
"125", 1280+512 } } },
2350 { { {
"-25", -624+2048 }, {
"-25", -640+2048 }, {
"-25", -640+2048 }, {
"-25",-1024+2048 } } },
2351 { { {
"0", 256+2048 }, {
"0", 256+2048 }, {
"0", 256+2048 }, {
"0", 0+2048 } } },
2352 { { {
"25", 1132+2048 }, {
"25", 1152+2048 }, {
"25", 1152+2048 }, {
"25", 1024+2048 } } },
2353 { { {
"50", 2008+2048 }, {
"50", 2048+2048 }, {
"50", 2048+2048 }, {
"50", 2048+2048 } } },
2354 { { {
"75", 2884+2048 }, {
"75", 2944+2048 }, {
"75", 2944+2048 }, {
"75", 3072+2048 } } },
2355 { { {
"100", 3760+2048 }, {
"100", 3840+2048 }, {
"100", 3840+2048 }, {
"100", 4096+2048 } } },
2356 { { {
"125", 4640+2048 }, {
"125", 4736+2048 }, {
"125", 4736+2048 }, {
"125", 5120+2048 } } },
2360 { { {
"16", 16+256 }, {
"16", 16+256 }, {
"16", 16+256 }, {
"0", 0+256 } } },
2361 { { {
"128", 128+256 }, {
"128", 128+256 }, {
"128", 128+256 }, {
"128", 128+256 } } },
2362 { { {
"235", 235+256 }, {
"240", 240+256 }, {
"240", 240+256 }, {
"255", 255+256 } } },
2366 { { {
"32", 32+512 }, {
"32", 32+512 }, {
"32", 32+512 }, {
"0", 0+512 } } },
2367 { { {
"256", 256+512 }, {
"256", 256+512 }, {
"256", 256+512 }, {
"256", 256+512 } } },
2368 { { {
"470", 470+512 }, {
"480", 480+512 }, {
"480", 480+512 }, {
"511", 511+512 } } },
2372 { { {
"64", 64+1024 }, {
"64", 64+1024 }, {
"64", 64+1024 }, {
"0", 0+1024 } } },
2373 { { {
"512", 512+1024 }, {
"512", 512+1024 }, {
"512", 512+1024 }, {
"512", 512+1024 } } },
2374 { { {
"940", 940+1024 }, {
"960", 960+1024 }, {
"960", 960+1024 }, {
"1023", 1023+1024 } } },
2378 { { {
"256", 256+4096 }, {
"256", 256+4096 }, {
"256", 256+4096 }, {
"0", 0+4096 } } },
2379 { { {
"2048", 2048+4096 }, {
"2048", 2048+4096 }, {
"2048", 2048+4096 }, {
"2048", 2048+4096 } } },
2380 { { {
"3760", 3760+4096 }, {
"3840", 3840+4096 }, {
"3840", 3840+4096 }, {
"4095", 4095+4096 } } },
2384 { { {
"0", 16+256 }, {
"0", 16+256 }, {
"0", 16+256 }, {
"0", 0+256 } } },
2385 { { {
"175", 71+256 }, {
"175", 72+256 }, {
"175", 72+256 }, {
"175", 64+256 } } },
2386 { { {
"350", 126+256 }, {
"350", 128+256 }, {
"350", 128+256 }, {
"350", 128+256 } } },
2387 { { {
"525", 180+256 }, {
"525", 184+256 }, {
"525", 184+256 }, {
"525", 192+256 } } },
2388 { { {
"700", 235+256 }, {
"700", 240+256 }, {
"700", 240+256 }, {
"700", 255+256 } } },
2392 { { {
"0", 32+512 }, {
"0", 32+512 }, {
"0", 32+512 }, {
"0", 0+512 } } },
2393 { { {
"175", 142+512 }, {
"175", 144+512 }, {
"175", 144+512 }, {
"175", 128+512 } } },
2394 { { {
"350", 251+512 }, {
"350", 256+512 }, {
"350", 256+512 }, {
"350", 256+512 } } },
2395 { { {
"525", 361+512 }, {
"525", 368+512 }, {
"525", 368+512 }, {
"525", 384+512 } } },
2396 { { {
"700", 470+512 }, {
"700", 480+512 }, {
"700", 480+512 }, {
"700", 511+512 } } },
2400 { { {
"0", 64+1024 }, {
"0", 64+1024 }, {
"0", 64+1024 }, {
"0", 0+1024 } } },
2401 { { {
"175", 283+1024 }, {
"175", 288+1024 }, {
"175", 288+1024 }, {
"175", 256+1024 } } },
2402 { { {
"350", 502+1024 }, {
"350", 512+1024 }, {
"350", 512+1024 }, {
"350", 512+1024 } } },
2403 { { {
"525", 721+1024 }, {
"525", 736+1024 }, {
"525", 736+1024 }, {
"525", 768+1024 } } },
2404 { { {
"700", 940+1024 }, {
"700", 960+1024 }, {
"700", 960+1024 }, {
"700", 1023+1024 } } },
2408 { { {
"0", 256+4096 }, {
"0", 256+4096 }, {
"0", 256+4096 }, {
"0", 0+4096 } } },
2409 { { {
"175", 1132+4096 }, {
"175", 1152+4096 }, {
"175", 1152+4096 }, {
"175", 1024+4096 } } },
2410 { { {
"350", 2008+4096 }, {
"350", 2048+4096 }, {
"350", 2048+4096 }, {
"350", 2048+4096 } } },
2411 { { {
"525", 2884+4096 }, {
"525", 2944+4096 }, {
"525", 2944+4096 }, {
"525", 3072+4096 } } },
2412 { { {
"700", 3760+4096 }, {
"700", 3840+4096 }, {
"700", 3840+4096 }, {
"700", 4095+4096 } } },
2416 { { {
"-25", -39+256 }, {
"-25", -40+256 }, {
"-25", -40+256 }, {
"-25", -64+256 } } },
2417 { { {
"0", 16+256 }, {
"0", 16+256 }, {
"0", 16+256 }, {
"0", 0+256 } } },
2418 { { {
"25", 71+256 }, {
"25", 72+256 }, {
"25", 72+256 }, {
"25", 64+256 } } },
2419 { { {
"50", 126+256 }, {
"50", 128+256 }, {
"50", 128+256 }, {
"50", 128+256 } } },
2420 { { {
"75", 180+256 }, {
"75", 184+256 }, {
"75", 184+256 }, {
"75", 192+256 } } },
2421 { { {
"100", 235+256 }, {
"100", 240+256 }, {
"100", 240+256 }, {
"100", 256+256 } } },
2422 { { {
"125", 290+256 }, {
"125", 296+256 }, {
"125", 296+256 }, {
"125", 320+256 } } },
2426 { { {
"-25", -78+512 }, {
"-25", -80+512 }, {
"-25", -80+512 }, {
"-25",-128+512 } } },
2427 { { {
"0", 32+512 }, {
"0", 32+512 }, {
"0", 32+512 }, {
"0", 0+512 } } },
2428 { { {
"25", 142+512 }, {
"25", 144+512 }, {
"25", 144+512 }, {
"25", 128+512 } } },
2429 { { {
"50", 251+512 }, {
"50", 256+512 }, {
"50", 256+512 }, {
"50", 256+512 } } },
2430 { { {
"75", 361+512 }, {
"75", 368+512 }, {
"75", 368+512 }, {
"75", 384+512 } } },
2431 { { {
"100", 470+512 }, {
"100", 480+512 }, {
"100", 480+512 }, {
"100", 512+512 } } },
2432 { { {
"125", 580+512 }, {
"125", 592+512 }, {
"125", 592+512 }, {
"125", 640+512 } } },
2436 { { {
"-25",-156+1024 }, {
"-25",-160+1024 }, {
"-25",-160+1024 }, {
"-25", -256+1024 } } },
2437 { { {
"0", 64+1024 }, {
"0", 64+1024 }, {
"0", 64+1024 }, {
"0", 0+1024 } } },
2438 { { {
"25", 283+1024 }, {
"25", 288+1024 }, {
"25", 288+1024 }, {
"25", 256+1024 } } },
2439 { { {
"50", 502+1024 }, {
"50", 512+1024 }, {
"50", 512+1024 }, {
"50", 512+1024 } } },
2440 { { {
"75", 721+1024 }, {
"75", 736+1024 }, {
"75", 736+1024 }, {
"75", 768+1024 } } },
2441 { { {
"100", 940+1024 }, {
"100", 960+1024 }, {
"100", 960+1024 }, {
"100", 1024+1024 } } },
2442 { { {
"125",1160+1024 }, {
"125",1184+1024 }, {
"125",1184+1024 }, {
"125", 1280+1024 } } },
2446 { { {
"-25", -624+4096 }, {
"-25", -640+4096 }, {
"-25", -640+4096 }, {
"-25",-1024+4096 } } },
2447 { { {
"0", 256+4096 }, {
"0", 256+4096 }, {
"0", 256+4096 }, {
"0", 0+4096 } } },
2448 { { {
"25", 1132+4096 }, {
"25", 1152+4096 }, {
"25", 1152+4096 }, {
"25", 1024+4096 } } },
2449 { { {
"50", 2008+4096 }, {
"50", 2048+4096 }, {
"50", 2048+4096 }, {
"50", 2048+4096 } } },
2450 { { {
"75", 2884+4096 }, {
"75", 2944+4096 }, {
"75", 2944+4096 }, {
"75", 3072+4096 } } },
2451 { { {
"100", 3760+4096 }, {
"100", 3840+4096 }, {
"100", 3840+4096 }, {
"100", 4096+4096 } } },
2452 { { {
"125", 4640+4096 }, {
"125", 4736+4096 }, {
"125", 4736+4096 }, {
"125", 5120+4096 } } },
2456 { { {
"16", 16 }, {
"16", 16 }, {
"16", 16 }, {
"0", 0 } } },
2457 { { {
"128", 128 }, {
"128", 128 }, {
"128", 128 }, {
"128", 128 } } },
2458 { { {
"235", 235 }, {
"240", 240 }, {
"240", 240 }, {
"255", 255 } } },
2462 { { {
"32", 32 }, {
"32", 32 }, {
"32", 32 }, {
"0", 0 } } },
2463 { { {
"256", 256 }, {
"256", 256 }, {
"256", 256 }, {
"256", 256 } } },
2464 { { {
"470", 470 }, {
"480", 480 }, {
"480", 480 }, {
"511", 511 } } },
2468 { { {
"64", 64 }, {
"64", 64 }, {
"64", 64 }, {
"0", 0 } } },
2469 { { {
"512", 512 }, {
"512", 512 }, {
"512", 512 }, {
"512", 512 } } },
2470 { { {
"940", 940 }, {
"960", 960 }, {
"960", 960 }, {
"1023", 1023 } } },
2474 { { {
"256", 256 }, {
"256", 256 }, {
"256", 256 }, {
"0", 0 } } },
2475 { { {
"2048", 2048 }, {
"2048", 2048 }, {
"2048", 2048 }, {
"2048", 2048 } } },
2476 { { {
"3760", 3760 }, {
"3840", 3840 }, {
"3840", 3840 }, {
"4095", 4095 } } },
2480 { { {
"0", 16 }, {
"0", 16 }, {
"0", 16 }, {
"0", 0 } } },
2481 { { {
"175", 71 }, {
"175", 72 }, {
"175", 72 }, {
"175", 64 } } },
2482 { { {
"350", 126 }, {
"350", 128 }, {
"350", 128 }, {
"350", 128 } } },
2483 { { {
"525", 180 }, {
"525", 184 }, {
"525", 184 }, {
"525", 192 } } },
2484 { { {
"700", 235 }, {
"700", 240 }, {
"700", 240 }, {
"700", 255 } } },
2488 { { {
"0", 32 }, {
"0", 32 }, {
"0", 32 }, {
"0", 0 } } },
2489 { { {
"175", 142 }, {
"175", 144 }, {
"175", 144 }, {
"175", 128 } } },
2490 { { {
"350", 251 }, {
"350", 256 }, {
"350", 256 }, {
"350", 256 } } },
2491 { { {
"525", 361 }, {
"525", 368 }, {
"525", 368 }, {
"525", 384 } } },
2492 { { {
"700", 470 }, {
"700", 480 }, {
"700", 480 }, {
"700", 511 } } },
2496 { { {
"0", 64 }, {
"0", 64 }, {
"0", 64 }, {
"0", 0 } } },
2497 { { {
"175", 283 }, {
"175", 288 }, {
"175", 288 }, {
"175", 256 } } },
2498 { { {
"350", 502 }, {
"350", 512 }, {
"350", 512 }, {
"350", 512 } } },
2499 { { {
"525", 721 }, {
"525", 736 }, {
"525", 736 }, {
"525", 768 } } },
2500 { { {
"700", 940 }, {
"700", 960 }, {
"700", 960 }, {
"700", 1023 } } },
2504 { { {
"0", 256 }, {
"0", 256 }, {
"0", 256 }, {
"0", 0 } } },
2505 { { {
"175", 1132 }, {
"175", 1152 }, {
"175", 1152 }, {
"175", 1024 } } },
2506 { { {
"350", 2008 }, {
"350", 2048 }, {
"350", 2048 }, {
"350", 2048 } } },
2507 { { {
"525", 2884 }, {
"525", 2944 }, {
"525", 2944 }, {
"525", 3072 } } },
2508 { { {
"700", 3760 }, {
"700", 3840 }, {
"700", 3840 }, {
"700", 4095 } } },
2512 { { {
"0", 16 }, {
"0", 16 }, {
"0", 16 }, {
"0", 0 } } },
2513 { { {
"25", 71 }, {
"25", 72 }, {
"25", 72 }, {
"25", 64 } } },
2514 { { {
"50", 126 }, {
"50", 128 }, {
"50", 128 }, {
"50", 128 } } },
2515 { { {
"75", 180 }, {
"75", 184 }, {
"75", 184 }, {
"75", 192 } } },
2516 { { {
"100", 235 }, {
"100", 240 }, {
"100", 240 }, {
"100", 255 } } },
2520 { { {
"0", 32 }, {
"0", 32 }, {
"0", 32 }, {
"0", 0 } } },
2521 { { {
"25", 142 }, {
"25", 144 }, {
"25", 144 }, {
"25", 128 } } },
2522 { { {
"50", 251 }, {
"50", 256 }, {
"50", 256 }, {
"50", 256 } } },
2523 { { {
"75", 361 }, {
"75", 368 }, {
"75", 368 }, {
"75", 384 } } },
2524 { { {
"100", 470 }, {
"100", 480 }, {
"100", 480 }, {
"100", 511 } } },
2528 { { {
"0", 64 }, {
"0", 64 }, {
"0", 64 }, {
"0", 0 } } },
2529 { { {
"25", 283 }, {
"25", 288 }, {
"25", 288 }, {
"25", 256 } } },
2530 { { {
"50", 502 }, {
"50", 512 }, {
"50", 512 }, {
"50", 512 } } },
2531 { { {
"75", 721 }, {
"75", 736 }, {
"75", 736 }, {
"75", 768 } } },
2532 { { {
"100", 940 }, {
"100", 960 }, {
"100", 960 }, {
"100", 1023 } } },
2536 { { {
"0", 256 }, {
"0", 256 }, {
"0", 256 }, {
"0", 0 } } },
2537 { { {
"25", 1132 }, {
"25", 1152 }, {
"25", 1152 }, {
"25", 1024 } } },
2538 { { {
"50", 2008 }, {
"50", 2048 }, {
"50", 2048 }, {
"50", 2048 } } },
2539 { { {
"75", 2884 }, {
"75", 2944 }, {
"75", 2944 }, {
"75", 3072 } } },
2540 { { {
"100", 3760 }, {
"100", 3840 }, {
"100", 3840 }, {
"100", 4095 } } },
2544 { { {
"50", 50 }, {
"50", 50 }, {
"50", 50 }, {
"50", 50 } } },
2545 { { {
"100", 100 }, {
"100", 100 }, {
"100", 100 }, {
"100", 100 } } },
2546 { { {
"150", 150 }, {
"150", 150 }, {
"150", 150 }, {
"150", 150 } } },
2547 { { {
"200", 200 }, {
"200", 200 }, {
"200", 200 }, {
"200", 200 } } },
2548 { { {
"255", 255 }, {
"255", 255 }, {
"255", 255 }, {
"255", 255 } } },
2552 { { {
"100", 100 }, {
"100", 100 }, {
"100", 100 }, {
"100", 100 } } },
2553 { { {
"200", 200 }, {
"200", 200 }, {
"200", 200 }, {
"200", 200 } } },
2554 { { {
"300", 300 }, {
"300", 300 }, {
"300", 300 }, {
"300", 300 } } },
2555 { { {
"400", 400 }, {
"400", 400 }, {
"400", 400 }, {
"400", 400 } } },
2556 { { {
"500", 500 }, {
"500", 500 }, {
"500", 500 }, {
"500", 500 } } },
2560 { { {
"200", 200 }, {
"200", 200 }, {
"200", 200 }, {
"200", 200 } } },
2561 { { {
"400", 400 }, {
"400", 400 }, {
"400", 400 }, {
"400", 400 } } },
2562 { { {
"600", 600 }, {
"600", 600 }, {
"600", 600 }, {
"600", 600 } } },
2563 { { {
"800", 800 }, {
"800", 800 }, {
"800", 800 }, {
"800", 800 } } },
2564 { { {
"1000",1000 }, {
"1000",1000 }, {
"1000",1000 }, {
"1000",1000 } } },
2568 { { {
"800", 800 }, {
"800", 800 }, {
"800", 800 }, {
"800", 800 } } },
2569 { { {
"1600", 1600 }, {
"1600", 1600 }, {
"1600", 1600 }, {
"1600", 1600 } } },
2570 { { {
"2400", 2400 }, {
"2400", 2400 }, {
"2400", 2400 }, {
"2400", 2400 } } },
2571 { { {
"3200", 3200 }, {
"3200", 3200 }, {
"3200", 3200 }, {
"3200", 3200 } } },
2572 { { {
"4000", 4000 }, {
"4000", 4000 }, {
"4000", 4000 }, {
"4000", 4000 } } },
2580 dst[0] = v * o1 + dst[0] * o2;
2582 dst += linesize *
step;
2588 uint16_t *dst = (uint16_t *)ddst;
2592 dst[0] = v * o1 + dst[0] * o2;
2594 dst += (linesize / 2) *
step;
2603 dst[x] = v * o1 + dst[x] * o2;
2609 uint16_t *dst = (uint16_t *)ddst;
2613 dst[x] = v * o1 + dst[x] * o2;
2625 for (plane = 0; plane < 4 &&
out->data[plane]; plane++) {
2626 for (
i = 0; txt[
i];
i++) {
2628 int v =
color[plane];
2630 uint8_t *p =
out->data[plane] + y *
out->linesize[plane] + (x +
i * 8);
2631 for (char_y = 0; char_y < font_height; char_y++) {
2633 if (font[txt[
i] * font_height + char_y] &
mask)
2634 p[0] = p[0] * o2 + v * o1;
2637 p +=
out->linesize[plane] - 8;
2651 for (plane = 0; plane < 4 &&
out->data[plane]; plane++) {
2652 for (
i = 0; txt[
i];
i++) {
2656 uint16_t *p = (uint16_t *)(
out->data[plane] + y *
out->linesize[plane]) + (x +
i * 8);
2657 for (char_y = 0; char_y < font_height; char_y++) {
2659 if (font[txt[
i] * font_height + char_y] &
mask)
2660 p[0] = p[0] * o2 + v * o1;
2663 p +=
out->linesize[plane] / 2 - 8;
2677 for (plane = 0; plane < 4 &&
out->data[plane]; plane++) {
2678 for (
i = 0; txt[
i];
i++) {
2680 int v =
color[plane];
2682 for (char_y = font_height - 1; char_y >= 0; char_y--) {
2683 uint8_t *p =
out->data[plane] + (y +
i * 10) *
out->linesize[plane] + x;
2685 if (font[txt[
i] * font_height + font_height - 1 - char_y] &
mask)
2686 p[char_y] = p[char_y] * o2 + v * o1;
2687 p +=
out->linesize[plane];
2702 for (plane = 0; plane < 4 &&
out->data[plane]; plane++) {
2703 for (
i = 0; txt[
i];
i++) {
2707 for (char_y = 0; char_y < font_height; char_y++) {
2708 uint16_t *p = (uint16_t *)(
out->data[plane] + (y +
i * 10) *
out->linesize[plane]) + x;
2710 if (font[txt[
i] * font_height + font_height - 1 - char_y] &
mask)
2711 p[char_y] = p[char_y] * o2 + v * o1;
2712 p +=
out->linesize[plane] / 2;
2724 dst[0] = (v - dst[0]) * o1 + dst[0] * o2;
2726 dst += linesize *
step;
2732 uint16_t *dst = (uint16_t *)ddst;
2736 dst[0] = (v - dst[0]) * o1 + dst[0] * o2;
2738 dst += (linesize / 2) *
step;
2747 dst[x] = (v - dst[x]) * o1 + dst[x] * o2;
2753 uint16_t *dst = (uint16_t *)ddst;
2757 dst[x] = (v - dst[x]) * o1 + dst[x] * o2;
2769 for (plane = 0; plane < 4 &&
out->data[plane]; plane++) {
2770 for (
i = 0; txt[
i];
i++) {
2772 int v =
color[plane];
2774 uint8_t *p =
out->data[plane] + y *
out->linesize[plane] + (x +
i * 8);
2775 for (char_y = 0; char_y < font_height; char_y++) {
2777 if (font[txt[
i] * font_height + char_y] &
mask)
2778 p[0] = p[0] * o2 + (v - p[0]) * o1;
2781 p +=
out->linesize[plane] - 8;
2795 for (plane = 0; plane < 4 &&
out->data[plane]; plane++) {
2796 for (
i = 0; txt[
i];
i++) {
2800 uint16_t *p = (uint16_t *)(
out->data[plane] + y *
out->linesize[plane]) + (x +
i * 8);
2801 for (char_y = 0; char_y < font_height; char_y++) {
2803 if (font[txt[
i] * font_height + char_y] &
mask)
2804 p[0] = p[0] * o2 + (v - p[0]) * o1;
2807 p +=
out->linesize[plane] / 2 - 8;
2821 for (plane = 0; plane < 4 &&
out->data[plane]; plane++) {
2822 for (
i = 0; txt[
i];
i++) {
2824 int v =
color[plane];
2826 for (char_y = font_height - 1; char_y >= 0; char_y--) {
2827 uint8_t *p =
out->data[plane] + (y +
i * 10) *
out->linesize[plane] + x;
2829 if (font[txt[
i] * font_height + font_height - 1 - char_y] &
mask)
2830 p[char_y] = p[char_y] * o2 + (v - p[char_y]) * o1;
2831 p +=
out->linesize[plane];
2846 for (plane = 0; plane < 4 &&
out->data[plane]; plane++) {
2847 for (
i = 0; txt[
i];
i++) {
2851 for (char_y = 0; char_y < font_height; char_y++) {
2852 uint16_t *p = (uint16_t *)(
out->data[plane] + (y +
i * 10) *
out->linesize[plane]) + x;
2854 if (font[txt[
i] * font_height + font_height - 1 - char_y] &
mask)
2855 p[char_y] = p[char_y] * o2 + (v - p[char_y]) * o1;
2856 p +=
out->linesize[plane] / 2;
2869 const int step = (
s->flags & 2) + 1;
2870 const float o1 =
s->opacity;
2871 const float o2 = 1. - o1;
2873 int C, k = 0,
c, p, l, offset_x = 0, offset_y = 0;
2875 for (
c = 0;
c <
s->ncomp;
c++) {
2876 if (!((1 <<
c) &
s->pcomp) || (!
s->display && k > 0))
2881 for (p = 0; p <
s->ncomp; p++) {
2882 const int v =
s->grat_yuva_color[p];
2883 for (l = 0; l <
s->nb_glines; l++) {
2884 const uint16_t
pos =
s->glines[l].line[
C].pos;
2885 int x = offset_x + (
s->mirror ?
s->size - 1 -
pos :
pos);
2886 uint8_t *dst =
out->data[p] + offset_y *
out->linesize[p] + x;
2892 for (l = 0; l <
s->nb_glines && (
s->flags & 1); l++) {
2893 const char *
name =
s->glines[l].line[
C].name;
2894 const uint16_t
pos =
s->glines[l].line[
C].pos;
2895 int x = offset_x + (
s->mirror ?
s->size - 1 -
pos :
pos) - 10;
2900 s->draw_text(
out, x, offset_y + 2, 1, o1, o2,
name,
s->grat_yuva_color);
2903 offset_x +=
s->size * (
s->display ==
STACK);
2910 const int step = (
s->flags & 2) + 1;
2911 const float o1 =
s->opacity;
2912 const float o2 = 1. - o1;
2913 const int mult =
s->max / 256;
2915 int C, k = 0,
c, p, l, offset_x = 0, offset_y = 0;
2917 for (
c = 0;
c <
s->ncomp;
c++) {
2918 if (!((1 <<
c) &
s->pcomp) || (!
s->display && k > 0))
2923 for (p = 0; p <
s->ncomp; p++) {
2924 const int v =
s->grat_yuva_color[p] *
mult;
2925 for (l = 0; l <
s->nb_glines ; l++) {
2926 const uint16_t
pos =
s->glines[l].line[
C].pos;
2927 int x = offset_x + (
s->mirror ?
s->size - 1 -
pos :
pos);
2934 for (l = 0; l <
s->nb_glines && (
s->flags & 1); l++) {
2935 const char *
name =
s->glines[l].line[
C].name;
2936 const uint16_t
pos =
s->glines[l].line[
C].pos;
2937 int x = offset_x + (
s->mirror ?
s->size - 1 -
pos :
pos) - 10;
2942 s->draw_text(
out, x, offset_y + 2,
mult, o1, o2,
name,
s->grat_yuva_color);
2945 offset_x +=
s->size * (
s->display ==
STACK);
2952 const int step = (
s->flags & 2) + 1;
2953 const float o1 =
s->opacity;
2954 const float o2 = 1. - o1;
2956 int C, k = 0,
c, p, l, offset_y = 0, offset_x = 0;
2958 for (
c = 0;
c <
s->ncomp;
c++) {
2959 if ((!((1 <<
c) &
s->pcomp) || (!
s->display && k > 0)))
2964 for (p = 0; p <
s->ncomp; p++) {
2965 const int v =
s->grat_yuva_color[p];
2966 for (l = 0; l <
s->nb_glines ; l++) {
2967 const uint16_t
pos =
s->glines[l].line[
C].pos;
2968 int y = offset_y + (
s->mirror ?
s->size - 1 -
pos :
pos);
2969 uint8_t *dst =
out->data[p] + y *
out->linesize[p] + offset_x;
2971 s->blend_line(dst,
width, 1, o1, o2, v,
step);
2975 for (l = 0; l <
s->nb_glines && (
s->flags & 1); l++) {
2976 const char *
name =
s->glines[l].line[
C].name;
2977 const uint16_t
pos =
s->glines[l].line[
C].pos;
2978 int y = offset_y + (
s->mirror ?
s->size - 1 -
pos :
pos) - 10;
2983 s->draw_text(
out, 2 + offset_x, y, 1, o1, o2,
name,
s->grat_yuva_color);
2986 offset_y +=
s->size * (
s->display ==
STACK);
2993 const int step = (
s->flags & 2) + 1;
2994 const float o1 =
s->opacity;
2995 const float o2 = 1. - o1;
2996 const int mult =
s->max / 256;
2998 int C, k = 0,
c, p, l, offset_x = 0, offset_y = 0;
3000 for (
c = 0;
c <
s->ncomp;
c++) {
3001 if ((!((1 <<
c) &
s->pcomp) || (!
s->display && k > 0)))
3006 for (p = 0; p <
s->ncomp; p++) {
3007 const int v =
s->grat_yuva_color[p] *
mult;
3008 for (l = 0; l <
s->nb_glines ; l++) {
3009 const uint16_t
pos =
s->glines[l].line[
C].pos;
3010 int y = offset_y + (
s->mirror ?
s->size - 1 -
pos :
pos);
3013 s->blend_line(dst,
width, 1, o1, o2, v,
step);
3017 for (l = 0; l <
s->nb_glines && (
s->flags & 1); l++) {
3018 const char *
name =
s->glines[l].line[
C].name;
3019 const uint16_t
pos =
s->glines[l].line[
C].pos;
3020 int y = offset_y + (
s->mirror ?
s->size - 1 -
pos:
pos) - 10;
3025 s->draw_text(
out, 2 + offset_x, y,
mult, o1, o2,
name,
s->grat_yuva_color);
3028 offset_y +=
s->size * (
s->display ==
STACK);
3039 s->ncomp =
s->desc->nb_components;
3040 s->bits =
s->desc->comp[0].depth;
3041 s->max = 1 <<
s->bits;
3042 s->intensity =
s->fintensity * (
s->max - 1);
3044 s->shift_w[0] =
s->shift_w[3] = 0;
3045 s->shift_h[0] =
s->shift_h[3] = 0;
3046 s->shift_w[1] =
s->shift_w[2] =
s->desc->log2_chroma_w;
3047 s->shift_h[1] =
s->shift_h[2] =
s->desc->log2_chroma_h;
3051 switch (
s->filter) {
3054 case AFLAT:
s->size = 256 * 2;
break;
3055 case FLAT:
s->size = 256 * 3;
break;
3056 default:
s->size = 256;
break;
3059 switch (
s->filter | ((
s->bits > 8) << 4) |
3060 (
s->mode << 8) | (
s->mirror << 12)) {
3061 case 0x1100:
s->waveform_slice = lowpass_column_mirror;
break;
3062 case 0x1000:
s->waveform_slice = lowpass_row_mirror;
break;
3063 case 0x0100:
s->waveform_slice = lowpass_column;
break;
3064 case 0x0000:
s->waveform_slice = lowpass_row;
break;
3065 case 0x1110:
s->waveform_slice = lowpass16_column_mirror;
break;
3066 case 0x1010:
s->waveform_slice = lowpass16_row_mirror;
break;
3067 case 0x0110:
s->waveform_slice = lowpass16_column;
break;
3068 case 0x0010:
s->waveform_slice = lowpass16_row;
break;
3069 case 0x1101:
s->waveform_slice = flat_column_mirror;
break;
3070 case 0x1001:
s->waveform_slice = flat_row_mirror;
break;
3071 case 0x0101:
s->waveform_slice = flat_column;
break;
3072 case 0x0001:
s->waveform_slice = flat_row;
break;
3073 case 0x1111:
s->waveform_slice = flat16_column_mirror;
break;
3074 case 0x1011:
s->waveform_slice = flat16_row_mirror;
break;
3075 case 0x0111:
s->waveform_slice = flat16_column;
break;
3076 case 0x0011:
s->waveform_slice = flat16_row;
break;
3077 case 0x1102:
s->waveform_slice = aflat_column_mirror;
break;
3078 case 0x1002:
s->waveform_slice = aflat_row_mirror;
break;
3079 case 0x0102:
s->waveform_slice = aflat_column;
break;
3080 case 0x0002:
s->waveform_slice = aflat_row;
break;
3081 case 0x1112:
s->waveform_slice = aflat16_column_mirror;
break;
3082 case 0x1012:
s->waveform_slice = aflat16_row_mirror;
break;
3083 case 0x0112:
s->waveform_slice = aflat16_column;
break;
3084 case 0x0012:
s->waveform_slice = aflat16_row;
break;
3085 case 0x1103:
s->waveform_slice = chroma_column_mirror;
break;
3086 case 0x1003:
s->waveform_slice = chroma_row_mirror;
break;
3087 case 0x0103:
s->waveform_slice = chroma_column;
break;
3088 case 0x0003:
s->waveform_slice = chroma_row;
break;
3089 case 0x1113:
s->waveform_slice = chroma16_column_mirror;
break;
3090 case 0x1013:
s->waveform_slice = chroma16_row_mirror;
break;
3091 case 0x0113:
s->waveform_slice = chroma16_column;
break;
3092 case 0x0013:
s->waveform_slice = chroma16_row;
break;
3093 case 0x1104:
s->waveform_slice = color_column_mirror;
break;
3094 case 0x1004:
s->waveform_slice = color_row_mirror;
break;
3095 case 0x0104:
s->waveform_slice = color_column;
break;
3096 case 0x0004:
s->waveform_slice = color_row;
break;
3097 case 0x1114:
s->waveform_slice = color16_column_mirror;
break;
3098 case 0x1014:
s->waveform_slice = color16_row_mirror;
break;
3099 case 0x0114:
s->waveform_slice = color16_column;
break;
3100 case 0x0014:
s->waveform_slice = color16_row;
break;
3101 case 0x1105:
s->waveform_slice = acolor_column_mirror;
break;
3102 case 0x1005:
s->waveform_slice = acolor_row_mirror;
break;
3103 case 0x0105:
s->waveform_slice = acolor_column;
break;
3104 case 0x0005:
s->waveform_slice = acolor_row;
break;
3105 case 0x1115:
s->waveform_slice = acolor16_column_mirror;
break;
3106 case 0x1015:
s->waveform_slice = acolor16_row_mirror;
break;
3107 case 0x0115:
s->waveform_slice = acolor16_column;
break;
3108 case 0x0015:
s->waveform_slice = acolor16_row;
break;
3109 case 0x1106:
s->waveform_slice = xflat_column_mirror;
break;
3110 case 0x1006:
s->waveform_slice = xflat_row_mirror;
break;
3111 case 0x0106:
s->waveform_slice = xflat_column;
break;
3112 case 0x0006:
s->waveform_slice = xflat_row;
break;
3113 case 0x1116:
s->waveform_slice = xflat16_column_mirror;
break;
3114 case 0x1016:
s->waveform_slice = xflat16_row_mirror;
break;
3115 case 0x0116:
s->waveform_slice = xflat16_column;
break;
3116 case 0x0016:
s->waveform_slice = xflat16_row;
break;
3117 case 0x1107:
s->waveform_slice = yflat_column_mirror;
break;
3118 case 0x1007:
s->waveform_slice = yflat_row_mirror;
break;
3119 case 0x0107:
s->waveform_slice = yflat_column;
break;
3120 case 0x0007:
s->waveform_slice = yflat_row;
break;
3121 case 0x1117:
s->waveform_slice = yflat16_column_mirror;
break;
3122 case 0x1017:
s->waveform_slice = yflat16_row_mirror;
break;
3123 case 0x0117:
s->waveform_slice = yflat16_column;
break;
3124 case 0x0017:
s->waveform_slice = yflat16_row;
break;
3127 s->grat_yuva_color[0] = 255;
3128 s->grat_yuva_color[1] =
s->graticule ==
GRAT_INVERT ? 255 : 0;
3130 s->grat_yuva_color[3] = 255;
3146 switch (
s->filter) {
3157 else if (
s->graticule >
GRAT_NONE &&
s->mode == 0)
3162 switch (
s->filter) {
3281 s->size =
s->size << (
s->bits - 8);
3283 s->tint[0] = .5f * (
s->ftint[0] + 1.f) * (
s->size - 1);
3284 s->tint[1] = .5f * (
s->ftint[1] + 1.f) * (
s->size - 1);
3286 switch (
inlink->format) {
3299 s->bg_color[3] *=
s->bgopacity;
3311 for (
i = 0;
i <
s->ncomp;
i++) {
3312 if ((1 <<
i) &
s->pcomp)
3320 s->dcomp =
s->odesc->nb_components;
3338 for (p = 0; p <
s->ncomp; p++) {
3339 const int plane =
s->desc->comp[p].plane;
3342 if (!((1 << p) &
s->pcomp))
3345 for (k = 0; k < 4; k++) {
3346 s->emax[plane][k] =
s->peak +
size * (plane * 4 + k + 0);
3347 s->emin[plane][k] =
s->peak +
size * (plane * 4 + k + 16);
3352 s->eend[plane] = (
offset +
s->size - 1);
3354 for (k = 0; k < 4; k++) {
3355 s->emax[plane][k][
i] =
s->estart[plane];
3356 s->emin[plane][k][
i] =
s->eend[plane];
3382 for (k = 0; k <
s->dcomp; k++) {
3384 for (
i = 0;
i < outlink->
h ;
i++)
3385 memset(
out->data[
s->odesc->comp[k].plane] +
3386 i *
out->linesize[
s->odesc->comp[k].plane],
3387 s->bg_color[k], outlink->
w);
3389 const int mult =
s->max / 256;
3390 uint16_t *dst = (uint16_t *)
out->data[
s->odesc->comp[k].plane];
3392 for (
i = 0;
i < outlink->
h ;
i++) {
3393 for (j = 0; j < outlink->
w; j++)
3394 dst[j] =
s->bg_color[k] *
mult;
3395 dst +=
out->linesize[
s->odesc->comp[k].plane] / 2;
3400 for (k = 0,
i = 0; k <
s->ncomp; k++) {
3401 if ((1 << k) &
s->pcomp) {
3402 const int plane =
s->desc->comp[k].plane;
3408 offset_x =
s->mode ?
i++ *
inlink->w : 0;
3409 offset_y =
s->mode ? 0 :
i++ *
inlink->h;
3411 offset_y =
s->mode ?
i++ *
s->size * !!
s->display : 0;
3412 offset_x =
s->mode ? 0 :
i++ *
s->size * !!
s->display;
3418 td.offset_y = offset_y;
3419 td.offset_x = offset_x;
3421 switch (
s->filter) {
3432 envelope(
s,
out, plane, plane,
s->mode ? offset_x : offset_y);
3438 envelope(
s,
out, plane, plane,
s->mode ? offset_x : offset_y);
3439 envelope(
s,
out, plane, (plane + 1) %
s->ncomp,
s->mode ? offset_x : offset_y);
3442 envelope16(
s,
out, plane, (plane + 1) %
s->ncomp,
s->mode ? offset_x : offset_y);
3449 envelope(
s,
out, plane, (plane + 0) %
s->ncomp,
s->mode ? offset_x : offset_y);
3450 envelope(
s,
out, plane, (plane + 1) %
s->ncomp,
s->mode ? offset_x : offset_y);
3451 envelope(
s,
out, plane, (plane + 2) %
s->ncomp,
s->mode ? offset_x : offset_y);
3453 envelope16(
s,
out, plane, (plane + 0) %
s->ncomp,
s->mode ? offset_x : offset_y);
3454 envelope16(
s,
out, plane, (plane + 1) %
s->ncomp,
s->mode ? offset_x : offset_y);
3455 envelope16(
s,
out, plane, (plane + 2) %
s->ncomp,
s->mode ? offset_x : offset_y);
3461 s->graticulef(
s,
out);
3497 .priv_class = &waveform_class,