108 int jobnr,
int nb_jobs);
114 #define OFFSET(x) offsetof(WaveformContext, x)
115 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
338 else if (rgb && depth == 8 && ncomp > 2)
340 else if (rgb && depth == 9 && ncomp > 2)
342 else if (rgb && depth == 10 && ncomp > 2)
344 else if (rgb && depth == 12 && ncomp > 2)
346 else if (depth == 8 && ncomp > 2)
348 else if (depth == 9 && ncomp > 2)
350 else if (depth == 10 && ncomp > 2)
352 else if (depth == 12 && ncomp > 2)
364 const int dst_linesize = out->
linesize[component] / 2;
365 const int bg = s->
bg_color[component] * (s->
max / 256);
366 const int limit = s->
max - 1;
375 for (x = offset; x < offset + dst_w; x++) {
376 for (y = start; y <
end; y++) {
377 dst = (uint16_t *)out->
data[component] + y * dst_linesize + x;
383 for (y = end - 1; y >=
start; y--) {
384 dst = (uint16_t *)out->
data[component] + y * dst_linesize + x;
392 for (y = offset; y < offset + dst_h; y++) {
393 dst = (uint16_t *)out->
data[component] + y * dst_linesize;
394 for (x = start; x <
end; x++) {
400 for (x = end - 1; x >=
start; x--) {
412 const int dst_linesize = out->
linesize[component];
422 for (x = offset; x < offset + dst_w; x++) {
423 for (y = start; y <
end; y++) {
424 dst = out->
data[component] + y * dst_linesize + x;
430 for (y = end - 1; y >=
start; y--) {
431 dst = out->
data[component] + y * dst_linesize + x;
439 for (y = offset; y < offset + dst_h; y++) {
440 dst = out->
data[component] + y * dst_linesize;
441 for (x = start; x <
end; x++) {
447 for (x = end - 1; x >=
start; x--) {
459 const int dst_linesize = out->
linesize[component] / 2;
460 const int bg = s->
bg_color[component] * (s->
max / 256);
461 const int limit = s->
max - 1;
472 for (x = offset; x < offset + dst_w; x++) {
473 for (y = start; y < end && y < emin[x -
offset]; y++) {
474 dst = (uint16_t *)out->
data[component] + y * dst_linesize + x;
480 for (y = end - 1; y >= start && y >= emax[x -
offset]; y--) {
481 dst = (uint16_t *)out->
data[component] + y * dst_linesize + x;
492 for (x = offset; x < offset + dst_w; x++) {
493 dst = (uint16_t *)out->
data[component] + emin[x - offset] * dst_linesize + x;
495 dst = (uint16_t *)out->
data[component] + emax[x -
offset] * dst_linesize + x;
499 for (y = offset; y < offset + dst_h; y++) {
500 dst = (uint16_t *)out->
data[component] + y * dst_linesize;
501 for (x = start; x < end && x < emin[y -
offset]; x++) {
507 for (x = end - 1; x >= start && x >= emax[y -
offset]; x--) {
518 for (y = offset; y < offset + dst_h; y++) {
519 dst = (uint16_t *)out->
data[component] + y * dst_linesize + emin[y - offset];
521 dst = (uint16_t *)out->
data[component] + y * dst_linesize + emax[y -
offset];
529 const int dst_linesize = out->
linesize[component];
530 const int bg = s->
bg_color[component];
541 for (x = offset; x < offset + dst_w; x++) {
542 for (y = start; y < end && y < emin[x -
offset]; y++) {
543 dst = out->
data[component] + y * dst_linesize + x;
549 for (y = end - 1; y >= start && y >= emax[x -
offset]; y--) {
550 dst = out->
data[component] + y * dst_linesize + x;
561 for (x = offset; x < offset + dst_w; x++) {
562 dst = out->
data[component] + emin[x -
offset] * dst_linesize + x;
564 dst = out->
data[component] + emax[x -
offset] * dst_linesize + x;
568 for (y = offset; y < offset + dst_h; y++) {
569 dst = out->
data[component] + y * dst_linesize;
570 for (x = start; x < end && x < emin[y -
offset]; x++) {
576 for (x = end - 1; x >= start && x >= emax[y -
offset]; x--) {
587 for (y = offset; y < offset + dst_h; y++) {
588 dst = out->
data[component] + y * dst_linesize + emin[y -
offset];
590 dst = out->
data[component] + y * dst_linesize + emax[y -
offset];
636 if (*target - intensity > 0)
644 if (*target - intensity > 0)
653 int offset_y,
int offset_x,
655 int jobnr,
int nb_jobs)
662 const int dst_signed_linesize = dst_linesize * (mirror == 1 ? -1 : 1);
663 const int limit = s->
max - 1;
667 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
668 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
669 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
670 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
671 const int step = column ? 1 << shift_w : 1 <<
shift_h;
672 const uint16_t *src_data = (
const uint16_t *)in->
data[plane] + sliceh_start * src_linesize;
673 uint16_t *dst_data = (uint16_t *)out->
data[
plane] + (offset_y + sliceh_start * step) * dst_linesize + offset_x;
674 uint16_t *
const dst_bottom_line = dst_data + dst_linesize * (s->
size - 1);
675 uint16_t *
const dst_line = (mirror ? dst_bottom_line : dst_data);
679 if (!column && mirror)
682 for (y = sliceh_start; y < sliceh_end; y++) {
683 const uint16_t *src_data_end = src_data + slicew_end;
684 uint16_t *dst = dst_line + slicew_start * step;
686 for (p = src_data + slicew_start; p < src_data_end; p++) {
688 int i = 0, v =
FFMIN(*p, limit);
692 target = dst++ + dst_signed_linesize * v;
693 update16(target, max, intensity, limit);
694 }
while (++i < step);
696 uint16_t *row = dst_data;
699 target = row - v - 1;
702 update16(target, max, intensity, limit);
704 }
while (++i < step);
707 src_data += src_linesize;
708 dst_data += dst_linesize * step;
712 #define LOWPASS16_FUNC(name, column, mirror) \
713 static int lowpass16_##name(AVFilterContext *ctx, \
714 void *arg, int jobnr, \
717 WaveformContext *s = ctx->priv; \
718 ThreadData *td = arg; \
719 AVFrame *in = td->in; \
720 AVFrame *out = td->out; \
721 int component = td->component; \
722 int offset_y = td->offset_y; \
723 int offset_x = td->offset_x; \
725 lowpass16(s, in, out, component, s->intensity, \
726 offset_y, offset_x, column, mirror, \
740 int offset_y,
int offset_x,
742 int jobnr,
int nb_jobs)
744 const int plane = s->desc->comp[component].plane;
745 const int shift_w = s->shift_w[component];
746 const int shift_h = s->shift_h[component];
747 const int src_linesize = in->linesize[
plane];
748 const int dst_linesize = out->linesize[
plane];
749 const int dst_signed_linesize = dst_linesize * (mirror == 1 ? -1 : 1);
753 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
754 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
755 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
756 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
757 const int step = column ? 1 << shift_w : 1 <<
shift_h;
758 const uint8_t *src_data = in->data[
plane] + sliceh_start * src_linesize;
759 uint8_t *dst_data = out->data[
plane] + (offset_y + sliceh_start * step) * dst_linesize + offset_x;
760 uint8_t *
const dst_bottom_line = dst_data + dst_linesize * (s->size - 1);
761 uint8_t *
const dst_line = (mirror ? dst_bottom_line : dst_data);
765 if (!column && mirror)
768 for (y = sliceh_start; y < sliceh_end; y++) {
769 const uint8_t *src_data_end = src_data + slicew_end;
770 uint8_t *dst = dst_line + slicew_start * step;
772 for (p = src_data + slicew_start; p < src_data_end; p++) {
775 target = dst + dst_signed_linesize * *p;
777 update(target, max, intensity);
781 target = row - *p - 1;
784 update(target, max, intensity);
788 src_data += src_linesize;
789 dst_data += dst_linesize * step;
792 if (column && step > 1) {
793 const int dst_h = 256;
797 dst = out->data[
plane] + offset_y * dst_linesize + offset_x;
798 for (y = 0; y < dst_h; y++) {
799 for (x = slicew_start * step; x < slicew_end * step; x+=step) {
800 for (z = 1; z < step; z++) {
806 }
else if (step > 1) {
807 const int dst_w = 256;
811 dst = out->data[
plane] + (offset_y + sliceh_start * step) * dst_linesize + offset_x;
812 for (y = sliceh_start * step; y < sliceh_end * step; y+=step) {
813 for (z = 1; z < step; z++)
814 memcpy(dst + dst_linesize * z, dst, dst_w);
815 dst += dst_linesize * step;
820 #define LOWPASS_FUNC(name, column, mirror) \
821 static int lowpass_##name(AVFilterContext *ctx, \
822 void *arg, int jobnr, \
825 WaveformContext *s = ctx->priv; \
826 ThreadData *td = arg; \
827 AVFrame *in = td->in; \
828 AVFrame *out = td->out; \
829 int component = td->component; \
830 int offset_y = td->offset_y; \
831 int offset_x = td->offset_x; \
833 lowpass(s, in, out, component, s->intensity, \
834 offset_y, offset_x, column, mirror, \
848 int offset_y,
int offset_x,
850 int jobnr,
int nb_jobs)
852 const int plane = s->desc->comp[component].plane;
853 const int c0_linesize = in->linesize[ plane + 0 ] / 2;
854 const int c1_linesize = in->linesize[(plane + 1) % s->ncomp] / 2;
855 const int c2_linesize = in->linesize[(plane + 2) % s->ncomp] / 2;
856 const int c0_shift_w = s->shift_w[ component + 0 ];
857 const int c1_shift_w = s->shift_w[(component + 1) % s->ncomp];
858 const int c2_shift_w = s->shift_w[(component + 2) % s->ncomp];
859 const int c0_shift_h = s->shift_h[ component + 0 ];
860 const int c1_shift_h = s->shift_h[(component + 1) % s->ncomp];
861 const int c2_shift_h = s->shift_h[(component + 2) % s->ncomp];
862 const int d0_linesize = out->linesize[ plane + 0 ] / 2;
863 const int d1_linesize = out->linesize[(plane + 1) % s->ncomp] / 2;
864 const int limit = s->max - 1;
865 const int max = limit - intensity;
866 const int mid = s->max / 2;
867 const int src_h = in->height;
868 const int src_w = in->width;
869 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
870 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
871 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
872 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
876 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1);
877 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1);
879 for (x = slicew_start; x < slicew_end; x++) {
880 const uint16_t *c0_data = (uint16_t *)in->data[plane + 0];
881 const uint16_t *c1_data = (uint16_t *)in->data[(plane + 1) % s->ncomp];
882 const uint16_t *c2_data = (uint16_t *)in->data[(plane + 2) % s->ncomp];
883 uint16_t *d0_data = (uint16_t *)(out->data[
plane]) + offset_y * d0_linesize + offset_x;
884 uint16_t *d1_data = (uint16_t *)(out->data[(plane + 1) % s->ncomp]) + offset_y * d1_linesize + offset_x;
885 uint16_t *
const d0_bottom_line = d0_data + d0_linesize * (s->size - 1);
886 uint16_t *
const d0 = (mirror ? d0_bottom_line : d0_data);
887 uint16_t *
const d1_bottom_line = d1_data + d1_linesize * (s->size - 1);
888 uint16_t *
const d1 = (mirror ? d1_bottom_line : d1_data);
890 for (y = 0; y < src_h; y++) {
891 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit) + s->max;
892 const int c1 =
FFMIN(
FFABS(c1_data[x >> c1_shift_w] - mid) +
FFABS(c2_data[x >> c2_shift_w] - mid), limit);
895 target = d0 + x + d0_signed_linesize * c0;
897 target = d1 + x + d1_signed_linesize * (c0 -
c1);
899 target = d1 + x + d1_signed_linesize * (c0 +
c1);
902 if (!c0_shift_h || (y & c0_shift_h))
903 c0_data += c0_linesize;
904 if (!c1_shift_h || (y & c1_shift_h))
905 c1_data += c1_linesize;
906 if (!c2_shift_h || (y & c2_shift_h))
907 c2_data += c2_linesize;
908 d0_data += d0_linesize;
909 d1_data += d1_linesize;
913 const uint16_t *c0_data = (uint16_t *)(in->data[plane]) + (sliceh_start >> c0_shift_h) * c0_linesize;
914 const uint16_t *c1_data = (uint16_t *)(in->data[(plane + 1) % s->ncomp]) + (sliceh_start >> c1_shift_h) * c1_linesize;
915 const uint16_t *c2_data = (uint16_t *)(in->data[(plane + 2) % s->ncomp]) + (sliceh_start >> c2_shift_h) * c2_linesize;
916 uint16_t *d0_data = (uint16_t *)(out->data[plane]) + (offset_y + sliceh_start) * d0_linesize + offset_x;
917 uint16_t *d1_data = (uint16_t *)(out->data[(plane + 1) % s->ncomp]) + (offset_y + sliceh_start) * d1_linesize + offset_x;
920 d0_data += s->size - 1;
921 d1_data += s->size - 1;
924 for (y = sliceh_start; y < sliceh_end; y++) {
925 for (x = 0; x < src_w; x++) {
926 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit) + s->max;
927 const int c1 =
FFMIN(
FFABS(c1_data[x >> c1_shift_w] - mid) +
FFABS(c2_data[x >> c2_shift_w] - mid), limit);
931 target = d0_data - c0;
933 target = d1_data - (c0 -
c1);
935 target = d1_data - (c0 +
c1);
938 target = d0_data + c0;
940 target = d1_data + (c0 -
c1);
942 target = d1_data + (c0 +
c1);
947 if (!c0_shift_h || (y & c0_shift_h))
948 c0_data += c0_linesize;
949 if (!c1_shift_h || (y & c1_shift_h))
950 c1_data += c1_linesize;
951 if (!c2_shift_h || (y & c2_shift_h))
952 c2_data += c2_linesize;
953 d0_data += d0_linesize;
954 d1_data += d1_linesize;
959 #define FLAT16_FUNC(name, column, mirror) \
960 static int flat16_##name(AVFilterContext *ctx, \
961 void *arg, int jobnr, \
964 WaveformContext *s = ctx->priv; \
965 ThreadData *td = arg; \
966 AVFrame *in = td->in; \
967 AVFrame *out = td->out; \
968 int component = td->component; \
969 int offset_y = td->offset_y; \
970 int offset_x = td->offset_x; \
972 flat16(s, in, out, component, s->intensity, \
973 offset_y, offset_x, column, mirror, \
987 int offset_y,
int offset_x,
989 int jobnr,
int nb_jobs)
991 const int plane = s->desc->comp[component].plane;
992 const int c0_linesize = in->linesize[ plane + 0 ];
993 const int c1_linesize = in->linesize[(plane + 1) % s->ncomp];
994 const int c2_linesize = in->linesize[(plane + 2) % s->ncomp];
995 const int c0_shift_w = s->shift_w[ component + 0 ];
996 const int c1_shift_w = s->shift_w[(component + 1) % s->ncomp];
997 const int c2_shift_w = s->shift_w[(component + 2) % s->ncomp];
998 const int c0_shift_h = s->shift_h[ component + 0 ];
999 const int c1_shift_h = s->shift_h[(component + 1) % s->ncomp];
1000 const int c2_shift_h = s->shift_h[(component + 2) % s->ncomp];
1001 const int d0_linesize = out->linesize[ plane + 0 ];
1002 const int d1_linesize = out->linesize[(plane + 1) % s->ncomp];
1003 const int max = 255 - intensity;
1004 const int src_h = in->height;
1005 const int src_w = in->width;
1006 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
1007 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
1008 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
1009 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
1013 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1);
1014 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1);
1016 for (x = slicew_start; x < slicew_end; x++) {
1017 const uint8_t *c0_data = in->data[plane + 0];
1018 const uint8_t *c1_data = in->data[(plane + 1) % s->ncomp];
1019 const uint8_t *c2_data = in->data[(plane + 2) % s->ncomp];
1020 uint8_t *d0_data = out->data[
plane] + offset_y * d0_linesize + offset_x;
1021 uint8_t *d1_data = out->data[(plane + 1) % s->ncomp] + offset_y * d1_linesize + offset_x;
1022 uint8_t *
const d0_bottom_line = d0_data + d0_linesize * (s->size - 1);
1023 uint8_t *
const d0 = (mirror ? d0_bottom_line : d0_data);
1024 uint8_t *
const d1_bottom_line = d1_data + d1_linesize * (s->size - 1);
1025 uint8_t *
const d1 = (mirror ? d1_bottom_line : d1_data);
1027 for (y = 0; y < src_h; y++) {
1028 const int c0 = c0_data[x >> c0_shift_w] + 256;
1029 const int c1 =
FFABS(c1_data[x >> c1_shift_w] - 128) +
FFABS(c2_data[x >> c2_shift_w] - 128);
1032 target = d0 + x + d0_signed_linesize * c0;
1034 target = d1 + x + d1_signed_linesize * (c0 -
c1);
1036 target = d1 + x + d1_signed_linesize * (c0 +
c1);
1039 if (!c0_shift_h || (y & c0_shift_h))
1040 c0_data += c0_linesize;
1041 if (!c1_shift_h || (y & c1_shift_h))
1042 c1_data += c1_linesize;
1043 if (!c2_shift_h || (y & c2_shift_h))
1044 c2_data += c2_linesize;
1045 d0_data += d0_linesize;
1046 d1_data += d1_linesize;
1050 const uint8_t *c0_data = in->data[
plane] + (sliceh_start >> c0_shift_h) * c0_linesize;
1051 const uint8_t *c1_data = in->data[(plane + 1) % s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize;
1052 const uint8_t *c2_data = in->data[(plane + 2) % s->ncomp] + (sliceh_start >> c2_shift_h) * c2_linesize;
1053 uint8_t *d0_data = out->data[
plane] + (offset_y + sliceh_start) * d0_linesize + offset_x;
1054 uint8_t *d1_data = out->data[(plane + 1) % s->ncomp] + (offset_y + sliceh_start) * d1_linesize + offset_x;
1057 d0_data += s->size - 1;
1058 d1_data += s->size - 1;
1061 for (y = sliceh_start; y < sliceh_end; y++) {
1062 for (x = 0; x < src_w; x++) {
1063 const int c0 = c0_data[x >> c0_shift_w] + 256;
1064 const int c1 =
FFABS(c1_data[x >> c1_shift_w] - 128) +
FFABS(c2_data[x >> c2_shift_w] - 128);
1068 target = d0_data - c0;
1070 target = d1_data - (c0 -
c1);
1072 target = d1_data - (c0 +
c1);
1075 target = d0_data + c0;
1077 target = d1_data + (c0 -
c1);
1079 target = d1_data + (c0 +
c1);
1084 if (!c0_shift_h || (y & c0_shift_h))
1085 c0_data += c0_linesize;
1086 if (!c1_shift_h || (y & c1_shift_h))
1087 c1_data += c1_linesize;
1088 if (!c2_shift_h || (y & c2_shift_h))
1089 c2_data += c2_linesize;
1090 d0_data += d0_linesize;
1091 d1_data += d1_linesize;
1096 #define FLAT_FUNC(name, column, mirror) \
1097 static int flat_##name(AVFilterContext *ctx, \
1098 void *arg, int jobnr, \
1101 WaveformContext *s = ctx->priv; \
1102 ThreadData *td = arg; \
1103 AVFrame *in = td->in; \
1104 AVFrame *out = td->out; \
1105 int component = td->component; \
1106 int offset_y = td->offset_y; \
1107 int offset_x = td->offset_x; \
1109 flat(s, in, out, component, s->intensity, \
1110 offset_y, offset_x, column, mirror, \
1121 #define AFLAT16(name, update_cr, column, mirror) \
1122 static int name(AVFilterContext *ctx, \
1123 void *arg, int jobnr, \
1126 WaveformContext *s = ctx->priv; \
1127 ThreadData *td = arg; \
1128 AVFrame *in = td->in; \
1129 AVFrame *out = td->out; \
1130 int component = td->component; \
1131 int offset_y = td->offset_y; \
1132 int offset_x = td->offset_x; \
1133 const int intensity = s->intensity; \
1134 const int plane = s->desc->comp[component].plane; \
1135 const int c0_linesize = in->linesize[ plane + 0 ] / 2; \
1136 const int c1_linesize = in->linesize[(plane + 1) % s->ncomp] / 2; \
1137 const int c2_linesize = in->linesize[(plane + 2) % s->ncomp] / 2; \
1138 const int c0_shift_w = s->shift_w[ component + 0 ]; \
1139 const int c1_shift_w = s->shift_w[(component + 1) % s->ncomp]; \
1140 const int c2_shift_w = s->shift_w[(component + 2) % s->ncomp]; \
1141 const int c0_shift_h = s->shift_h[ component + 0 ]; \
1142 const int c1_shift_h = s->shift_h[(component + 1) % s->ncomp]; \
1143 const int c2_shift_h = s->shift_h[(component + 2) % s->ncomp]; \
1144 const int d0_linesize = out->linesize[ plane + 0 ] / 2; \
1145 const int d1_linesize = out->linesize[(plane + 1) % s->ncomp] / 2; \
1146 const int d2_linesize = out->linesize[(plane + 2) % s->ncomp] / 2; \
1147 const int limit = s->max - 1; \
1148 const int max = limit - intensity; \
1149 const int mid = s->max / 2; \
1150 const int src_h = in->height; \
1151 const int src_w = in->width; \
1152 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0; \
1153 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h; \
1154 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0; \
1155 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w; \
1159 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1); \
1160 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1); \
1161 const int d2_signed_linesize = d2_linesize * (mirror == 1 ? -1 : 1); \
1163 for (x = slicew_start; x < slicew_end; x++) { \
1164 const uint16_t *c0_data = (uint16_t *)in->data[plane + 0]; \
1165 const uint16_t *c1_data = (uint16_t *)in->data[(plane + 1) % s->ncomp]; \
1166 const uint16_t *c2_data = (uint16_t *)in->data[(plane + 2) % s->ncomp]; \
1167 uint16_t *d0_data = (uint16_t *)out->data[plane] + offset_y * d0_linesize + offset_x; \
1168 uint16_t *d1_data = (uint16_t *)out->data[(plane + 1) % s->ncomp] + offset_y * d1_linesize + offset_x; \
1169 uint16_t *d2_data = (uint16_t *)out->data[(plane + 2) % s->ncomp] + offset_y * d2_linesize + offset_x; \
1170 uint16_t * const d0_bottom_line = d0_data + d0_linesize * (s->size - 1); \
1171 uint16_t * const d0 = (mirror ? d0_bottom_line : d0_data); \
1172 uint16_t * const d1_bottom_line = d1_data + d1_linesize * (s->size - 1); \
1173 uint16_t * const d1 = (mirror ? d1_bottom_line : d1_data); \
1174 uint16_t * const d2_bottom_line = d2_data + d2_linesize * (s->size - 1); \
1175 uint16_t * const d2 = (mirror ? d2_bottom_line : d2_data); \
1177 for (y = 0; y < src_h; y++) { \
1178 const int c0 = FFMIN(c0_data[x >> c0_shift_w], limit) + mid; \
1179 const int c1 = FFMIN(c1_data[x >> c1_shift_w], limit) - mid; \
1180 const int c2 = FFMIN(c2_data[x >> c2_shift_w], limit) - mid; \
1183 target = d0 + x + d0_signed_linesize * c0; \
1184 update16(target, max, intensity, limit); \
1186 target = d1 + x + d1_signed_linesize * (c0 + c1); \
1187 update16(target, max, intensity, limit); \
1189 target = d2 + x + d2_signed_linesize * (c0 + c2); \
1190 update_cr(target, max, intensity, limit); \
1192 if (!c0_shift_h || (y & c0_shift_h)) \
1193 c0_data += c0_linesize; \
1194 if (!c1_shift_h || (y & c1_shift_h)) \
1195 c1_data += c1_linesize; \
1196 if (!c2_shift_h || (y & c2_shift_h)) \
1197 c2_data += c2_linesize; \
1198 d0_data += d0_linesize; \
1199 d1_data += d1_linesize; \
1200 d2_data += d2_linesize; \
1204 const uint16_t *c0_data = (uint16_t *)in->data[plane] + (sliceh_start >> c0_shift_h) * c0_linesize; \
1205 const uint16_t *c1_data = (uint16_t *)in->data[(plane + 1) % s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize; \
1206 const uint16_t *c2_data = (uint16_t *)in->data[(plane + 2) % s->ncomp] + (sliceh_start >> c2_shift_h) * c2_linesize; \
1207 uint16_t *d0_data = (uint16_t *)out->data[plane] + (offset_y + sliceh_start) * d0_linesize + offset_x; \
1208 uint16_t *d1_data = (uint16_t *)out->data[(plane + 1) % s->ncomp] + (offset_y + sliceh_start) * d1_linesize + offset_x; \
1209 uint16_t *d2_data = (uint16_t *)out->data[(plane + 2) % s->ncomp] + (offset_y + sliceh_start) * d2_linesize + offset_x; \
1212 d0_data += s->size - 1; \
1213 d1_data += s->size - 1; \
1214 d2_data += s->size - 1; \
1217 for (y = sliceh_start; y < sliceh_end; y++) { \
1218 for (x = 0; x < src_w; x++) { \
1219 const int c0 = FFMIN(c0_data[x >> c0_shift_w], limit) + mid; \
1220 const int c1 = FFMIN(c1_data[x >> c1_shift_w], limit) - mid; \
1221 const int c2 = FFMIN(c2_data[x >> c2_shift_w], limit) - mid; \
1225 target = d0_data - c0; \
1226 update16(target, max, intensity, limit); \
1227 target = d1_data - (c0 + c1); \
1228 update16(target, max, intensity, limit); \
1229 target = d2_data - (c0 + c2); \
1230 update_cr(target, max, intensity, limit); \
1232 target = d0_data + c0; \
1233 update16(target, max, intensity, limit); \
1234 target = d1_data + (c0 + c1); \
1235 update16(target, max, intensity, limit); \
1236 target = d2_data + (c0 + c2); \
1237 update_cr(target, max, intensity, limit); \
1241 if (!c0_shift_h || (y & c0_shift_h)) \
1242 c0_data += c0_linesize; \
1243 if (!c1_shift_h || (y & c1_shift_h)) \
1244 c1_data += c1_linesize; \
1245 if (!c2_shift_h || (y & c2_shift_h)) \
1246 c2_data += c2_linesize; \
1247 d0_data += d0_linesize; \
1248 d1_data += d1_linesize; \
1249 d2_data += d2_linesize; \
1255 #define AFLAT(name, update_cr, column, mirror) \
1256 static int name(AVFilterContext *ctx, \
1257 void *arg, int jobnr, \
1260 WaveformContext *s = ctx->priv; \
1261 ThreadData *td = arg; \
1262 AVFrame *in = td->in; \
1263 AVFrame *out = td->out; \
1264 int component = td->component; \
1265 int offset_y = td->offset_y; \
1266 int offset_x = td->offset_x; \
1267 const int src_h = in->height; \
1268 const int src_w = in->width; \
1269 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0; \
1270 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h; \
1271 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0; \
1272 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w; \
1273 const int intensity = s->intensity; \
1274 const int plane = s->desc->comp[component].plane; \
1275 const int c0_linesize = in->linesize[ plane + 0 ]; \
1276 const int c1_linesize = in->linesize[(plane + 1) % s->ncomp]; \
1277 const int c2_linesize = in->linesize[(plane + 2) % s->ncomp]; \
1278 const int c0_shift_w = s->shift_w[ component + 0 ]; \
1279 const int c1_shift_w = s->shift_w[(component + 1) % s->ncomp]; \
1280 const int c2_shift_w = s->shift_w[(component + 2) % s->ncomp]; \
1281 const int c0_shift_h = s->shift_h[ component + 0 ]; \
1282 const int c1_shift_h = s->shift_h[(component + 1) % s->ncomp]; \
1283 const int c2_shift_h = s->shift_h[(component + 2) % s->ncomp]; \
1284 const int d0_linesize = out->linesize[ plane + 0 ]; \
1285 const int d1_linesize = out->linesize[(plane + 1) % s->ncomp]; \
1286 const int d2_linesize = out->linesize[(plane + 2) % s->ncomp]; \
1287 const int max = 255 - intensity; \
1291 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1); \
1292 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1); \
1293 const int d2_signed_linesize = d2_linesize * (mirror == 1 ? -1 : 1); \
1295 for (x = slicew_start; x < slicew_end; x++) { \
1296 const uint8_t *c0_data = in->data[plane + 0]; \
1297 const uint8_t *c1_data = in->data[(plane + 1) % s->ncomp]; \
1298 const uint8_t *c2_data = in->data[(plane + 2) % s->ncomp]; \
1299 uint8_t *d0_data = out->data[plane] + offset_y * d0_linesize + offset_x; \
1300 uint8_t *d1_data = out->data[(plane + 1) % s->ncomp] + offset_y * d1_linesize + offset_x; \
1301 uint8_t *d2_data = out->data[(plane + 2) % s->ncomp] + offset_y * d2_linesize + offset_x; \
1302 uint8_t * const d0_bottom_line = d0_data + d0_linesize * (s->size - 1); \
1303 uint8_t * const d0 = (mirror ? d0_bottom_line : d0_data); \
1304 uint8_t * const d1_bottom_line = d1_data + d1_linesize * (s->size - 1); \
1305 uint8_t * const d1 = (mirror ? d1_bottom_line : d1_data); \
1306 uint8_t * const d2_bottom_line = d2_data + d2_linesize * (s->size - 1); \
1307 uint8_t * const d2 = (mirror ? d2_bottom_line : d2_data); \
1309 for (y = 0; y < src_h; y++) { \
1310 const int c0 = c0_data[x >> c0_shift_w] + 128; \
1311 const int c1 = c1_data[x >> c1_shift_w] - 128; \
1312 const int c2 = c2_data[x >> c2_shift_w] - 128; \
1315 target = d0 + x + d0_signed_linesize * c0; \
1316 update(target, max, intensity); \
1318 target = d1 + x + d1_signed_linesize * (c0 + c1); \
1319 update(target, max, intensity); \
1321 target = d2 + x + d2_signed_linesize * (c0 + c2); \
1322 update_cr(target, max, intensity); \
1324 if (!c0_shift_h || (y & c0_shift_h)) \
1325 c0_data += c0_linesize; \
1326 if (!c1_shift_h || (y & c1_shift_h)) \
1327 c1_data += c1_linesize; \
1328 if (!c1_shift_h || (y & c1_shift_h)) \
1329 c2_data += c1_linesize; \
1330 d0_data += d0_linesize; \
1331 d1_data += d1_linesize; \
1332 d2_data += d2_linesize; \
1336 const uint8_t *c0_data = in->data[plane] + (sliceh_start >> c0_shift_h) * c0_linesize; \
1337 const uint8_t *c1_data = in->data[(plane + 1) % s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize; \
1338 const uint8_t *c2_data = in->data[(plane + 2) % s->ncomp] + (sliceh_start >> c2_shift_h) * c2_linesize; \
1339 uint8_t *d0_data = out->data[plane] + (offset_y + sliceh_start) * d0_linesize + offset_x; \
1340 uint8_t *d1_data = out->data[(plane + 1) % s->ncomp] + (offset_y + sliceh_start) * d1_linesize + offset_x; \
1341 uint8_t *d2_data = out->data[(plane + 2) % s->ncomp] + (offset_y + sliceh_start) * d2_linesize + offset_x; \
1344 d0_data += s->size - 1; \
1345 d1_data += s->size - 1; \
1346 d2_data += s->size - 1; \
1349 for (y = sliceh_start; y < sliceh_end; y++) { \
1350 for (x = 0; x < src_w; x++) { \
1351 const int c0 = c0_data[x >> c0_shift_w] + 128; \
1352 const int c1 = c1_data[x >> c1_shift_w] - 128; \
1353 const int c2 = c2_data[x >> c2_shift_w] - 128; \
1357 target = d0_data - c0; \
1358 update(target, max, intensity); \
1359 target = d1_data - (c0 + c1); \
1360 update(target, max, intensity); \
1361 target = d2_data - (c0 + c2); \
1362 update_cr(target, max, intensity); \
1364 target = d0_data + c0; \
1365 update(target, max, intensity); \
1366 target = d1_data + (c0 + c1); \
1367 update(target, max, intensity); \
1368 target = d2_data + (c0 + c2); \
1369 update_cr(target, max, intensity); \
1373 if (!c0_shift_h || (y & c0_shift_h)) \
1374 c0_data += c0_linesize; \
1375 if (!c1_shift_h || (y & c1_shift_h)) \
1376 c1_data += c1_linesize; \
1377 if (!c2_shift_h || (y & c2_shift_h)) \
1378 c2_data += c2_linesize; \
1379 d0_data += d0_linesize; \
1380 d1_data += d1_linesize; \
1381 d2_data += d2_linesize; \
1389 AFLAT16(aflat16_column, update16, 1, 0)
1390 AFLAT16(aflat16_column_mirror, update16, 1, 1)
1392 AFLAT16(xflat16_row_mirror, update16_cr, 0, 1)
1393 AFLAT16(xflat16_column, update16_cr, 1, 0)
1394 AFLAT16(xflat16_column_mirror, update16_cr, 1, 1)
1397 AFLAT(aflat_row_mirror, update, 0, 1)
1398 AFLAT(aflat_column, update, 1, 0)
1399 AFLAT(aflat_column_mirror, update, 1, 1)
1401 AFLAT(xflat_row_mirror, update_cr, 0, 1)
1402 AFLAT(xflat_column, update_cr, 1, 0)
1403 AFLAT(xflat_column_mirror, update_cr, 1, 1)
1408 int offset_y,
int offset_x,
1410 int jobnr,
int nb_jobs)
1412 const int plane = s->desc->comp[component].plane;
1413 const int c0_linesize = in->linesize[(plane + 1) % s->ncomp] / 2;
1414 const int c1_linesize = in->linesize[(plane + 2) % s->ncomp] / 2;
1415 const int dst_linesize = out->linesize[
plane] / 2;
1416 const int limit = s->max - 1;
1418 const int mid = s->max / 2;
1419 const int c0_shift_w = s->shift_w[(component + 1) % s->ncomp];
1420 const int c1_shift_w = s->shift_w[(component + 2) % s->ncomp];
1421 const int c0_shift_h = s->shift_h[(component + 1) % s->ncomp];
1422 const int c1_shift_h = s->shift_h[(component + 2) % s->ncomp];
1423 const int src_h = in->height;
1424 const int src_w = in->width;
1425 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
1426 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
1427 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
1428 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
1432 const int dst_signed_linesize = dst_linesize * (mirror == 1 ? -1 : 1);
1434 for (x = slicew_start; x < slicew_end; x++) {
1435 const uint16_t *c0_data = (uint16_t *)in->data[(plane + 1) % s->ncomp];
1436 const uint16_t *c1_data = (uint16_t *)in->data[(plane + 2) % s->ncomp];
1437 uint16_t *dst_data = (uint16_t *)out->data[plane] + offset_y * dst_linesize + offset_x;
1438 uint16_t *
const dst_bottom_line = dst_data + dst_linesize * (s->size - 1);
1439 uint16_t *
const dst_line = (mirror ? dst_bottom_line : dst_data);
1440 uint16_t *dst = dst_line;
1442 for (y = 0; y < src_h; y++) {
1443 const int sum =
FFMIN(
FFABS(c0_data[x >> c0_shift_w] - mid) +
FFABS(c1_data[x >> c1_shift_w] - mid - 1), limit);
1446 target = dst + x + dst_signed_linesize * sum;
1447 update16(target, max, intensity, limit);
1449 if (!c0_shift_h || (y & c0_shift_h))
1450 c0_data += c0_linesize;
1451 if (!c1_shift_h || (y & c1_shift_h))
1452 c1_data += c1_linesize;
1453 dst_data += dst_linesize;
1457 const uint16_t *c0_data = (uint16_t *)in->data[(plane + 1) % s->ncomp] + (sliceh_start >> c0_shift_h) * c0_linesize;
1458 const uint16_t *c1_data = (uint16_t *)in->data[(plane + 2) % s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize;
1459 uint16_t *dst_data = (uint16_t *)out->data[plane] + (offset_y + sliceh_start) * dst_linesize + offset_x;
1462 dst_data += s->size - 1;
1463 for (y = sliceh_start; y < sliceh_end; y++) {
1464 for (x = 0; x < src_w; x++) {
1465 const int sum =
FFMIN(
FFABS(c0_data[x >> c0_shift_w] - mid) +
FFABS(c1_data[x >> c1_shift_w] - mid - 1), limit);
1469 target = dst_data - sum;
1470 update16(target, max, intensity, limit);
1472 target = dst_data + sum;
1473 update16(target, max, intensity, limit);
1477 if (!c0_shift_h || (y & c0_shift_h))
1478 c0_data += c0_linesize;
1479 if (!c1_shift_h || (y & c1_shift_h))
1480 c1_data += c1_linesize;
1481 dst_data += dst_linesize;
1486 #define CHROMA16_FUNC(name, column, mirror) \
1487 static int chroma16_##name(AVFilterContext *ctx, \
1488 void *arg, int jobnr, \
1491 WaveformContext *s = ctx->priv; \
1492 ThreadData *td = arg; \
1493 AVFrame *in = td->in; \
1494 AVFrame *out = td->out; \
1495 int component = td->component; \
1496 int offset_y = td->offset_y; \
1497 int offset_x = td->offset_x; \
1499 chroma16(s, in, out, component, s->intensity,\
1500 offset_y, offset_x, column, mirror, \
1514 int offset_y,
int offset_x,
1516 int jobnr,
int nb_jobs)
1518 const int plane = s->desc->comp[component].plane;
1519 const int src_h = in->height;
1520 const int src_w = in->width;
1521 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
1522 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
1523 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
1524 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
1525 const int c0_linesize = in->linesize[(plane + 1) % s->ncomp];
1526 const int c1_linesize = in->linesize[(plane + 2) % s->ncomp];
1527 const int dst_linesize = out->linesize[
plane];
1529 const int c0_shift_w = s->shift_w[(component + 1) % s->ncomp];
1530 const int c1_shift_w = s->shift_w[(component + 2) % s->ncomp];
1531 const int c0_shift_h = s->shift_h[(component + 1) % s->ncomp];
1532 const int c1_shift_h = s->shift_h[(component + 2) % s->ncomp];
1536 const int dst_signed_linesize = dst_linesize * (mirror == 1 ? -1 : 1);
1538 for (x = slicew_start; x < slicew_end; x++) {
1539 const uint8_t *c0_data = in->data[(plane + 1) % s->ncomp];
1540 const uint8_t *c1_data = in->data[(plane + 2) % s->ncomp];
1541 uint8_t *dst_data = out->data[
plane] + offset_y * dst_linesize + offset_x;
1542 uint8_t *
const dst_bottom_line = dst_data + dst_linesize * (s->size - 1);
1543 uint8_t *
const dst_line = (mirror ? dst_bottom_line : dst_data);
1546 for (y = 0; y < src_h; y++) {
1547 const int sum =
FFABS(c0_data[x >> c0_shift_w] - 128) +
FFABS(c1_data[x >> c1_shift_w] - 127);
1550 target = dst + x + dst_signed_linesize * sum;
1551 update(target, max, intensity);
1553 if (!c0_shift_h || (y & c0_shift_h))
1554 c0_data += c0_linesize;
1555 if (!c1_shift_h || (y & c1_shift_h))
1556 c1_data += c1_linesize;
1557 dst_data += dst_linesize;
1561 const uint8_t *c0_data = in->data[(plane + 1) % s->ncomp] + (sliceh_start >> c0_shift_h) * c0_linesize;
1562 const uint8_t *c1_data = in->data[(plane + 2) % s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize;
1563 uint8_t *dst_data = out->data[
plane] + (offset_y + sliceh_start) * dst_linesize + offset_x;
1566 dst_data += s->size - 1;
1567 for (y = sliceh_start; y < sliceh_end; y++) {
1568 for (x = 0; x < src_w; x++) {
1569 const int sum =
FFABS(c0_data[x >> c0_shift_w] - 128) +
FFABS(c1_data[x >> c1_shift_w] - 127);
1573 target = dst_data - sum;
1574 update(target, max, intensity);
1576 target = dst_data + sum;
1577 update(target, max, intensity);
1581 if (!c0_shift_h || (y & c0_shift_h))
1582 c0_data += c0_linesize;
1583 if (!c1_shift_h || (y & c1_shift_h))
1584 c1_data += c1_linesize;
1585 dst_data += dst_linesize;
1590 #define CHROMA_FUNC(name, column, mirror) \
1591 static int chroma_##name(AVFilterContext *ctx, \
1592 void *arg, int jobnr, \
1595 WaveformContext *s = ctx->priv; \
1596 ThreadData *td = arg; \
1597 AVFrame *in = td->in; \
1598 AVFrame *out = td->out; \
1599 int component = td->component; \
1600 int offset_y = td->offset_y; \
1601 int offset_x = td->offset_x; \
1603 chroma(s, in, out, component, s->intensity, \
1604 offset_y, offset_x, column, mirror, \
1618 int offset_y,
int offset_x,
1620 int jobnr,
int nb_jobs)
1622 const int plane = s->desc->comp[component].plane;
1623 const int limit = s->max - 1;
1624 const int src_h = in->height;
1625 const int src_w = in->width;
1626 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
1627 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
1628 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
1629 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
1630 const int c0_linesize = in->linesize[ plane + 0 ] / 2;
1631 const int c1_linesize = in->linesize[(plane + 1) % s->ncomp] / 2;
1632 const int c2_linesize = in->linesize[(plane + 2) % s->ncomp] / 2;
1633 const int c0_shift_h = s->shift_h[ component + 0 ];
1634 const int c1_shift_h = s->shift_h[(component + 1) % s->ncomp];
1635 const int c2_shift_h = s->shift_h[(component + 2) % s->ncomp];
1636 const uint16_t *c0_data = (
const uint16_t *)in->data[plane + 0] + (sliceh_start >> c0_shift_h) * c0_linesize;
1637 const uint16_t *c1_data = (
const uint16_t *)in->data[(plane + 1) % s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize;
1638 const uint16_t *c2_data = (
const uint16_t *)in->data[(plane + 2) % s->ncomp] + (sliceh_start >> c2_shift_h) * c2_linesize;
1639 const int d0_linesize = out->linesize[ plane + 0 ] / 2;
1640 const int d1_linesize = out->linesize[(plane + 1) % s->ncomp] / 2;
1641 const int d2_linesize = out->linesize[(plane + 2) % s->ncomp] / 2;
1642 const int c0_shift_w = s->shift_w[ component + 0 ];
1643 const int c1_shift_w = s->shift_w[(component + 1) % s->ncomp];
1644 const int c2_shift_w = s->shift_w[(component + 2) % s->ncomp];
1648 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1);
1649 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1);
1650 const int d2_signed_linesize = d2_linesize * (mirror == 1 ? -1 : 1);
1651 uint16_t *d0_data = (uint16_t *)out->data[plane] + offset_y * d0_linesize + offset_x;
1652 uint16_t *d1_data = (uint16_t *)out->data[(plane + 1) % s->ncomp] + offset_y * d1_linesize + offset_x;
1653 uint16_t *d2_data = (uint16_t *)out->data[(plane + 2) % s->ncomp] + offset_y * d2_linesize + offset_x;
1654 uint16_t *
const d0_bottom_line = d0_data + d0_linesize * (s->size - 1);
1655 uint16_t *
const d0 = (mirror ? d0_bottom_line : d0_data);
1656 uint16_t *
const d1_bottom_line = d1_data + d1_linesize * (s->size - 1);
1657 uint16_t *
const d1 = (mirror ? d1_bottom_line : d1_data);
1658 uint16_t *
const d2_bottom_line = d2_data + d2_linesize * (s->size - 1);
1659 uint16_t *
const d2 = (mirror ? d2_bottom_line : d2_data);
1661 for (y = 0; y < src_h; y++) {
1662 for (x = slicew_start; x < slicew_end; x++) {
1663 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit);
1664 const int c1 = c1_data[x >> c1_shift_w];
1665 const int c2 = c2_data[x >> c2_shift_w];
1667 *(d0 + d0_signed_linesize * c0 + x) = c0;
1668 *(d1 + d1_signed_linesize * c0 + x) = c1;
1669 *(d2 + d2_signed_linesize * c0 + x) = c2;
1672 if (!c0_shift_h || (y & c0_shift_h))
1673 c0_data += c0_linesize;
1674 if (!c1_shift_h || (y & c1_shift_h))
1675 c1_data += c1_linesize;
1676 if (!c2_shift_h || (y & c2_shift_h))
1677 c2_data += c2_linesize;
1678 d0_data += d0_linesize;
1679 d1_data += d1_linesize;
1680 d2_data += d2_linesize;
1683 uint16_t *d0_data = (uint16_t *)out->data[plane] + (offset_y + sliceh_start) * d0_linesize + offset_x;
1684 uint16_t *d1_data = (uint16_t *)out->data[(plane + 1) % s->ncomp] + (offset_y + sliceh_start) * d1_linesize + offset_x;
1685 uint16_t *d2_data = (uint16_t *)out->data[(plane + 2) % s->ncomp] + (offset_y + sliceh_start) * d2_linesize + offset_x;
1688 d0_data += s->size - 1;
1689 d1_data += s->size - 1;
1690 d2_data += s->size - 1;
1693 for (y = sliceh_start; y < sliceh_end; y++) {
1694 for (x = 0; x < src_w; x++) {
1695 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit);
1696 const int c1 = c1_data[x >> c1_shift_w];
1697 const int c2 = c2_data[x >> c2_shift_w];
1700 *(d0_data - c0) = c0;
1701 *(d1_data - c0) = c1;
1702 *(d2_data - c0) = c2;
1704 *(d0_data + c0) = c0;
1705 *(d1_data + c0) = c1;
1706 *(d2_data + c0) = c2;
1710 if (!c0_shift_h || (y & c0_shift_h))
1711 c0_data += c0_linesize;
1712 if (!c1_shift_h || (y & c1_shift_h))
1713 c1_data += c1_linesize;
1714 if (!c2_shift_h || (y & c2_shift_h))
1715 c2_data += c2_linesize;
1716 d0_data += d0_linesize;
1717 d1_data += d1_linesize;
1718 d2_data += d2_linesize;
1723 #define COLOR16_FUNC(name, column, mirror) \
1724 static int color16_##name(AVFilterContext *ctx, \
1725 void *arg, int jobnr, \
1728 WaveformContext *s = ctx->priv; \
1729 ThreadData *td = arg; \
1730 AVFrame *in = td->in; \
1731 AVFrame *out = td->out; \
1732 int component = td->component; \
1733 int offset_y = td->offset_y; \
1734 int offset_x = td->offset_x; \
1736 color16(s, in, out, component, s->intensity, \
1737 offset_y, offset_x, column, mirror, \
1751 int offset_y,
int offset_x,
1753 int jobnr,
int nb_jobs)
1755 const int plane = s->desc->comp[component].plane;
1756 const int src_h = in->height;
1757 const int src_w = in->width;
1758 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
1759 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
1760 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
1761 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
1762 const int c0_linesize = in->linesize[ plane + 0 ];
1763 const int c1_linesize = in->linesize[(plane + 1) % s->ncomp];
1764 const int c2_linesize = in->linesize[(plane + 2) % s->ncomp];
1765 const int c0_shift_h = s->shift_h[ component + 0 ];
1766 const int c1_shift_h = s->shift_h[(component + 1) % s->ncomp];
1767 const int c2_shift_h = s->shift_h[(component + 2) % s->ncomp];
1768 const uint8_t *c0_data = in->data[
plane] + (sliceh_start >> c0_shift_h) * c0_linesize;
1769 const uint8_t *c1_data = in->data[(plane + 1) % s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize;
1770 const uint8_t *c2_data = in->data[(plane + 2) % s->ncomp] + (sliceh_start >> c2_shift_h) * c2_linesize;
1771 const int d0_linesize = out->linesize[ plane + 0 ];
1772 const int d1_linesize = out->linesize[(plane + 1) % s->ncomp];
1773 const int d2_linesize = out->linesize[(plane + 2) % s->ncomp];
1774 const int c0_shift_w = s->shift_w[ component + 0 ];
1775 const int c1_shift_w = s->shift_w[(component + 1) % s->ncomp];
1776 const int c2_shift_w = s->shift_w[(component + 2) % s->ncomp];
1780 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1);
1781 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1);
1782 const int d2_signed_linesize = d2_linesize * (mirror == 1 ? -1 : 1);
1783 uint8_t *d0_data = out->data[
plane] + offset_y * d0_linesize + offset_x;
1784 uint8_t *d1_data = out->data[(plane + 1) % s->ncomp] + offset_y * d1_linesize + offset_x;
1785 uint8_t *d2_data = out->data[(plane + 2) % s->ncomp] + offset_y * d2_linesize + offset_x;
1786 uint8_t *
const d0_bottom_line = d0_data + d0_linesize * (s->size - 1);
1787 uint8_t *
const d0 = (mirror ? d0_bottom_line : d0_data);
1788 uint8_t *
const d1_bottom_line = d1_data + d1_linesize * (s->size - 1);
1789 uint8_t *
const d1 = (mirror ? d1_bottom_line : d1_data);
1790 uint8_t *
const d2_bottom_line = d2_data + d2_linesize * (s->size - 1);
1791 uint8_t *
const d2 = (mirror ? d2_bottom_line : d2_data);
1793 for (y = 0; y < src_h; y++) {
1794 for (x = slicew_start; x < slicew_end; x++) {
1795 const int c0 = c0_data[x >> c0_shift_w];
1796 const int c1 = c1_data[x >> c1_shift_w];
1797 const int c2 = c2_data[x >> c2_shift_w];
1799 *(d0 + d0_signed_linesize * c0 + x) = c0;
1800 *(d1 + d1_signed_linesize * c0 + x) = c1;
1801 *(d2 + d2_signed_linesize * c0 + x) = c2;
1804 if (!c0_shift_h || (y & c0_shift_h))
1805 c0_data += c0_linesize;
1806 if (!c1_shift_h || (y & c1_shift_h))
1807 c1_data += c1_linesize;
1808 if (!c2_shift_h || (y & c2_shift_h))
1809 c2_data += c2_linesize;
1810 d0_data += d0_linesize;
1811 d1_data += d1_linesize;
1812 d2_data += d2_linesize;
1815 uint8_t *d0_data = out->data[
plane] + (offset_y + sliceh_start) * d0_linesize + offset_x;
1816 uint8_t *d1_data = out->data[(plane + 1) % s->ncomp] + (offset_y + sliceh_start) * d1_linesize + offset_x;
1817 uint8_t *d2_data = out->data[(plane + 2) % s->ncomp] + (offset_y + sliceh_start) * d2_linesize + offset_x;
1820 d0_data += s->size - 1;
1821 d1_data += s->size - 1;
1822 d2_data += s->size - 1;
1825 for (y = sliceh_start; y < sliceh_end; y++) {
1826 for (x = 0; x < src_w; x++) {
1827 const int c0 = c0_data[x >> c0_shift_w];
1828 const int c1 = c1_data[x >> c1_shift_w];
1829 const int c2 = c2_data[x >> c2_shift_w];
1832 *(d0_data - c0) = c0;
1833 *(d1_data - c0) = c1;
1834 *(d2_data - c0) = c2;
1836 *(d0_data + c0) = c0;
1837 *(d1_data + c0) = c1;
1838 *(d2_data + c0) = c2;
1842 if (!c0_shift_h || (y & c0_shift_h))
1843 c0_data += c0_linesize;
1844 if (!c1_shift_h || (y & c1_shift_h))
1845 c1_data += c1_linesize;
1846 if (!c2_shift_h || (y & c2_shift_h))
1847 c2_data += c2_linesize;
1848 d0_data += d0_linesize;
1849 d1_data += d1_linesize;
1850 d2_data += d2_linesize;
1855 #define COLOR_FUNC(name, column, mirror) \
1856 static int color_##name(AVFilterContext *ctx, \
1857 void *arg, int jobnr, \
1860 WaveformContext *s = ctx->priv; \
1861 ThreadData *td = arg; \
1862 AVFrame *in = td->in; \
1863 AVFrame *out = td->out; \
1864 int component = td->component; \
1865 int offset_y = td->offset_y; \
1866 int offset_x = td->offset_x; \
1868 color(s, in, out, component, s->intensity, \
1869 offset_y, offset_x, column, mirror, \
1883 int offset_y,
int offset_x,
1885 int jobnr,
int nb_jobs)
1887 const int plane = s->desc->comp[component].plane;
1888 const int limit = s->max - 1;
1890 const int src_h = in->height;
1891 const int src_w = in->width;
1892 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
1893 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
1894 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
1895 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
1896 const int c0_shift_h = s->shift_h[ component + 0 ];
1897 const int c1_shift_h = s->shift_h[(component + 1) % s->ncomp];
1898 const int c2_shift_h = s->shift_h[(component + 2) % s->ncomp];
1899 const int c0_linesize = in->linesize[ plane + 0 ] / 2;
1900 const int c1_linesize = in->linesize[(plane + 1) % s->ncomp] / 2;
1901 const int c2_linesize = in->linesize[(plane + 2) % s->ncomp] / 2;
1902 const uint16_t *c0_data = (
const uint16_t *)in->data[plane + 0] + (sliceh_start >> c0_shift_h) * c0_linesize;
1903 const uint16_t *c1_data = (
const uint16_t *)in->data[(plane + 1) % s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize;
1904 const uint16_t *c2_data = (
const uint16_t *)in->data[(plane + 2) % s->ncomp] + (sliceh_start >> c2_shift_h) * c2_linesize;
1905 const int d0_linesize = out->linesize[ plane + 0 ] / 2;
1906 const int d1_linesize = out->linesize[(plane + 1) % s->ncomp] / 2;
1907 const int d2_linesize = out->linesize[(plane + 2) % s->ncomp] / 2;
1908 const int c0_shift_w = s->shift_w[ component + 0 ];
1909 const int c1_shift_w = s->shift_w[(component + 1) % s->ncomp];
1910 const int c2_shift_w = s->shift_w[(component + 2) % s->ncomp];
1914 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1);
1915 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1);
1916 const int d2_signed_linesize = d2_linesize * (mirror == 1 ? -1 : 1);
1917 uint16_t *d0_data = (uint16_t *)out->data[plane] + offset_y * d0_linesize + offset_x;
1918 uint16_t *d1_data = (uint16_t *)out->data[(plane + 1) % s->ncomp] + offset_y * d1_linesize + offset_x;
1919 uint16_t *d2_data = (uint16_t *)out->data[(plane + 2) % s->ncomp] + offset_y * d2_linesize + offset_x;
1920 uint16_t *
const d0_bottom_line = d0_data + d0_linesize * (s->size - 1);
1921 uint16_t *
const d0 = (mirror ? d0_bottom_line : d0_data);
1922 uint16_t *
const d1_bottom_line = d1_data + d1_linesize * (s->size - 1);
1923 uint16_t *
const d1 = (mirror ? d1_bottom_line : d1_data);
1924 uint16_t *
const d2_bottom_line = d2_data + d2_linesize * (s->size - 1);
1925 uint16_t *
const d2 = (mirror ? d2_bottom_line : d2_data);
1927 for (y = 0; y < src_h; y++) {
1928 for (x = slicew_start; x < slicew_end; x++) {
1929 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit);
1930 const int c1 = c1_data[x >> c1_shift_w];
1931 const int c2 = c2_data[x >> c2_shift_w];
1933 update16(d0 + d0_signed_linesize * c0 + x, max, intensity, limit);
1934 *(d1 + d1_signed_linesize * c0 + x) = c1;
1935 *(d2 + d2_signed_linesize * c0 + x) = c2;
1938 if (!c0_shift_h || (y & c0_shift_h))
1939 c0_data += c0_linesize;
1940 if (!c1_shift_h || (y & c1_shift_h))
1941 c1_data += c1_linesize;
1942 if (!c2_shift_h || (y & c2_shift_h))
1943 c2_data += c2_linesize;
1944 d0_data += d0_linesize;
1945 d1_data += d1_linesize;
1946 d2_data += d2_linesize;
1949 uint16_t *d0_data = (uint16_t *)out->data[plane] + (offset_y + sliceh_start) * d0_linesize + offset_x;
1950 uint16_t *d1_data = (uint16_t *)out->data[(plane + 1) % s->ncomp] + (offset_y + sliceh_start) * d1_linesize + offset_x;
1951 uint16_t *d2_data = (uint16_t *)out->data[(plane + 2) % s->ncomp] + (offset_y + sliceh_start) * d2_linesize + offset_x;
1954 d0_data += s->size - 1;
1955 d1_data += s->size - 1;
1956 d2_data += s->size - 1;
1959 for (y = sliceh_start; y < sliceh_end; y++) {
1960 for (x = 0; x < src_w; x++) {
1961 const int c0 =
FFMIN(c0_data[x >> c0_shift_w], limit);
1962 const int c1 = c1_data[x >> c1_shift_w];
1963 const int c2 = c2_data[x >> c2_shift_w];
1966 update16(d0_data - c0, max, intensity, limit);
1967 *(d1_data - c0) = c1;
1968 *(d2_data - c0) = c2;
1970 update16(d0_data + c0, max, intensity, limit);
1971 *(d1_data + c0) = c1;
1972 *(d2_data + c0) = c2;
1976 if (!c0_shift_h || (y & c0_shift_h))
1977 c0_data += c0_linesize;
1978 if (!c1_shift_h || (y & c1_shift_h))
1979 c1_data += c1_linesize;
1980 if (!c2_shift_h || (y & c2_shift_h))
1981 c2_data += c2_linesize;
1982 d0_data += d0_linesize;
1983 d1_data += d1_linesize;
1984 d2_data += d2_linesize;
1989 #define ACOLOR16_FUNC(name, column, mirror) \
1990 static int acolor16_##name(AVFilterContext *ctx, \
1991 void *arg, int jobnr, \
1994 WaveformContext *s = ctx->priv; \
1995 ThreadData *td = arg; \
1996 AVFrame *in = td->in; \
1997 AVFrame *out = td->out; \
1998 int component = td->component; \
1999 int offset_y = td->offset_y; \
2000 int offset_x = td->offset_x; \
2002 acolor16(s, in, out, component, s->intensity,\
2003 offset_y, offset_x, column, mirror, \
2017 int offset_y,
int offset_x,
2019 int jobnr,
int nb_jobs)
2021 const int plane = s->desc->comp[component].plane;
2022 const int src_h = in->height;
2023 const int src_w = in->width;
2024 const int sliceh_start = !column ? (src_h * jobnr) / nb_jobs : 0;
2025 const int sliceh_end = !column ? (src_h * (jobnr+1)) / nb_jobs : src_h;
2026 const int slicew_start = column ? (src_w * jobnr) / nb_jobs : 0;
2027 const int slicew_end = column ? (src_w * (jobnr+1)) / nb_jobs : src_w;
2028 const int c0_shift_w = s->shift_w[ component + 0 ];
2029 const int c1_shift_w = s->shift_w[(component + 1) % s->ncomp];
2030 const int c2_shift_w = s->shift_w[(component + 2) % s->ncomp];
2031 const int c0_shift_h = s->shift_h[ component + 0 ];
2032 const int c1_shift_h = s->shift_h[(component + 1) % s->ncomp];
2033 const int c2_shift_h = s->shift_h[(component + 2) % s->ncomp];
2034 const int c0_linesize = in->linesize[ plane + 0 ];
2035 const int c1_linesize = in->linesize[(plane + 1) % s->ncomp];
2036 const int c2_linesize = in->linesize[(plane + 2) % s->ncomp];
2037 const uint8_t *c0_data = in->data[plane + 0] + (sliceh_start >> c0_shift_h) * c0_linesize;
2038 const uint8_t *c1_data = in->data[(plane + 1) % s->ncomp] + (sliceh_start >> c1_shift_h) * c1_linesize;
2039 const uint8_t *c2_data = in->data[(plane + 2) % s->ncomp] + (sliceh_start >> c2_shift_h) * c2_linesize;
2040 const int d0_linesize = out->linesize[ plane + 0 ];
2041 const int d1_linesize = out->linesize[(plane + 1) % s->ncomp];
2042 const int d2_linesize = out->linesize[(plane + 2) % s->ncomp];
2047 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1);
2048 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1);
2049 const int d2_signed_linesize = d2_linesize * (mirror == 1 ? -1 : 1);
2050 uint8_t *d0_data = out->data[
plane] + offset_y * d0_linesize + offset_x;
2051 uint8_t *d1_data = out->data[(plane + 1) % s->ncomp] + offset_y * d1_linesize + offset_x;
2052 uint8_t *d2_data = out->data[(plane + 2) % s->ncomp] + offset_y * d2_linesize + offset_x;
2053 uint8_t *
const d0_bottom_line = d0_data + d0_linesize * (s->size - 1);
2054 uint8_t *
const d0 = (mirror ? d0_bottom_line : d0_data);
2055 uint8_t *
const d1_bottom_line = d1_data + d1_linesize * (s->size - 1);
2056 uint8_t *
const d1 = (mirror ? d1_bottom_line : d1_data);
2057 uint8_t *
const d2_bottom_line = d2_data + d2_linesize * (s->size - 1);
2058 uint8_t *
const d2 = (mirror ? d2_bottom_line : d2_data);
2060 for (y = 0; y < src_h; y++) {
2061 for (x = slicew_start; x < slicew_end; x++) {
2062 const int c0 = c0_data[x >> c0_shift_w];
2063 const int c1 = c1_data[x >> c1_shift_w];
2064 const int c2 = c2_data[x >> c2_shift_w];
2066 update(d0 + d0_signed_linesize * c0 + x, max, intensity);
2067 *(d1 + d1_signed_linesize * c0 + x) = c1;
2068 *(d2 + d2_signed_linesize * c0 + x) = c2;
2071 if (!c0_shift_h || (y & c0_shift_h))
2072 c0_data += c0_linesize;
2073 if (!c1_shift_h || (y & c1_shift_h))
2074 c1_data += c1_linesize;
2075 if (!c2_shift_h || (y & c2_shift_h))
2076 c2_data += c2_linesize;
2077 d0_data += d0_linesize;
2078 d1_data += d1_linesize;
2079 d2_data += d2_linesize;
2082 uint8_t *d0_data = out->data[
plane] + (offset_y + sliceh_start) * d0_linesize + offset_x;
2083 uint8_t *d1_data = out->data[(plane + 1) % s->ncomp] + (offset_y + sliceh_start) * d1_linesize + offset_x;
2084 uint8_t *d2_data = out->data[(plane + 2) % s->ncomp] + (offset_y + sliceh_start) * d2_linesize + offset_x;
2087 d0_data += s->size - 1;
2088 d1_data += s->size - 1;
2089 d2_data += s->size - 1;
2092 for (y = sliceh_start; y < sliceh_end; y++) {
2093 for (x = 0; x < src_w; x++) {
2094 const int c0 = c0_data[x >> c0_shift_w];
2095 const int c1 = c1_data[x >> c1_shift_w];
2096 const int c2 = c2_data[x >> c2_shift_w];
2099 update(d0_data - c0, max, intensity);
2100 *(d1_data - c0) = c1;
2101 *(d2_data - c0) = c2;
2103 update(d0_data + c0, max, intensity);
2104 *(d1_data + c0) = c1;
2105 *(d2_data + c0) = c2;
2109 if (!c0_shift_h || (y & c0_shift_h))
2110 c0_data += c0_linesize;
2111 if (!c1_shift_h || (y & c1_shift_h))
2112 c1_data += c1_linesize;
2113 if (!c2_shift_h || (y & c2_shift_h))
2114 c2_data += c2_linesize;
2115 d0_data += d0_linesize;
2116 d1_data += d1_linesize;
2117 d2_data += d2_linesize;
2122 #define ACOLOR_FUNC(name, column, mirror) \
2123 static int acolor_##name(AVFilterContext *ctx, \
2124 void *arg, int jobnr, \
2127 WaveformContext *s = ctx->priv; \
2128 ThreadData *td = arg; \
2129 AVFrame *in = td->in; \
2130 AVFrame *out = td->out; \
2131 int component = td->component; \
2132 int offset_y = td->offset_y; \
2133 int offset_x = td->offset_x; \
2135 acolor(s, in, out, component, s->intensity, \
2136 offset_y, offset_x, column, mirror, \
2151 { { {
"16", 16+128 }, {
"16", 16+128 }, {
"16", 16+128 }, {
"0", 0+128 } } },
2152 { { {
"128", 128+128 }, {
"128", 128+128 }, {
"128", 128+128 }, {
"128", 128+128 } } },
2153 { { {
"235", 235+128 }, {
"240", 240+128 }, {
"240", 240+128 }, {
"255", 255+128 } } },
2157 { { {
"32", 32+256 }, {
"32", 32+256 }, {
"32", 32+256 }, {
"0", 0+256 } } },
2158 { { {
"256", 256+256 }, {
"256", 256+256 }, {
"256", 256+256 }, {
"256", 256+256 } } },
2159 { { {
"470", 470+256 }, {
"480", 480+256 }, {
"480", 480+256 }, {
"511", 511+256 } } },
2163 { { {
"64", 64+512 }, {
"64", 64+512 }, {
"64", 64+512 }, {
"0", 0+512 } } },
2164 { { {
"512", 512+512 }, {
"512", 512+512 }, {
"512", 512+512 }, {
"512", 512+512 } } },
2165 { { {
"940", 940+512 }, {
"960", 960+512 }, {
"960", 960+512 }, {
"1023", 1023+512 } } },
2169 { { {
"256", 256+2048 }, {
"256", 256+2048 }, {
"256", 256+2048 }, {
"0", 0+2048 } } },
2170 { { {
"2048", 2048+2048 }, {
"2048", 2048+2048 }, {
"2048", 2048+2048 }, {
"2048", 2048+2048 } } },
2171 { { {
"3760", 3760+2048 }, {
"3840", 3840+2048 }, {
"3840", 3840+2048 }, {
"4095", 4095+2048 } } },
2175 { { {
"0", 16+128 }, {
"0", 16+128 }, {
"0", 16+128 }, {
"0", 0+128 } } },
2176 { { {
"175", 71+128 }, {
"175", 72+128 }, {
"175", 72+128 }, {
"175", 64+128 } } },
2177 { { {
"350", 126+128 }, {
"350", 128+128 }, {
"350", 128+128 }, {
"350", 128+128 } } },
2178 { { {
"525", 180+128 }, {
"525", 184+128 }, {
"525", 184+128 }, {
"525", 192+128 } } },
2179 { { {
"700", 235+128 }, {
"700", 240+128 }, {
"700", 240+128 }, {
"700", 255+128 } } },
2183 { { {
"0", 32+256 }, {
"0", 32+256 }, {
"0", 32+256 }, {
"0", 0+256 } } },
2184 { { {
"175", 142+256 }, {
"175", 144+256 }, {
"175", 144+256 }, {
"175", 128+256 } } },
2185 { { {
"350", 251+256 }, {
"350", 256+256 }, {
"350", 256+256 }, {
"350", 256+256 } } },
2186 { { {
"525", 361+256 }, {
"525", 368+256 }, {
"525", 368+256 }, {
"525", 384+256 } } },
2187 { { {
"700", 470+256 }, {
"700", 480+256 }, {
"700", 480+256 }, {
"700", 511+256 } } },
2191 { { {
"0", 64+512 }, {
"0", 64+512 }, {
"0", 64+512 }, {
"0", 0+512 } } },
2192 { { {
"175", 283+512 }, {
"175", 288+512 }, {
"175", 288+512 }, {
"175", 256+512 } } },
2193 { { {
"350", 502+512 }, {
"350", 512+512 }, {
"350", 512+512 }, {
"350", 512+512 } } },
2194 { { {
"525", 721+512 }, {
"525", 736+512 }, {
"525", 736+512 }, {
"525", 768+512 } } },
2195 { { {
"700", 940+512 }, {
"700", 960+512 }, {
"700", 960+512 }, {
"700", 1023+512 } } },
2199 { { {
"0", 256+2048 }, {
"0", 256+2048 }, {
"0", 256+2048 }, {
"0", 0+2048 } } },
2200 { { {
"175", 1132+2048 }, {
"175", 1152+2048 }, {
"175", 1152+2048 }, {
"175", 1024+2048 } } },
2201 { { {
"350", 2008+2048 }, {
"350", 2048+2048 }, {
"350", 2048+2048 }, {
"350", 2048+2048 } } },
2202 { { {
"525", 2884+2048 }, {
"525", 2944+2048 }, {
"525", 2944+2048 }, {
"525", 3072+2048 } } },
2203 { { {
"700", 3760+2048 }, {
"700", 3840+2048 }, {
"700", 3840+2048 }, {
"700", 4095+2048 } } },
2207 { { {
"-25", -39+128 }, {
"-25", -40+128 }, {
"-25", -40+128 }, {
"-25", -64+128 } } },
2208 { { {
"0", 16+128 }, {
"0", 16+128 }, {
"0", 16+128 }, {
"0", 0+128 } } },
2209 { { {
"25", 71+128 }, {
"25", 72+128 }, {
"25", 72+128 }, {
"25", 64+128 } } },
2210 { { {
"50", 126+128 }, {
"50", 128+128 }, {
"50", 128+128 }, {
"50", 128+128 } } },
2211 { { {
"75", 180+128 }, {
"75", 184+128 }, {
"75", 184+128 }, {
"75", 192+128 } } },
2212 { { {
"100", 235+128 }, {
"100", 240+128 }, {
"100", 240+128 }, {
"100", 256+128 } } },
2213 { { {
"125", 290+128 }, {
"125", 296+128 }, {
"125", 296+128 }, {
"125", 320+128 } } },
2217 { { {
"-25", -78+256 }, {
"-25", -80+256 }, {
"-25", -80+256 }, {
"-25",-128+256 } } },
2218 { { {
"0", 32+256 }, {
"0", 32+256 }, {
"0", 32+256 }, {
"0", 0+256 } } },
2219 { { {
"25", 142+256 }, {
"25", 144+256 }, {
"25", 144+256 }, {
"25", 128+256 } } },
2220 { { {
"50", 251+256 }, {
"50", 256+256 }, {
"50", 256+256 }, {
"50", 256+256 } } },
2221 { { {
"75", 361+256 }, {
"75", 368+256 }, {
"75", 368+256 }, {
"75", 384+256 } } },
2222 { { {
"100", 470+256 }, {
"100", 480+256 }, {
"100", 480+256 }, {
"100", 512+256 } } },
2223 { { {
"125", 580+256 }, {
"125", 592+256 }, {
"125", 592+256 }, {
"125", 640+256 } } },
2227 { { {
"-25",-156+512 }, {
"-25",-160+512 }, {
"-25",-160+512 }, {
"-25", -256+512 } } },
2228 { { {
"0", 64+512 }, {
"0", 64+512 }, {
"0", 64+512 }, {
"0", 0+512 } } },
2229 { { {
"25", 283+512 }, {
"25", 288+512 }, {
"25", 288+512 }, {
"25", 256+512 } } },
2230 { { {
"50", 502+512 }, {
"50", 512+512 }, {
"50", 512+512 }, {
"50", 512+512 } } },
2231 { { {
"75", 721+512 }, {
"75", 736+512 }, {
"75", 736+512 }, {
"75", 768+512 } } },
2232 { { {
"100", 940+512 }, {
"100", 960+512 }, {
"100", 960+512 }, {
"100", 1024+512 } } },
2233 { { {
"125",1160+512 }, {
"125",1184+512 }, {
"125",1184+512 }, {
"125", 1280+512 } } },
2237 { { {
"-25", -624+2048 }, {
"-25", -640+2048 }, {
"-25", -640+2048 }, {
"-25",-1024+2048 } } },
2238 { { {
"0", 256+2048 }, {
"0", 256+2048 }, {
"0", 256+2048 }, {
"0", 0+2048 } } },
2239 { { {
"25", 1132+2048 }, {
"25", 1152+2048 }, {
"25", 1152+2048 }, {
"25", 1024+2048 } } },
2240 { { {
"50", 2008+2048 }, {
"50", 2048+2048 }, {
"50", 2048+2048 }, {
"50", 2048+2048 } } },
2241 { { {
"75", 2884+2048 }, {
"75", 2944+2048 }, {
"75", 2944+2048 }, {
"75", 3072+2048 } } },
2242 { { {
"100", 3760+2048 }, {
"100", 3840+2048 }, {
"100", 3840+2048 }, {
"100", 4096+2048 } } },
2243 { { {
"125", 4640+2048 }, {
"125", 4736+2048 }, {
"125", 4736+2048 }, {
"125", 5120+2048 } } },
2247 { { {
"16", 16+256 }, {
"16", 16+256 }, {
"16", 16+256 }, {
"0", 0+256 } } },
2248 { { {
"128", 128+256 }, {
"128", 128+256 }, {
"128", 128+256 }, {
"128", 128+256 } } },
2249 { { {
"235", 235+256 }, {
"240", 240+256 }, {
"240", 240+256 }, {
"255", 255+256 } } },
2253 { { {
"32", 32+512 }, {
"32", 32+512 }, {
"32", 32+512 }, {
"0", 0+512 } } },
2254 { { {
"256", 256+512 }, {
"256", 256+512 }, {
"256", 256+512 }, {
"256", 256+512 } } },
2255 { { {
"470", 470+512 }, {
"480", 480+512 }, {
"480", 480+512 }, {
"511", 511+512 } } },
2259 { { {
"64", 64+1024 }, {
"64", 64+1024 }, {
"64", 64+1024 }, {
"0", 0+1024 } } },
2260 { { {
"512", 512+1024 }, {
"512", 512+1024 }, {
"512", 512+1024 }, {
"512", 512+1024 } } },
2261 { { {
"940", 940+1024 }, {
"960", 960+1024 }, {
"960", 960+1024 }, {
"1023", 1023+1024 } } },
2265 { { {
"256", 256+4096 }, {
"256", 256+4096 }, {
"256", 256+4096 }, {
"0", 0+4096 } } },
2266 { { {
"2048", 2048+4096 }, {
"2048", 2048+4096 }, {
"2048", 2048+4096 }, {
"2048", 2048+4096 } } },
2267 { { {
"3760", 3760+4096 }, {
"3840", 3840+4096 }, {
"3840", 3840+4096 }, {
"4095", 4095+4096 } } },
2271 { { {
"0", 16+256 }, {
"0", 16+256 }, {
"0", 16+256 }, {
"0", 0+256 } } },
2272 { { {
"175", 71+256 }, {
"175", 72+256 }, {
"175", 72+256 }, {
"175", 64+256 } } },
2273 { { {
"350", 126+256 }, {
"350", 128+256 }, {
"350", 128+256 }, {
"350", 128+256 } } },
2274 { { {
"525", 180+256 }, {
"525", 184+256 }, {
"525", 184+256 }, {
"525", 192+256 } } },
2275 { { {
"700", 235+256 }, {
"700", 240+256 }, {
"700", 240+256 }, {
"700", 255+256 } } },
2279 { { {
"0", 32+512 }, {
"0", 32+512 }, {
"0", 32+512 }, {
"0", 0+512 } } },
2280 { { {
"175", 142+512 }, {
"175", 144+512 }, {
"175", 144+512 }, {
"175", 128+512 } } },
2281 { { {
"350", 251+512 }, {
"350", 256+512 }, {
"350", 256+512 }, {
"350", 256+512 } } },
2282 { { {
"525", 361+512 }, {
"525", 368+512 }, {
"525", 368+512 }, {
"525", 384+512 } } },
2283 { { {
"700", 470+512 }, {
"700", 480+512 }, {
"700", 480+512 }, {
"700", 511+512 } } },
2287 { { {
"0", 64+1024 }, {
"0", 64+1024 }, {
"0", 64+1024 }, {
"0", 0+1024 } } },
2288 { { {
"175", 283+1024 }, {
"175", 288+1024 }, {
"175", 288+1024 }, {
"175", 256+1024 } } },
2289 { { {
"350", 502+1024 }, {
"350", 512+1024 }, {
"350", 512+1024 }, {
"350", 512+1024 } } },
2290 { { {
"525", 721+1024 }, {
"525", 736+1024 }, {
"525", 736+1024 }, {
"525", 768+1024 } } },
2291 { { {
"700", 940+1024 }, {
"700", 960+1024 }, {
"700", 960+1024 }, {
"700", 1023+1024 } } },
2295 { { {
"0", 256+4096 }, {
"0", 256+4096 }, {
"0", 256+4096 }, {
"0", 0+4096 } } },
2296 { { {
"175", 1132+4096 }, {
"175", 1152+4096 }, {
"175", 1152+4096 }, {
"175", 1024+4096 } } },
2297 { { {
"350", 2008+4096 }, {
"350", 2048+4096 }, {
"350", 2048+4096 }, {
"350", 2048+4096 } } },
2298 { { {
"525", 2884+4096 }, {
"525", 2944+4096 }, {
"525", 2944+4096 }, {
"525", 3072+4096 } } },
2299 { { {
"700", 3760+4096 }, {
"700", 3840+4096 }, {
"700", 3840+4096 }, {
"700", 4095+4096 } } },
2303 { { {
"-25", -39+256 }, {
"-25", -40+256 }, {
"-25", -40+256 }, {
"-25", -64+256 } } },
2304 { { {
"0", 16+256 }, {
"0", 16+256 }, {
"0", 16+256 }, {
"0", 0+256 } } },
2305 { { {
"25", 71+256 }, {
"25", 72+256 }, {
"25", 72+256 }, {
"25", 64+256 } } },
2306 { { {
"50", 126+256 }, {
"50", 128+256 }, {
"50", 128+256 }, {
"50", 128+256 } } },
2307 { { {
"75", 180+256 }, {
"75", 184+256 }, {
"75", 184+256 }, {
"75", 192+256 } } },
2308 { { {
"100", 235+256 }, {
"100", 240+256 }, {
"100", 240+256 }, {
"100", 256+256 } } },
2309 { { {
"125", 290+256 }, {
"125", 296+256 }, {
"125", 296+256 }, {
"125", 320+256 } } },
2313 { { {
"-25", -78+512 }, {
"-25", -80+512 }, {
"-25", -80+512 }, {
"-25",-128+512 } } },
2314 { { {
"0", 32+512 }, {
"0", 32+512 }, {
"0", 32+512 }, {
"0", 0+512 } } },
2315 { { {
"25", 142+512 }, {
"25", 144+512 }, {
"25", 144+512 }, {
"25", 128+512 } } },
2316 { { {
"50", 251+512 }, {
"50", 256+512 }, {
"50", 256+512 }, {
"50", 256+512 } } },
2317 { { {
"75", 361+512 }, {
"75", 368+512 }, {
"75", 368+512 }, {
"75", 384+512 } } },
2318 { { {
"100", 470+512 }, {
"100", 480+512 }, {
"100", 480+512 }, {
"100", 512+512 } } },
2319 { { {
"125", 580+512 }, {
"125", 592+512 }, {
"125", 592+512 }, {
"125", 640+512 } } },
2323 { { {
"-25",-156+1024 }, {
"-25",-160+1024 }, {
"-25",-160+1024 }, {
"-25", -256+1024 } } },
2324 { { {
"0", 64+1024 }, {
"0", 64+1024 }, {
"0", 64+1024 }, {
"0", 0+1024 } } },
2325 { { {
"25", 283+1024 }, {
"25", 288+1024 }, {
"25", 288+1024 }, {
"25", 256+1024 } } },
2326 { { {
"50", 502+1024 }, {
"50", 512+1024 }, {
"50", 512+1024 }, {
"50", 512+1024 } } },
2327 { { {
"75", 721+1024 }, {
"75", 736+1024 }, {
"75", 736+1024 }, {
"75", 768+1024 } } },
2328 { { {
"100", 940+1024 }, {
"100", 960+1024 }, {
"100", 960+1024 }, {
"100", 1024+1024 } } },
2329 { { {
"125",1160+1024 }, {
"125",1184+1024 }, {
"125",1184+1024 }, {
"125", 1280+1024 } } },
2333 { { {
"-25", -624+4096 }, {
"-25", -640+4096 }, {
"-25", -640+4096 }, {
"-25",-1024+4096 } } },
2334 { { {
"0", 256+4096 }, {
"0", 256+4096 }, {
"0", 256+4096 }, {
"0", 0+4096 } } },
2335 { { {
"25", 1132+4096 }, {
"25", 1152+4096 }, {
"25", 1152+4096 }, {
"25", 1024+4096 } } },
2336 { { {
"50", 2008+4096 }, {
"50", 2048+4096 }, {
"50", 2048+4096 }, {
"50", 2048+4096 } } },
2337 { { {
"75", 2884+4096 }, {
"75", 2944+4096 }, {
"75", 2944+4096 }, {
"75", 3072+4096 } } },
2338 { { {
"100", 3760+4096 }, {
"100", 3840+4096 }, {
"100", 3840+4096 }, {
"100", 4096+4096 } } },
2339 { { {
"125", 4640+4096 }, {
"125", 4736+4096 }, {
"125", 4736+4096 }, {
"125", 5120+4096 } } },
2343 { { {
"16", 16 }, {
"16", 16 }, {
"16", 16 }, {
"0", 0 } } },
2344 { { {
"128", 128 }, {
"128", 128 }, {
"128", 128 }, {
"128", 128 } } },
2345 { { {
"235", 235 }, {
"240", 240 }, {
"240", 240 }, {
"255", 255 } } },
2349 { { {
"32", 32 }, {
"32", 32 }, {
"32", 32 }, {
"0", 0 } } },
2350 { { {
"256", 256 }, {
"256", 256 }, {
"256", 256 }, {
"256", 256 } } },
2351 { { {
"470", 470 }, {
"480", 480 }, {
"480", 480 }, {
"511", 511 } } },
2355 { { {
"64", 64 }, {
"64", 64 }, {
"64", 64 }, {
"0", 0 } } },
2356 { { {
"512", 512 }, {
"512", 512 }, {
"512", 512 }, {
"512", 512 } } },
2357 { { {
"940", 940 }, {
"960", 960 }, {
"960", 960 }, {
"1023", 1023 } } },
2361 { { {
"256", 256 }, {
"256", 256 }, {
"256", 256 }, {
"0", 0 } } },
2362 { { {
"2048", 2048 }, {
"2048", 2048 }, {
"2048", 2048 }, {
"2048", 2048 } } },
2363 { { {
"3760", 3760 }, {
"3840", 3840 }, {
"3840", 3840 }, {
"4095", 4095 } } },
2367 { { {
"0", 16 }, {
"0", 16 }, {
"0", 16 }, {
"0", 0 } } },
2368 { { {
"175", 71 }, {
"175", 72 }, {
"175", 72 }, {
"175", 64 } } },
2369 { { {
"350", 126 }, {
"350", 128 }, {
"350", 128 }, {
"350", 128 } } },
2370 { { {
"525", 180 }, {
"525", 184 }, {
"525", 184 }, {
"525", 192 } } },
2371 { { {
"700", 235 }, {
"700", 240 }, {
"700", 240 }, {
"700", 255 } } },
2375 { { {
"0", 32 }, {
"0", 32 }, {
"0", 32 }, {
"0", 0 } } },
2376 { { {
"175", 142 }, {
"175", 144 }, {
"175", 144 }, {
"175", 128 } } },
2377 { { {
"350", 251 }, {
"350", 256 }, {
"350", 256 }, {
"350", 256 } } },
2378 { { {
"525", 361 }, {
"525", 368 }, {
"525", 368 }, {
"525", 384 } } },
2379 { { {
"700", 470 }, {
"700", 480 }, {
"700", 480 }, {
"700", 511 } } },
2383 { { {
"0", 64 }, {
"0", 64 }, {
"0", 64 }, {
"0", 0 } } },
2384 { { {
"175", 283 }, {
"175", 288 }, {
"175", 288 }, {
"175", 256 } } },
2385 { { {
"350", 502 }, {
"350", 512 }, {
"350", 512 }, {
"350", 512 } } },
2386 { { {
"525", 721 }, {
"525", 736 }, {
"525", 736 }, {
"525", 768 } } },
2387 { { {
"700", 940 }, {
"700", 960 }, {
"700", 960 }, {
"700", 1023 } } },
2391 { { {
"0", 256 }, {
"0", 256 }, {
"0", 256 }, {
"0", 0 } } },
2392 { { {
"175", 1132 }, {
"175", 1152 }, {
"175", 1152 }, {
"175", 1024 } } },
2393 { { {
"350", 2008 }, {
"350", 2048 }, {
"350", 2048 }, {
"350", 2048 } } },
2394 { { {
"525", 2884 }, {
"525", 2944 }, {
"525", 2944 }, {
"525", 3072 } } },
2395 { { {
"700", 3760 }, {
"700", 3840 }, {
"700", 3840 }, {
"700", 4095 } } },
2399 { { {
"0", 16 }, {
"0", 16 }, {
"0", 16 }, {
"0", 0 } } },
2400 { { {
"25", 71 }, {
"25", 72 }, {
"25", 72 }, {
"25", 64 } } },
2401 { { {
"50", 126 }, {
"50", 128 }, {
"50", 128 }, {
"50", 128 } } },
2402 { { {
"75", 180 }, {
"75", 184 }, {
"75", 184 }, {
"75", 192 } } },
2403 { { {
"100", 235 }, {
"100", 240 }, {
"100", 240 }, {
"100", 255 } } },
2407 { { {
"0", 32 }, {
"0", 32 }, {
"0", 32 }, {
"0", 0 } } },
2408 { { {
"25", 142 }, {
"25", 144 }, {
"25", 144 }, {
"25", 128 } } },
2409 { { {
"50", 251 }, {
"50", 256 }, {
"50", 256 }, {
"50", 256 } } },
2410 { { {
"75", 361 }, {
"75", 368 }, {
"75", 368 }, {
"75", 384 } } },
2411 { { {
"100", 470 }, {
"100", 480 }, {
"100", 480 }, {
"100", 511 } } },
2415 { { {
"0", 64 }, {
"0", 64 }, {
"0", 64 }, {
"0", 0 } } },
2416 { { {
"25", 283 }, {
"25", 288 }, {
"25", 288 }, {
"25", 256 } } },
2417 { { {
"50", 502 }, {
"50", 512 }, {
"50", 512 }, {
"50", 512 } } },
2418 { { {
"75", 721 }, {
"75", 736 }, {
"75", 736 }, {
"75", 768 } } },
2419 { { {
"100", 940 }, {
"100", 960 }, {
"100", 960 }, {
"100", 1023 } } },
2423 { { {
"0", 256 }, {
"0", 256 }, {
"0", 256 }, {
"0", 0 } } },
2424 { { {
"25", 1132 }, {
"25", 1152 }, {
"25", 1152 }, {
"25", 1024 } } },
2425 { { {
"50", 2008 }, {
"50", 2048 }, {
"50", 2048 }, {
"50", 2048 } } },
2426 { { {
"75", 2884 }, {
"75", 2944 }, {
"75", 2944 }, {
"75", 3072 } } },
2427 { { {
"100", 3760 }, {
"100", 3840 }, {
"100", 3840 }, {
"100", 4095 } } },
2431 { { {
"50", 50 }, {
"50", 50 }, {
"50", 50 }, {
"50", 50 } } },
2432 { { {
"100", 100 }, {
"100", 100 }, {
"100", 100 }, {
"100", 100 } } },
2433 { { {
"150", 150 }, {
"150", 150 }, {
"150", 150 }, {
"150", 150 } } },
2434 { { {
"200", 200 }, {
"200", 200 }, {
"200", 200 }, {
"200", 200 } } },
2435 { { {
"255", 255 }, {
"255", 255 }, {
"255", 255 }, {
"255", 255 } } },
2439 { { {
"100", 100 }, {
"100", 100 }, {
"100", 100 }, {
"100", 100 } } },
2440 { { {
"200", 200 }, {
"200", 200 }, {
"200", 200 }, {
"200", 200 } } },
2441 { { {
"300", 300 }, {
"300", 300 }, {
"300", 300 }, {
"300", 300 } } },
2442 { { {
"400", 400 }, {
"400", 400 }, {
"400", 400 }, {
"400", 400 } } },
2443 { { {
"500", 500 }, {
"500", 500 }, {
"500", 500 }, {
"500", 500 } } },
2447 { { {
"200", 200 }, {
"200", 200 }, {
"200", 200 }, {
"200", 200 } } },
2448 { { {
"400", 400 }, {
"400", 400 }, {
"400", 400 }, {
"400", 400 } } },
2449 { { {
"600", 600 }, {
"600", 600 }, {
"600", 600 }, {
"600", 600 } } },
2450 { { {
"800", 800 }, {
"800", 800 }, {
"800", 800 }, {
"800", 800 } } },
2451 { { {
"1000",1000 }, {
"1000",1000 }, {
"1000",1000 }, {
"1000",1000 } } },
2455 { { {
"800", 800 }, {
"800", 800 }, {
"800", 800 }, {
"800", 800 } } },
2456 { { {
"1600", 1600 }, {
"1600", 1600 }, {
"1600", 1600 }, {
"1600", 1600 } } },
2457 { { {
"2400", 2400 }, {
"2400", 2400 }, {
"2400", 2400 }, {
"2400", 2400 } } },
2458 { { {
"3200", 3200 }, {
"3200", 3200 }, {
"3200", 3200 }, {
"3200", 3200 } } },
2459 { { {
"4000", 4000 }, {
"4000", 4000 }, {
"4000", 4000 }, {
"4000", 4000 } } },
2466 for (y = 0; y <
height; y += step) {
2467 dst[0] = v * o1 + dst[0] * o2;
2469 dst += linesize * step;
2477 for (y = 0; y <
height; y += step) {
2478 dst[0] = v * o1 + dst[0] * o2;
2480 dst += (linesize / 2) * step;
2488 for (x = 0; x <
width; x += step) {
2489 dst[x] = v * o1 + dst[x] * o2;
2497 for (x = 0; x <
width; x += step) {
2498 dst[x] = v * o1 + dst[x] * o2;
2510 for (plane = 0; plane < 4 && out->
data[
plane]; plane++) {
2511 for (i = 0; txt[i]; i++) {
2513 int v = color[
plane];
2516 for (char_y = 0; char_y < font_height; char_y++) {
2517 for (mask = 0x80;
mask; mask >>= 1) {
2518 if (font[txt[i] * font_height + char_y] & mask)
2519 p[0] = p[0] * o2 + v * o1;
2536 for (plane = 0; plane < 4 && out->
data[
plane]; plane++) {
2537 for (i = 0; txt[i]; i++) {
2541 uint16_t *p = (uint16_t *)(out->
data[plane] + y * out->
linesize[plane]) + (x + i * 8);
2542 for (char_y = 0; char_y < font_height; char_y++) {
2543 for (mask = 0x80;
mask; mask >>= 1) {
2544 if (font[txt[i] * font_height + char_y] & mask)
2545 p[0] = p[0] * o2 + v * o1;
2562 for (plane = 0; plane < 4 && out->
data[
plane]; plane++) {
2563 for (i = 0; txt[i]; i++) {
2565 int v = color[
plane];
2567 for (char_y = font_height - 1; char_y >= 0; char_y--) {
2569 for (mask = 0x80;
mask; mask >>= 1) {
2570 if (font[txt[i] * font_height + font_height - 1 - char_y] & mask)
2571 p[char_y] = p[char_y] * o2 + v * o1;
2587 for (plane = 0; plane < 4 && out->
data[
plane]; plane++) {
2588 for (i = 0; txt[i]; i++) {
2592 for (char_y = 0; char_y < font_height; char_y++) {
2593 uint16_t *p = (uint16_t *)(out->
data[plane] + (y + i * 10) * out->
linesize[
plane]) + x;
2594 for (mask = 0x80;
mask; mask >>= 1) {
2595 if (font[txt[i] * font_height + font_height - 1 - char_y] & mask)
2596 p[char_y] = p[char_y] * o2 + v * o1;
2610 const int step = (s->
flags & 2) + 1;
2612 const float o2 = 1. - o1;
2614 int C, k = 0,
c, p, l, offset_x = 0, offset_y = 0;
2622 for (p = 0; p < s->
ncomp; p++) {
2626 int x = offset_x + (s->
mirror ? s->
size - 1 - pos : pos);
2636 int x = offset_x + (s->
mirror ? s->
size - 1 - pos : pos) - 10;
2651 const int step = (s->
flags & 2) + 1;
2653 const float o2 = 1. - o1;
2654 const int mult = s->
max / 256;
2656 int C, k = 0,
c, p, l, offset_x = 0, offset_y = 0;
2664 for (p = 0; p < s->
ncomp; p++) {
2668 int x = offset_x + (s->
mirror ? s->
size - 1 - pos : pos);
2669 uint16_t *dst = (uint16_t *)(out->
data[p] + offset_y * out->
linesize[p]) + x;
2678 int x = offset_x + (s->
mirror ? s->
size - 1 - pos : pos) - 10;
2693 const int step = (s->
flags & 2) + 1;
2695 const float o2 = 1. - o1;
2697 int C, k = 0,
c, p, l, offset_y = 0, offset_x = 0;
2705 for (p = 0; p < s->
ncomp; p++) {
2709 int y = offset_y + (s->
mirror ? s->
size - 1 - pos : pos);
2719 int y = offset_y + (s->
mirror ? s->
size - 1 - pos : pos) - 10;
2734 const int step = (s->
flags & 2) + 1;
2736 const float o2 = 1. - o1;
2737 const int mult = s->
max / 256;
2739 int C, k = 0,
c, p, l, offset_x = 0, offset_y = 0;
2747 for (p = 0; p < s->
ncomp; p++) {
2751 int y = offset_y + (s->
mirror ? s->
size - 1 - pos : pos);
2752 uint16_t *dst = (uint16_t *)(out->
data[p] + y * out->
linesize[p]) + offset_x;
2761 int y = offset_y + (s->
mirror ? s->
size - 1 - pos: pos) - 10;
2795 case FLAT: s->
size = 256 * 3;
break;
2796 default: s->
size = 256;
break;
2998 switch (inlink->
format) {
3021 int comp = 0, i, j = 0, k, p,
size;
3023 for (i = 0; i < s->
ncomp; i++) {
3024 if ((1 << i) & s->
pcomp)
3050 for (p = 0; p < s->
ncomp; p++) {
3054 if (!((1 << p) & s->
pcomp))
3057 for (k = 0; k < 4; k++) {
3065 for (i = 0; i <
size; i++) {
3066 for (k = 0; k < 4; k++) {
3094 for (k = 0; k < s->
dcomp; k++) {
3096 for (i = 0; i < outlink->
h ; i++)
3101 const int mult = s->
max / 256;
3104 for (i = 0; i < outlink->
h ; i++) {
3105 for (j = 0; j < outlink->
w; j++)
3112 for (k = 0, i = 0; k < s->
ncomp; k++) {
3113 if ((1 << k) & s->
pcomp) {
3120 offset_x = s->
mode ? i++ * inlink->
w : 0;
3121 offset_y = s->
mode ? 0 : i++ * inlink->
h;
3139 envelope(s, out, plane, plane, s->
mode ? offset_x : offset_y);
3145 envelope(s, out, plane, plane, s->
mode ? offset_x : offset_y);
3203 .priv_class = &waveform_class,
int plane
Which of the 4 planes contains the component.
#define AV_PIX_FMT_YUVA422P9
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
This structure describes decoded (raw) audio or video data.
#define AV_PIX_FMT_YUVA420P10
#define AV_PIX_FMT_GBRAP10
#define AV_PIX_FMT_YUVA422P10
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Main libavfilter public API header.
int h
agreed upon image height
#define AV_PIX_FMT_GBRP10
#define AV_PIX_FMT_YUV420P12
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
#define AV_PIX_FMT_GRAY10
const char * name
Pad name.
#define AV_PIX_FMT_GRAY12
AVFilterLink ** inputs
array of pointers to input links
uint8_t grat_yuva_color[4]
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
static void filter(int16_t *output, ptrdiff_t out_stride, int16_t *low, ptrdiff_t low_stride, int16_t *high, ptrdiff_t high_stride, int len, int clip)
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
static av_cold int end(AVCodecContext *avctx)
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
#define AV_PIX_FMT_YUVA420P9
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range...
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
#define AV_PIX_FMT_YUV422P12
A filter pad used for either input or output.
A link between two filters.
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
const uint8_t avpriv_cga_font[2048]
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
static const uint16_t mask[17]
struct GraticuleLine line[4]
#define AV_PIX_FMT_FLAG_RGB
The pixel format contains RGB-like data (as opposed to YUV/grayscale).
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void * priv
private data for use by the filter
enum AVColorRange color_range
MPEG vs JPEG YUV range.
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
#define AV_PIX_FMT_GBRAP12
simple assert() macros that are a bit more flexible than ISO C assert().
int(* waveform_slice)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
AVFilterFormats * in_formats
Lists of formats and channel layouts supported by the input and output filters respectively.
#define AV_PIX_FMT_YUV444P10
static enum AVPixelFormat in_pix_fmts[]
static const uint8_t offset[127][2]
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
int w
agreed upon image width
uint64_t flags
Combination of AV_PIX_FMT_FLAG_...
#define AV_PIX_FMT_YUV422P9
uint8_t nb_components
The number of components each pixel has, (1-4)
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
static int16_t mult(Float11 *f1, Float11 *f2)
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
typedef void(APIENTRY *FF_PFNGLACTIVETEXTUREPROC)(GLenum texture)
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
AVFilterContext * src
source filter
#define AV_PIX_FMT_YUVA444P10
#define AV_PIX_FMT_YUV444P9
int format
agreed upon media format
#define FF_ARRAY_ELEMS(a)
the normal 2^n-1 "JPEG" YUV ranges
static void comp(unsigned char *dst, ptrdiff_t dst_stride, unsigned char *src, ptrdiff_t src_stride, int add)
Used for passing data between threads.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31))))#defineSET_CONV_FUNC_GROUP(ofmt, ifmt) staticvoidset_generic_function(AudioConvert *ac){}voidff_audio_convert_free(AudioConvert **ac){if(!*ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);}AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, intsample_rate, intapply_map){AudioConvert *ac;intin_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) returnNULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method!=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt)>2){ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc){av_free(ac);returnNULL;}returnac;}in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar){ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar?ac->channels:1;}elseif(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;elseac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);returnac;}intff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in){intuse_generic=1;intlen=in->nb_samples;intp;if(ac->dc){av_log(ac->avr, AV_LOG_TRACE,"%dsamples-audio_convert:%sto%s(dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));returnff_convert_dither(ac-> in
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
#define AV_PIX_FMT_YUV420P10
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Describe the class of an AVClass context structure.
Rational number (pair of numerator and denominator).
const char * name
Filter name.
#define AV_PIX_FMT_YUV440P12
#define AV_PIX_FMT_YUV420P9
AVRational sample_aspect_ratio
agreed upon sample aspect ratio
AVFilterLink ** outputs
array of pointers to output links
#define AV_PIX_FMT_GBRP12
#define flags(name, subs,...)
AVFilterInternal * internal
An opaque struct for libavfilter internal use.
#define AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_YUV444P12
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
void(* graticulef)(struct WaveformContext *s, AVFrame *out)
planar GBRA 4:4:4:4 32bpp
#define AV_PIX_FMT_YUVA444P9
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
static enum AVPixelFormat out_pix_fmts[]
avfilter_execute_func * execute
AVFilterContext * dst
dest filter
const AVPixFmtDescriptor * odesc
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor ...
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
#define av_malloc_array(a, b)
int depth
Number of bits in the component.
const AVPixFmtDescriptor * desc
AVPixelFormat
Pixel format.
mode
Use these values in ebur128_init (or'ed).
CGA/EGA/VGA ROM font data.
AVFilterFormats * out_formats
#define AV_CEIL_RSHIFT(a, b)