FFmpeg
vf_histogram.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012-2019 Paul B Mahol
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #include "config_components.h"
22 
23 #include "libavutil/colorspace.h"
24 #include "libavutil/opt.h"
25 #include "libavutil/parseutils.h"
26 #include "libavutil/pixdesc.h"
27 #include "libavutil/imgutils.h"
28 #include "libavutil/intreadwrite.h"
29 #include "avfilter.h"
30 #include "filters.h"
31 #include "formats.h"
32 #include "video.h"
33 
34 typedef struct HistogramContext {
35  const AVClass *class; ///< AVClass context for log and options purpose
37  int envelope;
38  int slide;
39  unsigned histogram[256*256];
41  int width;
42  int x_pos;
43  int mult;
44  int mid;
45  int ncomp;
46  int dncomp;
47  uint8_t bg_color[4][4];
48  uint8_t fg_color[4][4];
49  uint8_t envelope_rgba[4];
50  uint8_t envelope_color[4];
58  float fgopacity;
59  float bgopacity;
60  int planewidth[4];
61  int planeheight[4];
62  int start[4];
65 
66 #define OFFSET(x) offsetof(HistogramContext, x)
67 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
68 
69 #define COMMON_OPTIONS \
70  { "display_mode", "set display mode", OFFSET(display_mode), AV_OPT_TYPE_INT, {.i64=2}, 0, 2, FLAGS, .unit = "display_mode"}, \
71  { "d", "set display mode", OFFSET(display_mode), AV_OPT_TYPE_INT, {.i64=2}, 0, 2, FLAGS, .unit = "display_mode"}, \
72  { "overlay", NULL, 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, .unit = "display_mode" }, \
73  { "parade", NULL, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, .unit = "display_mode" }, \
74  { "stack", NULL, 0, AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, FLAGS, .unit = "display_mode" }, \
75  { "levels_mode", "set levels mode", OFFSET(levels_mode), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, FLAGS, .unit = "levels_mode"}, \
76  { "m", "set levels mode", OFFSET(levels_mode), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, FLAGS, .unit = "levels_mode"}, \
77  { "linear", NULL, 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, .unit = "levels_mode" }, \
78  { "logarithmic", NULL, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, .unit = "levels_mode" }, \
79  { "components", "set color components to display", OFFSET(components), AV_OPT_TYPE_INT, {.i64=7}, 1, 15, FLAGS}, \
80  { "c", "set color components to display", OFFSET(components), AV_OPT_TYPE_INT, {.i64=7}, 1, 15, FLAGS},
81 
82 static const AVOption histogram_options[] = {
83  { "level_height", "set level height", OFFSET(level_height), AV_OPT_TYPE_INT, {.i64=200}, 50, 2048, FLAGS},
84  { "scale_height", "set scale height", OFFSET(scale_height), AV_OPT_TYPE_INT, {.i64=12}, 0, 40, FLAGS},
86  { "fgopacity", "set foreground opacity", OFFSET(fgopacity), AV_OPT_TYPE_FLOAT, {.dbl=0.7}, 0, 1, FLAGS},
87  { "f", "set foreground opacity", OFFSET(fgopacity), AV_OPT_TYPE_FLOAT, {.dbl=0.7}, 0, 1, FLAGS},
88  { "bgopacity", "set background opacity", OFFSET(bgopacity), AV_OPT_TYPE_FLOAT, {.dbl=0.5}, 0, 1, FLAGS},
89  { "b", "set background opacity", OFFSET(bgopacity), AV_OPT_TYPE_FLOAT, {.dbl=0.5}, 0, 1, FLAGS},
90  { "colors_mode", "set colors mode", OFFSET(colors_mode), AV_OPT_TYPE_INT, {.i64=0}, 0, 9, FLAGS, .unit = "colors_mode"},
91  { "l", "set colors mode", OFFSET(colors_mode), AV_OPT_TYPE_INT, {.i64=0}, 0, 9, FLAGS, .unit = "colors_mode"},
92  { "whiteonblack", NULL, 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, .unit = "colors_mode" },
93  { "blackonwhite", NULL, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, .unit = "colors_mode" },
94  { "whiteongray", NULL, 0, AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, FLAGS, .unit = "colors_mode" },
95  { "blackongray", NULL, 0, AV_OPT_TYPE_CONST, {.i64=3}, 0, 0, FLAGS, .unit = "colors_mode" },
96  { "coloronblack", NULL, 0, AV_OPT_TYPE_CONST, {.i64=4}, 0, 0, FLAGS, .unit = "colors_mode" },
97  { "coloronwhite", NULL, 0, AV_OPT_TYPE_CONST, {.i64=5}, 0, 0, FLAGS, .unit = "colors_mode" },
98  { "colorongray" , NULL, 0, AV_OPT_TYPE_CONST, {.i64=6}, 0, 0, FLAGS, .unit = "colors_mode" },
99  { "blackoncolor", NULL, 0, AV_OPT_TYPE_CONST, {.i64=7}, 0, 0, FLAGS, .unit = "colors_mode" },
100  { "whiteoncolor", NULL, 0, AV_OPT_TYPE_CONST, {.i64=8}, 0, 0, FLAGS, .unit = "colors_mode" },
101  { "grayoncolor" , NULL, 0, AV_OPT_TYPE_CONST, {.i64=9}, 0, 0, FLAGS, .unit = "colors_mode" },
102  { NULL }
103 };
104 
105 AVFILTER_DEFINE_CLASS(histogram);
106 
107 static const enum AVPixelFormat levels_in_pix_fmts[] = {
124 };
125 
129 };
130 
134 };
135 
139 };
140 
144 };
145 
149 };
150 
154 };
155 
159 };
160 
164 };
165 
167 {
168  AVFilterFormats *avff;
169  const AVPixFmtDescriptor *desc;
170  const enum AVPixelFormat *out_pix_fmts;
171  int rgb, i, bits;
172  int ret;
173 
174  if (!ctx->inputs[0]->incfg.formats ||
175  !ctx->inputs[0]->incfg.formats->nb_formats) {
176  return AVERROR(EAGAIN);
177  }
178 
179  if (!ctx->inputs[0]->outcfg.formats)
180  if ((ret = ff_formats_ref(ff_make_format_list(levels_in_pix_fmts), &ctx->inputs[0]->outcfg.formats)) < 0)
181  return ret;
182  avff = ctx->inputs[0]->incfg.formats;
183  desc = av_pix_fmt_desc_get(avff->formats[0]);
184  rgb = desc->flags & AV_PIX_FMT_FLAG_RGB;
185  bits = desc->comp[0].depth;
186  for (i = 1; i < avff->nb_formats; i++) {
187  desc = av_pix_fmt_desc_get(avff->formats[i]);
188  if ((rgb != (desc->flags & AV_PIX_FMT_FLAG_RGB)) ||
189  (bits != desc->comp[0].depth))
190  return AVERROR(EAGAIN);
191  }
192 
193  if (rgb && bits == 8)
195  else if (rgb && bits == 9)
197  else if (rgb && bits == 10)
199  else if (rgb && bits == 12)
201  else if (bits == 8)
203  else if (bits == 9)
205  else if (bits == 10)
207  else if (bits == 12)
209  else
210  return AVERROR(EAGAIN);
211  if ((ret = ff_formats_ref(ff_make_format_list(out_pix_fmts), &ctx->outputs[0]->incfg.formats)) < 0)
212  return ret;
213 
214  return 0;
215 }
216 
217 static const uint8_t black_yuva_color[4] = { 0, 127, 127, 255 };
218 static const uint8_t black_gbrp_color[4] = { 0, 0, 0, 255 };
219 static const uint8_t white_yuva_color[4] = { 255, 127, 127, 255 };
220 static const uint8_t white_gbrp_color[4] = { 255, 255, 255, 255 };
221 static const uint8_t gray_color[4] = { 127, 127, 127, 255 };
222 static const uint8_t red_yuva_color[4] = { 127, 127, 255, 255 };
223 static const uint8_t red_gbrp_color[4] = { 255, 0, 0, 255 };
224 static const uint8_t green_yuva_color[4] = { 255, 127, 127, 255 };
225 static const uint8_t igreen_yuva_color[4]= { 0, 127, 127, 255 };
226 static const uint8_t green_gbrp_color[4] = { 0, 255, 0, 255 };
227 static const uint8_t blue_yuva_color[4] = { 127, 255, 127, 255 };
228 static const uint8_t blue_gbrp_color[4] = { 0, 0, 255, 255 };
229 
231 {
232  HistogramContext *s = inlink->dst->priv;
233  int rgb = 0;
234 
235  s->desc = av_pix_fmt_desc_get(inlink->format);
236  s->ncomp = s->desc->nb_components;
237  s->histogram_size = 1 << s->desc->comp[0].depth;
238  s->mult = s->histogram_size / 256;
239 
240  switch (inlink->format) {
241  case AV_PIX_FMT_GBRAP12:
242  case AV_PIX_FMT_GBRP12:
243  case AV_PIX_FMT_GBRAP10:
244  case AV_PIX_FMT_GBRP10:
245  case AV_PIX_FMT_GBRP9:
246  case AV_PIX_FMT_GBRAP:
247  case AV_PIX_FMT_GBRP:
248  memcpy(s->bg_color[0], black_gbrp_color, 4);
249  memcpy(s->fg_color[0], white_gbrp_color, 4);
250  s->start[0] = s->start[1] = s->start[2] = s->start[3] = 0;
251  memcpy(s->envelope_color, s->envelope_rgba, 4);
252  rgb = 1;
253  break;
254  default:
255  s->mid = 127;
256  memcpy(s->bg_color[0], black_yuva_color, 4);
257  memcpy(s->fg_color[0], white_yuva_color, 4);
258  s->start[0] = s->start[3] = 0;
259  s->start[1] = s->start[2] = s->histogram_size / 2;
260  s->envelope_color[0] = RGB_TO_Y_BT709(s->envelope_rgba[0], s->envelope_rgba[1], s->envelope_rgba[2]);
261  s->envelope_color[1] = RGB_TO_U_BT709(s->envelope_rgba[0], s->envelope_rgba[1], s->envelope_rgba[2], 0);
262  s->envelope_color[2] = RGB_TO_V_BT709(s->envelope_rgba[0], s->envelope_rgba[1], s->envelope_rgba[2], 0);
263  s->envelope_color[3] = s->envelope_rgba[3];
264  }
265 
266  for (int i = 1; i < 4; i++) {
267  memcpy(s->fg_color[i], s->fg_color[0], 4);
268  memcpy(s->bg_color[i], s->bg_color[0], 4);
269  }
270 
271  if (s->display_mode) {
272  if (s->colors_mode == 1) {
273  for (int i = 0; i < 4; i++)
274  for (int j = 0; j < 4; j++)
275  FFSWAP(uint8_t, s->fg_color[i][j], s->bg_color[i][j]);
276  } else if (s->colors_mode == 2) {
277  for (int i = 0; i < 4; i++)
278  memcpy(s->bg_color[i], gray_color, 4);
279  } else if (s->colors_mode == 3) {
280  for (int i = 0; i < 4; i++)
281  for (int j = 0; j < 4; j++)
282  FFSWAP(uint8_t, s->fg_color[i][j], s->bg_color[i][j]);
283  for (int i = 0; i < 4; i++)
284  memcpy(s->bg_color[i], gray_color, 4);
285  } else if (s->colors_mode == 4) {
286  if (rgb) {
287  memcpy(s->fg_color[0], red_gbrp_color, 4);
288  memcpy(s->fg_color[1], green_gbrp_color, 4);
289  memcpy(s->fg_color[2], blue_gbrp_color, 4);
290  } else {
291  memcpy(s->fg_color[0], green_yuva_color, 4);
292  memcpy(s->fg_color[1], blue_yuva_color, 4);
293  memcpy(s->fg_color[2], red_yuva_color, 4);
294  }
295  } else if (s->colors_mode == 5) {
296  for (int i = 0; i < 4; i++)
297  for (int j = 0; j < 4; j++)
298  FFSWAP(uint8_t, s->fg_color[i][j], s->bg_color[i][j]);
299  if (rgb) {
300  memcpy(s->fg_color[0], red_gbrp_color, 4);
301  memcpy(s->fg_color[1], green_gbrp_color, 4);
302  memcpy(s->fg_color[2], blue_gbrp_color, 4);
303  } else {
304  memcpy(s->fg_color[0], igreen_yuva_color,4);
305  memcpy(s->fg_color[1], blue_yuva_color, 4);
306  memcpy(s->fg_color[2], red_yuva_color, 4);
307  }
308  } else if (s->colors_mode == 6) {
309  for (int i = 0; i < 4; i++)
310  memcpy(s->bg_color[i], gray_color, 4);
311  if (rgb) {
312  memcpy(s->fg_color[0], red_gbrp_color, 4);
313  memcpy(s->fg_color[1], green_gbrp_color, 4);
314  memcpy(s->fg_color[2], blue_gbrp_color, 4);
315  } else {
316  memcpy(s->fg_color[0], green_yuva_color, 4);
317  memcpy(s->fg_color[1], blue_yuva_color, 4);
318  memcpy(s->fg_color[2], red_yuva_color, 4);
319  }
320  } else if (s->colors_mode == 7) {
321  for (int i = 0; i < 4; i++)
322  for (int j = 0; j < 4; j++)
323  FFSWAP(uint8_t, s->fg_color[i][j], s->bg_color[i][j]);
324  if (rgb) {
325  memcpy(s->bg_color[0], red_gbrp_color, 4);
326  memcpy(s->bg_color[1], green_gbrp_color, 4);
327  memcpy(s->bg_color[2], blue_gbrp_color, 4);
328  } else {
329  memcpy(s->bg_color[0], green_yuva_color, 4);
330  memcpy(s->bg_color[1], blue_yuva_color, 4);
331  memcpy(s->bg_color[2], red_yuva_color, 4);
332  }
333  } else if (s->colors_mode == 8) {
334  if (rgb) {
335  memcpy(s->bg_color[0], red_gbrp_color, 4);
336  memcpy(s->bg_color[1], green_gbrp_color, 4);
337  memcpy(s->bg_color[2], blue_gbrp_color, 4);
338  } else {
339  memcpy(s->bg_color[0], igreen_yuva_color,4);
340  memcpy(s->bg_color[1], blue_yuva_color, 4);
341  memcpy(s->bg_color[2], red_yuva_color, 4);
342  }
343  } else if (s->colors_mode == 9) {
344  for (int i = 0; i < 4; i++)
345  memcpy(s->fg_color[i], gray_color, 4);
346  if (rgb) {
347  memcpy(s->bg_color[0], red_gbrp_color, 4);
348  memcpy(s->bg_color[1], green_gbrp_color, 4);
349  memcpy(s->bg_color[2], blue_gbrp_color, 4);
350  } else {
351  memcpy(s->bg_color[0], igreen_yuva_color,4);
352  memcpy(s->bg_color[1], blue_yuva_color, 4);
353  memcpy(s->bg_color[2], red_yuva_color, 4);
354  }
355  }
356  }
357 
358  for (int i = 0; i < 4; i++) {
359  s->fg_color[i][3] = s->fgopacity * 255;
360  s->bg_color[i][3] = s->bgopacity * 255;
361  }
362 
363  s->planeheight[1] = s->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, s->desc->log2_chroma_h);
364  s->planeheight[0] = s->planeheight[3] = inlink->h;
365  s->planewidth[1] = s->planewidth[2] = AV_CEIL_RSHIFT(inlink->w, s->desc->log2_chroma_w);
366  s->planewidth[0] = s->planewidth[3] = inlink->w;
367 
368  return 0;
369 }
370 
371 static int config_output(AVFilterLink *outlink)
372 {
373  AVFilterContext *ctx = outlink->src;
374  HistogramContext *s = ctx->priv;
375  int ncomp = 0, i;
376 
377  if (!strcmp(ctx->filter->name, "thistogram"))
378  s->thistogram = 1;
379 
380  for (i = 0; i < s->ncomp; i++) {
381  if ((1 << i) & s->components)
382  ncomp++;
383  }
384 
385  if (s->thistogram) {
386  if (!s->width)
387  s->width = ctx->inputs[0]->w;
388  outlink->w = s->width * FFMAX(ncomp * (s->display_mode == 1), 1);
389  outlink->h = s->histogram_size * FFMAX(ncomp * (s->display_mode == 2), 1);
390  } else {
391  outlink->w = s->histogram_size * FFMAX(ncomp * (s->display_mode == 1), 1);
392  outlink->h = (s->level_height + s->scale_height) * FFMAX(ncomp * (s->display_mode == 2), 1);
393  }
394 
395  s->odesc = av_pix_fmt_desc_get(outlink->format);
396  s->dncomp = s->odesc->nb_components;
397  outlink->sample_aspect_ratio = (AVRational){1,1};
398 
399  return 0;
400 }
401 
403 {
404  HistogramContext *s = inlink->dst->priv;
405  AVFilterContext *ctx = inlink->dst;
406  AVFilterLink *outlink = ctx->outputs[0];
407  AVFrame *out = s->out;
408  int i, j, k, l, m;
409 
410  if (!s->thistogram || !out) {
411  out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
412  if (!out) {
413  av_frame_free(&in);
414  return AVERROR(ENOMEM);
415  }
416  s->out = out;
417 
418  for (k = 0; k < 4 && out->data[k]; k++) {
419  const int is_chroma = (k == 1 || k == 2);
420  const int dst_h = AV_CEIL_RSHIFT(outlink->h, (is_chroma ? s->odesc->log2_chroma_h : 0));
421  const int dst_w = AV_CEIL_RSHIFT(outlink->w, (is_chroma ? s->odesc->log2_chroma_w : 0));
422 
423  if (s->histogram_size <= 256) {
424  for (i = 0; i < dst_h ; i++)
425  memset(out->data[s->odesc->comp[k].plane] +
426  i * out->linesize[s->odesc->comp[k].plane],
427  s->bg_color[0][k], dst_w);
428  } else {
429  const int mult = s->mult;
430 
431  for (i = 0; i < dst_h ; i++)
432  for (j = 0; j < dst_w; j++)
433  AV_WN16(out->data[s->odesc->comp[k].plane] +
434  i * out->linesize[s->odesc->comp[k].plane] + j * 2,
435  s->bg_color[0][k] * mult);
436  }
437  }
438  }
439 
440  for (m = 0, k = 0; k < s->ncomp; k++) {
441  const int p = s->desc->comp[k].plane;
442  const int max_value = s->histogram_size - 1 - s->start[p];
443  const int height = s->planeheight[p];
444  const int width = s->planewidth[p];
445  const int mid = s->mid;
446  double max_hval_log;
447  unsigned max_hval = 0;
448  int starty, startx;
449 
450  if (!((1 << k) & s->components))
451  continue;
452  if (s->thistogram) {
453  starty = m * s->histogram_size * (s->display_mode == 2);
454  startx = m++ * s->width * (s->display_mode == 1);
455  } else {
456  startx = m * s->histogram_size * (s->display_mode == 1);
457  starty = m++ * (s->level_height + s->scale_height) * (s->display_mode == 2);
458  }
459 
460  if (s->histogram_size <= 256) {
461  for (i = 0; i < height; i++) {
462  const uint8_t *src = in->data[p] + i * in->linesize[p];
463  for (j = 0; j < width; j++)
464  s->histogram[src[j]]++;
465  }
466  } else {
467  for (i = 0; i < height; i++) {
468  const uint16_t *src = (const uint16_t *)(in->data[p] + i * in->linesize[p]);
469  for (j = 0; j < width; j++)
470  s->histogram[src[j]]++;
471  }
472  }
473 
474  for (i = 0; i < s->histogram_size; i++)
475  max_hval = FFMAX(max_hval, s->histogram[i]);
476  max_hval_log = log2(max_hval + 1);
477 
478  if (s->thistogram) {
479  const int bpp = 1 + (s->histogram_size > 256);
480  int minh = s->histogram_size - 1, maxh = 0;
481 
482  if (s->slide == 2) {
483  s->x_pos = out->width - 1;
484  for (j = 0; j < outlink->h; j++) {
485  memmove(out->data[p] + j * out->linesize[p] ,
486  out->data[p] + j * out->linesize[p] + bpp,
487  (outlink->w - 1) * bpp);
488  }
489  } else if (s->slide == 3) {
490  s->x_pos = 0;
491  for (j = 0; j < outlink->h; j++) {
492  memmove(out->data[p] + j * out->linesize[p] + bpp,
493  out->data[p] + j * out->linesize[p],
494  (outlink->w - 1) * bpp);
495  }
496  }
497 
498  for (int i = 0; i < s->histogram_size; i++) {
499  int idx = s->histogram_size - i - 1;
500  int value = s->start[p];
501 
502  if (s->envelope && s->histogram[idx]) {
503  minh = FFMIN(minh, i);
504  maxh = FFMAX(maxh, i);
505  }
506 
507  if (s->levels_mode)
508  value += lrint(max_value * (log2(s->histogram[idx] + 1) / max_hval_log));
509  else
510  value += lrint(max_value * s->histogram[idx] / (float)max_hval);
511 
512  if (s->histogram_size <= 256) {
513  s->out->data[p][(i + starty) * s->out->linesize[p] + startx + s->x_pos] = value;
514  } else {
515  AV_WN16(s->out->data[p] + (i + starty) * s->out->linesize[p] + startx * 2 + s->x_pos * 2, value);
516  }
517  }
518 
519  if (s->envelope) {
520  if (s->histogram_size <= 256) {
521  s->out->data[0][(minh + starty) * s->out->linesize[p] + startx + s->x_pos] = s->envelope_color[0];
522  s->out->data[0][(maxh + starty) * s->out->linesize[p] + startx + s->x_pos] = s->envelope_color[0];
523  if (s->dncomp >= 3) {
524  s->out->data[1][(minh + starty) * s->out->linesize[p] + startx + s->x_pos] = s->envelope_color[1];
525  s->out->data[2][(minh + starty) * s->out->linesize[p] + startx + s->x_pos] = s->envelope_color[2];
526  s->out->data[1][(maxh + starty) * s->out->linesize[p] + startx + s->x_pos] = s->envelope_color[1];
527  s->out->data[2][(maxh + starty) * s->out->linesize[p] + startx + s->x_pos] = s->envelope_color[2];
528  }
529  } else {
530  const int mult = s->mult;
531 
532  AV_WN16(s->out->data[0] + (minh + starty) * s->out->linesize[p] + startx * 2 + s->x_pos * 2, s->envelope_color[0] * mult);
533  AV_WN16(s->out->data[0] + (maxh + starty) * s->out->linesize[p] + startx * 2 + s->x_pos * 2, s->envelope_color[0] * mult);
534  if (s->dncomp >= 3) {
535  AV_WN16(s->out->data[1] + (minh + starty) * s->out->linesize[p] + startx * 2 + s->x_pos * 2, s->envelope_color[1] * mult);
536  AV_WN16(s->out->data[2] + (minh + starty) * s->out->linesize[p] + startx * 2 + s->x_pos * 2, s->envelope_color[2] * mult);
537  AV_WN16(s->out->data[1] + (maxh + starty) * s->out->linesize[p] + startx * 2 + s->x_pos * 2, s->envelope_color[1] * mult);
538  AV_WN16(s->out->data[2] + (maxh + starty) * s->out->linesize[p] + startx * 2 + s->x_pos * 2, s->envelope_color[2] * mult);
539  }
540  }
541  }
542  } else {
543  for (i = 0; i < s->histogram_size; i++) {
544  int col_height;
545 
546  if (s->levels_mode)
547  col_height = lrint(s->level_height * (1. - (log2(s->histogram[i] + 1) / max_hval_log)));
548  else
549  col_height = s->level_height - (s->histogram[i] * (int64_t)s->level_height + max_hval - 1) / max_hval;
550 
551  if (s->histogram_size <= 256) {
552  for (j = s->level_height - 1; j >= col_height; j--) {
553  if (s->display_mode) {
554  for (l = 0; l < s->dncomp; l++)
555  out->data[l][(j + starty) * out->linesize[l] + startx + i] = s->fg_color[p][l];
556  } else {
557  out->data[p][(j + starty) * out->linesize[p] + startx + i] = 255;
558  }
559  }
560  if (s->display_mode) {
561  for (j = col_height - 1; j >= 0; j--) {
562  for (l = 0; l < s->dncomp; l++)
563  out->data[l][(j + starty) * out->linesize[l] + startx + i] = s->bg_color[p][l];
564  }
565  }
566  for (j = s->level_height + s->scale_height - 1; j >= s->level_height; j--)
567  for (l = 0; l < s->dncomp; l++)
568  out->data[l][(j + starty) * out->linesize[l] + startx + i] = p == l ? i : mid;
569  } else {
570  const int mult = s->mult;
571 
572  for (j = s->level_height - 1; j >= col_height; j--) {
573  if (s->display_mode) {
574  for (l = 0; l < s->dncomp; l++)
575  AV_WN16(out->data[l] + (j + starty) * out->linesize[l] + startx * 2 + i * 2, s->fg_color[p][l] * mult);
576  } else {
577  AV_WN16(out->data[p] + (j + starty) * out->linesize[p] + startx * 2 + i * 2, 255 * mult);
578  }
579  }
580  if (s->display_mode) {
581  for (j = col_height - 1; j >= 0; j--) {
582  for (l = 0; l < s->dncomp; l++)
583  AV_WN16(out->data[l] + (j + starty) * out->linesize[l] + startx * 2 + i * 2, s->bg_color[p][l] * mult);
584  }
585  }
586  for (j = s->level_height + s->scale_height - 1; j >= s->level_height; j--)
587  for (l = 0; l < s->dncomp; l++)
588  AV_WN16(out->data[l] + (j + starty) * out->linesize[l] + startx * 2 + i * 2, p == l ? i : mid * mult);
589  }
590  }
591  }
592 
593  memset(s->histogram, 0, s->histogram_size * sizeof(unsigned));
594  }
595 
597  av_frame_free(&in);
598  s->x_pos++;
599  if (s->x_pos >= s->width) {
600  s->x_pos = 0;
601  if (s->thistogram && (s->slide == 4 || s->slide == 0)) {
602  s->out = NULL;
603  goto end;
604  }
605  } else if (s->thistogram && s->slide == 4) {
606  return 0;
607  }
608 
609  if (s->thistogram) {
610  AVFrame *clone = av_frame_clone(out);
611 
612  if (!clone)
613  return AVERROR(ENOMEM);
614  return ff_filter_frame(outlink, clone);
615  }
616 end:
617  return ff_filter_frame(outlink, out);
618 }
619 
620 static const AVFilterPad inputs[] = {
621  {
622  .name = "default",
623  .type = AVMEDIA_TYPE_VIDEO,
624  .filter_frame = filter_frame,
625  .config_props = config_input,
626  },
627 };
628 
629 static const AVFilterPad outputs[] = {
630  {
631  .name = "default",
632  .type = AVMEDIA_TYPE_VIDEO,
633  .config_props = config_output,
634  },
635 };
636 
637 #if CONFIG_HISTOGRAM_FILTER
638 
639 const AVFilter ff_vf_histogram = {
640  .name = "histogram",
641  .description = NULL_IF_CONFIG_SMALL("Compute and draw a histogram."),
642  .priv_size = sizeof(HistogramContext),
646  .priv_class = &histogram_class,
647 };
648 
649 #endif /* CONFIG_HISTOGRAM_FILTER */
650 
651 #if CONFIG_THISTOGRAM_FILTER
652 
653 static av_cold void uninit(AVFilterContext *ctx)
654 {
655  HistogramContext *s = ctx->priv;
656 
657  av_frame_free(&s->out);
658 }
659 
660 static const AVOption thistogram_options[] = {
661  { "width", "set width", OFFSET(width), AV_OPT_TYPE_INT, {.i64=0}, 0, 8192, FLAGS},
662  { "w", "set width", OFFSET(width), AV_OPT_TYPE_INT, {.i64=0}, 0, 8192, FLAGS},
664  { "bgopacity", "set background opacity", OFFSET(bgopacity), AV_OPT_TYPE_FLOAT, {.dbl=0.9}, 0, 1, FLAGS},
665  { "b", "set background opacity", OFFSET(bgopacity), AV_OPT_TYPE_FLOAT, {.dbl=0.9}, 0, 1, FLAGS},
666  { "envelope", "display envelope", OFFSET(envelope), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS },
667  { "e", "display envelope", OFFSET(envelope), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS },
668  { "ecolor", "set envelope color", OFFSET(envelope_rgba), AV_OPT_TYPE_COLOR, {.str="gold"}, 0, 0, FLAGS },
669  { "ec", "set envelope color", OFFSET(envelope_rgba), AV_OPT_TYPE_COLOR, {.str="gold"}, 0, 0, FLAGS },
670  { "slide", "set slide mode", OFFSET(slide), AV_OPT_TYPE_INT, {.i64=1}, 0, 4, FLAGS, .unit = "slide" },
671  {"frame", "draw new frames", OFFSET(slide), AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, .unit = "slide"},
672  {"replace", "replace old columns with new", OFFSET(slide), AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, .unit = "slide"},
673  {"scroll", "scroll from right to left", OFFSET(slide), AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, FLAGS, .unit = "slide"},
674  {"rscroll", "scroll from left to right", OFFSET(slide), AV_OPT_TYPE_CONST, {.i64=3}, 0, 0, FLAGS, .unit = "slide"},
675  {"picture", "display graph in single frame", OFFSET(slide), AV_OPT_TYPE_CONST, {.i64=4}, 0, 0, FLAGS, .unit = "slide"},
676  { NULL }
677 };
678 
679 AVFILTER_DEFINE_CLASS(thistogram);
680 
681 const AVFilter ff_vf_thistogram = {
682  .name = "thistogram",
683  .description = NULL_IF_CONFIG_SMALL("Compute and draw a temporal histogram."),
684  .priv_size = sizeof(HistogramContext),
688  .uninit = uninit,
689  .priv_class = &thistogram_class,
690 };
691 
692 #endif /* CONFIG_THISTOGRAM_FILTER */
FLAGS
#define FLAGS
Definition: vf_histogram.c:67
ff_get_video_buffer
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
Definition: video.c:116
HistogramContext::fg_color
uint8_t fg_color[4][4]
Definition: vf_histogram.c:48
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:71
HistogramContext::ncomp
int ncomp
Definition: vf_histogram.c:45
ff_vf_thistogram
const AVFilter ff_vf_thistogram
AVERROR
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
opt.h
HistogramContext::colors_mode
int colors_mode
Definition: vf_histogram.c:54
ff_make_format_list
AVFilterFormats * ff_make_format_list(const int *fmts)
Create a list of supported formats.
Definition: formats.c:435
out
FILE * out
Definition: movenc.c:55
HistogramContext::envelope_rgba
uint8_t envelope_rgba[4]
Definition: vf_histogram.c:49
ff_filter_frame
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:1061
outputs
static const AVFilterPad outputs[]
Definition: vf_histogram.c:629
av_pix_fmt_desc_get
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:3170
int64_t
long long int64_t
Definition: coverity.c:34
HistogramContext::out
AVFrame * out
Definition: vf_histogram.c:63
inlink
The exact code depends on how similar the blocks are and how related they are to the and needs to apply these operations to the correct inlink or outlink if there are several Macros are available to factor that when no extra processing is inlink
Definition: filter_design.txt:212
HistogramContext::odesc
const AVPixFmtDescriptor * odesc
Definition: vf_histogram.c:56
av_frame_free
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:162
AV_PIX_FMT_YUVA422P9
#define AV_PIX_FMT_YUVA422P9
Definition: pixfmt.h:538
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: filters.h:262
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: vf_histogram.c:166
HistogramContext::level_height
int level_height
Definition: vf_histogram.c:51
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:389
pixdesc.h
black_yuva_color
static const uint8_t black_yuva_color[4]
Definition: vf_histogram.c:217
AV_PIX_FMT_YUVA420P10
#define AV_PIX_FMT_YUVA420P10
Definition: pixfmt.h:540
AVOption
AVOption.
Definition: opt.h:429
levels_out_yuv8_pix_fmts
static enum AVPixelFormat levels_out_yuv8_pix_fmts[]
Definition: vf_histogram.c:126
AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:502
levels_out_yuv9_pix_fmts
static enum AVPixelFormat levels_out_yuv9_pix_fmts[]
Definition: vf_histogram.c:131
green_gbrp_color
static const uint8_t green_gbrp_color[4]
Definition: vf_histogram.c:226
AV_PIX_FMT_YUV440P
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition: pixfmt.h:106
config_input
static int config_input(AVFilterLink *inlink)
Definition: vf_histogram.c:230
FFMAX
#define FFMAX(a, b)
Definition: macros.h:47
AVFilterFormats::formats
int * formats
list of media formats
Definition: formats.h:66
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_histogram.c:402
AVFilter::name
const char * name
Filter name.
Definition: avfilter.h:205
white_gbrp_color
static const uint8_t white_gbrp_color[4]
Definition: vf_histogram.c:220
video.h
AV_PIX_FMT_YUVA422P10
#define AV_PIX_FMT_YUVA422P10
Definition: pixfmt.h:541
HistogramContext::display_mode
int display_mode
Definition: vf_histogram.c:53
blue_yuva_color
static const uint8_t blue_yuva_color[4]
Definition: vf_histogram.c:227
AVFrame::data
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:410
AVFilterFormats
A list of supported formats for one end of a filter link.
Definition: formats.h:64
formats.h
HistogramContext::envelope
int envelope
Definition: vf_histogram.c:37
HistogramContext
Definition: vf_histogram.c:34
AV_PIX_FMT_YUVA420P9
#define AV_PIX_FMT_YUVA420P9
Definition: pixfmt.h:537
rgb
Definition: rpzaenc.c:60
AV_PIX_FMT_GBRAP
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
Definition: pixfmt.h:212
red_gbrp_color
static const uint8_t red_gbrp_color[4]
Definition: vf_histogram.c:223
AV_PIX_FMT_GBRP10
#define AV_PIX_FMT_GBRP10
Definition: pixfmt.h:518
AV_PIX_FMT_YUV422P9
#define AV_PIX_FMT_YUV422P9
Definition: pixfmt.h:500
HistogramContext::bg_color
uint8_t bg_color[4][4]
Definition: vf_histogram.c:47
AVFilterPad
A filter pad used for either input or output.
Definition: filters.h:38
levels_out_rgb10_pix_fmts
static enum AVPixelFormat levels_out_rgb10_pix_fmts[]
Definition: vf_histogram.c:156
AV_PIX_FMT_YUV444P10
#define AV_PIX_FMT_YUV444P10
Definition: pixfmt.h:505
AV_PIX_FMT_YUVJ411P
@ AV_PIX_FMT_YUVJ411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor ...
Definition: pixfmt.h:283
mult
static int16_t mult(Float11 *f1, Float11 *f2)
Definition: g726.c:60
lrint
#define lrint
Definition: tablegen.h:53
colorspace.h
av_cold
#define av_cold
Definition: attributes.h:90
HistogramContext::levels_mode
int levels_mode
Definition: vf_histogram.c:55
HistogramContext::slide
int slide
Definition: vf_histogram.c:38
AV_PIX_FMT_YUVJ422P
@ AV_PIX_FMT_YUVJ422P
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
Definition: pixfmt.h:86
AV_PIX_FMT_GBRAP10
#define AV_PIX_FMT_GBRAP10
Definition: pixfmt.h:522
HistogramContext::scale_height
int scale_height
Definition: vf_histogram.c:52
RGB_TO_Y_BT709
#define RGB_TO_Y_BT709(r, g, b)
Definition: vf_pseudocolor.c:674
intreadwrite.h
s
#define s(width, name)
Definition: cbs_vp9.c:198
histogram_options
static const AVOption histogram_options[]
Definition: vf_histogram.c:82
AV_PIX_FMT_GBRAP12
#define AV_PIX_FMT_GBRAP12
Definition: pixfmt.h:523
AV_PIX_FMT_YUVA420P
@ AV_PIX_FMT_YUVA420P
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
Definition: pixfmt.h:108
AV_CEIL_RSHIFT
#define AV_CEIL_RSHIFT(a, b)
Definition: common.h:60
RGB_TO_U_BT709
#define RGB_TO_U_BT709(r1, g1, b1, max)
Definition: vf_pseudocolor.c:678
ff_formats_ref
int ff_formats_ref(AVFilterFormats *f, AVFilterFormats **ref)
Add *ref as a new reference to formats.
Definition: formats.c:678
HistogramContext::envelope_color
uint8_t envelope_color[4]
Definition: vf_histogram.c:50
HistogramContext::bgopacity
float bgopacity
Definition: vf_histogram.c:59
bits
uint8_t bits
Definition: vp3data.h:128
filters.h
AV_PIX_FMT_YUVA444P12
#define AV_PIX_FMT_YUVA444P12
Definition: pixfmt.h:544
AV_PIX_FMT_YUV420P9
#define AV_PIX_FMT_YUV420P9
Definition: pixfmt.h:499
ctx
AVFormatContext * ctx
Definition: movenc.c:49
av_frame_clone
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
Definition: frame.c:609
AV_PIX_FMT_YUV420P
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:73
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: filters.h:263
AV_PIX_FMT_YUVJ444P
@ AV_PIX_FMT_YUVJ444P
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
Definition: pixfmt.h:87
HistogramContext::mult
int mult
Definition: vf_histogram.c:43
HistogramContext::start
int start[4]
Definition: vf_histogram.c:62
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:75
NULL
#define NULL
Definition: coverity.c:32
av_frame_copy_props
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
Definition: frame.c:725
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
AV_PIX_FMT_YUVJ420P
@ AV_PIX_FMT_YUVJ420P
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
Definition: pixfmt.h:85
AV_OPT_TYPE_COLOR
@ AV_OPT_TYPE_COLOR
Underlying C type is uint8_t[4].
Definition: opt.h:323
levels_out_rgb12_pix_fmts
static enum AVPixelFormat levels_out_rgb12_pix_fmts[]
Definition: vf_histogram.c:161
parseutils.h
AVFilterFormats::nb_formats
unsigned nb_formats
number of formats
Definition: formats.h:65
HistogramContext::thistogram
int thistogram
Definition: vf_histogram.c:36
HistogramContext::histogram_size
int histogram_size
Definition: vf_histogram.c:40
AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_YUV422P10
Definition: pixfmt.h:503
AV_PIX_FMT_GRAY8
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition: pixfmt.h:81
AV_PIX_FMT_GBRP9
#define AV_PIX_FMT_GBRP9
Definition: pixfmt.h:517
config_output
static int config_output(AVFilterLink *outlink)
Definition: vf_histogram.c:371
ff_vf_histogram
const AVFilter ff_vf_histogram
blue_gbrp_color
static const uint8_t blue_gbrp_color[4]
Definition: vf_histogram.c:228
HistogramContext::width
int width
Definition: vf_histogram.c:41
RGB_TO_V_BT709
#define RGB_TO_V_BT709(r1, g1, b1, max)
Definition: vf_pseudocolor.c:682
inputs
static const AVFilterPad inputs[]
Definition: vf_histogram.c:620
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:94
height
#define height
Definition: dsp.h:85
AV_PIX_FMT_FLAG_RGB
#define AV_PIX_FMT_FLAG_RGB
The pixel format contains RGB-like data (as opposed to YUV/grayscale).
Definition: pixdesc.h:136
AVFILTER_DEFINE_CLASS
AVFILTER_DEFINE_CLASS(histogram)
AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_YUV422P12
Definition: pixfmt.h:507
AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV444P12
Definition: pixfmt.h:509
HistogramContext::dncomp
int dncomp
Definition: vf_histogram.c:46
OFFSET
#define OFFSET(x)
Definition: vf_histogram.c:66
red_yuva_color
static const uint8_t red_yuva_color[4]
Definition: vf_histogram.c:222
AV_PIX_FMT_YUVA444P
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Definition: pixfmt.h:174
AV_PIX_FMT_YUVA444P10
#define AV_PIX_FMT_YUVA444P10
Definition: pixfmt.h:542
levels_in_pix_fmts
static enum AVPixelFormat levels_in_pix_fmts[]
Definition: vf_histogram.c:107
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Underlying C type is float.
Definition: opt.h:271
gray_color
static const uint8_t gray_color[4]
Definition: vf_histogram.c:221
uninit
static void uninit(AVBSFContext *ctx)
Definition: pcm_rechunk.c:68
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
envelope
static float envelope(const float x)
Definition: vf_monochrome.c:45
AV_PIX_FMT_GBRP12
#define AV_PIX_FMT_GBRP12
Definition: pixfmt.h:519
HistogramContext::fgopacity
float fgopacity
Definition: vf_histogram.c:58
out_pix_fmts
static enum AVPixelFormat out_pix_fmts[]
Definition: vf_ciescope.c:137
HistogramContext::planeheight
int planeheight[4]
Definition: vf_histogram.c:61
levels_out_yuv10_pix_fmts
static enum AVPixelFormat levels_out_yuv10_pix_fmts[]
Definition: vf_histogram.c:136
value
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default value
Definition: writing_filters.txt:86
HistogramContext::x_pos
int x_pos
Definition: vf_histogram.c:42
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
HistogramContext::desc
const AVPixFmtDescriptor * desc
Definition: vf_histogram.c:56
AVFilterPad::name
const char * name
Pad name.
Definition: filters.h:44
HistogramContext::components
int components
Definition: vf_histogram.c:57
AV_PIX_FMT_YUV444P9
#define AV_PIX_FMT_YUV444P9
Definition: pixfmt.h:501
log2
#define log2(x)
Definition: libm.h:404
COMMON_OPTIONS
#define COMMON_OPTIONS
Definition: vf_histogram.c:69
AVFilter
Filter definition.
Definition: avfilter.h:201
ret
ret
Definition: filter_design.txt:187
FFSWAP
#define FFSWAP(type, a, b)
Definition: macros.h:52
AV_PIX_FMT_YUVA444P9
#define AV_PIX_FMT_YUVA444P9
Definition: pixfmt.h:539
AV_PIX_FMT_YUV420P12
#define AV_PIX_FMT_YUV420P12
Definition: pixfmt.h:506
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:72
AV_PIX_FMT_YUVA422P12
#define AV_PIX_FMT_YUVA422P12
Definition: pixfmt.h:543
igreen_yuva_color
static const uint8_t igreen_yuva_color[4]
Definition: vf_histogram.c:225
levels_out_rgb8_pix_fmts
static enum AVPixelFormat levels_out_rgb8_pix_fmts[]
Definition: vf_histogram.c:146
HistogramContext::mid
int mid
Definition: vf_histogram.c:44
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
avfilter.h
HistogramContext::planewidth
int planewidth[4]
Definition: vf_histogram.c:60
AV_PIX_FMT_YUV444P
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:78
AVFilterContext
An instance of a filter.
Definition: avfilter.h:457
AV_PIX_FMT_GBRP
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
Definition: pixfmt.h:165
desc
const char * desc
Definition: libsvtav1.c:79
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AV_PIX_FMT_YUV422P
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:77
levels_out_yuv12_pix_fmts
static enum AVPixelFormat levels_out_yuv12_pix_fmts[]
Definition: vf_histogram.c:141
AVPixFmtDescriptor
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:69
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
Definition: opt.h:327
AV_PIX_FMT_YUV411P
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
Definition: pixfmt.h:80
imgutils.h
AVFrame::linesize
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
Definition: frame.h:434
rgb
static const SheerTable rgb[2]
Definition: sheervideodata.h:32
AV_PIX_FMT_YUV410P
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Definition: pixfmt.h:79
levels_out_rgb9_pix_fmts
static enum AVPixelFormat levels_out_rgb9_pix_fmts[]
Definition: vf_histogram.c:151
HistogramContext::histogram
unsigned histogram[256 *256]
Definition: vf_histogram.c:39
AV_PIX_FMT_YUV440P12
#define AV_PIX_FMT_YUV440P12
Definition: pixfmt.h:508
width
#define width
Definition: dsp.h:85
black_gbrp_color
static const uint8_t black_gbrp_color[4]
Definition: vf_histogram.c:218
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition: opt.h:299
FILTER_QUERY_FUNC
#define FILTER_QUERY_FUNC(func)
Definition: filters.h:236
src
#define src
Definition: vp8dsp.c:248
AV_PIX_FMT_YUVA422P
@ AV_PIX_FMT_YUVA422P
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
Definition: pixfmt.h:173
white_yuva_color
static const uint8_t white_yuva_color[4]
Definition: vf_histogram.c:219
green_yuva_color
static const uint8_t green_yuva_color[4]
Definition: vf_histogram.c:224
AV_WN16
#define AV_WN16(p, v)
Definition: intreadwrite.h:368