FFmpeg
vf_avgblur.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016 Paul B Mahol
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a copy
5  * of this software and associated documentation files (the "Software"), to deal
6  * in the Software without restriction, including without limitation the rights
7  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8  * copies of the Software, and to permit persons to whom the Software is
9  * furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20  * SOFTWARE.
21  */
22 
23 #include "libavutil/imgutils.h"
24 #include "libavutil/opt.h"
25 #include "libavutil/pixdesc.h"
26 #include "avfilter.h"
27 #include "formats.h"
28 #include "internal.h"
29 #include "video.h"
30 
31 typedef struct AverageBlurContext {
32  const AVClass *class;
33 
34  int radius;
35  int radiusV;
36  int planes;
37 
38  int depth;
39  int planewidth[4];
40  int planeheight[4];
41  float *buffer;
42  int nb_planes;
43 
44  int (*filter_horizontally)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs);
45  int (*filter_vertically)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs);
47 
48 #define OFFSET(x) offsetof(AverageBlurContext, x)
49 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
50 
51 static const AVOption avgblur_options[] = {
52  { "sizeX", "set horizontal size", OFFSET(radius), AV_OPT_TYPE_INT, {.i64=1}, 1, 1024, FLAGS },
53  { "planes", "set planes to filter", OFFSET(planes), AV_OPT_TYPE_INT, {.i64=0xF}, 0, 0xF, FLAGS },
54  { "sizeY", "set vertical size", OFFSET(radiusV), AV_OPT_TYPE_INT, {.i64=0}, 0, 1024, FLAGS },
55  { NULL }
56 };
57 
58 AVFILTER_DEFINE_CLASS(avgblur);
59 
60 typedef struct ThreadData {
61  int height;
62  int width;
64  int linesize;
65 } ThreadData;
66 
67 #define HORIZONTAL_FILTER(name, type) \
68 static int filter_horizontally_##name(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)\
69 { \
70  AverageBlurContext *s = ctx->priv; \
71  ThreadData *td = arg; \
72  const int height = td->height; \
73  const int width = td->width; \
74  const int slice_start = (height * jobnr ) / nb_jobs; \
75  const int slice_end = (height * (jobnr+1)) / nb_jobs; \
76  const int radius = FFMIN(s->radius, width / 2); \
77  const int linesize = td->linesize / sizeof(type); \
78  float *buffer = s->buffer; \
79  const type *src; \
80  float *ptr; \
81  int y, x; \
82  \
83  /* Filter horizontally along each row */ \
84  for (y = slice_start; y < slice_end; y++) { \
85  float acc = 0; \
86  int count = 0; \
87  \
88  src = (const type *)td->ptr + linesize * y; \
89  ptr = buffer + width * y; \
90  \
91  for (x = 0; x < radius; x++) { \
92  acc += src[x]; \
93  } \
94  count += radius; \
95  \
96  for (x = 0; x <= radius; x++) { \
97  acc += src[x + radius]; \
98  count++; \
99  ptr[x] = acc / count; \
100  } \
101  \
102  for (; x < width - radius; x++) { \
103  acc += src[x + radius] - src[x - radius - 1]; \
104  ptr[x] = acc / count; \
105  } \
106  \
107  for (; x < width; x++) { \
108  acc -= src[x - radius]; \
109  count--; \
110  ptr[x] = acc / count; \
111  } \
112  } \
113  \
114  return 0; \
115 }
116 
118 HORIZONTAL_FILTER(16, uint16_t)
119 
120 #define VERTICAL_FILTER(name, type) \
121 static int filter_vertically_##name(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) \
122 { \
123  AverageBlurContext *s = ctx->priv; \
124  ThreadData *td = arg; \
125  const int height = td->height; \
126  const int width = td->width; \
127  const int slice_start = (width * jobnr ) / nb_jobs; \
128  const int slice_end = (width * (jobnr+1)) / nb_jobs; \
129  const int radius = FFMIN(s->radiusV, height / 2); \
130  const int linesize = td->linesize / sizeof(type); \
131  type *buffer = (type *)td->ptr; \
132  const float *src; \
133  type *ptr; \
134  int i, x; \
135  \
136  /* Filter vertically along each column */ \
137  for (x = slice_start; x < slice_end; x++) { \
138  float acc = 0; \
139  int count = 0; \
140  \
141  ptr = buffer + x; \
142  src = s->buffer + x; \
143  \
144  for (i = 0; i < radius; i++) { \
145  acc += src[0]; \
146  src += width; \
147  } \
148  count += radius; \
149  \
150  src = s->buffer + x; \
151  ptr = buffer + x; \
152  for (i = 0; i <= radius; i++) { \
153  acc += src[(i + radius) * width]; \
154  count++; \
155  ptr[i * linesize] = acc / count; \
156  } \
157  \
158  for (; i < height - radius; i++) { \
159  acc += src[(i + radius) * width] - src[(i - radius - 1) * width]; \
160  ptr[i * linesize] = acc / count; \
161  } \
162  \
163  for (; i < height; i++) { \
164  acc -= src[(i - radius) * width]; \
165  count--; \
166  ptr[i * linesize] = acc / count; \
167  } \
168  } \
169  \
170  return 0; \
171 }
172 
174 VERTICAL_FILTER(16, uint16_t)
175 
177 {
178  const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
179  AverageBlurContext *s = inlink->dst->priv;
180 
181  s->depth = desc->comp[0].depth;
182  s->planewidth[1] = s->planewidth[2] = AV_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w);
183  s->planewidth[0] = s->planewidth[3] = inlink->w;
184  s->planeheight[1] = s->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
185  s->planeheight[0] = s->planeheight[3] = inlink->h;
186 
187  s->nb_planes = av_pix_fmt_count_planes(inlink->format);
188 
189  s->buffer = av_malloc_array(inlink->w, inlink->h * sizeof(*s->buffer));
190  if (!s->buffer)
191  return AVERROR(ENOMEM);
192 
193  if (s->radiusV <= 0) {
194  s->radiusV = s->radius;
195  }
196 
197  if (s->depth == 8) {
198  s->filter_horizontally = filter_horizontally_8;
199  s->filter_vertically = filter_vertically_8;
200  } else {
201  s->filter_horizontally = filter_horizontally_16;
202  s->filter_vertically = filter_vertically_16;
203  }
204 
205  return 0;
206 }
207 
209 {
210  AverageBlurContext *s = ctx->priv;
211  const int width = s->planewidth[plane];
212  const int height = s->planeheight[plane];
213  const int nb_threads = ff_filter_get_nb_threads(ctx);
214  ThreadData td;
215 
216  td.width = width;
217  td.height = height;
218  td.ptr = in->data[plane];
219  td.linesize = in->linesize[plane];
220  ctx->internal->execute(ctx, s->filter_horizontally, &td, NULL, FFMIN(height, nb_threads));
221  td.ptr = out->data[plane];
222  td.linesize = out->linesize[plane];
223  ctx->internal->execute(ctx, s->filter_vertically, &td, NULL, FFMIN(width, nb_threads));
224 }
225 
227 {
228  static const enum AVPixelFormat pix_fmts[] = {
247  };
248 
249  return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
250 }
251 
253 {
254  AVFilterContext *ctx = inlink->dst;
255  AverageBlurContext *s = ctx->priv;
256  AVFilterLink *outlink = ctx->outputs[0];
257  AVFrame *out;
258  int plane;
259 
260  if (av_frame_is_writable(in)) {
261  out = in;
262  } else {
263  out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
264  if (!out) {
265  av_frame_free(&in);
266  return AVERROR(ENOMEM);
267  }
268  av_frame_copy_props(out, in);
269  }
270 
271  for (plane = 0; plane < s->nb_planes; plane++) {
272  const int height = s->planeheight[plane];
273  const int width = s->planewidth[plane];
274 
275  if (!(s->planes & (1 << plane))) {
276  if (out != in)
277  av_image_copy_plane(out->data[plane], out->linesize[plane],
278  in->data[plane], in->linesize[plane],
279  width * ((s->depth + 7) / 8), height);
280  continue;
281  }
282 
283  averageiir2d(ctx, in, out, plane);
284  }
285 
286  if (out != in)
287  av_frame_free(&in);
288  return ff_filter_frame(outlink, out);
289 }
290 
292 {
293  AverageBlurContext *s = ctx->priv;
294 
295  av_freep(&s->buffer);
296 }
297 
298 static const AVFilterPad avgblur_inputs[] = {
299  {
300  .name = "default",
301  .type = AVMEDIA_TYPE_VIDEO,
302  .config_props = config_input,
303  .filter_frame = filter_frame,
304  },
305  { NULL }
306 };
307 
308 static const AVFilterPad avgblur_outputs[] = {
309  {
310  .name = "default",
311  .type = AVMEDIA_TYPE_VIDEO,
312  },
313  { NULL }
314 };
315 
317  .name = "avgblur",
318  .description = NULL_IF_CONFIG_SMALL("Apply Average Blur filter."),
319  .priv_size = sizeof(AverageBlurContext),
320  .priv_class = &avgblur_class,
321  .uninit = uninit,
323  .inputs = avgblur_inputs,
324  .outputs = avgblur_outputs,
326 };
int plane
Definition: avisynth_c.h:384
#define NULL
Definition: coverity.c:32
#define AV_PIX_FMT_YUVA422P16
Definition: pixfmt.h:430
#define AV_PIX_FMT_YUVA422P9
Definition: pixfmt.h:422
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2522
This structure describes decoded (raw) audio or video data.
Definition: frame.h:268
AVOption.
Definition: opt.h:246
#define AV_PIX_FMT_YUVA420P10
Definition: pixfmt.h:424
#define AV_PIX_FMT_YUV444P14
Definition: pixfmt.h:397
#define AV_PIX_FMT_GBRAP10
Definition: pixfmt.h:407
#define AV_PIX_FMT_YUVA422P10
Definition: pixfmt.h:425
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:71
misc image utilities
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2562
Main libavfilter public API header.
static const AVOption avgblur_options[]
Definition: vf_avgblur.c:51
const char * desc
Definition: nvenc.c:68
static int query_formats(AVFilterContext *ctx)
Definition: vf_avgblur.c:226
planar GBR 4:4:4 24bpp
Definition: pixfmt.h:168
#define HORIZONTAL_FILTER(name, type)
Definition: vf_avgblur.c:67
#define AV_PIX_FMT_GBRP10
Definition: pixfmt.h:403
#define AV_PIX_FMT_GRAY9
Definition: pixfmt.h:367
#define AV_PIX_FMT_YUV420P12
Definition: pixfmt.h:391
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
Definition: video.c:99
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
Definition: pixdesc.h:92
AVFilterFormats * ff_make_format_list(const int *fmts)
Create a list of supported formats.
Definition: formats.c:283
#define AV_PIX_FMT_GRAY10
Definition: pixfmt.h:368
#define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
Some filters support a generic "enable" expression option that can be used to enable or disable a fil...
Definition: avfilter.h:125
const char * name
Pad name.
Definition: internal.h:60
#define AV_PIX_FMT_GRAY12
Definition: pixfmt.h:369
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:1080
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
Definition: pixfmt.h:101
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
Definition: pixdesc.h:117
uint8_t
#define av_cold
Definition: attributes.h:82
AVOptions.
AVFILTER_DEFINE_CLASS(avgblur)
#define AV_PIX_FMT_YUVA420P9
Definition: pixfmt.h:421
#define AV_PIX_FMT_GBRP9
Definition: pixfmt.h:402
int height
Definition: vf_avgblur.c:61
#define height
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range...
Definition: pixfmt.h:100
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
Definition: pixfmt.h:79
int linesize
Definition: vf_avgblur.c:64
#define AV_PIX_FMT_YUV444P16
Definition: pixfmt.h:400
#define AV_PIX_FMT_YUV422P12
Definition: pixfmt.h:392
#define AV_PIX_FMT_YUVA420P16
Definition: pixfmt.h:429
A filter pad used for either input or output.
Definition: internal.h:54
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
Definition: pixfmt.h:176
int(* filter_vertically)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: vf_avgblur.c:45
int ff_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats)
A helper for query_formats() which sets all links to the same list of formats.
Definition: formats.c:568
#define td
Definition: regdef.h:70
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
Definition: pixdesc.h:101
uint8_t * ptr
Definition: vf_avgblur.c:63
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:202
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:186
void * priv
private data for use by the filter
Definition: avfilter.h:353
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
Definition: avfilter.h:116
#define AV_PIX_FMT_YUVA444P16
Definition: pixfmt.h:431
const char * arg
Definition: jacosubdec.c:66
#define AV_PIX_FMT_GBRAP12
Definition: pixfmt.h:408
#define AV_PIX_FMT_YUV444P10
Definition: pixfmt.h:390
#define AV_PIX_FMT_GBRAP16
Definition: pixfmt.h:409
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:70
#define AV_PIX_FMT_YUV422P9
Definition: pixfmt.h:385
#define AV_PIX_FMT_GBRP16
Definition: pixfmt.h:406
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
Definition: avfilter.c:802
#define AV_PIX_FMT_GRAY16
Definition: pixfmt.h:371
#define FFMIN(a, b)
Definition: common.h:96
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
Definition: pixfmt.h:78
#define width
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_avgblur.c:252
AVFormatContext * ctx
Definition: movenc.c:48
#define s(width, name)
Definition: cbs_vp9.c:257
#define AV_PIX_FMT_YUVA444P10
Definition: pixfmt.h:426
#define AV_PIX_FMT_YUV444P9
Definition: pixfmt.h:386
#define AV_PIX_FMT_GBRP14
Definition: pixfmt.h:405
#define FLAGS
Definition: vf_avgblur.c:49
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
#define VERTICAL_FILTER(name, type)
Definition: vf_avgblur.c:120
#define AV_PIX_FMT_YUV420P16
Definition: pixfmt.h:398
#define AV_PIX_FMT_YUV420P14
Definition: pixfmt.h:395
int av_frame_is_writable(AVFrame *frame)
Check if the frame data is writable.
Definition: frame.c:594
Used for passing data between threads.
Definition: af_adeclick.c:487
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Definition: frame.h:299
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Definition: pixfmt.h:177
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:81
#define AV_PIX_FMT_GRAY14
Definition: pixfmt.h:370
AVFilter ff_vf_avgblur
Definition: vf_avgblur.c:316
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several inputs
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
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:387
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Definition: pixfmt.h:72
Describe the class of an AVClass context structure.
Definition: log.h:67
Filter definition.
Definition: avfilter.h:144
static void averageiir2d(AVFilterContext *ctx, AVFrame *in, AVFrame *out, int plane)
Definition: vf_avgblur.c:208
const char * name
Filter name.
Definition: avfilter.h:148
#define AV_PIX_FMT_YUV440P12
Definition: pixfmt.h:393
#define AV_PIX_FMT_YUV420P9
Definition: pixfmt.h:384
AVFilterLink ** outputs
array of pointers to output links
Definition: avfilter.h:350
static enum AVPixelFormat pix_fmts[]
Definition: libkvazaar.c:275
#define AV_PIX_FMT_YUV422P14
Definition: pixfmt.h:396
#define AV_PIX_FMT_GBRP12
Definition: pixfmt.h:404
#define flags(name, subs,...)
Definition: cbs_av1.c:561
AVFilterInternal * internal
An opaque struct for libavfilter internal use.
Definition: avfilter.h:378
#define AV_PIX_FMT_YUV422P10
Definition: pixfmt.h:388
#define AV_PIX_FMT_YUV444P12
Definition: pixfmt.h:394
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:282
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_avgblur.c:291
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
int
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:66
Y , 8bpp.
Definition: pixfmt.h:74
planar GBRA 4:4:4:4 32bpp
Definition: pixfmt.h:215
#define OFFSET(x)
Definition: vf_avgblur.c:48
#define AV_PIX_FMT_YUVA444P9
Definition: pixfmt.h:423
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
Definition: pixfmt.h:80
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
Definition: pixfmt.h:73
avfilter_execute_func * execute
Definition: internal.h:155
static const AVFilterPad avgblur_outputs[]
Definition: vf_avgblur.c:308
static int config_input(AVFilterLink *inlink)
Definition: vf_avgblur.c:176
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor ...
Definition: pixfmt.h:258
An instance of a filter.
Definition: avfilter.h:338
FILE * out
Definition: movenc.c:54
#define av_freep(p)
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition: pixfmt.h:99
#define av_malloc_array(a, b)
void av_image_copy_plane(uint8_t *dst, int dst_linesize, const uint8_t *src, int src_linesize, int bytewidth, int height)
Copy image plane from src to dst.
Definition: imgutils.c:338
static const AVFilterPad avgblur_inputs[]
Definition: vf_avgblur.c:298
internal API functions
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
int depth
Number of bits in the component.
Definition: pixdesc.h:58
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
int(* filter_horizontally)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: vf_avgblur.c:44
#define AV_PIX_FMT_YUV422P16
Definition: pixfmt.h:399
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
Definition: frame.c:654
#define AV_CEIL_RSHIFT(a, b)
Definition: common.h:58