FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
vf_histogram.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012-2013 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 "libavutil/avassert.h"
22 #include "libavutil/opt.h"
23 #include "libavutil/parseutils.h"
24 #include "libavutil/pixdesc.h"
25 #include "libavutil/imgutils.h"
26 #include "libavutil/intreadwrite.h"
27 #include "avfilter.h"
28 #include "formats.h"
29 #include "internal.h"
30 #include "video.h"
31 
32 typedef struct HistogramContext {
33  const AVClass *class; ///< AVClass context for log and options purpose
34  unsigned histogram[256*256];
36  int mult;
37  int ncomp;
38  const uint8_t *bg_color;
39  const uint8_t *fg_color;
46  int planewidth[4];
47  int planeheight[4];
49 
50 #define OFFSET(x) offsetof(HistogramContext, x)
51 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
52 
53 static const AVOption histogram_options[] = {
54  { "level_height", "set level height", OFFSET(level_height), AV_OPT_TYPE_INT, {.i64=200}, 50, 2048, FLAGS},
55  { "scale_height", "set scale height", OFFSET(scale_height), AV_OPT_TYPE_INT, {.i64=12}, 0, 40, FLAGS},
56  { "display_mode", "set display mode", OFFSET(display_mode), AV_OPT_TYPE_INT, {.i64=1}, 0, 1, FLAGS, "display_mode"},
57  { "d", "set display mode", OFFSET(display_mode), AV_OPT_TYPE_INT, {.i64=1}, 0, 1, FLAGS, "display_mode"},
58  { "parade", NULL, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, "display_mode" },
59  { "overlay", NULL, 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, "display_mode" },
60  { "levels_mode", "set levels mode", OFFSET(levels_mode), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, FLAGS, "levels_mode"},
61  { "m", "set levels mode", OFFSET(levels_mode), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, FLAGS, "levels_mode"},
62  { "linear", NULL, 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, "levels_mode" },
63  { "logarithmic", NULL, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, "levels_mode" },
64  { "components", "set color components to display", OFFSET(components), AV_OPT_TYPE_INT, {.i64=7}, 1, 15, FLAGS},
65  { "c", "set color components to display", OFFSET(components), AV_OPT_TYPE_INT, {.i64=7}, 1, 15, FLAGS},
66  { NULL }
67 };
68 
69 AVFILTER_DEFINE_CLASS(histogram);
70 
71 static const enum AVPixelFormat levels_in_pix_fmts[] = {
87 };
88 
89 static const enum AVPixelFormat levels_out_yuv8_pix_fmts[] = {
92 };
93 
94 static const enum AVPixelFormat levels_out_yuv9_pix_fmts[] = {
97 };
98 
102 };
103 
107 };
108 
112 };
113 
117 };
118 
122 };
123 
127 };
128 
130 {
131  AVFilterFormats *avff;
132  const AVPixFmtDescriptor *desc;
133  const enum AVPixelFormat *out_pix_fmts;
134  int rgb, i, bits;
135  int ret;
136 
137  if (!ctx->inputs[0]->in_formats ||
138  !ctx->inputs[0]->in_formats->nb_formats) {
139  return AVERROR(EAGAIN);
140  }
141 
142  if (!ctx->inputs[0]->out_formats)
144  return ret;
145  avff = ctx->inputs[0]->in_formats;
146  desc = av_pix_fmt_desc_get(avff->formats[0]);
147  rgb = desc->flags & AV_PIX_FMT_FLAG_RGB;
148  bits = desc->comp[0].depth;
149  for (i = 1; i < avff->nb_formats; i++) {
150  desc = av_pix_fmt_desc_get(avff->formats[i]);
151  if ((rgb != (desc->flags & AV_PIX_FMT_FLAG_RGB)) ||
152  (bits != desc->comp[0].depth))
153  return AVERROR(EAGAIN);
154  }
155 
156  if (rgb && bits == 8)
157  out_pix_fmts = levels_out_rgb8_pix_fmts;
158  else if (rgb && bits == 9)
159  out_pix_fmts = levels_out_rgb9_pix_fmts;
160  else if (rgb && bits == 10)
161  out_pix_fmts = levels_out_rgb10_pix_fmts;
162  else if (rgb && bits == 12)
163  out_pix_fmts = levels_out_rgb12_pix_fmts;
164  else if (bits == 8)
165  out_pix_fmts = levels_out_yuv8_pix_fmts;
166  else if (bits == 9)
167  out_pix_fmts = levels_out_yuv9_pix_fmts;
168  else if (bits == 10)
169  out_pix_fmts = levels_out_yuv10_pix_fmts;
170  else if (bits == 12)
171  out_pix_fmts = levels_out_yuv12_pix_fmts;
172  else
173  return AVERROR(EAGAIN);
174  if ((ret = ff_formats_ref(ff_make_format_list(out_pix_fmts), &ctx->outputs[0]->in_formats)) < 0)
175  return ret;
176 
177  return 0;
178 }
179 
180 static const uint8_t black_yuva_color[4] = { 0, 127, 127, 255 };
181 static const uint8_t black_gbrp_color[4] = { 0, 0, 0, 255 };
182 static const uint8_t white_yuva_color[4] = { 255, 127, 127, 255 };
183 static const uint8_t white_gbrp_color[4] = { 255, 255, 255, 255 };
184 
185 static int config_input(AVFilterLink *inlink)
186 {
187  HistogramContext *h = inlink->dst->priv;
188 
189  h->desc = av_pix_fmt_desc_get(inlink->format);
190  h->ncomp = h->desc->nb_components;
191  h->histogram_size = 1 << h->desc->comp[0].depth;
192  h->mult = h->histogram_size / 256;
193 
194  switch (inlink->format) {
195  case AV_PIX_FMT_GBRP12:
196  case AV_PIX_FMT_GBRP10:
197  case AV_PIX_FMT_GBRP9:
198  case AV_PIX_FMT_GBRAP:
199  case AV_PIX_FMT_GBRP:
202  break;
203  default:
206  }
207 
208  h->planeheight[1] = h->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, h->desc->log2_chroma_h);
209  h->planeheight[0] = h->planeheight[3] = inlink->h;
210  h->planewidth[1] = h->planewidth[2] = AV_CEIL_RSHIFT(inlink->w, h->desc->log2_chroma_w);
211  h->planewidth[0] = h->planewidth[3] = inlink->w;
212 
213  return 0;
214 }
215 
216 static int config_output(AVFilterLink *outlink)
217 {
218  AVFilterContext *ctx = outlink->src;
219  HistogramContext *h = ctx->priv;
220  int ncomp = 0, i;
221 
222  for (i = 0; i < h->ncomp; i++) {
223  if ((1 << i) & h->components)
224  ncomp++;
225  }
226  outlink->w = h->histogram_size;
227  outlink->h = (h->level_height + h->scale_height) * FFMAX(ncomp * h->display_mode, 1);
228 
229  h->odesc = av_pix_fmt_desc_get(outlink->format);
230  outlink->sample_aspect_ratio = (AVRational){1,1};
231 
232  return 0;
233 }
234 
235 static int filter_frame(AVFilterLink *inlink, AVFrame *in)
236 {
237  HistogramContext *h = inlink->dst->priv;
238  AVFilterContext *ctx = inlink->dst;
239  AVFilterLink *outlink = ctx->outputs[0];
240  AVFrame *out;
241  int i, j, k, l, m;
242 
243  out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
244  if (!out) {
245  av_frame_free(&in);
246  return AVERROR(ENOMEM);
247  }
248 
249  out->pts = in->pts;
250 
251  for (k = 0; k < 4 && out->data[k]; k++) {
252  const int is_chroma = (k == 1 || k == 2);
253  const int dst_h = AV_CEIL_RSHIFT(outlink->h, (is_chroma ? h->odesc->log2_chroma_h : 0));
254  const int dst_w = AV_CEIL_RSHIFT(outlink->w, (is_chroma ? h->odesc->log2_chroma_w : 0));
255 
256  if (h->histogram_size <= 256) {
257  for (i = 0; i < dst_h ; i++)
258  memset(out->data[h->odesc->comp[k].plane] +
259  i * out->linesize[h->odesc->comp[k].plane],
260  h->bg_color[k], dst_w);
261  } else {
262  const int mult = h->mult;
263 
264  for (i = 0; i < dst_h ; i++)
265  for (j = 0; j < dst_w; j++)
266  AV_WN16(out->data[h->odesc->comp[k].plane] +
267  i * out->linesize[h->odesc->comp[k].plane] + j * 2,
268  h->bg_color[k] * mult);
269  }
270  }
271 
272  for (m = 0, k = 0; k < h->ncomp; k++) {
273  const int p = h->desc->comp[k].plane;
274  const int height = h->planeheight[p];
275  const int width = h->planewidth[p];
276  double max_hval_log;
277  unsigned max_hval = 0;
278  int start;
279 
280  if (!((1 << k) & h->components))
281  continue;
282  start = m++ * (h->level_height + h->scale_height) * h->display_mode;
283 
284  if (h->histogram_size <= 256) {
285  for (i = 0; i < height; i++) {
286  const uint8_t *src = in->data[p] + i * in->linesize[p];
287  for (j = 0; j < width; j++)
288  h->histogram[src[j]]++;
289  }
290  } else {
291  for (i = 0; i < height; i++) {
292  const uint16_t *src = (const uint16_t *)(in->data[p] + i * in->linesize[p]);
293  for (j = 0; j < width; j++)
294  h->histogram[src[j]]++;
295  }
296  }
297 
298  for (i = 0; i < h->histogram_size; i++)
299  max_hval = FFMAX(max_hval, h->histogram[i]);
300  max_hval_log = log2(max_hval + 1);
301 
302  for (i = 0; i < outlink->w; i++) {
303  int col_height;
304 
305  if (h->levels_mode)
306  col_height = lrint(h->level_height * (1. - (log2(h->histogram[i] + 1) / max_hval_log)));
307  else
308  col_height = h->level_height - (h->histogram[i] * (int64_t)h->level_height + max_hval - 1) / max_hval;
309 
310  if (h->histogram_size <= 256) {
311  for (j = h->level_height - 1; j >= col_height; j--) {
312  if (h->display_mode) {
313  for (l = 0; l < h->ncomp; l++)
314  out->data[l][(j + start) * out->linesize[l] + i] = h->fg_color[l];
315  } else {
316  out->data[p][(j + start) * out->linesize[p] + i] = 255;
317  }
318  }
319  for (j = h->level_height + h->scale_height - 1; j >= h->level_height; j--)
320  out->data[p][(j + start) * out->linesize[p] + i] = i;
321  } else {
322  const int mult = h->mult;
323 
324  for (j = h->level_height - 1; j >= col_height; j--) {
325  if (h->display_mode) {
326  for (l = 0; l < h->ncomp; l++)
327  AV_WN16(out->data[l] + (j + start) * out->linesize[l] + i * 2, h->fg_color[l] * mult);
328  } else {
329  AV_WN16(out->data[p] + (j + start) * out->linesize[p] + i * 2, 255 * mult);
330  }
331  }
332  for (j = h->level_height + h->scale_height - 1; j >= h->level_height; j--)
333  AV_WN16(out->data[p] + (j + start) * out->linesize[p] + i * 2, i);
334  }
335  }
336 
337  memset(h->histogram, 0, h->histogram_size * sizeof(unsigned));
338  }
339 
340  av_frame_free(&in);
341  return ff_filter_frame(outlink, out);
342 }
343 
344 static const AVFilterPad inputs[] = {
345  {
346  .name = "default",
347  .type = AVMEDIA_TYPE_VIDEO,
348  .filter_frame = filter_frame,
349  .config_props = config_input,
350  },
351  { NULL }
352 };
353 
354 static const AVFilterPad outputs[] = {
355  {
356  .name = "default",
357  .type = AVMEDIA_TYPE_VIDEO,
358  .config_props = config_output,
359  },
360  { NULL }
361 };
362 
364  .name = "histogram",
365  .description = NULL_IF_CONFIG_SMALL("Compute and draw a histogram."),
366  .priv_size = sizeof(HistogramContext),
368  .inputs = inputs,
369  .outputs = outputs,
370  .priv_class = &histogram_class,
371 };
static enum AVPixelFormat levels_out_yuv8_pix_fmts[]
Definition: vf_histogram.c:89
int plane
Which of the 4 planes contains the component.
Definition: pixdesc.h:35
#define NULL
Definition: coverity.c:32
#define AV_PIX_FMT_YUVA422P9
Definition: pixfmt.h:374
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2263
This structure describes decoded (raw) audio or video data.
Definition: frame.h:184
AVOption.
Definition: opt.h:245
#define AV_PIX_FMT_YUVA420P10
Definition: pixfmt.h:376
#define AV_PIX_FMT_YUVA422P10
Definition: pixfmt.h:377
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:67
misc image utilities
Main libavfilter public API header.
const char * desc
Definition: nvenc.c:89
unsigned histogram[256 *256]
Definition: vf_histogram.c:34
static enum AVPixelFormat levels_out_rgb8_pix_fmts[]
Definition: vf_histogram.c:109
planar GBR 4:4:4 24bpp
Definition: pixfmt.h:180
#define AV_PIX_FMT_GBRP10
Definition: pixfmt.h:359
#define AV_PIX_FMT_YUV420P12
Definition: pixfmt.h:347
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
Definition: video.c:76
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
Definition: pixdesc.h:92
#define log2(x)
Definition: libm.h:404
AVFilterFormats * ff_make_format_list(const int *fmts)
Create a list of supported formats.
Definition: formats.c:283
static enum AVPixelFormat levels_out_rgb12_pix_fmts[]
Definition: vf_histogram.c:124
const char * name
Pad name.
Definition: internal.h:59
AVFilterLink ** inputs
array of pointers to input links
Definition: avfilter.h:313
static const uint8_t black_gbrp_color[4]
Definition: vf_histogram.c:181
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:1180
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
Definition: pixfmt.h:102
uint8_t bits
Definition: crc.c:296
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
Definition: pixdesc.h:117
uint8_t
AVOptions.
const uint8_t * bg_color
Definition: vf_histogram.c:38
const AVPixFmtDescriptor * odesc
Definition: vf_histogram.c:44
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
Definition: frame.h:268
#define AV_PIX_FMT_YUVA420P9
Definition: pixfmt.h:373
#define AV_PIX_FMT_GBRP9
Definition: pixfmt.h:358
#define height
static const AVFilterPad inputs[]
Definition: vf_histogram.c:344
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
Definition: pixfmt.h:75
static int config_input(AVFilterLink *inlink)
Definition: vf_histogram.c:185
#define AV_PIX_FMT_YUV422P12
Definition: pixfmt.h:348
static const AVFilterPad outputs[]
Definition: vf_histogram.c:354
unsigned m
Definition: audioconvert.c:187
A filter pad used for either input or output.
Definition: internal.h:53
static const uint8_t white_gbrp_color[4]
Definition: vf_histogram.c:183
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
Definition: pixfmt.h:187
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
Definition: pixdesc.h:101
#define AVERROR(e)
Definition: error.h:43
#define AV_PIX_FMT_FLAG_RGB
The pixel format contains RGB-like data (as opposed to YUV/grayscale).
Definition: pixdesc.h:148
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:153
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:176
void * priv
private data for use by the filter
Definition: avfilter.h:320
#define AV_PIX_FMT_GBRAP12
Definition: pixfmt.h:364
simple assert() macros that are a bit more flexible than ISO C assert().
#define AV_PIX_FMT_YUV444P10
Definition: pixfmt.h:346
#define OFFSET(x)
Definition: vf_histogram.c:50
#define FFMAX(a, b)
Definition: common.h:94
static enum AVPixelFormat levels_out_rgb10_pix_fmts[]
Definition: vf_histogram.c:119
static enum AVPixelFormat levels_in_pix_fmts[]
Definition: vf_histogram.c:71
AVFilter ff_vf_histogram
Definition: vf_histogram.c:363
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:66
uint64_t flags
Combination of AV_PIX_FMT_FLAG_...
Definition: pixdesc.h:106
#define AV_PIX_FMT_YUV422P9
Definition: pixfmt.h:341
uint8_t nb_components
The number of components each pixel has, (1-4)
Definition: pixdesc.h:83
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
Definition: pixfmt.h:74
#define width
int ff_formats_ref(AVFilterFormats *f, AVFilterFormats **ref)
Add *ref as a new reference to formats.
Definition: formats.c:440
const uint8_t * fg_color
Definition: vf_histogram.c:39
AVFormatContext * ctx
Definition: movenc.c:48
unsigned nb_formats
number of formats
Definition: formats.h:65
#define AV_PIX_FMT_YUVA444P10
Definition: pixfmt.h:378
#define src
Definition: vp9dsp.c:530
static const AVOption histogram_options[]
Definition: vf_histogram.c:53
#define AV_PIX_FMT_YUV444P9
Definition: pixfmt.h:342
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Definition: frame.h:215
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Definition: pixfmt.h:188
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:81
const AVPixFmtDescriptor * desc
Definition: vf_histogram.c:44
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 int config_output(AVFilterLink *outlink)
Definition: vf_histogram.c:216
static int16_t mult(Float11 *f1, Float11 *f2)
Definition: g726.c:55
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:343
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Definition: pixfmt.h:68
Describe the class of an AVClass context structure.
Definition: log.h:67
Filter definition.
Definition: avfilter.h:142
rational number numerator/denominator
Definition: rational.h:43
static const uint8_t white_yuva_color[4]
Definition: vf_histogram.c:182
const char * name
Filter name.
Definition: avfilter.h:146
#define AV_PIX_FMT_YUV440P12
Definition: pixfmt.h:349
static enum AVPixelFormat levels_out_yuv12_pix_fmts[]
Definition: vf_histogram.c:104
#define AV_PIX_FMT_YUV420P9
Definition: pixfmt.h:340
misc parsing utilities
AVFilterLink ** outputs
array of pointers to output links
Definition: avfilter.h:317
static enum AVPixelFormat levels_out_rgb9_pix_fmts[]
Definition: vf_histogram.c:114
#define AV_PIX_FMT_GBRP12
Definition: pixfmt.h:360
#define AV_PIX_FMT_YUV422P10
Definition: pixfmt.h:344
#define AV_PIX_FMT_YUV444P12
Definition: pixfmt.h:350
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:198
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:62
Y , 8bpp.
Definition: pixfmt.h:70
AVFILTER_DEFINE_CLASS(histogram)
if(ret< 0)
Definition: vf_mcdeint.c:282
planar GBRA 4:4:4:4 32bpp
Definition: pixfmt.h:228
#define AV_PIX_FMT_YUVA444P9
Definition: pixfmt.h:375
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
Definition: pixfmt.h:76
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
Definition: pixfmt.h:69
static enum AVPixelFormat out_pix_fmts[]
Definition: vf_ciescope.c:130
#define FLAGS
Definition: vf_histogram.c:51
static int query_formats(AVFilterContext *ctx)
Definition: vf_histogram.c:129
static const uint8_t black_yuva_color[4]
Definition: vf_histogram.c:180
static enum AVPixelFormat levels_out_yuv9_pix_fmts[]
Definition: vf_histogram.c:94
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_histogram.c:235
A list of supported formats for one end of a filter link.
Definition: formats.h:64
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor ...
Definition: pixfmt.h:271
#define lrint
Definition: tablegen.h:53
An instance of a filter.
Definition: avfilter.h:305
FILE * out
Definition: movenc.c:54
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition: pixfmt.h:100
void INT64 start
Definition: avisynth_c.h:553
#define AV_WN16(p, v)
Definition: intreadwrite.h:372
internal API functions
int depth
Number of bits in the component.
Definition: pixdesc.h:58
static enum AVPixelFormat levels_out_yuv10_pix_fmts[]
Definition: vf_histogram.c:99
AVPixelFormat
Pixel format.
Definition: pixfmt.h:60
#define AV_CEIL_RSHIFT(a, b)
Definition: common.h:58
int * formats
list of media formats
Definition: formats.h:66