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|AV_OPT_FLAG_RUNTIME_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;
63  uint8_t *ptr;
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 
117 HORIZONTAL_FILTER(8, uint8_t)
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  src = s->buffer + x; \
142  \
143  for (i = 0; i < radius; i++) { \
144  acc += src[0]; \
145  src += width; \
146  } \
147  count += radius; \
148  \
149  src = s->buffer + x; \
150  ptr = buffer + x; \
151  for (i = 0; i + radius < height && i <= radius; i++) { \
152  acc += src[(i + radius) * width]; \
153  count++; \
154  ptr[i * linesize] = acc / count; \
155  } \
156  \
157  for (; i < height - radius; i++) { \
158  acc += src[(i + radius) * width] - src[(i - radius - 1) * width]; \
159  ptr[i * linesize] = acc / count; \
160  } \
161  \
162  for (; i < height; i++) { \
163  acc -= src[(i - radius) * width]; \
164  count--; \
165  ptr[i * linesize] = acc / count; \
166  } \
167  } \
168  \
169  return 0; \
170 }
171 
172 VERTICAL_FILTER(8, uint8_t)
173 VERTICAL_FILTER(16, uint16_t)
174 
176 {
178  AverageBlurContext *s = inlink->dst->priv;
179 
180  s->depth = desc->comp[0].depth;
181  s->planewidth[1] = s->planewidth[2] = AV_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w);
182  s->planewidth[0] = s->planewidth[3] = inlink->w;
183  s->planeheight[1] = s->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
184  s->planeheight[0] = s->planeheight[3] = inlink->h;
185 
186  s->nb_planes = av_pix_fmt_count_planes(inlink->format);
187 
188  s->buffer = av_malloc_array(inlink->w, inlink->h * sizeof(*s->buffer));
189  if (!s->buffer)
190  return AVERROR(ENOMEM);
191 
192  if (s->radiusV <= 0) {
193  s->radiusV = s->radius;
194  }
195 
196  if (s->depth == 8) {
197  s->filter_horizontally = filter_horizontally_8;
198  s->filter_vertically = filter_vertically_8;
199  } else {
200  s->filter_horizontally = filter_horizontally_16;
201  s->filter_vertically = filter_vertically_16;
202  }
203 
204  return 0;
205 }
206 
207 static void averageiir2d(AVFilterContext *ctx, AVFrame *in, AVFrame *out, int plane)
208 {
209  AverageBlurContext *s = ctx->priv;
210  const int width = s->planewidth[plane];
211  const int height = s->planeheight[plane];
212  const int nb_threads = ff_filter_get_nb_threads(ctx);
213  ThreadData td;
214 
215  td.width = width;
216  td.height = height;
217  td.ptr = in->data[plane];
218  td.linesize = in->linesize[plane];
219  ff_filter_execute(ctx, s->filter_horizontally, &td,
220  NULL, FFMIN(height, nb_threads));
221  td.ptr = out->data[plane];
222  td.linesize = out->linesize[plane];
223  ff_filter_execute(ctx, s->filter_vertically, &td,
224  NULL, FFMIN(width, nb_threads));
225 }
226 
228 {
229  static const enum AVPixelFormat pix_fmts[] = {
249  };
250 
252 }
253 
255 {
256  AVFilterContext *ctx = inlink->dst;
257  AverageBlurContext *s = ctx->priv;
258  AVFilterLink *outlink = ctx->outputs[0];
259  AVFrame *out;
260  int plane;
261 
262  if (av_frame_is_writable(in)) {
263  out = in;
264  } else {
265  out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
266  if (!out) {
267  av_frame_free(&in);
268  return AVERROR(ENOMEM);
269  }
271  }
272 
273  for (plane = 0; plane < s->nb_planes; plane++) {
274  const int height = s->planeheight[plane];
275  const int width = s->planewidth[plane];
276 
277  if (!(s->planes & (1 << plane))) {
278  if (out != in)
279  av_image_copy_plane(out->data[plane], out->linesize[plane],
280  in->data[plane], in->linesize[plane],
281  width * ((s->depth + 7) / 8), height);
282  continue;
283  }
284 
285  averageiir2d(ctx, in, out, plane);
286  }
287 
288  if (out != in)
289  av_frame_free(&in);
290  return ff_filter_frame(outlink, out);
291 }
292 
294 {
295  AverageBlurContext *s = ctx->priv;
296 
297  av_freep(&s->buffer);
298 }
299 
300 static const AVFilterPad avgblur_inputs[] = {
301  {
302  .name = "default",
303  .type = AVMEDIA_TYPE_VIDEO,
304  .config_props = config_input,
305  .filter_frame = filter_frame,
306  },
307 };
308 
309 static const AVFilterPad avgblur_outputs[] = {
310  {
311  .name = "default",
312  .type = AVMEDIA_TYPE_VIDEO,
313  },
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,
326  .process_command = ff_filter_process_command,
327 };
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:98
AV_PIX_FMT_YUVA422P16
#define AV_PIX_FMT_YUVA422P16
Definition: pixfmt.h:432
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: vf_avgblur.c:227
AV_PIX_FMT_GBRAP16
#define AV_PIX_FMT_GBRAP16
Definition: pixfmt.h:411
td
#define td
Definition: regdef.h:70
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
AverageBlurContext::buffer
float * buffer
Definition: vf_avgblur.c:41
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
AverageBlurContext::radiusV
int radiusV
Definition: vf_avgblur.c:35
out
FILE * out
Definition: movenc.c:54
ff_filter_frame
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:1017
av_pix_fmt_desc_get
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2540
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
av_frame_free
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:112
AV_PIX_FMT_YUVA422P9
#define AV_PIX_FMT_YUVA422P9
Definition: pixfmt.h:424
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:303
pixdesc.h
AV_PIX_FMT_YUVA420P16
#define AV_PIX_FMT_YUVA420P16
Definition: pixfmt.h:431
AV_PIX_FMT_YUVA420P10
#define AV_PIX_FMT_YUVA420P10
Definition: pixfmt.h:426
AVOption
AVOption.
Definition: opt.h:247
AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:389
AV_PIX_FMT_YUV440P
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition: pixfmt.h:99
AVFilter::name
const char * name
Filter name.
Definition: avfilter.h:153
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_avgblur.c:293
video.h
AV_PIX_FMT_YUVA422P10
#define AV_PIX_FMT_YUVA422P10
Definition: pixfmt.h:427
ThreadData::width
int width
Definition: vf_avgblur.c:62
AV_PIX_FMT_GRAY9
#define AV_PIX_FMT_GRAY9
Definition: pixfmt.h:369
AVFrame::data
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:317
av_image_copy_plane
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:374
formats.h
av_pix_fmt_count_planes
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2580
AV_PIX_FMT_YUVA420P9
#define AV_PIX_FMT_YUVA420P9
Definition: pixfmt.h:423
AverageBlurContext::planeheight
int planeheight[4]
Definition: vf_avgblur.c:40
AV_PIX_FMT_GBRP14
#define AV_PIX_FMT_GBRP14
Definition: pixfmt.h:407
AV_PIX_FMT_GBRAP
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
Definition: pixfmt.h:205
AV_PIX_FMT_GBRP10
#define AV_PIX_FMT_GBRP10
Definition: pixfmt.h:405
AV_PIX_FMT_YUVA444P16
#define AV_PIX_FMT_YUVA444P16
Definition: pixfmt.h:433
AV_PIX_FMT_YUV422P9
#define AV_PIX_FMT_YUV422P9
Definition: pixfmt.h:387
FLAGS
#define FLAGS
Definition: vf_avgblur.c:49
AV_PIX_FMT_GRAY16
#define AV_PIX_FMT_GRAY16
Definition: pixfmt.h:373
ff_vf_avgblur
const AVFilter ff_vf_avgblur
Definition: vf_avgblur.c:316
AVFilterPad
A filter pad used for either input or output.
Definition: internal.h:50
AV_PIX_FMT_YUV444P10
#define AV_PIX_FMT_YUV444P10
Definition: pixfmt.h:392
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:248
AverageBlurContext::radius
int radius
Definition: vf_avgblur.c:34
planes
static const struct @318 planes[]
av_cold
#define av_cold
Definition: attributes.h:90
AV_PIX_FMT_YUV422P16
#define AV_PIX_FMT_YUV422P16
Definition: pixfmt.h:401
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:79
AV_PIX_FMT_GBRAP10
#define AV_PIX_FMT_GBRAP10
Definition: pixfmt.h:409
width
#define width
s
#define s(width, name)
Definition: cbs_vp9.c:257
ThreadData::ptr
uint8_t * ptr
Definition: vf_avgblur.c:63
AV_PIX_FMT_GBRAP12
#define AV_PIX_FMT_GBRAP12
Definition: pixfmt.h:410
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:101
AV_PIX_FMT_YUV444P16
#define AV_PIX_FMT_YUV444P16
Definition: pixfmt.h:402
AV_CEIL_RSHIFT
#define AV_CEIL_RSHIFT(a, b)
Definition: common.h:51
ThreadData::height
int height
Definition: vf_avgblur.c:61
ThreadData::linesize
int linesize
Definition: vf_avgblur.c:64
ff_set_common_formats_from_list
int ff_set_common_formats_from_list(AVFilterContext *ctx, const int *fmts)
Equivalent to ff_set_common_formats(ctx, ff_make_format_list(fmts))
Definition: formats.c:703
pix_fmts
static enum AVPixelFormat pix_fmts[]
Definition: libkvazaar.c:290
AV_PIX_FMT_YUVA444P12
#define AV_PIX_FMT_YUVA444P12
Definition: pixfmt.h:430
AV_PIX_FMT_YUV420P9
#define AV_PIX_FMT_YUV420P9
Definition: pixfmt.h:386
AV_PIX_FMT_YUV420P16
#define AV_PIX_FMT_YUV420P16
Definition: pixfmt.h:400
ctx
AVFormatContext * ctx
Definition: movenc.c:48
AV_PIX_FMT_GRAY14
#define AV_PIX_FMT_GRAY14
Definition: pixfmt.h:372
HORIZONTAL_FILTER
#define HORIZONTAL_FILTER(name, type)
Definition: vf_avgblur.c:67
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:66
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:152
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:80
arg
const char * arg
Definition: jacosubdec.c:67
AV_PIX_FMT_GRAY10
#define AV_PIX_FMT_GRAY10
Definition: pixfmt.h:370
AV_PIX_FMT_GBRP16
#define AV_PIX_FMT_GBRP16
Definition: pixfmt.h:408
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:66
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:537
avgblur_inputs
static const AVFilterPad avgblur_inputs[]
Definition: vf_avgblur.c:300
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:78
AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_YUV422P10
Definition: pixfmt.h:390
AV_PIX_FMT_GRAY8
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition: pixfmt.h:74
AV_PIX_FMT_GBRP9
#define AV_PIX_FMT_GBRP9
Definition: pixfmt.h:404
avgblur_options
static const AVOption avgblur_options[]
Definition: vf_avgblur.c:51
AverageBlurContext::depth
int depth
Definition: vf_avgblur.c:38
VERTICAL_FILTER
#define VERTICAL_FILTER(name, type)
Definition: vf_avgblur.c:120
avgblur_outputs
static const AVFilterPad avgblur_outputs[]
Definition: vf_avgblur.c:309
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:117
AverageBlurContext::planewidth
int planewidth[4]
Definition: vf_avgblur.c:39
AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_YUV422P12
Definition: pixfmt.h:394
AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV444P12
Definition: pixfmt.h:396
AverageBlurContext::filter_vertically
int(* filter_vertically)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: vf_avgblur.c:45
av_frame_is_writable
int av_frame_is_writable(AVFrame *frame)
Check if the frame data is writable.
Definition: frame.c:473
ff_filter_process_command
int ff_filter_process_command(AVFilterContext *ctx, const char *cmd, const char *arg, char *res, int res_len, int flags)
Generic processing of user supplied commands that are set in the same way as the filter options.
Definition: avfilter.c:883
height
#define height
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:167
AV_PIX_FMT_YUVA444P10
#define AV_PIX_FMT_YUVA444P10
Definition: pixfmt.h:428
internal.h
AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
#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:130
OFFSET
#define OFFSET(x)
Definition: vf_avgblur.c:48
AV_PIX_FMT_GBRP12
#define AV_PIX_FMT_GBRP12
Definition: pixfmt.h:406
av_malloc_array
#define av_malloc_array(a, b)
Definition: tableprint_vlc.h:32
ff_filter_get_nb_threads
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
Definition: avfilter.c:804
ThreadData
Used for passing data between threads.
Definition: dsddec.c:67
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
AV_PIX_FMT_YUVJ440P
@ AV_PIX_FMT_YUVJ440P
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range
Definition: pixfmt.h:100
AVFilterPad::name
const char * name
Pad name.
Definition: internal.h:56
AverageBlurContext::filter_horizontally
int(* filter_horizontally)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: vf_avgblur.c:44
AV_PIX_FMT_YUV444P9
#define AV_PIX_FMT_YUV444P9
Definition: pixfmt.h:388
AVFilter
Filter definition.
Definition: avfilter.h:149
AV_PIX_FMT_YUVA444P9
#define AV_PIX_FMT_YUVA444P9
Definition: pixfmt.h:425
AV_PIX_FMT_YUV420P12
#define AV_PIX_FMT_YUV420P12
Definition: pixfmt.h:393
AV_PIX_FMT_YUV422P14
#define AV_PIX_FMT_YUV422P14
Definition: pixfmt.h:398
averageiir2d
static void averageiir2d(AVFilterContext *ctx, AVFrame *in, AVFrame *out, int plane)
Definition: vf_avgblur.c:207
AverageBlurContext
Definition: vf_avgblur.c:31
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:65
AV_PIX_FMT_YUVA422P12
#define AV_PIX_FMT_YUVA422P12
Definition: pixfmt.h:429
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:224
avfilter.h
AverageBlurContext::nb_planes
int nb_planes
Definition: vf_avgblur.c:42
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:71
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_avgblur.c:254
AVFilterContext
An instance of a filter.
Definition: avfilter.h:346
AV_PIX_FMT_GBRP
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
Definition: pixfmt.h:158
AVFILTER_FLAG_SLICE_THREADS
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
Definition: avfilter.h:121
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:70
AVPixFmtDescriptor
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:69
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:153
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:35
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:73
imgutils.h
AVFrame::linesize
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Definition: frame.h:334
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:72
AV_PIX_FMT_YUV440P12
#define AV_PIX_FMT_YUV440P12
Definition: pixfmt.h:395
AV_PIX_FMT_YUV444P14
#define AV_PIX_FMT_YUV444P14
Definition: pixfmt.h:399
AV_PIX_FMT_GRAY12
#define AV_PIX_FMT_GRAY12
Definition: pixfmt.h:371
ff_filter_execute
static av_always_inline int ff_filter_execute(AVFilterContext *ctx, avfilter_action_func *func, void *arg, int *ret, int nb_jobs)
Definition: internal.h:143
int
int
Definition: ffmpeg_filter.c:156
AVFILTER_DEFINE_CLASS
AVFILTER_DEFINE_CLASS(avgblur)
AverageBlurContext::planes
int planes
Definition: vf_avgblur.c:36
config_input
static int config_input(AVFilterLink *inlink)
Definition: vf_avgblur.c:175
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:166
AV_PIX_FMT_YUV420P14
#define AV_PIX_FMT_YUV420P14
Definition: pixfmt.h:397