71 #define OFFSET(x) offsetof(SignalstatsContext, x)
72 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
96 s->filters |= 1 <<
s->outfilter;
100 b =
s->rgba_color[2];
101 s->yuv_color[0] = (( 66*
r + 129*
g + 25*
b + (1<<7)) >> 8) + 16;
102 s->yuv_color[1] = ((-38*
r + -74*
g + 112*
b + (1<<7)) >> 8) + 128;
103 s->yuv_color[2] = ((112*
r + -94*
g + -18*
b + (1<<7)) >> 8) + 128;
168 s->hsub =
desc->log2_chroma_w;
169 s->vsub =
desc->log2_chroma_h;
170 s->depth =
desc->comp[0].depth;
171 s->maxsize = 1 <<
s->depth;
177 if (!
s->histy || !
s->histu || !
s->histv || !
s->histsat)
180 outlink->
w = inlink->
w;
181 outlink->
h = inlink->
h;
186 s->fs = inlink->
w * inlink->
h;
187 s->cfs =
s->chromaw *
s->chromah;
196 if (!
s->frame_sat || !
s->frame_hue)
204 const int chromax = x >>
s->hsub;
205 const int chromay = y >>
s->vsub;
206 f->data[0][y *
f->linesize[0] + x] =
s->yuv_color[0];
207 f->data[1][chromay *
f->linesize[1] + chromax] =
s->yuv_color[1];
208 f->data[2][chromay *
f->linesize[2] + chromax] =
s->yuv_color[2];
213 const int chromax = x >>
s->hsub;
214 const int chromay = y >>
s->vsub;
215 const int mult = 1 << (
s->depth - 8);
216 AV_WN16(
f->data[0] + y *
f->linesize[0] + x * 2,
s->yuv_color[0] *
mult);
217 AV_WN16(
f->data[1] + chromay *
f->linesize[1] + chromax * 2,
s->yuv_color[1] *
mult);
218 AV_WN16(
f->data[2] + chromay *
f->linesize[2] + chromax * 2,
s->yuv_color[2] *
mult);
227 const int w =
in->width;
228 const int h =
in->height;
233 for (y = slice_start; y <
slice_end; y++) {
234 const int yc = y >>
s->vsub;
235 const uint8_t *pluma = &
in->data[0][y *
in->linesize[0]];
236 const uint8_t *pchromau = &
in->data[1][yc *
in->linesize[1]];
237 const uint8_t *pchromav = &
in->data[2][yc *
in->linesize[2]];
239 for (x = 0; x <
w; x++) {
240 const int xc = x >>
s->hsub;
241 const int luma = pluma[x];
242 const int chromau = pchromau[xc];
243 const int chromav = pchromav[xc];
244 const int filt = luma < 16 || luma > 235 ||
245 chromau < 16 || chromau > 240 ||
246 chromav < 16 || chromav > 240;
261 const int mult = 1 << (
s->depth - 8);
262 const int w =
in->width;
263 const int h =
in->height;
268 for (y = slice_start; y <
slice_end; y++) {
269 const int yc = y >>
s->vsub;
270 const uint16_t *pluma = (uint16_t *)&
in->data[0][y *
in->linesize[0]];
271 const uint16_t *pchromau = (uint16_t *)&
in->data[1][yc *
in->linesize[1]];
272 const uint16_t *pchromav = (uint16_t *)&
in->data[2][yc *
in->linesize[2]];
274 for (x = 0; x <
w; x++) {
275 const int xc = x >>
s->hsub;
276 const int luma = pluma[x];
277 const int chromau = pchromau[xc];
278 const int chromav = pchromav[xc];
279 const int filt = luma < 16 * mult || luma > 235 *
mult ||
280 chromau < 16 * mult || chromau > 240 *
mult ||
281 chromav < 16 * mult || chromav > 240 *
mult;
292 return ((
abs(x - y) +
abs (z - y)) / 2) -
abs(z - x) > 4;
301 const int w =
in->width;
302 const int h =
in->height;
306 int lw =
in->linesize[0];
307 int x, y, score = 0,
filt;
309 for (y = slice_start; y <
slice_end; y++) {
311 if (y - 1 < 0 || y + 1 >=
h)
317 #define FILTER(i, j) \
318 filter_tout_outlier(p[(y-j) * lw + x + i], \
319 p[ y * lw + x + i], \
320 p[(y+j) * lw + x + i])
322 #define FILTER3(j) (FILTER(-1, j) && FILTER(0, j) && FILTER(1, j))
324 if (y - 2 >= 0 && y + 2 <
h) {
325 for (x = 1; x <
w - 1; x++) {
332 for (x = 1; x <
w - 1; x++) {
349 const int w =
in->width;
350 const int h =
in->height;
353 const uint16_t *p = (uint16_t *)
in->data[0];
354 int lw =
in->linesize[0] / 2;
355 int x, y, score = 0,
filt;
359 if (y - 1 < 0 || y + 1 >=
h)
365 if (y - 2 >= 0 && y + 2 <
h) {
366 for (x = 1; x <
w - 1; x++) {
373 for (x = 1; x <
w - 1; x++) {
392 const int w =
in->width;
393 const int h =
in->height;
397 const int lw =
in->linesize[0];
400 for (y = slice_start; y <
slice_end; y++) {
402 const int ylw = y * lw;
403 int filt, totdiff = 0;
408 for (x = 0; x <
w; x++)
409 totdiff +=
abs(p[y2lw + x] - p[ylw + x]);
414 for (x = 0; x <
w; x++)
426 const int w =
in->width;
427 const int h =
in->height;
430 const uint16_t *p = (uint16_t *)
in->data[0];
431 const int lw =
in->linesize[0] / 2;
436 const int ylw = y * lw;
443 for (x = 0; x <
w; x++)
444 totdiff +=
abs(p[y2lw + x] - p[ylw + x]);
449 for (x = 0; x <
w; x++)
455 static const struct {
475 const int slice_start =
ff_slice_pos(
s->chromah, jobnr, nb_jobs);
478 const int lsz_u =
src->linesize[1];
479 const int lsz_v =
src->linesize[2];
480 const uint8_t *p_u =
src->data[1] + slice_start * lsz_u;
481 const uint8_t *p_v =
src->data[2] + slice_start * lsz_v;
483 const int lsz_sat = dst_sat->
linesize[0];
484 const int lsz_hue = dst_hue->
linesize[0];
485 uint8_t *p_sat = dst_sat->
data[0] + slice_start * lsz_sat;
486 uint8_t *p_hue = dst_hue->
data[0] + slice_start * lsz_hue;
488 for (j = slice_start; j <
slice_end; j++) {
489 for (
i = 0;
i <
s->chromaw;
i++) {
490 const int yuvu = p_u[
i];
491 const int yuvv = p_v[
i];
492 p_sat[
i] =
hypot(yuvu - 128, yuvv - 128);
493 ((int16_t*)p_hue)[
i] = fmod(
floor((180 /
M_PI) *
atan2f(yuvu-128, yuvv-128) + 180), 360.);
512 const int mid = 1 << (
s->depth - 1);
514 const int slice_start =
ff_slice_pos(
s->chromah, jobnr, nb_jobs);
517 const int lsz_u =
src->linesize[1] / 2;
518 const int lsz_v =
src->linesize[2] / 2;
519 const uint16_t *p_u = (uint16_t*)
src->data[1] + slice_start * lsz_u;
520 const uint16_t *p_v = (uint16_t*)
src->data[2] + slice_start * lsz_v;
522 const int lsz_sat = dst_sat->
linesize[0] / 2;
523 const int lsz_hue = dst_hue->
linesize[0] / 2;
524 uint16_t *p_sat = (uint16_t*)dst_sat->
data[0] + slice_start * lsz_sat;
525 uint16_t *p_hue = (uint16_t*)dst_hue->
data[0] + slice_start * lsz_hue;
527 for (j = slice_start; j <
slice_end; j++) {
528 for (
i = 0;
i <
s->chromaw;
i++) {
529 const int yuvu = p_u[
i];
530 const int yuvv = p_v[
i];
531 p_sat[
i] =
hypot(yuvu - mid, yuvv - mid);
532 ((int16_t*)p_hue)[
i] = fmod(
floor((180 /
M_PI) *
atan2f(yuvu-mid, yuvv-mid) + 180), 360.);
559 unsigned int *histy =
s->histy,
563 *histsat =
s->histsat;
564 int miny = -1, minu = -1, minv = -1;
565 int maxy = -1, maxu = -1, maxv = -1;
566 int lowy = -1, lowu = -1, lowv = -1;
567 int highy = -1, highu = -1, highv = -1;
568 int minsat = -1, maxsat = -1, lowsat = -1, highsat = -1;
569 int lowp, highp, clowp, chighp;
570 int accy, accu, accv;
571 int accsat, acchue = 0;
573 int toty = 0, totu = 0, totv = 0, totsat=0;
575 int dify = 0, difu = 0, difv = 0;
576 uint16_t masky = 0, masku = 0, maskv = 0;
585 const int lsz_sat = sat->
linesize[0];
586 const int lsz_hue = hue->
linesize[0];
596 prev =
s->frame_prev;
607 memset(
s->histy, 0,
s->maxsize *
sizeof(*
s->histy));
608 for (j = 0; j < link->
h; j++) {
609 for (
i = 0;
i < link->
w;
i++) {
610 const int yuv =
in->data[0][
w +
i];
614 dify +=
abs(yuv - prev->
data[0][pw +
i]);
616 w +=
in->linesize[0];
621 memset(
s->histu, 0,
s->maxsize *
sizeof(*
s->histu));
622 memset(
s->histv, 0,
s->maxsize *
sizeof(*
s->histv));
623 memset(
s->histsat, 0,
s->maxsize *
sizeof(*
s->histsat));
624 for (j = 0; j <
s->chromah; j++) {
625 for (
i = 0;
i <
s->chromaw;
i++) {
626 const int yuvu =
in->data[1][cw+
i];
627 const int yuvv =
in->data[2][cw+
i];
632 difu +=
abs(yuvu - prev->
data[1][cpw+
i]);
634 difv +=
abs(yuvv - prev->
data[2][cpw+
i]);
637 histhue[((int16_t*)p_hue)[
i]]++;
639 cw +=
in->linesize[1];
646 if (
s->filters & 1<<fil) {
651 memset(
s->jobs_rets, 0,
s->nb_jobs *
sizeof(*
s->jobs_rets));
653 &
td,
s->jobs_rets,
s->nb_jobs);
654 for (
i = 0;
i <
s->nb_jobs;
i++)
655 filtot[fil] +=
s->jobs_rets[
i];
662 lowp =
lrint(
s->fs * 10 / 100.);
663 highp =
lrint(
s->fs * 90 / 100.);
664 clowp =
lrint(
s->cfs * 10 / 100.);
665 chighp =
lrint(
s->cfs * 90 / 100.);
667 accy = accu = accv = accsat = 0;
668 for (fil = 0; fil <
s->maxsize; fil++) {
669 if (miny < 0 && histy[fil]) miny = fil;
670 if (minu < 0 && histu[fil]) minu = fil;
671 if (minv < 0 && histv[fil]) minv = fil;
672 if (minsat < 0 && histsat[fil]) minsat = fil;
674 if (histy[fil]) maxy = fil;
675 if (histu[fil]) maxu = fil;
676 if (histv[fil]) maxv = fil;
677 if (histsat[fil]) maxsat = fil;
679 toty += histy[fil] * fil;
680 totu += histu[fil] * fil;
681 totv += histv[fil] * fil;
682 totsat += histsat[fil] * fil;
687 accsat += histsat[fil];
689 if (lowy == -1 && accy >= lowp) lowy = fil;
690 if (lowu == -1 && accu >= clowp) lowu = fil;
691 if (lowv == -1 && accv >= clowp) lowv = fil;
692 if (lowsat == -1 && accsat >= clowp) lowsat = fil;
694 if (highy == -1 && accy >= highp) highy = fil;
695 if (highu == -1 && accu >= chighp) highu = fil;
696 if (highv == -1 && accv >= chighp) highv = fil;
697 if (highsat == -1 && accsat >= chighp) highsat = fil;
702 for (fil = 0; fil < 360; fil++) {
703 tothue += histhue[fil] * fil;
704 acchue += histhue[fil];
706 if (medhue == -1 && acchue >
s->cfs / 2)
708 if (histhue[fil] > maxhue) {
709 maxhue = histhue[fil];
716 #define SET_META(key, fmt, val) do { \
717 snprintf(metabuf, sizeof(metabuf), fmt, val); \
718 av_dict_set(&out->metadata, "lavfi.signalstats." key, metabuf, 0); \
723 SET_META(
"YAVG",
"%g", 1.0 * toty /
s->fs);
729 SET_META(
"UAVG",
"%g", 1.0 * totu /
s->cfs);
735 SET_META(
"VAVG",
"%g", 1.0 * totv /
s->cfs);
741 SET_META(
"SATAVG",
"%g", 1.0 * totsat /
s->cfs);
746 SET_META(
"HUEAVG",
"%g", 1.0 * tothue /
s->cfs);
748 SET_META(
"YDIF",
"%g", 1.0 * dify /
s->fs);
749 SET_META(
"UDIF",
"%g", 1.0 * difu /
s->cfs);
750 SET_META(
"VDIF",
"%g", 1.0 * difv /
s->cfs);
757 if (
s->filters & 1<<fil) {
759 snprintf(metabuf,
sizeof(metabuf),
"%g", 1.0 * filtot[fil] /
s->fs);
781 unsigned int *histy =
s->histy,
785 *histsat =
s->histsat;
786 int miny = -1, minu = -1, minv = -1;
787 int maxy = -1, maxu = -1, maxv = -1;
788 int lowy = -1, lowu = -1, lowv = -1;
789 int highy = -1, highu = -1, highv = -1;
790 int minsat = -1, maxsat = -1, lowsat = -1, highsat = -1;
791 int lowp, highp, clowp, chighp;
792 int accy, accu, accv;
793 int accsat, acchue = 0;
795 int64_t toty = 0, totu = 0, totv = 0, totsat=0;
797 int64_t dify = 0, difu = 0, difv = 0;
798 uint16_t masky = 0, masku = 0, maskv = 0;
805 const uint16_t *p_sat = (uint16_t *)sat->
data[0];
806 const uint16_t *p_hue = (uint16_t *)hue->
data[0];
807 const int lsz_sat = sat->
linesize[0] / 2;
808 const int lsz_hue = hue->
linesize[0] / 2;
818 prev =
s->frame_prev;
829 memset(
s->histy, 0,
s->maxsize *
sizeof(*
s->histy));
830 for (j = 0; j < link->
h; j++) {
831 for (
i = 0;
i < link->
w;
i++) {
838 w +=
in->linesize[0];
843 memset(
s->histu, 0,
s->maxsize *
sizeof(*
s->histu));
844 memset(
s->histv, 0,
s->maxsize *
sizeof(*
s->histv));
845 memset(
s->histsat, 0,
s->maxsize *
sizeof(*
s->histsat));
846 for (j = 0; j <
s->chromah; j++) {
847 for (
i = 0;
i <
s->chromaw;
i++) {
848 const int yuvu =
AV_RN16(
in->data[1] + cw +
i * 2);
849 const int yuvv =
AV_RN16(
in->data[2] + cw +
i * 2);
859 histhue[((int16_t*)p_hue)[
i]]++;
861 cw +=
in->linesize[1];
868 if (
s->filters & 1<<fil) {
873 memset(
s->jobs_rets, 0,
s->nb_jobs *
sizeof(*
s->jobs_rets));
875 &
td,
s->jobs_rets,
s->nb_jobs);
876 for (
i = 0;
i <
s->nb_jobs;
i++)
877 filtot[fil] +=
s->jobs_rets[
i];
884 lowp =
lrint(
s->fs * 10 / 100.);
885 highp =
lrint(
s->fs * 90 / 100.);
886 clowp =
lrint(
s->cfs * 10 / 100.);
887 chighp =
lrint(
s->cfs * 90 / 100.);
889 accy = accu = accv = accsat = 0;
890 for (fil = 0; fil <
s->maxsize; fil++) {
891 if (miny < 0 && histy[fil]) miny = fil;
892 if (minu < 0 && histu[fil]) minu = fil;
893 if (minv < 0 && histv[fil]) minv = fil;
894 if (minsat < 0 && histsat[fil]) minsat = fil;
896 if (histy[fil]) maxy = fil;
897 if (histu[fil]) maxu = fil;
898 if (histv[fil]) maxv = fil;
899 if (histsat[fil]) maxsat = fil;
901 toty += histy[fil] * fil;
902 totu += histu[fil] * fil;
903 totv += histv[fil] * fil;
904 totsat += histsat[fil] * fil;
909 accsat += histsat[fil];
911 if (lowy == -1 && accy >= lowp) lowy = fil;
912 if (lowu == -1 && accu >= clowp) lowu = fil;
913 if (lowv == -1 && accv >= clowp) lowv = fil;
914 if (lowsat == -1 && accsat >= clowp) lowsat = fil;
916 if (highy == -1 && accy >= highp) highy = fil;
917 if (highu == -1 && accu >= chighp) highu = fil;
918 if (highv == -1 && accv >= chighp) highv = fil;
919 if (highsat == -1 && accsat >= chighp) highsat = fil;
924 for (fil = 0; fil < 360; fil++) {
925 tothue += histhue[fil] * fil;
926 acchue += histhue[fil];
928 if (medhue == -1 && acchue >
s->cfs / 2)
930 if (histhue[fil] > maxhue) {
931 maxhue = histhue[fil];
940 SET_META(
"YAVG",
"%g", 1.0 * toty /
s->fs);
946 SET_META(
"UAVG",
"%g", 1.0 * totu /
s->cfs);
952 SET_META(
"VAVG",
"%g", 1.0 * totv /
s->cfs);
958 SET_META(
"SATAVG",
"%g", 1.0 * totsat /
s->cfs);
963 SET_META(
"HUEAVG",
"%g", 1.0 * tothue /
s->cfs);
965 SET_META(
"YDIF",
"%g", 1.0 * dify /
s->fs);
966 SET_META(
"UDIF",
"%g", 1.0 * difu /
s->cfs);
967 SET_META(
"VDIF",
"%g", 1.0 * difv /
s->cfs);
974 if (
s->filters & 1<<fil) {
976 snprintf(metabuf,
sizeof(metabuf),
"%g", 1.0 * filtot[fil] /
s->fs);
1017 .
name =
"signalstats",
1018 .description =
"Generate statistics from video analysis.",
1025 .priv_class = &signalstats_class,
static const AVFilterPad inputs[]
static const AVFilterPad outputs[]
static const int8_t filt[NUMTAPS *2]
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)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));return ff_convert_dither(ac-> in
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
#define flags(name, subs,...)
#define AV_CEIL_RSHIFT(a, b)
static __device__ float floor(float a)
static int ff_slice_pos(int total, int jobnr, int nb_jobs)
Compute the boundary index for a slice when work of size total is split into nb_jobs slices.
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
int av_frame_get_buffer(AVFrame *frame, int align)
Allocate new buffer(s) for audio or video data.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
int av_frame_make_writable(AVFrame *frame)
Ensure that the frame data is writable, avoiding data copy if possible.
enum AVPixelFormat pixfmt
static int16_t mult(Float11 *f1, Float11 *f2)
common internal API header
static enum AVPixelFormat pix_fmts[]
static av_const double hypot(double x, double y)
static const uint16_t mask[17]
static int slice_end(AVCodecContext *avctx, AVFrame *pict)
Handle slice ends.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
#define AV_PIX_FMT_YUV420P16
#define AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV444P9
#define AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_YUV440P12
#define AV_PIX_FMT_YUV422P9
#define AV_PIX_FMT_YUV420P12
#define AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_YUV420P9
#define AV_PIX_FMT_YUV420P14
AVPixelFormat
Pixel format.
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
@ AV_PIX_FMT_YUVJ440P
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
@ AV_PIX_FMT_YUVJ411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor ...
@ AV_PIX_FMT_YUVJ422P
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
@ AV_PIX_FMT_YUVJ444P
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
@ AV_PIX_FMT_YUVJ420P
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
#define AV_PIX_FMT_YUV422P14
#define AV_PIX_FMT_YUV422P16
#define AV_PIX_FMT_YUV440P10
#define AV_PIX_FMT_GRAY16
#define AV_PIX_FMT_YUV444P14
#define AV_PIX_FMT_YUV444P16
#define AV_PIX_FMT_YUV444P10
static const struct PPFilter filters[]
Describe the class of an AVClass context structure.
AVFilterLink ** inputs
array of pointers to input links
A link between two filters.
int w
agreed upon image width
int h
agreed upon image height
AVFilterContext * src
source filter
AVFilterContext * dst
dest filter
int format
agreed upon media format
A filter pad used for either input or output.
const char * name
Pad name.
const char * name
Filter name.
AVFormatInternal * internal
An opaque field for libavformat internal usage.
This structure describes decoded (raw) audio or video data.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames,...
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Used for passing data between threads.
#define av_malloc_array(a, b)
#define SET_META(key, fmt, val)
static const AVFilterPad signalstats_outputs[]
static int filter8_tout(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static void burn_frame8(const SignalstatsContext *s, AVFrame *f, int x, int y)
int(* process16)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static const AVFilterPad signalstats_inputs[]
static int compute_sat_hue_metrics8(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int filter_frame(AVFilterLink *link, AVFrame *in)
static int compute_sat_hue_metrics16(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int filter8_vrep(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int query_formats(AVFilterContext *ctx)
static unsigned compute_bit_depth(uint16_t mask)
static int filter16_vrep(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int filter16_tout(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int filter8_brng(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
AVFilter ff_vf_signalstats
static const struct @235 filters_def[]
static AVFrame * alloc_frame(enum AVPixelFormat pixfmt, int w, int h)
AVFILTER_DEFINE_CLASS(signalstats)
static av_cold int init(AVFilterContext *ctx)
static av_cold void uninit(AVFilterContext *ctx)
int(* process8)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int filter_frame8(AVFilterLink *link, AVFrame *in)
static int config_output(AVFilterLink *outlink)
static int filter_frame16(AVFilterLink *link, AVFrame *in)
static void burn_frame16(const SignalstatsContext *s, AVFrame *f, int x, int y)
static const AVOption signalstats_options[]
static int filter_tout_outlier(uint8_t x, uint8_t y, uint8_t z)
static int filter16_brng(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)