83 int X,
int Y,
int D,
int P);
86 #define OFFSET(x) offsetof(VectorscopeContext, x) 87 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM 227 if ((s->
x == 1 && s->
y == 2) || (s->
x == 2 && s->
y == 1))
246 if (rgb && depth == 8)
248 else if (rgb && depth == 9)
250 else if (rgb && depth == 10)
252 else if (rgb && depth == 12)
258 else if (depth == 10)
260 else if (depth == 12)
276 outlink->
h = outlink->
w = s->
size;
287 for (i = 0; i < s->
size; i++)
295 const int dlinesize = out->
linesize[0] / 2;
300 for (i = 0; i < out->
height; i++) {
301 for (j = 0; j < out->
width; j++) {
302 const int pos = i * dlinesize + j;
303 const int poa = (i - 1) * dlinesize + j;
304 const int pob = (i + 1) * dlinesize + j;
306 if (dpd[pos] && (((!j || !dpd[pos - 1]) || ((j == (out->
width - 1)) || !dpd[pos + 1]))
307 || ((!i || !dpd[poa]) || ((i == (out->
height - 1)) || !dpd[pob])))) {
316 const int dlinesize = out->
linesize[0] / 2;
321 for (i = 0; i < out->
height; i++) {
322 for (j = 0; j < out->
width; j++) {
323 const int pos = i * dlinesize + j;
333 for (i = 0; i < out->
height; i++) {
334 for (j = 0; j < out->
width; j++) {
335 const int pos = i * dlinesize + j;
337 if (s->
peak[i][j] && (((!j || !s->
peak[i][j-1]) || ((j == (out->
width - 1)) || !s->
peak[i][j + 1]))
338 || ((!i || !s->
peak[i-1][j]) || ((i == (out->
height - 1)) || !s->
peak[i + 1][j])))) {
347 const int dlinesize = out->
linesize[0];
351 for (i = 0; i < out->
height; i++) {
352 for (j = 0; j < out->
width; j++) {
353 const int pos = i * dlinesize + j;
354 const int poa = (i - 1) * dlinesize + j;
355 const int pob = (i + 1) * dlinesize + j;
357 if (dpd[pos] && (((!j || !dpd[pos - 1]) || ((j == (out->
width - 1)) || !dpd[pos + 1]))
358 || ((!i || !dpd[poa]) || ((i == (out->
height - 1)) || !dpd[pob])))) {
367 const int dlinesize = out->
linesize[0];
371 for (i = 0; i < out->
height; i++) {
372 for (j = 0; j < out->
width; j++) {
373 const int pos = i * dlinesize + j;
383 for (i = 0; i < out->
height; i++) {
384 for (j = 0; j < out->
width; j++) {
385 const int pos = i * dlinesize + j;
387 if (s->
peak[i][j] && (((!j || !s->
peak[i][j-1]) || ((j == (out->
width - 1)) || !s->
peak[i][j + 1]))
388 || ((!i || !s->
peak[i-1][j]) || ((i == (out->
height - 1)) || !s->
peak[i + 1][j])))) {
419 const uint16_t *
const *
src = (
const uint16_t *
const *)in->
data;
420 const int slinesizex = in->
linesize[s->
x] / 2;
421 const int slinesizey = in->
linesize[s->
y] / 2;
422 const int slinesized = in->
linesize[pd] / 2;
423 const int dlinesize = out->
linesize[0] / 2;
425 const int px = s->
x, py = s->
y;
428 const uint16_t *spx = src[px];
429 const uint16_t *spy = src[py];
430 const uint16_t *spd = src[pd];
433 uint16_t **dst = (uint16_t **)out->
data;
434 uint16_t *dpx = dst[px];
435 uint16_t *dpy = dst[py];
436 uint16_t *dpd = dst[
pd];
437 uint16_t *dp1 = dst[1];
438 uint16_t *dp2 = dst[2];
440 const int mid = s->
size / 2;
445 for (k = 0; k < 4 && dst[k]; k++) {
446 for (i = 0; i < out->
height ; i++)
447 for (j = 0; j < out->
width; j++)
456 for (i = 0; i <
h; i++) {
457 const int iwx = i * slinesizex;
458 const int iwy = i * slinesizey;
459 const int iwd = i * slinesized;
460 for (j = 0; j <
w; j++) {
461 const int x =
FFMIN(spx[iwx + j], max);
462 const int y =
FFMIN(spy[iwy + j], max);
463 const int z = spd[iwd + j];
464 const int pos = y * dlinesize +
x;
466 if (z < tmin || z > tmax)
475 for (i = 0; i <
h; i++) {
476 const int iw1 = i * slinesizex;
477 const int iw2 = i * slinesizey;
478 const int iwd = i * slinesized;
479 for (j = 0; j <
w; j++) {
480 const int x =
FFMIN(spx[iw1 + j], max);
481 const int y =
FFMIN(spy[iw2 + j], max);
482 const int z = spd[iwd + j];
483 const int pos = y * dlinesize +
x;
485 if (z < tmin || z > tmax)
495 for (i = 0; i <
h; i++) {
496 const int iw1 = i * slinesizex;
497 const int iw2 = i * slinesizey;
498 const int iwd = i * slinesized;
499 for (j = 0; j <
w; j++) {
500 const int x =
FFMIN(spx[iw1 + j], max);
501 const int y =
FFMIN(spy[iw2 + j], max);
502 const int z = spd[iwd + j];
503 const int pos = y * dlinesize +
x;
505 if (z < tmin || z > tmax)
517 for (i = 0; i <
h; i++) {
518 const int iw1 = i * slinesizex;
519 const int iw2 = i * slinesizey;
520 const int iwd = i * slinesized;
521 for (j = 0; j <
w; j++) {
522 const int x =
FFMIN(spx[iw1 + j], max);
523 const int y =
FFMIN(spy[iw2 + j], max);
524 const int z = spd[iwd + j];
525 const int pos = y * dlinesize +
x;
527 if (z < tmin || z > tmax)
537 for (i = 0; i < in->
height; i++) {
538 const int iwx = (i >>
vsub) * slinesizex;
539 const int iwy = (i >>
vsub) * slinesizey;
540 const int iwd = i * slinesized;
541 for (j = 0; j < in->
width; j++) {
542 const int x =
FFMIN(spx[iwx + (j >>
hsub)], max);
543 const int y =
FFMIN(spy[iwy + (j >>
hsub)], max);
544 const int z = spd[iwd + j];
545 const int pos = y * dlinesize +
x;
547 if (z < tmin || z > tmax)
563 for (i = 0; i < out->
height; i++) {
564 for (j = 0; j < out->
width; j++) {
565 int pos = i * dlinesize + j;
574 (s->
tint[0] != mid || s->
tint[1] != mid)) {
575 for (i = 0; i < out->
height; i++) {
576 for (j = 0; j < out->
width; j++) {
577 const int pos = i * dlinesize + j;
585 for (i = 0; i < out->
height; i++) {
586 for (j = 0; j < out->
width; j++) {
587 const int pos = i * dlinesize + j;
589 dpx[
pos] = av_clip(dpd[pos] + dpd[pos] * s->
ftint[0], 0, max);
590 dpy[
pos] = av_clip(dpd[pos] + dpd[pos] * s->
ftint[1], 0, max);
595 for (i = 0; i < out->
height; i++) {
596 for (j = 0; j < out->
width; j++) {
597 if (!dpd[i * dlinesize + j]) {
598 dpx[i * dlinesize + j] = j;
599 dpy[i * dlinesize + j] =
i;
600 dpd[i * dlinesize + j] = mid;
605 for (i = 0; i < out->
height; i++) {
606 for (j = 0; j < out->
width; j++) {
607 if (!dpd[i * dlinesize + j]) {
608 dpx[i * dlinesize + j] = j;
609 dpy[i * dlinesize + j] =
i;
610 dpd[i * dlinesize + j] = mid *
M_SQRT2 -
hypot(i - mid, j - mid);
620 const int slinesizex = in->
linesize[s->
x];
621 const int slinesizey = in->
linesize[s->
y];
622 const int slinesized = in->
linesize[pd];
623 const int dlinesize = out->
linesize[0];
625 const int px = s->
x, py = s->
y;
643 for (k = 0; k < 4 && dst[k]; k++)
644 for (i = 0; i < out->
height ; i++)
645 memset(dst[k] + i * out->
linesize[k],
652 for (i = 0; i <
h; i++) {
653 const int iwx = i * slinesizex;
654 const int iwy = i * slinesizey;
655 const int iwd = i * slinesized;
656 for (j = 0; j <
w; j++) {
657 const int x = spx[iwx + j];
658 const int y = spy[iwy + j];
659 const int z = spd[iwd + j];
660 const int pos = y * dlinesize +
x;
662 if (z < tmin || z >
tmax)
671 for (i = 0; i <
h; i++) {
672 const int iw1 = i * slinesizex;
673 const int iw2 = i * slinesizey;
674 const int iwd = i * slinesized;
675 for (j = 0; j <
w; j++) {
676 const int x = spx[iw1 + j];
677 const int y = spy[iw2 + j];
678 const int z = spd[iwd + j];
679 const int pos = y * dlinesize +
x;
681 if (z < tmin || z >
tmax)
691 for (i = 0; i <
h; i++) {
692 const int iw1 = i * slinesizex;
693 const int iw2 = i * slinesizey;
694 const int iwd = i * slinesized;
695 for (j = 0; j <
w; j++) {
696 const int x = spx[iw1 + j];
697 const int y = spy[iw2 + j];
698 const int z = spd[iwd + j];
699 const int pos = y * dlinesize +
x;
701 if (z < tmin || z >
tmax)
713 for (i = 0; i <
h; i++) {
714 const int iw1 = i * slinesizex;
715 const int iw2 = i * slinesizey;
716 const int iwd = i * slinesized;
717 for (j = 0; j <
w; j++) {
718 const int x = spx[iw1 + j];
719 const int y = spy[iw2 + j];
720 const int z = spd[iwd + j];
721 const int pos = y * dlinesize +
x;
723 if (z < tmin || z >
tmax)
733 for (i = 0; i < in->
height; i++) {
734 const int iwx = (i >>
vsub) * slinesizex;
735 const int iwy = (i >>
vsub) * slinesizey;
736 const int iwd = i * slinesized;
737 for (j = 0; j < in->
width; j++) {
738 const int x = spx[iwx + (j >>
hsub)];
739 const int y = spy[iwy + (j >>
hsub)];
740 const int z = spd[iwd + j];
741 const int pos = y * dlinesize +
x;
743 if (z < tmin || z >
tmax)
759 for (i = 0; i < out->
height; i++) {
760 for (j = 0; j < out->
width; j++) {
761 int pos = i * dlinesize + j;
770 (s->
tint[0] != 128 || s->
tint[1] != 128)) {
771 for (i = 0; i < out->
height; i++) {
772 for (j = 0; j < out->
width; j++) {
773 const int pos = i * dlinesize + j;
781 for (i = 0; i < out->
height; i++) {
782 for (j = 0; j < out->
width; j++) {
783 const int pos = i * dlinesize + j;
785 dpx[
pos] = av_clip_uint8(dpd[pos] + dpd[pos] * s->
ftint[0]);
786 dpy[
pos] = av_clip_uint8(dpd[pos] + dpd[pos] * s->
ftint[1]);
791 for (i = 0; i < out->
height; i++) {
792 for (j = 0; j < out->
width; j++) {
793 if (!dpd[i * out->
linesize[pd] + j]) {
801 for (i = 0; i < out->
height; i++) {
802 for (j = 0; j < out->
width; j++) {
803 if (!dpd[i * out->
linesize[pd] + j]) {
814 "R",
"B",
"Cy",
"Yl",
"G",
"Mg",
819 { 81, 90, 240 }, { 41, 240, 110 }, { 170, 166, 16 },
820 { 210, 16, 146 }, { 145, 54, 34 }, { 106, 202, 222 },
821 { 162, 44, 142 }, { 131, 156, 44 }, { 112, 72, 58 },
822 { 84, 184, 198 }, { 65, 100, 212 }, { 35, 212, 114 },
823 { 235, 128, 128 }, { 16, 128, 128 } },
824 { { 63, 102, 240 }, { 32, 240, 118 }, { 188, 154, 16 },
825 { 219, 16, 138 }, { 173, 42, 26 }, { 78, 214, 230 },
826 { 28, 212, 120 }, { 51, 109, 212 }, { 63, 193, 204 },
827 { 133, 63, 52 }, { 145, 147, 44 }, { 168, 44, 136 },
828 { 235, 128, 128 }, { 16, 128, 128 } },
829 { { 81*2, 90*2, 240*2 }, { 41*2, 240*2, 110*2 }, { 170*2, 166*2, 16*2 },
830 { 210*2, 16*2, 146*2 }, { 145*2, 54*2, 34*2 }, { 106*2, 202*2, 222*2 },
831 { 162*2, 44*2, 142*2 }, { 131*2, 156*2, 44*2 }, { 112*2, 72*2, 58*2 },
832 { 84*2, 184*2, 198*2 }, { 65*2, 100*2, 212*2 }, { 35*2, 212*2, 114*2 },
833 { 470, 256, 256 }, { 32, 256, 256 } },
834 { { 63*2, 102*2, 240*2 }, { 32*2, 240*2, 118*2 }, { 188*2, 154*2, 16*2 },
835 { 219*2, 16*2, 138*2 }, { 173*2, 42*2, 26*2 }, { 78*2, 214*2, 230*2 },
836 { 28*2, 212*2, 120*2 }, { 51*2, 109*2, 212*2 }, { 63*2, 193*2, 204*2 },
837 { 133*2, 63*2, 52*2 }, { 145*2, 147*2, 44*2 }, { 168*2, 44*2, 136*2 },
838 { 470, 256, 256 }, { 32, 256, 256 } },
839 { { 81*4, 90*4, 240*4 }, { 41*4, 240*4, 110*4 }, { 170*4, 166*4, 16*4 },
840 { 210*4, 16*4, 146*4 }, { 145*4, 54*4, 34*4 }, { 106*4, 202*4, 222*4 },
841 { 162*4, 44*4, 142*4 }, { 131*4, 156*4, 44*4 }, { 112*4, 72*4, 58*4 },
842 { 84*4, 184*4, 198*4 }, { 65*4, 100*4, 212*4 }, { 35*4, 212*4, 114*4 },
843 { 940, 512, 512 }, { 64, 512, 512 } },
844 { { 63*4, 102*4, 240*4 }, { 32*4, 240*4, 118*4 }, { 188*4, 154*4, 16*4 },
845 { 219*4, 16*4, 138*4 }, { 173*4, 42*4, 26*4 }, { 78*4, 214*4, 230*4 },
846 { 28*4, 212*4, 120*4 }, { 51*4, 109*4, 212*4 }, { 63*4, 193*4, 204*4 },
847 { 133*4, 63*4, 52*4 }, { 145*4, 147*4, 44*4 }, { 168*4, 44*4, 136*4 },
848 { 940, 512, 512 }, { 64, 512, 512 } },
849 { { 81*8, 90*4, 240*8 }, { 41*8, 240*8, 110*8 }, { 170*8, 166*8, 16*8 },
850 { 210*8, 16*4, 146*8 }, { 145*8, 54*8, 34*8 }, { 106*8, 202*8, 222*8 },
851 { 162*8, 44*4, 142*8 }, { 131*8, 156*8, 44*8 }, { 112*8, 72*8, 58*8 },
852 { 84*8, 184*4, 198*8 }, { 65*8, 100*8, 212*8 }, { 35*8, 212*8, 114*8 },
853 { 1880, 1024, 1024 }, { 128, 1024, 1024 } },
854 { { 63*8, 102*8, 240*8 }, { 32*8, 240*8, 118*8 }, { 188*8, 154*8, 16*8 },
855 { 219*8, 16*8, 138*8 }, { 173*8, 42*8, 26*8 }, { 78*8, 214*8, 230*8 },
856 { 28*8, 212*8, 120*8 }, { 51*8, 109*8, 212*8 }, { 63*8, 193*8, 204*8 },
857 { 133*8, 63*8, 52*8 }, { 145*8, 147*8, 44*8 }, { 168*8, 44*8, 136*8 },
858 { 1880, 1024, 1024 }, { 128, 1024, 1024 } },
859 { { 81*16, 90*16, 240*16 }, { 41*16, 240*16, 110*16 }, { 170*16, 166*16, 16*16 },
860 { 210*16, 16*16, 146*16 }, { 145*16, 54*16, 34*16 }, { 106*16, 202*16, 222*16 },
861 { 162*16, 44*16, 142*16 }, { 131*16, 156*16, 44*16 }, { 112*16, 72*16, 58*16 },
862 { 84*16, 184*16, 198*16 }, { 65*16, 100*16, 212*16 }, { 35*16, 212*16, 114*16 },
863 { 3760, 2048, 2048 }, { 256, 2048, 2048 } },
864 { { 63*16, 102*16, 240*16 }, { 32*16, 240*16, 118*16 }, { 188*16, 154*16, 16*16 },
865 { 219*16, 16*16, 138*16 }, { 173*16, 42*16, 26*16 }, { 78*16, 214*16, 230*16 },
866 { 28*16, 212*16, 120*16 }, { 51*16, 109*16, 212*16 }, { 63*16, 193*16, 204*16 },
867 { 133*16, 63*16, 52*16 }, { 145*16, 147*16, 44*16 }, { 168*16, 44*16, 136*16 },
868 { 3760, 2048, 2048 }, { 256, 2048, 2048 } },
873 const float f = 1. - o;
874 const float V = o * v;
877 dst[ l - 3] = dst[ l - 3] * f +
V;
878 dst[ l + 3] = dst[ l + 3] * f +
V;
879 dst[-l - 3] = dst[-l - 3] * f +
V;
880 dst[-l + 3] = dst[-l + 3] * f +
V;
884 dst[ l - 3] = dst[ l - 3] * f +
V;
885 dst[ l + 3] = dst[ l + 3] * f +
V;
886 dst[ l - 2] = dst[ l - 2] * f +
V;
887 dst[ l + 2] = dst[ l + 2] * f +
V;
888 dst[-l - 3] = dst[-l - 3] * f +
V;
889 dst[-l + 3] = dst[-l + 3] * f +
V;
890 dst[-l - 2] = dst[-l - 2] * f +
V;
891 dst[-l + 2] = dst[-l + 2] * f +
V;
896 const float f = 1. - o;
899 dst[ l - 3] = dst[ l - 3] * f + (255 - dst[ l - 3]) * o;
900 dst[ l + 3] = dst[ l + 3] * f + (255 - dst[ l + 3]) * o;
901 dst[-l - 3] = dst[-l - 3] * f + (255 - dst[-l - 3]) * o;
902 dst[-l + 3] = dst[-l + 3] * f + (255 - dst[-l + 3]) * o;
906 dst[ l - 3] = dst[ l - 3] * f + (255 - dst[ l - 3]) * o;
907 dst[ l + 3] = dst[ l + 3] * f + (255 - dst[ l + 3]) * o;
908 dst[ l - 2] = dst[ l - 2] * f + (255 - dst[ l - 2]) * o;
909 dst[ l + 2] = dst[ l + 2] * f + (255 - dst[ l + 2]) * o;
910 dst[-l - 3] = dst[-l - 3] * f + (255 - dst[-l - 3]) * o;
911 dst[-l + 3] = dst[-l + 3] * f + (255 - dst[-l + 3]) * o;
912 dst[-l - 2] = dst[-l - 2] * f + (255 - dst[-l - 2]) * o;
913 dst[-l + 2] = dst[-l + 2] * f + (255 - dst[-l + 2]) * o;
918 const float f = 1. - o;
919 const float V = o * v;
922 dst[ l - 3] = dst[ l - 3] * f +
V;
923 dst[ l + 3] = dst[ l + 3] * f +
V;
924 dst[-l - 3] = dst[-l - 3] * f +
V;
925 dst[-l + 3] = dst[-l + 3] * f +
V;
929 dst[ l - 3] = dst[ l - 3] * f +
V;
930 dst[ l + 3] = dst[ l + 3] * f +
V;
931 dst[ l - 2] = dst[ l - 2] * f +
V;
932 dst[ l + 2] = dst[ l + 2] * f +
V;
933 dst[-l - 3] = dst[-l - 3] * f +
V;
934 dst[-l + 3] = dst[-l + 3] * f +
V;
935 dst[-l - 2] = dst[-l - 2] * f +
V;
936 dst[-l + 2] = dst[-l + 2] * f +
V;
941 const float f = 1. - o;
944 dst[ l - 3] = dst[ l - 3] * f + (v - dst[ l - 3]) * o;
945 dst[ l + 3] = dst[ l + 3] * f + (v - dst[ l + 3]) * o;
946 dst[-l - 3] = dst[-l - 3] * f + (v - dst[-l - 3]) * o;
947 dst[-l + 3] = dst[-l + 3] * f + (v - dst[-l + 3]) * o;
951 dst[ l - 3] = dst[ l - 3] * f + (v - dst[ l - 3]) * o;
952 dst[ l + 3] = dst[ l + 3] * f + (v - dst[ l + 3]) * o;
953 dst[ l - 2] = dst[ l - 2] * f + (v - dst[ l - 2]) * o;
954 dst[ l + 2] = dst[ l + 2] * f + (v - dst[ l + 2]) * o;
955 dst[-l - 3] = dst[-l - 3] * f + (v - dst[-l - 3]) * o;
956 dst[-l + 3] = dst[-l + 3] * f + (v - dst[-l + 3]) * o;
957 dst[-l - 2] = dst[-l - 2] * f + (v - dst[-l - 2]) * o;
958 dst[-l + 2] = dst[-l + 2] * f + (v - dst[-l + 2]) * o;
973 for (plane = 0; plane < 4 && out->
data[plane]; plane++) {
974 for (i = 0; txt[
i]; i++) {
978 for (char_y = font_height - 1; char_y >= 0; char_y--) {
979 for (mask = 0x80;
mask; mask >>= 1) {
980 if (font[txt[i] * font_height + char_y] & mask)
981 p[0] = p[0] * o2 + (255 - p[0]) * o1;
998 for (plane = 0; plane < 4 && out->
data[plane]; plane++) {
999 for (i = 0; txt[
i]; i++) {
1001 int v = color[plane];
1003 uint16_t *p = (uint16_t *)(out->
data[plane] + y * out->
linesize[plane]) + (x + i * 8);
1004 for (char_y = font_height - 1; char_y >= 0; char_y--) {
1005 for (mask = 0x80;
mask; mask >>= 1) {
1006 if (font[txt[i] * font_height + char_y] & mask)
1007 p[0] = p[0] * o2 + (v - p[0]) * o1;
1024 for (plane = 0; plane < 4 && out->
data[plane]; plane++) {
1025 for (i = 0; txt[
i]; i++) {
1027 int v = color[plane];
1030 for (char_y = font_height - 1; char_y >= 0; char_y--) {
1031 for (mask = 0x80;
mask; mask >>= 1) {
1032 if (font[txt[i] * font_height + char_y] & mask)
1033 p[0] = p[0] * o2 + v * o1;
1050 for (plane = 0; plane < 4 && out->
data[plane]; plane++) {
1051 for (i = 0; txt[
i]; i++) {
1053 int v = color[plane];
1055 uint16_t *p = (uint16_t *)(out->
data[plane] + y * out->
linesize[plane]) + (x + i * 8);
1056 for (char_y = font_height - 1; char_y >= 0; char_y--) {
1057 for (mask = 0x80;
mask; mask >>= 1) {
1058 if (font[txt[i] * font_height + char_y] & mask)
1059 p[0] = p[0] * o2 + v * o1;
1074 for (i = 0; i < 12; i++) {
1110 for (i = 0; i < 6 && s->
flags & 4; i++) {
1111 uint16_t
color[4] = { 0, 0, 0, 0 };
1130 x = av_clip(x, 0, out->
width - 9);
1131 y = av_clip(y, 0, out->
height - 9);
1141 for (i = 0; i < 12; i++) {
1177 for (i = 0; i < 6 && s->
flags & 4; i++) {
1196 x = av_clip(x, 0, out->
width - 9);
1197 y = av_clip(y, 0, out->
height - 9);
1206 const int m = s->
mult;
1209 for (i = 0; i < 12; i++) {
1242 for (i = 0; i < 6 && s->
flags & 4; i++) {
1243 const uint16_t
color[4] = { 128 * m, 0, 0, max };
1256 x = av_clip(x, 0, out->
width - 9);
1257 y = av_clip(y, 0, out->
height - 9);
1267 for (i = 0; i < 12; i++) {
1300 for (i = 0; i < 6 && s->
flags & 4; i++) {
1314 x = av_clip(x, 0, out->
width - 9);
1315 y = av_clip(y, 0, out->
height - 9);
1326 for (i = 0; i < 12; i++) {
1359 for (i = 0; i < 6 && s->
flags & 4; i++) {
1373 x = av_clip(x, 0, out->
width - 9);
1374 y = av_clip(y, 0, out->
height - 9);
1384 for (i = 0; i < 12; i++) {
1417 for (i = 0; i < 6 && s->
flags & 4; i++) {
1431 x = av_clip(x, 0, out->
width - 9);
1432 y = av_clip(y, 0, out->
height - 9);
1451 s->
cs = (s->
depth - 8) * 2 + 0;
1455 s->
cs = (s->
depth - 8) * 2 + 1;
1469 for (plane = 0; plane < 4; plane++) {
1470 if (out->
data[plane]) {
1501 if ((s->
x == 1 && s->
y == 2) || (s->
x == 2 && s->
y == 1))
1503 else if ((s->
x == 0 && s->
y == 2) || (s->
x == 2 && s->
y == 0))
1505 else if ((s->
x == 0 && s->
y == 1) || (s->
x == 1 && s->
y == 0))
1537 switch (inlink->
format) {
1591 .
name =
"vectorscope",
1594 .priv_class = &vectorscope_class,
also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B
static int config_input(AVFilterLink *inlink)
#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.
AVFILTER_DEFINE_CLASS(vectorscope)
#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.
also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601 ...
int h
agreed upon image height
static void envelope_peak(VectorscopeContext *s, AVFrame *out)
static void draw_ihtext(AVFrame *out, int x, int y, float o1, float o2, const char *txt, const uint8_t color[4])
static void draw_idots16(uint16_t *dst, int L, int v, float o)
#define AV_PIX_FMT_GBRP10
also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
#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.
void * av_calloc(size_t nmemb, size_t size)
Non-inlined equivalent of av_mallocz_array().
static void envelope_instant16(VectorscopeContext *s, AVFrame *out)
static enum AVPixelFormat out_yuv8_pix_fmts[]
const char * name
Pad name.
AVFilterLink ** inputs
array of pointers to input links
static enum AVPixelFormat out_rgb12_pix_fmts[]
#define av_assert0(cond)
assert() equivalent, that is always enabled.
void(* vectorscope)(struct VectorscopeContext *s, AVFrame *in, AVFrame *out, int pd)
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 enum AVPixelFormat in2_pix_fmts[]
#define AV_PIX_FMT_YUVA420P9
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
static void invert_graticule16(VectorscopeContext *s, AVFrame *out, int X, int Y, int D, int P)
A filter pad used for either input or output.
static const AVOption vectorscope_options[]
A link between two filters.
static enum AVPixelFormat out_rgb8_pix_fmts[]
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
#define i(width, name, range_min, range_max)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
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]
static const uint16_t positions[][14][3]
#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
static const AVFilterPad inputs[]
enum AVColorSpace colorspace
YUV colorspace type.
#define AV_PIX_FMT_GBRAP12
simple assert() macros that are a bit more flexible than ISO C assert().
AVFilterFormats * in_formats
Lists of formats and channel layouts supported by the input and output filters respectively.
#define AV_PIX_FMT_YUV444P10
static void draw_dots16(uint16_t *dst, int L, int v, float o)
static enum AVPixelFormat in_pix_fmts[]
static void draw_idots(uint8_t *dst, int L, float o)
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
AVFilter ff_vf_vectorscope
static enum AVPixelFormat out_yuv10_pix_fmts[]
int w
agreed upon image width
uint64_t flags
Combination of AV_PIX_FMT_FLAG_...
static enum AVPixelFormat out_rgb9_pix_fmts[]
#define AV_PIX_FMT_YUV422P9
static av_const double hypot(double x, double y)
static enum AVPixelFormat in1_pix_fmts[]
static void none_graticule(VectorscopeContext *s, AVFrame *out, int X, int Y, int D, int P)
static enum AVPixelFormat out_rgb10_pix_fmts[]
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
#define AV_PIX_FMT_YUVA444P12
static void green_graticule16(VectorscopeContext *s, AVFrame *out, int X, int Y, int D, int P)
static void vectorscope16(VectorscopeContext *s, AVFrame *in, AVFrame *out, int pd)
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
static void draw_dots(uint8_t *dst, int L, int v, float o)
AVFilterContext * src
source filter
#define AV_PIX_FMT_YUVA444P10
#define AV_PIX_FMT_YUV444P9
static void color_graticule(VectorscopeContext *s, AVFrame *out, int X, int Y, int D, int P)
static enum AVPixelFormat out_yuv12_pix_fmts[]
int format
agreed upon media format
static void envelope_peak16(VectorscopeContext *s, AVFrame *out)
typedef void(RENAME(mix_any_func_type))
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...
static const AVFilterPad outputs[]
static int config_output(AVFilterLink *outlink)
static av_cold void uninit(AVFilterContext *ctx)
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(const int16_t *) pi >> 8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(const int32_t *) pi >> 24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31)))) #define SET_CONV_FUNC_GROUP(ofmt, ifmt) static void set_generic_function(AudioConvert *ac) { } void ff_audio_convert_free(AudioConvert **ac) { if(! *ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);} AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, int sample_rate, int apply_map) { AudioConvert *ac;int in_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) return NULL;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);return NULL;} return ac;} 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;} else if(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;else ac->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);return ac;} int ff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in) { int use_generic=1;int len=in->nb_samples;int p;if(ac->dc) { av_log(ac->avr, AV_LOG_TRACE, "%d samples - audio_convert: %s to %s (dithered)\", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));return ff_convert_dither(ac-> in
#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.
static int query_formats(AVFilterContext *ctx)
static void draw_htext(AVFrame *out, int x, int y, float o1, float o2, const char *txt, const uint8_t color[4])
Rational number (pair of numerator and denominator).
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
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
static void envelope_instant(VectorscopeContext *s, AVFrame *out)
#define AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_YUV444P12
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
void(* graticulef)(struct VectorscopeContext *s, AVFrame *out, int X, int Y, int D, int P)
static const char * positions_name[]
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)
static enum AVPixelFormat out_pix_fmts[]
static enum AVPixelFormat out_yuv9_pix_fmts[]
AVFilterContext * dst
dest filter
static void envelope16(VectorscopeContext *s, AVFrame *out)
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor ...
static void green_graticule(VectorscopeContext *s, AVFrame *out, int X, int Y, int D, int P)
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
static void draw_ihtext16(AVFrame *out, int x, int y, float o1, float o2, const char *txt, const uint16_t color[4])
static void vectorscope8(VectorscopeContext *s, AVFrame *in, AVFrame *out, int pd)
static void draw_htext16(AVFrame *out, int x, int y, float o1, float o2, const char *txt, const uint16_t color[4])
int depth
Number of bits in the component.
static void invert_graticule(VectorscopeContext *s, AVFrame *out, int X, int Y, int D, int P)
AVPixelFormat
Pixel format.
mode
Use these values in ebur128_init (or'ed).
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
CGA/EGA/VGA ROM font data.
AVFilterFormats * out_formats
#define AV_PIX_FMT_YUVA422P12
#define AV_CEIL_RSHIFT(a, b)
static void color_graticule16(VectorscopeContext *s, AVFrame *out, int X, int Y, int D, int P)