66 #define OFFSET(x) offsetof(WaveformContext, x)
67 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
155 const int dst_linesize = out->
linesize[component] / 2;
156 const int bg = s->
bg_color[component] * (s->
max / 256);
157 const int limit = s->
max - 1;
158 const int is_chroma = (component == 1 || component == 2);
169 for (x = 0; x < dst_w; x++) {
170 for (y = start; y <
end; y++) {
171 dst = (uint16_t *)out->
data[component] + y * dst_linesize + x;
177 for (y = end - 1; y >=
start; y--) {
178 dst = (uint16_t *)out->
data[component] + y * dst_linesize + x;
186 for (y = 0; y < dst_h; y++) {
187 dst = (uint16_t *)out->
data[component] + y * dst_linesize;
188 for (x = start; x <
end; x++) {
194 for (x = end - 1; x >=
start; x--) {
206 const int dst_linesize = out->
linesize[component];
208 const int is_chroma = (component == 1 || component == 2);
219 for (x = 0; x < dst_w; x++) {
220 for (y = start; y <
end; y++) {
221 dst = out->
data[component] + y * dst_linesize + x;
227 for (y = end - 1; y >=
start; y--) {
228 dst = out->
data[component] + y * dst_linesize + x;
236 for (y = 0; y < dst_h; y++) {
237 dst = out->
data[component] + y * dst_linesize;
238 for (x = start; x <
end; x++) {
244 for (x = end - 1; x >=
start; x--) {
256 const int dst_linesize = out->
linesize[component] / 2;
257 const int bg = s->
bg_color[component] * (s->
max / 256);
258 const int limit = s->
max - 1;
259 const int is_chroma = (component == 1 || component == 2);
272 for (x = 0; x < dst_w; x++) {
273 for (y = start; y < end && y < emin[x]; y++) {
274 dst = (uint16_t *)out->
data[component] + y * dst_linesize + x;
280 for (y = end - 1; y >= start && y >= emax[x]; y--) {
281 dst = (uint16_t *)out->
data[component] + y * dst_linesize + x;
292 for (x = 0; x < dst_w; x++) {
293 dst = (uint16_t *)out->
data[component] + emin[x] * dst_linesize + x;
295 dst = (uint16_t *)out->
data[component] + emax[x] * dst_linesize + x;
299 for (y = 0; y < dst_h; y++) {
300 dst = (uint16_t *)out->
data[component] + y * dst_linesize;
301 for (x = start; x < end && x < emin[
y]; x++) {
307 for (x = end - 1; x >= start && x >= emax[
y]; x--) {
318 for (y = 0; y < dst_h; y++) {
319 dst = (uint16_t *)out->
data[component] + y * dst_linesize + emin[y];
321 dst = (uint16_t *)out->
data[component] + y * dst_linesize + emax[
y];
329 const int dst_linesize = out->
linesize[component];
330 const int bg = s->
bg_color[component];
331 const int is_chroma = (component == 1 || component == 2);
344 for (x = 0; x < dst_w; x++) {
345 for (y = start; y < end && y < emin[x]; y++) {
346 dst = out->
data[component] + y * dst_linesize + x;
352 for (y = end - 1; y >= start && y >= emax[x]; y--) {
353 dst = out->
data[component] + y * dst_linesize + x;
364 for (x = 0; x < dst_w; x++) {
365 dst = out->
data[component] + emin[x] * dst_linesize + x;
367 dst = out->
data[component] + emax[x] * dst_linesize + x;
371 for (y = 0; y < dst_h; y++) {
372 dst = out->
data[component] + y * dst_linesize;
373 for (x = start; x < end && x < emin[
y]; x++) {
379 for (x = end - 1; x >= start && x >= emax[
y]; x--) {
390 for (y = 0; y < dst_h; y++) {
391 dst = out->
data[component] + y * dst_linesize + emin[
y];
393 dst = out->
data[component] + y * dst_linesize + emax[
y];
442 const int is_chroma = (component == 1 || component == 2);
447 const int dst_signed_linesize = dst_linesize * (mirror == 1 ? -1 : 1);
448 const int limit = s->
max - 1;
452 const uint16_t *src_data = (
const uint16_t *)in->
data[plane];
453 uint16_t *dst_data = (uint16_t *)out->
data[
plane] + (column ? (offset >> shift_h) * dst_linesize : offset >> shift_w);
454 uint16_t *
const dst_bottom_line = dst_data + dst_linesize * ((s->
size >> shift_h) - 1);
455 uint16_t *
const dst_line = (mirror ? dst_bottom_line : dst_data);
459 if (!column && mirror)
460 dst_data += s->
size >> shift_w;
462 for (y = 0; y < src_h; y++) {
463 const uint16_t *src_data_end = src_data + src_w;
464 uint16_t *dst = dst_line;
466 for (p = src_data; p < src_data_end; p++) {
471 target = dst++ + dst_signed_linesize * (v >> shift_h);
474 target = dst_data - (v >> shift_w) - 1;
476 target = dst_data + (v >> shift_w);
478 update16(target, max, intensity, limit);
480 src_data += src_linesize;
481 dst_data += dst_linesize;
492 const int is_chroma = (component == 1 || component == 2);
497 const int dst_signed_linesize = dst_linesize * (mirror == 1 ? -1 : 1);
502 uint8_t *dst_data = out->
data[
plane] + (column ? (offset >> shift_h) * dst_linesize : offset >> shift_w);
503 uint8_t *
const dst_bottom_line = dst_data + dst_linesize * ((s->
size >> shift_h) - 1);
504 uint8_t *
const dst_line = (mirror ? dst_bottom_line : dst_data);
508 if (!column && mirror)
509 dst_data += s->
size >> shift_w;
511 for (y = 0; y < src_h; y++) {
512 const uint8_t *src_data_end = src_data + src_w;
515 for (p = src_data; p < src_data_end; p++) {
518 target = dst++ + dst_signed_linesize * (*p >> shift_h);
521 target = dst_data - (*p >> shift_w) - 1;
523 target = dst_data + (*p >> shift_w);
525 update(target, max, intensity);
527 src_data += src_linesize;
528 dst_data += dst_linesize;
539 const int c0_linesize = in->
linesize[ plane + 0 ];
540 const int c1_linesize = in->
linesize[(plane + 1) % s->
ncomp];
541 const int c2_linesize = in->
linesize[(plane + 2) % s->
ncomp];
542 const int d0_linesize = out->
linesize[ plane + 0 ];
543 const int d1_linesize = out->
linesize[(plane + 1) % s->
ncomp];
544 const int max = 255 - intensity;
545 const int src_h = in->
height;
546 const int src_w = in->
width;
550 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1);
551 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1);
553 for (x = 0; x < src_w; x++) {
558 uint8_t *d1_data = out->
data[(plane + 1) % s->
ncomp] + offset * d1_linesize;
559 uint8_t *
const d0_bottom_line = d0_data + d0_linesize * (s->
size - 1);
560 uint8_t *
const d0 = (mirror ? d0_bottom_line : d0_data);
561 uint8_t *
const d1_bottom_line = d1_data + d1_linesize * (s->
size - 1);
562 uint8_t *
const d1 = (mirror ? d1_bottom_line : d1_data);
564 for (
y = 0;
y < src_h;
y++) {
565 const int c0 = c0_data[x] + 256;
566 const int c1 =
FFABS(c1_data[x] - 128) +
FFABS(c2_data[x] - 128);
570 target = d0 + x + d0_signed_linesize * c0;
573 for (p = c0 - c1; p < c0 +
c1; p++) {
574 target = d1 + x + d1_signed_linesize * p;
577 c0_data += c0_linesize;
578 c1_data += c1_linesize;
579 c2_data += c2_linesize;
580 d0_data += d0_linesize;
581 d1_data += d1_linesize;
592 d0_data += s->
size - 1;
593 d1_data += s->
size - 1;
596 for (
y = 0;
y < src_h;
y++) {
597 for (x = 0; x < src_w; x++) {
598 int c0 = c0_data[x] + 256;
599 const int c1 =
FFABS(c1_data[x] - 128) +
FFABS(c2_data[x] - 128);
604 target = d0_data - c0;
606 target = d0_data + c0;
610 for (p = c0 - c1; p < c0 +
c1; p++) {
612 target = d1_data - p;
614 target = d1_data + p;
620 c0_data += c0_linesize;
621 c1_data += c1_linesize;
622 c2_data += c2_linesize;
623 d0_data += d0_linesize;
624 d1_data += d1_linesize;
637 const int c0_linesize = in->
linesize[ plane + 0 ];
638 const int c1_linesize = in->
linesize[(plane + 1) % s->
ncomp];
639 const int c2_linesize = in->
linesize[(plane + 2) % s->
ncomp];
640 const int d0_linesize = out->
linesize[ plane + 0 ];
641 const int d1_linesize = out->
linesize[(plane + 1) % s->
ncomp];
642 const int d2_linesize = out->
linesize[(plane + 2) % s->
ncomp];
644 const int src_h = in->
height;
645 const int src_w = in->
width;
649 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1);
650 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1);
651 const int d2_signed_linesize = d2_linesize * (mirror == 1 ? -1 : 1);
653 for (x = 0; x < src_w; x++) {
658 uint8_t *d1_data = out->
data[(plane + 1) % s->
ncomp] + offset * d1_linesize;
659 uint8_t *d2_data = out->
data[(plane + 2) % s->
ncomp] + offset * d2_linesize;
660 uint8_t *
const d0_bottom_line = d0_data + d0_linesize * (s->
size - 1);
661 uint8_t *
const d0 = (mirror ? d0_bottom_line : d0_data);
662 uint8_t *
const d1_bottom_line = d1_data + d1_linesize * (s->
size - 1);
663 uint8_t *
const d1 = (mirror ? d1_bottom_line : d1_data);
664 uint8_t *
const d2_bottom_line = d2_data + d2_linesize * (s->
size - 1);
665 uint8_t *
const d2 = (mirror ? d2_bottom_line : d2_data);
667 for (y = 0; y < src_h; y++) {
668 const int c0 = c0_data[x] + 128;
669 const int c1 = c1_data[x] - 128;
670 const int c2 = c2_data[x] - 128;
674 target = d0 + x + d0_signed_linesize * c0;
675 update(target, max, intensity);
677 for (p = c0 + c1; p < c0; p++) {
678 target = d1 + x + d1_signed_linesize * p;
682 for (p = c0 + c1 - 1; p > c0; p--) {
683 target = d1 + x + d1_signed_linesize * p;
687 for (p = c0 + c2; p < c0; p++) {
688 target = d2 + x + d2_signed_linesize * p;
692 for (p = c0 + c2 - 1; p > c0; p--) {
693 target = d2 + x + d2_signed_linesize * p;
697 c0_data += c0_linesize;
698 c1_data += c1_linesize;
699 c2_data += c2_linesize;
700 d0_data += d0_linesize;
701 d1_data += d1_linesize;
702 d2_data += d2_linesize;
714 d0_data += s->
size - 1;
715 d1_data += s->
size - 1;
716 d2_data += s->
size - 1;
719 for (y = 0; y < src_h; y++) {
720 for (x = 0; x < src_w; x++) {
721 const int c0 = c0_data[x] + 128;
722 const int c1 = c1_data[x] - 128;
723 const int c2 = c2_data[x] - 128;
728 target = d0_data - c0;
730 target = d0_data + c0;
732 update(target, max, intensity);
734 for (p = c0 + c1; p < c0; p++) {
736 target = d1_data - p;
738 target = d1_data + p;
743 for (p = c0 + 1; p < c0 +
c1; p++) {
745 target = d1_data - p;
747 target = d1_data + p;
752 for (p = c0 + c2; p < c0; p++) {
754 target = d2_data - p;
756 target = d2_data + p;
761 for (p = c0 + 1; p < c0 +
c2; p++) {
763 target = d2_data - p;
765 target = d2_data + p;
771 c0_data += c0_linesize;
772 c1_data += c1_linesize;
773 c2_data += c2_linesize;
774 d0_data += d0_linesize;
775 d1_data += d1_linesize;
776 d2_data += d2_linesize;
790 const int c0_linesize = in->
linesize[(plane + 1) % s->
ncomp];
791 const int c1_linesize = in->
linesize[(plane + 2) % s->
ncomp];
794 const int src_h = in->
height;
795 const int src_w = in->
width;
799 const int dst_signed_linesize = dst_linesize * (mirror == 1 ? -1 : 1);
801 for (x = 0; x < src_w; x++) {
805 uint8_t *
const dst_bottom_line = dst_data + dst_linesize * (s->
size - 1);
806 uint8_t *
const dst_line = (mirror ? dst_bottom_line : dst_data);
809 for (y = 0; y < src_h; y++) {
810 const int sum =
FFABS(c0_data[x] - 128) +
FFABS(c1_data[x] - 128);
814 for (p = 256 - sum; p < 256 + sum; p++) {
815 target = dst + x + dst_signed_linesize * p;
819 c0_data += c0_linesize;
820 c1_data += c1_linesize;
821 dst_data += dst_linesize;
830 dst_data += s->
size - 1;
831 for (y = 0; y < src_h; y++) {
832 for (x = 0; x < src_w; x++) {
833 const int sum =
FFABS(c0_data[x] - 128) +
FFABS(c1_data[x] - 128);
837 for (p = 256 - sum; p < 256 + sum; p++) {
839 target = dst_data - p;
841 target = dst_data + p;
847 c0_data += c0_linesize;
848 c1_data += c1_linesize;
849 dst_data += dst_linesize;
861 const int c1_linesize = in->
linesize[(plane + 1) % s->
ncomp];
862 const int c2_linesize = in->
linesize[(plane + 2) % s->
ncomp];
863 const int d1_linesize = out->
linesize[(plane + 1) % s->
ncomp];
864 const int d2_linesize = out->
linesize[(plane + 2) % s->
ncomp];
866 const int src_h = in->
height;
867 const int src_w = in->
width;
871 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1);
872 const int d2_signed_linesize = d2_linesize * (mirror == 1 ? -1 : 1);
874 for (x = 0; x < src_w; x++) {
877 uint8_t *d1_data = out->
data[(plane + 1) % s->
ncomp] + offset * d1_linesize;
878 uint8_t *d2_data = out->
data[(plane + 2) % s->
ncomp] + offset * d2_linesize;
879 uint8_t *
const d1_bottom_line = d1_data + d1_linesize * (s->
size - 1);
880 uint8_t *
const d1 = (mirror ? d1_bottom_line : d1_data);
881 uint8_t *
const d2_bottom_line = d2_data + d2_linesize * (s->
size - 1);
882 uint8_t *
const d2 = (mirror ? d2_bottom_line : d2_data);
884 for (y = 0; y < src_h; y++) {
885 const int c1 = c1_data[x] - 128;
886 const int c2 = c2_data[x] - 128;
890 for (p = 128 + c1; p < 128; p++) {
891 target = d1 + x + d1_signed_linesize * p;
895 for (p = 128 + c1 - 1; p > 128; p--) {
896 target = d1 + x + d1_signed_linesize * p;
900 for (p = 128 + c2; p < 128; p++) {
901 target = d2 + x + d2_signed_linesize * p;
905 for (p = 128 + c2 - 1; p > 128; p--) {
906 target = d2 + x + d2_signed_linesize * p;
910 c1_data += c1_linesize;
911 c2_data += c2_linesize;
912 d1_data += d1_linesize;
913 d2_data += d2_linesize;
924 d0_data += s->
size - 1;
925 d1_data += s->
size - 1;
926 d2_data += s->
size - 1;
929 for (y = 0; y < src_h; y++) {
930 for (x = 0; x < src_w; x++) {
931 const int c1 = c1_data[x] - 128;
932 const int c2 = c2_data[x] - 128;
936 for (p = 128 + c1; p < 128; p++) {
938 target = d1_data - p;
940 target = d1_data + p;
945 for (p = 128 + 1; p < 128 +
c1; p++) {
947 target = d1_data - p;
949 target = d1_data + p;
954 for (p = 128 + c2; p < 128; p++) {
956 target = d2_data - p;
958 target = d2_data + p;
963 for (p = 128 + 1; p < 128 +
c2; p++) {
965 target = d2_data - p;
967 target = d2_data + p;
973 c1_data += c1_linesize;
974 c2_data += c2_linesize;
975 d1_data += d1_linesize;
976 d2_data += d2_linesize;
989 const int limit = s->
max - 1;
990 const uint16_t *c0_data = (
const uint16_t *)in->
data[plane + 0];
991 const uint16_t *c1_data = (
const uint16_t *)in->
data[(plane + 1) % s->
ncomp];
992 const uint16_t *c2_data = (
const uint16_t *)in->
data[(plane + 2) % s->
ncomp];
993 const int c0_linesize = in->
linesize[ plane + 0 ] / 2;
994 const int c1_linesize = in->
linesize[(plane + 1) % s->
ncomp] / 2;
995 const int c2_linesize = in->
linesize[(plane + 2) % s->
ncomp] / 2;
996 const int d0_linesize = out->
linesize[ plane + 0 ] / 2;
997 const int d1_linesize = out->
linesize[(plane + 1) % s->
ncomp] / 2;
998 const int d2_linesize = out->
linesize[(plane + 2) % s->
ncomp] / 2;
999 const int src_h = in->
height;
1000 const int src_w = in->
width;
1004 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1);
1005 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1);
1006 const int d2_signed_linesize = d2_linesize * (mirror == 1 ? -1 : 1);
1007 uint16_t *d0_data = (uint16_t *)out->
data[plane] + offset * d0_linesize;
1008 uint16_t *d1_data = (uint16_t *)out->
data[(plane + 1) % s->
ncomp] + offset * d1_linesize;
1009 uint16_t *d2_data = (uint16_t *)out->
data[(plane + 2) % s->
ncomp] + offset * d2_linesize;
1010 uint16_t *
const d0_bottom_line = d0_data + d0_linesize * (s->
size - 1);
1011 uint16_t *
const d0 = (mirror ? d0_bottom_line : d0_data);
1012 uint16_t *
const d1_bottom_line = d1_data + d1_linesize * (s->
size - 1);
1013 uint16_t *
const d1 = (mirror ? d1_bottom_line : d1_data);
1014 uint16_t *
const d2_bottom_line = d2_data + d2_linesize * (s->
size - 1);
1015 uint16_t *
const d2 = (mirror ? d2_bottom_line : d2_data);
1017 for (
y = 0;
y < src_h;
y++) {
1018 for (x = 0; x < src_w; x++) {
1019 const int c0 =
FFMIN(c0_data[x], limit);
1020 const int c1 = c1_data[x];
1021 const int c2 = c2_data[x];
1023 *(d0 + d0_signed_linesize * c0 + x) = c0;
1024 *(d1 + d1_signed_linesize * c0 + x) = c1;
1025 *(d2 + d2_signed_linesize * c0 + x) = c2;
1028 c0_data += c0_linesize;
1029 c1_data += c1_linesize;
1030 c2_data += c2_linesize;
1031 d0_data += d0_linesize;
1032 d1_data += d1_linesize;
1033 d2_data += d2_linesize;
1036 uint16_t *d0_data = (uint16_t *)out->
data[plane] + offset;
1037 uint16_t *d1_data = (uint16_t *)out->
data[(plane + 1) % s->
ncomp] + offset;
1038 uint16_t *d2_data = (uint16_t *)out->
data[(plane + 2) % s->
ncomp] + offset;
1041 d0_data += s->
size - 1;
1042 d1_data += s->
size - 1;
1043 d2_data += s->
size - 1;
1046 for (
y = 0;
y < src_h;
y++) {
1047 for (x = 0; x < src_w; x++) {
1048 const int c0 =
FFMIN(c0_data[x], limit);
1049 const int c1 = c1_data[x];
1050 const int c2 = c2_data[x];
1053 *(d0_data - c0) = c0;
1054 *(d1_data - c0) = c1;
1055 *(d2_data - c0) = c2;
1057 *(d0_data + c0) = c0;
1058 *(d1_data + c0) = c1;
1059 *(d2_data + c0) = c2;
1063 c0_data += c0_linesize;
1064 c1_data += c1_linesize;
1065 c2_data += c2_linesize;
1066 d0_data += d0_linesize;
1067 d1_data += d1_linesize;
1068 d2_data += d2_linesize;
1083 const int c0_linesize = in->
linesize[ plane + 0 ];
1084 const int c1_linesize = in->
linesize[(plane + 1) % s->
ncomp];
1085 const int c2_linesize = in->
linesize[(plane + 2) % s->
ncomp];
1086 const int d0_linesize = out->
linesize[ plane + 0 ];
1087 const int d1_linesize = out->
linesize[(plane + 1) % s->
ncomp];
1088 const int d2_linesize = out->
linesize[(plane + 2) % s->
ncomp];
1089 const int src_h = in->
height;
1090 const int src_w = in->
width;
1094 const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1);
1095 const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1);
1096 const int d2_signed_linesize = d2_linesize * (mirror == 1 ? -1 : 1);
1098 uint8_t *d1_data = out->
data[(plane + 1) % s->
ncomp] + offset * d1_linesize;
1099 uint8_t *d2_data = out->
data[(plane + 2) % s->
ncomp] + offset * d2_linesize;
1100 uint8_t *
const d0_bottom_line = d0_data + d0_linesize * (s->
size - 1);
1101 uint8_t *
const d0 = (mirror ? d0_bottom_line : d0_data);
1102 uint8_t *
const d1_bottom_line = d1_data + d1_linesize * (s->
size - 1);
1103 uint8_t *
const d1 = (mirror ? d1_bottom_line : d1_data);
1104 uint8_t *
const d2_bottom_line = d2_data + d2_linesize * (s->
size - 1);
1105 uint8_t *
const d2 = (mirror ? d2_bottom_line : d2_data);
1107 for (y = 0; y < src_h; y++) {
1108 for (x = 0; x < src_w; x++) {
1109 const int c0 = c0_data[x];
1110 const int c1 = c1_data[x];
1111 const int c2 = c2_data[x];
1113 *(d0 + d0_signed_linesize * c0 + x) = c0;
1114 *(d1 + d1_signed_linesize * c0 + x) = c1;
1115 *(d2 + d2_signed_linesize * c0 + x) = c2;
1118 c0_data += c0_linesize;
1119 c1_data += c1_linesize;
1120 c2_data += c2_linesize;
1121 d0_data += d0_linesize;
1122 d1_data += d1_linesize;
1123 d2_data += d2_linesize;
1131 d0_data += s->
size - 1;
1132 d1_data += s->
size - 1;
1133 d2_data += s->
size - 1;
1136 for (y = 0; y < src_h; y++) {
1137 for (x = 0; x < src_w; x++) {
1138 const int c0 = c0_data[x];
1139 const int c1 = c1_data[x];
1140 const int c2 = c2_data[x];
1143 *(d0_data - c0) = c0;
1144 *(d1_data - c0) = c1;
1145 *(d2_data - c0) = c2;
1147 *(d0_data + c0) = c0;
1148 *(d1_data + c0) = c1;
1149 *(d2_data + c0) = c2;
1153 c0_data += c0_linesize;
1154 c1_data += c1_linesize;
1155 c2_data += c2_linesize;
1156 d0_data += d0_linesize;
1157 d1_data += d1_linesize;
1158 d2_data += d2_linesize;
1202 switch (inlink->
format) {
1223 for (i = 0; i < s->
ncomp; i++) {
1224 if ((1 << i) & s->
pcomp)
1242 for (p = 0; p < 4; p++) {
1243 const int is_chroma = (p == 1 || p == 2);
1249 if (!((1 << p) & s->
pcomp))
1252 shift = s->
mode ? shift_h : shift_w;
1254 for (k = 0; k < 4; k++) {
1262 for (i = 0; i <
size; i++) {
1263 for (k = 0; k < 4; k++) {
1290 for (k = 0; k < s->
ncomp; k++) {
1291 const int is_chroma = (k == 1 || k == 2);
1295 for (i = 0; i < dst_h ; i++)
1303 for (i = 0; i < dst_h ; i++) {
1304 for (j = 0; j < dst_w; j++)
1311 for (k = 0, i = 0; k < s->
ncomp; k++) {
1312 if ((1 << k) & s->
pcomp) {
1352 .priv_class = &waveform_class,
static int shift(int a, int b)
#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_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
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.
const char * name
Pad name.
AVFilterLink ** inputs
array of pointers to input links
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
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...
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)
uint16_t depth_minus1
Number of bits in the component minus 1.
int width
width and height of the video frame
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
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
simple assert() macros that are a bit more flexible than ISO C assert().
#define AV_PIX_FMT_YUV444P10
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
#define AV_PIX_FMT_YUV422P9
uint8_t nb_components
The number of components each pixel has, (1-4)
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 FF_CEIL_RSHIFT(a, b)
#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
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
static int16_t mult(Float11 *f1, Float11 *f2)
#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 numerator/denominator
const char * name
Filter name.
#define AV_PIX_FMT_YUV420P9
AVRational sample_aspect_ratio
agreed upon sample aspect ratio
AVFilterLink ** outputs
array of pointers to output links
static enum AVPixelFormat pix_fmts[]
#define AV_PIX_FMT_YUV422P10
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
uint16_t plane
Which of the 4 planes contains the component.
static void filter(MpegAudioContext *s, int ch, const short *samples, int incr)
void(* waveform)(struct WaveformContext *s, AVFrame *in, AVFrame *out, int component, int intensity, int offset, int column)
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
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)
AVFilterContext * dst
dest filter
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor ...
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-> out
static void comp(unsigned char *dst, int dst_stride, unsigned char *src, int src_stride, int add)
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
#define av_malloc_array(a, b)
const AVPixFmtDescriptor * desc
AVPixelFormat
Pixel format.