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/avassert.h"
24 #include "libavutil/imgutils.h"
25 #include "libavutil/opt.h"
26 #include "libavutil/pixdesc.h"
27 #include "avfilter.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 max;
40  int area;
41  int planewidth[4];
42  int planeheight[4];
43  void *buffer;
44  uint16_t lut[256 * 256 * 256];
45  int nb_planes;
46 
47  int (*filter[2])(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs);
49 
50 #define OFFSET(x) offsetof(AverageBlurContext, x)
51 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
52 
53 static const AVOption avgblur_options[] = {
54  { "sizeX", "set horizontal size", OFFSET(radius), AV_OPT_TYPE_INT, {.i64=1}, 1, 1024, FLAGS },
55  { "planes", "set planes to filter", OFFSET(planes), AV_OPT_TYPE_INT, {.i64=0xF}, 0, 0xF, FLAGS },
56  { "sizeY", "set vertical size", OFFSET(radiusV), AV_OPT_TYPE_INT, {.i64=0}, 0, 1024, FLAGS },
57  { NULL }
58 };
59 
60 AVFILTER_DEFINE_CLASS(avgblur);
61 
62 typedef struct ThreadData {
63  int height;
64  int width;
65  const void *ptr;
66  void *dptr;
68 } ThreadData;
69 
70 #define LUT_DIV(sum, area) (lut[(sum)])
71 #define SLOW_DIV(sum, area) ((sum) / (area))
72 
73 #define FILTER(name, type, btype, lutunused, areaunused, lutdiv) \
74 static int filter_##name(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) \
75 { \
76  AverageBlurContext *s = ctx->priv; \
77  ThreadData *td = arg; \
78  areaunused const int area = s->area; \
79  lutunused const uint16_t *lut = s->lut; \
80  const int size_w = s->radius; \
81  const int size_h = s->radiusV; \
82  btype *col_sum = (btype *)s->buffer + size_w; \
83  const int dlinesize = td->dlinesize / sizeof(type); \
84  const int linesize = td->linesize / sizeof(type); \
85  const int height = td->height; \
86  const int width = td->width; \
87  const type *src = td->ptr; \
88  type *dst = td->dptr; \
89  btype sum = 0; \
90  \
91  for (int x = -size_w; x < 0; x++) { \
92  sum = src[0] * size_h; \
93  for (int y = 0; y <= size_h; y++) \
94  sum += src[y * linesize]; \
95  av_assert2(sum >= 0); \
96  col_sum[x] = sum; \
97  } \
98  \
99  for (int x = 0; x < width; x++) { \
100  sum = src[x] * size_h; \
101  for (int y = 0; y <= size_h; y++) \
102  sum += src[x + y * linesize]; \
103  av_assert2(sum >= 0); \
104  col_sum[x] = sum; \
105  } \
106  \
107  for (int x = width; x < width + size_w; x++) { \
108  sum = src[width - 1] * size_h; \
109  for (int y = 0; y <= size_h; y++) \
110  sum += src[width - 1 + y * linesize]; \
111  av_assert2(sum >= 0); \
112  col_sum[x] = sum; \
113  } \
114  \
115  sum = 0; \
116  for (int x = -size_w; x <= size_w; x++) \
117  sum += col_sum[x]; \
118  av_assert2(sum >= 0); \
119  dst[0] = lutdiv(sum, area); \
120  \
121  for (int x = 1; x < width; x++) { \
122  sum = sum - col_sum[x - size_w - 1] + col_sum[x + size_w]; \
123  av_assert2(sum >= 0); \
124  dst[x] = lutdiv(sum, area); \
125  } \
126  \
127  src = td->ptr; \
128  src += linesize; \
129  dst += dlinesize; \
130  \
131  for (int y = 1; y < height; y++) { \
132  const int syp = FFMIN(size_h, height - y - 1) * linesize; \
133  const int syn = FFMIN(y, size_h + 1) * linesize; \
134  \
135  sum = 0; \
136  \
137  for (int x = -size_w; x < 0; x++) \
138  col_sum[x] += src[0 + syp] - src[0 - syn]; \
139  \
140  for (int x = 0; x < width; x++) \
141  col_sum[x] += src[x + syp] - src[x - syn]; \
142  \
143  for (int x = width; x < width + size_w; x++) \
144  col_sum[x] += src[width - 1 + syp] - src[width - 1 - syn]; \
145  \
146  for (int x = -size_w; x <= size_w; x++) \
147  sum += col_sum[x]; \
148  av_assert2(sum >= 0); \
149  dst[0] = lutdiv(sum, area); \
150  \
151  for (int x = 1; x < width; x++) { \
152  sum = sum - col_sum[x - size_w - 1] + col_sum[x + size_w]; \
153  av_assert2(sum >= 0); \
154  dst[x] = lutdiv(sum, area); \
155  } \
156  \
157  src += linesize; \
158  dst += dlinesize; \
159  } \
160  \
161  return 0; \
162 }
163 
164 FILTER(lut8, uint8_t, int32_t, , av_unused, LUT_DIV)
165 FILTER(lut16, uint16_t, int64_t, , av_unused, LUT_DIV)
166 
167 FILTER(slow8, uint8_t, int32_t, av_unused, , SLOW_DIV)
168 FILTER(slow16, uint16_t, int64_t, av_unused, , SLOW_DIV)
169 
170 static void build_lut(AVFilterContext *ctx, int max)
171 {
172  AverageBlurContext *s = ctx->priv;
173  const int area = (2 * s->radiusV + 1) * (2 * s->radius + 1);
174 
175  s->area = area;
176  if (max * area >= FF_ARRAY_ELEMS(s->lut))
177  return;
178 
179  for (int i = 0, j = 0, k = 0; i < max * area; i++, j++) {
180  if (j == area) {
181  k++;
182  j = 0;
183  }
184 
185  s->lut[i] = k;
186  }
187 }
188 
190 {
191  AverageBlurContext *s = ctx->priv;
192 
193  av_freep(&s->buffer);
194 }
195 
197 {
198  AVFilterContext *ctx = inlink->dst;
200  AverageBlurContext *s = ctx->priv;
201 
202  uninit(ctx);
203 
204  s->depth = desc->comp[0].depth;
205  s->max = 1 << s->depth;
206  s->planewidth[1] = s->planewidth[2] = AV_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w);
207  s->planewidth[0] = s->planewidth[3] = inlink->w;
208  s->planeheight[1] = s->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
209  s->planeheight[0] = s->planeheight[3] = inlink->h;
210 
211  s->nb_planes = av_pix_fmt_count_planes(inlink->format);
212 
213  s->buffer = av_calloc(inlink->w + (1024 * 2 + 1), 4 * ((s->depth + 7) / 8));
214  if (!s->buffer)
215  return AVERROR(ENOMEM);
216 
217  if (s->radiusV <= 0)
218  s->radiusV = s->radius;
219 
220  s->filter[0] = s->depth <= 8 ? filter_lut8 : filter_lut16;
221  s->filter[1] = s->depth <= 8 ? filter_slow8 : filter_slow16;
222 
223  s->radius = FFMIN(s->planewidth[1] / 2, s->radius);
224  s->radiusV = FFMIN(s->planeheight[1] / 2, s->radiusV);
225 
226  build_lut(ctx, s->max);
227 
228  return 0;
229 }
230 
231 static void averageiir2d(AVFilterContext *ctx, AVFrame *in, AVFrame *out, int plane)
232 {
233  AverageBlurContext *s = ctx->priv;
234  const int width = s->planewidth[plane];
235  const int height = s->planeheight[plane];
236  const int slow = (s->max * s->area) >= FF_ARRAY_ELEMS(s->lut);
237  ThreadData td;
238 
239  td.width = width;
240  td.height = height;
241  td.ptr = in->data[plane];
242  td.linesize = in->linesize[plane];
243  td.dptr = out->data[plane];
244  td.dlinesize = out->linesize[plane];
245  s->filter[slow](ctx, &td, 0, 0);
246 }
247 
248 static const enum AVPixelFormat pix_fmts[] = {
268 };
269 
271 {
272  AVFilterContext *ctx = inlink->dst;
273  AverageBlurContext *s = ctx->priv;
274  AVFilterLink *outlink = ctx->outputs[0];
275  AVFrame *out;
276  int plane;
277 
278  out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
279  if (!out) {
280  av_frame_free(&in);
281  return AVERROR(ENOMEM);
282  }
284 
285  for (plane = 0; plane < s->nb_planes; plane++) {
286  const int height = s->planeheight[plane];
287  const int width = s->planewidth[plane];
288 
289  if (!(s->planes & (1 << plane))) {
290  if (out->data[plane] != in->data[plane])
291  av_image_copy_plane(out->data[plane], out->linesize[plane],
292  in->data[plane], in->linesize[plane],
293  width * ((s->depth + 7) / 8), height);
294  continue;
295  }
296 
297  averageiir2d(ctx, in, out, plane);
298  }
299 
300  av_frame_free(&in);
301  return ff_filter_frame(outlink, out);
302 }
303 
304 static int process_command(AVFilterContext *ctx, const char *cmd, const char *args,
305  char *res, int res_len, int flags)
306 {
307  AverageBlurContext *s = ctx->priv;
308  const int area = s->area;
309  int ret;
310 
311  ret = ff_filter_process_command(ctx, cmd, args, res, res_len, flags);
312  if (ret < 0)
313  return ret;
314 
315  if (s->radiusV <= 0)
316  s->radiusV = s->radius;
317 
318  s->radius = FFMIN(s->planewidth[1] / 2, s->radius);
319  s->radiusV = FFMIN(s->planeheight[1] / 2, s->radiusV);
320 
321  if (area != (2 * s->radiusV + 1) * (2 * s->radius + 1))
322  build_lut(ctx, s->max);
323 
324  return 0;
325 }
326 
327 static const AVFilterPad avgblur_inputs[] = {
328  {
329  .name = "default",
330  .type = AVMEDIA_TYPE_VIDEO,
331  .config_props = config_input,
332  .filter_frame = filter_frame,
333  },
334 };
335 
337  .name = "avgblur",
338  .description = NULL_IF_CONFIG_SMALL("Apply Average Blur filter."),
339  .priv_size = sizeof(AverageBlurContext),
340  .priv_class = &avgblur_class,
341  .uninit = uninit,
346  .process_command = process_command,
347 };
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:112
AV_PIX_FMT_YUVA422P16
#define AV_PIX_FMT_YUVA422P16
Definition: pixfmt.h:522
AV_PIX_FMT_GBRAP16
#define AV_PIX_FMT_GBRAP16
Definition: pixfmt.h:501
td
#define td
Definition: regdef.h:70
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:71
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:1018
av_pix_fmt_desc_get
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2962
FILTER_PIXFMTS_ARRAY
#define FILTER_PIXFMTS_ARRAY(array)
Definition: internal.h:162
AverageBlurContext::area
int area
Definition: vf_avgblur.c:40
int64_t
long long int64_t
Definition: coverity.c:34
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_unused
#define av_unused
Definition: attributes.h:131
av_frame_free
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:130
AV_PIX_FMT_YUVA422P9
#define AV_PIX_FMT_YUVA422P9
Definition: pixfmt.h:514
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:344
pixdesc.h
AV_PIX_FMT_YUVA420P16
#define AV_PIX_FMT_YUVA420P16
Definition: pixfmt.h:521
ThreadData::dptr
void * dptr
Definition: vf_avgblur.c:66
AV_PIX_FMT_YUVA420P10
#define AV_PIX_FMT_YUVA420P10
Definition: pixfmt.h:516
AVOption
AVOption.
Definition: opt.h:346
AverageBlurContext::max
int max
Definition: vf_avgblur.c:39
AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:478
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
max
#define max(a, b)
Definition: cuda_runtime.h:33
AVFilter::name
const char * name
Filter name.
Definition: avfilter.h:170
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_avgblur.c:189
video.h
AV_PIX_FMT_YUVA422P10
#define AV_PIX_FMT_YUVA422P10
Definition: pixfmt.h:517
ThreadData::width
int width
Definition: vf_avgblur.c:64
AV_PIX_FMT_GRAY9
#define AV_PIX_FMT_GRAY9
Definition: pixfmt.h:458
AVFrame::data
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:365
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
av_pix_fmt_count_planes
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:3002
AV_PIX_FMT_YUVA420P9
#define AV_PIX_FMT_YUVA420P9
Definition: pixfmt.h:513
AverageBlurContext::planeheight
int planeheight[4]
Definition: vf_avgblur.c:42
AV_PIX_FMT_GBRP14
#define AV_PIX_FMT_GBRP14
Definition: pixfmt.h:496
AV_PIX_FMT_GBRAP
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
Definition: pixfmt.h:212
AV_PIX_FMT_GBRP10
#define AV_PIX_FMT_GBRP10
Definition: pixfmt.h:494
AV_PIX_FMT_YUVA444P16
#define AV_PIX_FMT_YUVA444P16
Definition: pixfmt.h:523
AV_PIX_FMT_YUV422P9
#define AV_PIX_FMT_YUV422P9
Definition: pixfmt.h:476
FLAGS
#define FLAGS
Definition: vf_avgblur.c:51
AV_PIX_FMT_GRAY16
#define AV_PIX_FMT_GRAY16
Definition: pixfmt.h:462
ff_vf_avgblur
const AVFilter ff_vf_avgblur
Definition: vf_avgblur.c:336
AVFilterPad
A filter pad used for either input or output.
Definition: internal.h:33
AV_PIX_FMT_YUV444P10
#define AV_PIX_FMT_YUV444P10
Definition: pixfmt.h:481
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
AverageBlurContext::radius
int radius
Definition: vf_avgblur.c:34
avassert.h
FF_ARRAY_ELEMS
#define FF_ARRAY_ELEMS(a)
Definition: sinewin_tablegen.c:29
av_cold
#define av_cold
Definition: attributes.h:90
AV_PIX_FMT_YUV422P16
#define AV_PIX_FMT_YUV422P16
Definition: pixfmt.h:490
ff_video_default_filterpad
const AVFilterPad ff_video_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_VIDEO.
Definition: video.c:37
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:498
width
#define width
s
#define s(width, name)
Definition: cbs_vp9.c:198
AV_PIX_FMT_GBRAP12
#define AV_PIX_FMT_GBRAP12
Definition: pixfmt.h:499
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
LUT_DIV
#define LUT_DIV(sum, area)
Definition: vf_avgblur.c:70
AV_PIX_FMT_YUV444P16
#define AV_PIX_FMT_YUV444P16
Definition: pixfmt.h:491
AV_CEIL_RSHIFT
#define AV_CEIL_RSHIFT(a, b)
Definition: common.h:58
ThreadData::height
int height
Definition: vf_avgblur.c:63
ThreadData::linesize
int linesize
Definition: vf_avgblur.c:67
AV_PIX_FMT_YUVA444P12
#define AV_PIX_FMT_YUVA444P12
Definition: pixfmt.h:520
AV_PIX_FMT_YUV420P9
#define AV_PIX_FMT_YUV420P9
Definition: pixfmt.h:475
AV_PIX_FMT_YUV420P16
#define AV_PIX_FMT_YUV420P16
Definition: pixfmt.h:489
ctx
AVFormatContext * ctx
Definition: movenc.c:48
AV_PIX_FMT_GRAY14
#define AV_PIX_FMT_GRAY14
Definition: pixfmt.h:461
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_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:182
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
arg
const char * arg
Definition: jacosubdec.c:67
AV_PIX_FMT_GRAY10
#define AV_PIX_FMT_GRAY10
Definition: pixfmt.h:459
AV_PIX_FMT_GBRP16
#define AV_PIX_FMT_GBRP16
Definition: pixfmt.h:497
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:679
avgblur_inputs
static const AVFilterPad avgblur_inputs[]
Definition: vf_avgblur.c:327
SLOW_DIV
#define SLOW_DIV(sum, area)
Definition: vf_avgblur.c:71
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
AverageBlurContext::lut
uint16_t lut[256 *256 *256]
Definition: vf_avgblur.c:44
AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_YUV422P10
Definition: pixfmt.h:479
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:493
avgblur_options
static const AVOption avgblur_options[]
Definition: vf_avgblur.c:53
AverageBlurContext::depth
int depth
Definition: vf_avgblur.c:38
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:106
AverageBlurContext::planewidth
int planewidth[4]
Definition: vf_avgblur.c:41
FILTER
#define FILTER(name, type, btype, lutunused, areaunused, lutdiv)
Definition: vf_avgblur.c:73
AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_YUV422P12
Definition: pixfmt.h:483
AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV444P12
Definition: pixfmt.h:485
AverageBlurContext::buffer
void * buffer
Definition: vf_avgblur.c:43
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:890
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:174
AV_PIX_FMT_YUVA444P10
#define AV_PIX_FMT_YUVA444P10
Definition: pixfmt.h:518
pix_fmts
static enum AVPixelFormat pix_fmts[]
Definition: vf_avgblur.c:248
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:147
build_lut
static void build_lut(AVFilterContext *ctx, int max)
Definition: vf_avgblur.c:170
OFFSET
#define OFFSET(x)
Definition: vf_avgblur.c:50
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:255
ThreadData::ptr
const void * ptr
Definition: vf_avgblur.c:65
AV_PIX_FMT_GBRP12
#define AV_PIX_FMT_GBRP12
Definition: pixfmt.h:495
ThreadData
Used for passing data between threads.
Definition: dsddec.c:69
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:107
AVFilterPad::name
const char * name
Pad name.
Definition: internal.h:39
av_calloc
void * av_calloc(size_t nmemb, size_t size)
Definition: mem.c:262
AV_PIX_FMT_YUV444P9
#define AV_PIX_FMT_YUV444P9
Definition: pixfmt.h:477
AVFilter
Filter definition.
Definition: avfilter.h:166
ret
ret
Definition: filter_design.txt:187
AV_PIX_FMT_YUVA444P9
#define AV_PIX_FMT_YUVA444P9
Definition: pixfmt.h:515
AV_PIX_FMT_YUV420P12
#define AV_PIX_FMT_YUV420P12
Definition: pixfmt.h:482
AV_PIX_FMT_YUV422P14
#define AV_PIX_FMT_YUV422P14
Definition: pixfmt.h:487
averageiir2d
static void averageiir2d(AVFilterContext *ctx, AVFrame *in, AVFrame *out, int plane)
Definition: vf_avgblur.c:231
AverageBlurContext
Definition: vf_avgblur.c:31
ThreadData::dlinesize
int dlinesize
Definition: vf_avgblur.c:67
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:72
AV_PIX_FMT_YUVA422P12
#define AV_PIX_FMT_YUVA422P12
Definition: pixfmt.h:519
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:235
avfilter.h
AverageBlurContext::filter
int(* filter[2])(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: vf_avgblur.c:47
AverageBlurContext::nb_planes
int nb_planes
Definition: vf_avgblur.c:45
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
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_avgblur.c:270
AVFilterContext
An instance of a filter.
Definition: avfilter.h:407
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:75
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
AVPixFmtDescriptor
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:69
planes
static const struct @386 planes[]
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:183
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:34
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
int32_t
int32_t
Definition: audioconvert.c:56
imgutils.h
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:482
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:389
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
AV_PIX_FMT_YUV440P12
#define AV_PIX_FMT_YUV440P12
Definition: pixfmt.h:484
AV_PIX_FMT_YUV444P14
#define AV_PIX_FMT_YUV444P14
Definition: pixfmt.h:488
AV_PIX_FMT_GRAY12
#define AV_PIX_FMT_GRAY12
Definition: pixfmt.h:460
int
int
Definition: ffmpeg_filter.c:409
AVFILTER_DEFINE_CLASS
AVFILTER_DEFINE_CLASS(avgblur)
AverageBlurContext::planes
int planes
Definition: vf_avgblur.c:36
process_command
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
Definition: vf_avgblur.c:304
config_input
static int config_input(AVFilterLink *inlink)
Definition: vf_avgblur.c:196
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
AV_PIX_FMT_YUV420P14
#define AV_PIX_FMT_YUV420P14
Definition: pixfmt.h:486