FFmpeg
vf_varblur.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2021 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/imgutils.h"
22 #include "libavutil/mem.h"
23 #include "libavutil/opt.h"
24 #include "libavutil/pixdesc.h"
25 #include "avfilter.h"
26 #include "filters.h"
27 #include "framesync.h"
28 #include "video.h"
29 
30 typedef struct VarBlurContext {
31  const AVClass *class;
33 
36  int planes;
37 
38  int depth;
39  int planewidth[4];
40  int planeheight[4];
41 
42  uint8_t *sat[4];
43  int sat_linesize[4];
44  int nb_planes;
45 
46  void (*compute_sat)(const uint8_t *ssrc,
47  int linesize,
48  int w, int h,
49  uint8_t *dstp,
50  int dst_linesize);
51 
53  uint8_t *ddst,
54  int ddst_linesize,
55  const uint8_t *rrptr,
56  int rrptr_linesize,
57  int w, int h,
58  const uint8_t *pptr,
59  int pptr_linesize,
60  int slice_start, int slice_end);
62 
63 #define OFFSET(x) offsetof(VarBlurContext, x)
64 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
65 
66 static const AVOption varblur_options[] = {
67  { "min_r", "set min blur radius", OFFSET(min_radius), AV_OPT_TYPE_INT, {.i64=0}, 0, 254, FLAGS },
68  { "max_r", "set max blur radius", OFFSET(max_radius), AV_OPT_TYPE_INT, {.i64=8}, 1, 255, FLAGS },
69  { "planes", "set planes to filter", OFFSET(planes), AV_OPT_TYPE_INT, {.i64=0xF}, 0, 0xF, FLAGS },
70  { NULL }
71 };
72 
74 
75 static const enum AVPixelFormat pix_fmts[] = {
96 };
97 
98 #define COMPUTE_SAT(type, stype, depth) \
99 static void compute_sat##depth(const uint8_t *ssrc, \
100  int linesize, \
101  int w, int h, \
102  uint8_t *dstp, \
103  int dst_linesize) \
104 { \
105  const type *src = (const type *)ssrc; \
106  stype *dst = (stype *)dstp; \
107  \
108  linesize /= (depth / 8); \
109  dst_linesize /= sizeof(stype); \
110  dst += dst_linesize; \
111  \
112  for (int y = 0; y < h; y++) { \
113  stype sum = 0; \
114  \
115  for (int x = 1; x < w; x++) { \
116  sum += src[x - 1]; \
117  dst[x] = sum + dst[x - dst_linesize]; \
118  } \
119  \
120  src += linesize; \
121  dst += dst_linesize; \
122  } \
123 }
124 
125 COMPUTE_SAT(uint8_t, uint32_t, 8)
126 COMPUTE_SAT(uint16_t, uint64_t, 16)
127 COMPUTE_SAT(float, double, 32)
128 
129 typedef struct ThreadData {
130  AVFrame *in, *out, *radius;
131 } ThreadData;
132 
133 static float lerpf(float v0, float v1, float f)
134 {
135  return v0 + (v1 - v0) * f;
136 }
137 
138 #define BLUR_PLANE(type, stype, bits) \
139 static int blur_plane##bits(AVFilterContext *ctx, \
140  uint8_t *ddst, \
141  int ddst_linesize, \
142  const uint8_t *rrptr, \
143  int rrptr_linesize, \
144  int w, int h, \
145  const uint8_t *pptr, \
146  int pptr_linesize, \
147  int slice_start, int slice_end) \
148 { \
149  VarBlurContext *s = ctx->priv; \
150  const int ddepth = (bits == 32) ? 1 : s->depth; \
151  const int dst_linesize = ddst_linesize / (bits / 8); \
152  const int ptr_linesize = pptr_linesize / sizeof(stype); \
153  const int rptr_linesize = rrptr_linesize / (bits / 8); \
154  const type *rptr = ((const type *)rrptr) + slice_start * rptr_linesize; \
155  type *dst = ((type *)ddst) + slice_start * dst_linesize; \
156  const stype *ptr = (stype *)pptr; \
157  const float minr = 2.f * s->min_radius + 1.f; \
158  const float maxr = 2.f * s->max_radius + 1.f; \
159  const float scaler = (maxr - minr) / ((1 << ddepth) - 1); \
160  \
161  for (int y = slice_start; y < slice_end; y++) { \
162  for (int x = 0; x < w; x++) { \
163  const float radiusf = minr + (FFMAX(0.f, 2 * rptr[x] + 1 - minr)) * scaler; \
164  const int radius = floorf(radiusf); \
165  const float factor = radiusf - radius; \
166  const int nradius = radius + 1; \
167  const int l = FFMIN(radius, x); \
168  const int r = FFMIN(radius, w - x - 1); \
169  const int t = FFMIN(radius, y); \
170  const int b = FFMIN(radius, h - y - 1); \
171  const int nl = FFMIN(nradius, x); \
172  const int nr = FFMIN(nradius, w - x - 1); \
173  const int nt = FFMIN(nradius, y); \
174  const int nb = FFMIN(nradius, h - y - 1); \
175  stype tl = ptr[(y - t) * ptr_linesize + x - l]; \
176  stype tr = ptr[(y - t) * ptr_linesize + x + r]; \
177  stype bl = ptr[(y + b) * ptr_linesize + x - l]; \
178  stype br = ptr[(y + b) * ptr_linesize + x + r]; \
179  stype ntl = ptr[(y - nt) * ptr_linesize + x - nl]; \
180  stype ntr = ptr[(y - nt) * ptr_linesize + x + nr]; \
181  stype nbl = ptr[(y + nb) * ptr_linesize + x - nl]; \
182  stype nbr = ptr[(y + nb) * ptr_linesize + x + nr]; \
183  stype div = (l + r) * (t + b); \
184  stype ndiv = (nl + nr) * (nt + nb); \
185  stype p0 = (br + tl - bl - tr) / div; \
186  stype n0 = (nbr + ntl - nbl - ntr) / ndiv; \
187  \
188  if (bits == 32) \
189  dst[x] = lerpf(p0, n0, factor); \
190  else \
191  dst[x] = av_clip_uintp2_c(lrintf( \
192  lerpf(p0, n0, factor)), \
193  ddepth); \
194  } \
195  \
196  rptr += rptr_linesize; \
197  dst += dst_linesize; \
198  } \
199  \
200  return 0; \
201 }
202 
203 BLUR_PLANE(uint8_t, uint32_t, 8)
204 BLUR_PLANE(uint16_t, uint64_t, 16)
205 BLUR_PLANE(float, double, 32)
206 
207 static int blur_planes(AVFilterContext *ctx, void *arg,
208  int jobnr, int nb_jobs)
209 {
210  VarBlurContext *s = ctx->priv;
211  ThreadData *td = arg;
212  AVFrame *radius = td->radius;
213  AVFrame *out = td->out;
214  AVFrame *in = td->in;
215 
216  for (int plane = 0; plane < s->nb_planes; plane++) {
217  const int height = s->planeheight[plane];
218  const int slice_start = (height * jobnr) / nb_jobs;
219  const int slice_end = (height * (jobnr+1)) / nb_jobs;
220  const int width = s->planewidth[plane];
221  const int linesize = in->linesize[plane];
222  const int dst_linesize = out->linesize[plane];
223  const uint8_t *rptr = radius->data[plane];
224  const int rptr_linesize = radius->linesize[plane];
225  uint8_t *ptr = s->sat[plane];
226  const int ptr_linesize = s->sat_linesize[plane];
227  const uint8_t *src = in->data[plane];
228  uint8_t *dst = out->data[plane];
229 
230  if (!(s->planes & (1 << plane))) {
231  if (out != in)
232  av_image_copy_plane(dst + slice_start * dst_linesize,
233  dst_linesize,
234  src + slice_start * linesize,
235  linesize,
236  width * ((s->depth + 7) / 8),
238  continue;
239  }
240 
241  s->blur_plane(ctx, dst, dst_linesize,
242  rptr, rptr_linesize,
243  width, height,
244  ptr, ptr_linesize,
246  }
247 
248  return 0;
249 }
250 
251 static int blur_frame(AVFilterContext *ctx, AVFrame *in, AVFrame *radius)
252 {
253  VarBlurContext *s = ctx->priv;
254  AVFilterLink *outlink = ctx->outputs[0];
255  ThreadData td;
256  AVFrame *out;
257 
258  if (av_frame_is_writable(in)) {
259  out = in;
260  } else {
261  out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
262  if (!out) {
263  av_frame_free(&in);
264  return AVERROR(ENOMEM);
265  }
267  }
268 
269  for (int plane = 0; plane < s->nb_planes; plane++) {
270  const int height = s->planeheight[plane];
271  const int width = s->planewidth[plane];
272  const int linesize = in->linesize[plane];
273  uint8_t *ptr = s->sat[plane];
274  const int ptr_linesize = s->sat_linesize[plane];
275  const uint8_t *src = in->data[plane];
276 
277  if (!(s->planes & (1 << plane)))
278  continue;
279 
280  s->compute_sat(src, linesize, width, height, ptr, ptr_linesize);
281  }
282 
283  td.in = in;
284  td.out = out;
285  td.radius = radius;
287  FFMIN(s->planeheight[1], ff_filter_get_nb_threads(ctx)));
288 
289  if (out != in)
290  av_frame_free(&in);
291  return ff_filter_frame(outlink, out);
292 }
293 
295 {
296  VarBlurContext *s = ctx->priv;
297  return ff_framesync_activate(&s->fs);
298 }
299 
301 {
302  AVFilterContext *ctx = fs->parent;
303  VarBlurContext *s = ctx->priv;
304  AVFrame *in, *radius;
305  int ret;
306 
307  if (s->max_radius <= s->min_radius)
308  s->max_radius = s->min_radius + 1;
309 
310  ret = ff_framesync_dualinput_get(fs, &in, &radius);
311  if (ret < 0)
312  return ret;
313  if (!radius)
314  return ff_filter_frame(ctx->outputs[0], in);
315  return blur_frame(ctx, in, radius);
316 }
317 
318 static int config_output(AVFilterLink *outlink)
319 {
320  AVFilterContext *ctx = outlink->src;
321  AVFilterLink *inlink = ctx->inputs[0];
322  AVFilterLink *radiuslink = ctx->inputs[1];
324  FilterLink *ol = ff_filter_link(outlink);
325  VarBlurContext *s = ctx->priv;
327  int ret;
328 
329  if (inlink->w != radiuslink->w || inlink->h != radiuslink->h) {
330  av_log(ctx, AV_LOG_ERROR, "First input link %s parameters "
331  "(size %dx%d) do not match the corresponding "
332  "second input link %s parameters (size %dx%d)\n",
333  ctx->input_pads[0].name, inlink->w, inlink->h,
334  ctx->input_pads[1].name, radiuslink->w, radiuslink->h);
335  return AVERROR(EINVAL);
336  }
337 
338  outlink->w = inlink->w;
339  outlink->h = inlink->h;
340  outlink->time_base = inlink->time_base;
341  outlink->sample_aspect_ratio = inlink->sample_aspect_ratio;
342  ol->frame_rate = il->frame_rate;
343 
344  s->depth = desc->comp[0].depth;
345  s->blur_plane = s->depth <= 8 ? blur_plane8 : s->depth <= 16 ? blur_plane16 : blur_plane32;
346  s->compute_sat = s->depth <= 8 ? compute_sat8 : s->depth <= 16 ? compute_sat16 : compute_sat32;
347 
348  s->planewidth[1] = s->planewidth[2] = AV_CEIL_RSHIFT(outlink->w, desc->log2_chroma_w);
349  s->planewidth[0] = s->planewidth[3] = outlink->w;
350  s->planeheight[1] = s->planeheight[2] = AV_CEIL_RSHIFT(outlink->h, desc->log2_chroma_h);
351  s->planeheight[0] = s->planeheight[3] = outlink->h;
352 
353  s->nb_planes = av_pix_fmt_count_planes(outlink->format);
354 
355  for (int p = 0; p < s->nb_planes; p++) {
356  s->sat_linesize[p] = (outlink->w + 1) * (4 + 4 * (s->depth > 8));
357  s->sat[p] = av_calloc(s->sat_linesize[p], outlink->h + 1);
358  if (!s->sat[p])
359  return AVERROR(ENOMEM);
360  }
361 
362  s->fs.on_event = varblur_frame;
363  if ((ret = ff_framesync_init_dualinput(&s->fs, ctx)) < 0)
364  return ret;
365 
366  ret = ff_framesync_configure(&s->fs);
367  outlink->time_base = s->fs.time_base;
368 
369  return ret;
370 }
371 
373 {
374  VarBlurContext *s = ctx->priv;
375 
376  ff_framesync_uninit(&s->fs);
377  for (int p = 0; p < 4; p++)
378  av_freep(&s->sat[p]);
379 }
380 
381 static const AVFilterPad varblur_inputs[] = {
382  {
383  .name = "default",
384  .type = AVMEDIA_TYPE_VIDEO,
385  },
386  {
387  .name = "radius",
388  .type = AVMEDIA_TYPE_VIDEO,
389  },
390 };
391 
392 static const AVFilterPad varblur_outputs[] = {
393  {
394  .name = "default",
395  .type = AVMEDIA_TYPE_VIDEO,
396  .config_props = config_output,
397  },
398 };
399 
401  .name = "varblur",
402  .description = NULL_IF_CONFIG_SMALL("Apply Variable Blur filter."),
403  .priv_size = sizeof(VarBlurContext),
404  .priv_class = &varblur_class,
405  .activate = activate,
406  .preinit = varblur_framesync_preinit,
407  .uninit = uninit,
413  .process_command = ff_filter_process_command,
414 };
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
AV_PIX_FMT_YUVA422P16
#define AV_PIX_FMT_YUVA422P16
Definition: pixfmt.h:546
AV_PIX_FMT_GBRAP16
#define AV_PIX_FMT_GBRAP16
Definition: pixfmt.h:525
blur_planes
static int blur_planes(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: vf_varblur.c:207
ff_framesync_configure
int ff_framesync_configure(FFFrameSync *fs)
Configure a frame sync structure.
Definition: framesync.c:137
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
ThreadData::radius
AVFrame * radius
Definition: vf_varblur.c:130
FILTER_PIXFMTS_ARRAY
#define FILTER_PIXFMTS_ARRAY(array)
Definition: filters.h:242
ff_framesync_uninit
void ff_framesync_uninit(FFFrameSync *fs)
Free all memory currently allocated.
Definition: framesync.c:301
out
FILE * out
Definition: movenc.c:55
ff_filter_frame
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:1061
av_pix_fmt_desc_get
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:3170
config_output
static int config_output(AVFilterLink *outlink)
Definition: vf_varblur.c:318
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:162
AV_PIX_FMT_YUVA422P9
#define AV_PIX_FMT_YUVA422P9
Definition: pixfmt.h:538
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: filters.h:262
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:389
pixdesc.h
AV_PIX_FMT_YUVA420P16
#define AV_PIX_FMT_YUVA420P16
Definition: pixfmt.h:545
w
uint8_t w
Definition: llviddspenc.c:38
VarBlurContext::nb_planes
int nb_planes
Definition: vf_varblur.c:44
AV_PIX_FMT_YUVA420P10
#define AV_PIX_FMT_YUVA420P10
Definition: pixfmt.h:540
AVOption
AVOption.
Definition: opt.h:429
planes
static const struct @467 planes[]
AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:502
preinit
static av_cold int preinit(AVFilterContext *ctx)
Definition: af_aresample.c:48
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
AVFilter::name
const char * name
Filter name.
Definition: avfilter.h:205
FFFrameSync
Frame sync structure.
Definition: framesync.h:168
ThreadData::out
AVFrame * out
Definition: af_adeclick.c:526
video.h
ThreadData::in
AVFrame * in
Definition: af_adecorrelate.c:155
AV_PIX_FMT_YUVA422P10
#define AV_PIX_FMT_YUVA422P10
Definition: pixfmt.h:541
AV_PIX_FMT_GRAY9
#define AV_PIX_FMT_GRAY9
Definition: pixfmt.h:482
BLUR_PLANE
#define BLUR_PLANE(type, stype, bits)
Definition: vf_varblur.c:138
AVFrame::data
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:410
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
varblur_inputs
static const AVFilterPad varblur_inputs[]
Definition: vf_varblur.c:381
av_pix_fmt_count_planes
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:3210
AV_PIX_FMT_YUVA420P9
#define AV_PIX_FMT_YUVA420P9
Definition: pixfmt.h:537
VarBlurContext::planewidth
int planewidth[4]
Definition: vf_varblur.c:39
AV_PIX_FMT_GBRP14
#define AV_PIX_FMT_GBRP14
Definition: pixfmt.h:520
slice_end
static int slice_end(AVCodecContext *avctx, AVFrame *pict, int *got_output)
Handle slice ends.
Definition: mpeg12dec.c:1720
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:518
AV_PIX_FMT_YUVA444P16
#define AV_PIX_FMT_YUVA444P16
Definition: pixfmt.h:547
AV_PIX_FMT_YUV422P9
#define AV_PIX_FMT_YUV422P9
Definition: pixfmt.h:500
lerpf
static float lerpf(float v0, float v1, float f)
Definition: vf_varblur.c:133
AV_PIX_FMT_GRAY16
#define AV_PIX_FMT_GRAY16
Definition: pixfmt.h:486
AVFilterPad
A filter pad used for either input or output.
Definition: filters.h:38
varblur_frame
static int varblur_frame(FFFrameSync *fs)
Definition: vf_varblur.c:300
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
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:209
VarBlurContext::compute_sat
void(* compute_sat)(const uint8_t *ssrc, int linesize, int w, int h, uint8_t *dstp, int dst_linesize)
Definition: vf_varblur.c:46
av_cold
#define av_cold
Definition: attributes.h:90
AV_PIX_FMT_YUV422P16
#define AV_PIX_FMT_YUV422P16
Definition: pixfmt.h:514
VarBlurContext::fs
FFFrameSync fs
Definition: vf_varblur.c:32
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
s
#define s(width, name)
Definition: cbs_vp9.c:198
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_PIX_FMT_YUV444P16
#define AV_PIX_FMT_YUV444P16
Definition: pixfmt.h:515
AV_CEIL_RSHIFT
#define AV_CEIL_RSHIFT(a, b)
Definition: common.h:60
VarBlurContext::depth
int depth
Definition: vf_varblur.c:38
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
ff_vf_varblur
const AVFilter ff_vf_varblur
Definition: vf_varblur.c:400
FLAGS
#define FLAGS
Definition: vf_varblur.c:64
AV_PIX_FMT_YUV420P16
#define AV_PIX_FMT_YUV420P16
Definition: pixfmt.h:513
ctx
AVFormatContext * ctx
Definition: movenc.c:49
AV_PIX_FMT_GRAY14
#define AV_PIX_FMT_GRAY14
Definition: pixfmt.h:485
VarBlurContext::planeheight
int planeheight[4]
Definition: vf_varblur.c:40
VarBlurContext
Definition: vf_varblur.c:30
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
arg
const char * arg
Definition: jacosubdec.c:67
AV_PIX_FMT_GRAY10
#define AV_PIX_FMT_GRAY10
Definition: pixfmt.h:483
AV_PIX_FMT_GBRP16
#define AV_PIX_FMT_GBRP16
Definition: pixfmt.h:521
VarBlurContext::planes
int planes
Definition: vf_varblur.c:36
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:75
COMPUTE_SAT
#define COMPUTE_SAT(type, stype, depth)
Definition: vf_varblur.c:98
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
fs
#define fs(width, name, subs,...)
Definition: cbs_vp9.c:200
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
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_varblur.c:372
varblur_options
static const AVOption varblur_options[]
Definition: vf_varblur.c:66
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
ff_filter_link
static FilterLink * ff_filter_link(AVFilterLink *link)
Definition: filters.h:197
VarBlurContext::max_radius
int max_radius
Definition: vf_varblur.c:35
f
f
Definition: af_crystalizer.c:122
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
ff_framesync_init_dualinput
int ff_framesync_init_dualinput(FFFrameSync *fs, AVFilterContext *parent)
Initialize a frame sync structure for dualinput.
Definition: framesync.c:372
height
#define height
Definition: dsp.h:85
dst
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition: dsp.h:83
AV_PIX_FMT_GBRPF32
#define AV_PIX_FMT_GBRPF32
Definition: pixfmt.h:532
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
av_frame_is_writable
int av_frame_is_writable(AVFrame *frame)
Check if the frame data is writable.
Definition: frame.c:661
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:900
VarBlurContext::min_radius
int min_radius
Definition: vf_varblur.c:34
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
blur_frame
static int blur_frame(AVFilterContext *ctx, AVFrame *in, AVFrame *radius)
Definition: vf_varblur.c:251
FRAMESYNC_DEFINE_CLASS
FRAMESYNC_DEFINE_CLASS(varblur, VarBlurContext, fs)
AV_PIX_FMT_GBRP12
#define AV_PIX_FMT_GBRP12
Definition: pixfmt.h:519
ff_filter_get_nb_threads
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
Definition: avfilter.c:840
ThreadData
Used for passing data between threads.
Definition: dsddec.c:71
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: filters.h:44
activate
static int activate(AVFilterContext *ctx)
Definition: vf_varblur.c:294
av_calloc
void * av_calloc(size_t nmemb, size_t size)
Definition: mem.c:264
AV_PIX_FMT_YUV444P9
#define AV_PIX_FMT_YUV444P9
Definition: pixfmt.h:501
slice_start
static int slice_start(SliceContext *sc, VVCContext *s, VVCFrameContext *fc, const CodedBitstreamUnit *unit, const int is_first_slice)
Definition: dec.c:736
VarBlurContext::sat
uint8_t * sat[4]
Definition: vf_varblur.c:42
AVFilter
Filter definition.
Definition: avfilter.h:201
ret
ret
Definition: filter_design.txt:187
AV_PIX_FMT_YUVA444P9
#define AV_PIX_FMT_YUVA444P9
Definition: pixfmt.h:539
VarBlurContext::blur_plane
int(* blur_plane)(AVFilterContext *ctx, uint8_t *ddst, int ddst_linesize, const uint8_t *rrptr, int rrptr_linesize, int w, int h, const uint8_t *pptr, int pptr_linesize, int slice_start, int slice_end)
Definition: vf_varblur.c:52
AV_PIX_FMT_YUV420P12
#define AV_PIX_FMT_YUV420P12
Definition: pixfmt.h:506
AV_PIX_FMT_YUV422P14
#define AV_PIX_FMT_YUV422P14
Definition: pixfmt.h:511
framesync.h
ff_filter_execute
int ff_filter_execute(AVFilterContext *ctx, avfilter_action_func *func, void *arg, int *ret, int nb_jobs)
Definition: avfilter.c:1666
VarBlurContext::sat_linesize
int sat_linesize[4]
Definition: vf_varblur.c:43
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
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
avfilter.h
AV_PIX_FMT_GBRAPF32
#define AV_PIX_FMT_GBRAPF32
Definition: pixfmt.h:533
varblur_outputs
static const AVFilterPad varblur_outputs[]
Definition: vf_varblur.c:392
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
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:152
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
mem.h
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_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
AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL
#define AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL
Same as AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, except that the filter will have its filter_frame() c...
Definition: avfilter.h:190
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
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_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
AV_PIX_FMT_YUV440P12
#define AV_PIX_FMT_YUV440P12
Definition: pixfmt.h:508
h
h
Definition: vp9dsp_template.c:2070
pix_fmts
static enum AVPixelFormat pix_fmts[]
Definition: vf_varblur.c:75
AV_PIX_FMT_YUV444P14
#define AV_PIX_FMT_YUV444P14
Definition: pixfmt.h:512
ff_framesync_activate
int ff_framesync_activate(FFFrameSync *fs)
Examine the frames in the filter's input and try to produce output.
Definition: framesync.c:352
ff_framesync_dualinput_get
int ff_framesync_dualinput_get(FFFrameSync *fs, AVFrame **f0, AVFrame **f1)
Definition: framesync.c:390
width
#define width
Definition: dsp.h:85
AV_PIX_FMT_GRAY12
#define AV_PIX_FMT_GRAY12
Definition: pixfmt.h:484
OFFSET
#define OFFSET(x)
Definition: vf_varblur.c:63
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
AV_PIX_FMT_YUV420P14
#define AV_PIX_FMT_YUV420P14
Definition: pixfmt.h:510