FFmpeg
vf_gblur.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011 Pascal Getreuer
3  * Copyright (c) 2016 Paul B Mahol
4  *
5  * Redistribution and use in source and binary forms, with or without modification,
6  * are permitted provided that the following conditions are met:
7  *
8  * * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above
11  * copyright notice, this list of conditions and the following
12  * disclaimer in the documentation and/or other materials provided
13  * with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19  * HOLDER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
22  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
23  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 
28 #include <float.h>
29 
30 #include "libavutil/imgutils.h"
31 #include "libavutil/opt.h"
32 #include "libavutil/pixdesc.h"
33 #include "avfilter.h"
34 #include "gblur.h"
35 #include "internal.h"
36 #include "vf_gblur_init.h"
37 #include "video.h"
38 
39 #define OFFSET(x) offsetof(GBlurContext, x)
40 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
41 
42 static const AVOption gblur_options[] = {
43  { "sigma", "set sigma", OFFSET(sigma), AV_OPT_TYPE_FLOAT, {.dbl=0.5}, 0.0, 1024, FLAGS },
44  { "steps", "set number of steps", OFFSET(steps), AV_OPT_TYPE_INT, {.i64=1}, 1, 6, FLAGS },
45  { "planes", "set planes to filter", OFFSET(planes), AV_OPT_TYPE_INT, {.i64=0xF}, 0, 0xF, FLAGS },
46  { "sigmaV", "set vertical sigma", OFFSET(sigmaV), AV_OPT_TYPE_FLOAT, {.dbl=-1}, -1, 1024, FLAGS },
47  { NULL }
48 };
49 
51 
52 typedef struct ThreadData {
53  int height;
54  int width;
55 } ThreadData;
56 
57 static int filter_horizontally(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
58 {
59  GBlurContext *s = ctx->priv;
60  ThreadData *td = arg;
61  const int height = td->height;
62  const int width = td->width;
63  const int slice_start = (height * jobnr ) / nb_jobs;
64  const int slice_end = (height * (jobnr+1)) / nb_jobs;
65  const float boundaryscale = s->boundaryscale;
66  const int steps = s->steps;
67  const float nu = s->nu;
68  float *buffer = s->buffer;
69  float *localbuf = NULL;
70 
71  if (s->localbuf)
72  localbuf = s->localbuf + s->stride * width * slice_start;
73 
74  s->horiz_slice(buffer + width * slice_start, width, slice_end - slice_start,
75  steps, nu, boundaryscale, localbuf);
76  return 0;
77 }
78 
79 static int filter_vertically(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
80 {
81  GBlurContext *s = ctx->priv;
82  ThreadData *td = arg;
83  const int height = td->height;
84  const int width = td->width;
85  const int slice_start = (width * jobnr ) / nb_jobs;
86  const int slice_end = (width * (jobnr+1)) / nb_jobs;
87  const float boundaryscale = s->boundaryscaleV;
88  const int steps = s->steps;
89  const float nu = s->nuV;
90  float *buffer = s->buffer;
91 
92  s->verti_slice(buffer, width, height, slice_start, slice_end,
93  steps, nu, boundaryscale);
94 
95  return 0;
96 }
97 
98 static int filter_postscale(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
99 {
100  GBlurContext *s = ctx->priv;
101  ThreadData *td = arg;
102  const float max = s->flt ? FLT_MAX : (1 << s->depth) - 1;
103  const float min = s->flt ? -FLT_MAX : 0.f;
104  const int height = td->height;
105  const int width = td->width;
106  const int awidth = FFALIGN(width, 64);
107  const int slice_start = (height * jobnr ) / nb_jobs;
108  const int slice_end = (height * (jobnr+1)) / nb_jobs;
109  const float postscale = s->postscale * s->postscaleV;
110  const int slice_size = slice_end - slice_start;
111 
112  s->postscale_slice(s->buffer + slice_start * awidth,
113  slice_size * awidth, postscale, min, max);
114 
115  return 0;
116 }
117 
118 static void gaussianiir2d(AVFilterContext *ctx, int plane)
119 {
120  GBlurContext *s = ctx->priv;
121  const int width = s->planewidth[plane];
122  const int height = s->planeheight[plane];
123  const int nb_threads = ff_filter_get_nb_threads(ctx);
124  ThreadData td;
125 
126  if (s->sigma < 0 || s->steps < 0)
127  return;
128 
129  td.width = width;
130  td.height = height;
132  NULL, FFMIN(height, nb_threads));
134  NULL, FFMIN(width, nb_threads));
136  NULL, FFMIN(width * height, nb_threads));
137 }
138 
139 static const enum AVPixelFormat pix_fmts[] = {
161 };
162 
164 {
165  GBlurContext *s = ctx->priv;
166 
167  av_freep(&s->buffer);
168  av_freep(&s->localbuf);
169 }
170 
172 {
174  GBlurContext *s = inlink->dst->priv;
175 
176  uninit(inlink->dst);
177 
178  s->depth = desc->comp[0].depth;
179  s->flt = !!(desc->flags & AV_PIX_FMT_FLAG_FLOAT);
180  s->planewidth[1] = s->planewidth[2] = AV_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w);
181  s->planewidth[0] = s->planewidth[3] = inlink->w;
182  s->planeheight[1] = s->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
183  s->planeheight[0] = s->planeheight[3] = inlink->h;
184 
185  s->nb_planes = av_pix_fmt_count_planes(inlink->format);
186 
187  s->buffer = av_malloc_array(FFALIGN(inlink->w, 64), FFALIGN(inlink->h, 64) * sizeof(*s->buffer));
188  if (!s->buffer)
189  return AVERROR(ENOMEM);
190 
191  if (s->sigmaV < 0) {
192  s->sigmaV = s->sigma;
193  }
194  ff_gblur_init(s);
195 
196  return 0;
197 }
198 
199 static void set_params(float sigma, int steps, float *postscale, float *boundaryscale, float *nu)
200 {
201  double dnu, lambda;
202 
203  lambda = (sigma * sigma) / (2.0 * steps);
204  dnu = (1.0 + 2.0 * lambda - sqrt(1.0 + 4.0 * lambda)) / (2.0 * lambda);
205  *postscale = pow(dnu / lambda, steps);
206  *boundaryscale = 1.0 / (1.0 - dnu);
207  *nu = (float)dnu;
208  if (!isnormal(*postscale))
209  *postscale = 1.f;
210  if (!isnormal(*boundaryscale))
211  *boundaryscale = 1.f;
212  if (!isnormal(*nu))
213  *nu = 0.f;
214 }
215 
217 {
218  AVFilterContext *ctx = inlink->dst;
219  GBlurContext *s = ctx->priv;
220  AVFilterLink *outlink = ctx->outputs[0];
221  AVFrame *out;
222  int plane;
223 
224  set_params(s->sigma, s->steps, &s->postscale, &s->boundaryscale, &s->nu);
225  set_params(s->sigmaV, s->steps, &s->postscaleV, &s->boundaryscaleV, &s->nuV);
226 
227  if (av_frame_is_writable(in)) {
228  out = in;
229  } else {
230  out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
231  if (!out) {
232  av_frame_free(&in);
233  return AVERROR(ENOMEM);
234  }
236  }
237 
238  for (plane = 0; plane < s->nb_planes; plane++) {
239  const int height = s->planeheight[plane];
240  const int width = s->planewidth[plane];
241  float *bptr = s->buffer;
242  const uint8_t *src = in->data[plane];
243  const uint16_t *src16 = (const uint16_t *)in->data[plane];
244  uint8_t *dst = out->data[plane];
245  uint16_t *dst16 = (uint16_t *)out->data[plane];
246  int y, x;
247 
248  if (!(s->planes & (1 << plane))) {
249  if (out != in)
250  av_image_copy_plane(out->data[plane], out->linesize[plane],
251  in->data[plane], in->linesize[plane],
252  width * ((s->depth + 7) / 8), height);
253  continue;
254  }
255 
256  if (s->flt) {
257  av_image_copy_plane((uint8_t *)bptr, width * sizeof(float),
258  in->data[plane], in->linesize[plane],
259  width * sizeof(float), height);
260  } else if (s->depth == 8) {
261  for (y = 0; y < height; y++) {
262  for (x = 0; x < width; x++) {
263  bptr[x] = src[x];
264  }
265  bptr += width;
266  src += in->linesize[plane];
267  }
268  } else {
269  for (y = 0; y < height; y++) {
270  for (x = 0; x < width; x++) {
271  bptr[x] = src16[x];
272  }
273  bptr += width;
274  src16 += in->linesize[plane] / 2;
275  }
276  }
277 
278  gaussianiir2d(ctx, plane);
279 
280  bptr = s->buffer;
281  if (s->flt) {
282  av_image_copy_plane(out->data[plane], out->linesize[plane],
283  (uint8_t *)bptr, width * sizeof(float),
284  width * sizeof(float), height);
285  } else if (s->depth == 8) {
286  for (y = 0; y < height; y++) {
287  for (x = 0; x < width; x++)
288  dst[x] = lrintf(bptr[x]);
289  bptr += width;
290  dst += out->linesize[plane];
291  }
292  } else {
293  for (y = 0; y < height; y++) {
294  for (x = 0; x < width; x++)
295  dst16[x] = lrintf(bptr[x]);
296  bptr += width;
297  dst16 += out->linesize[plane] / 2;
298  }
299  }
300  }
301 
302  if (out != in)
303  av_frame_free(&in);
304  return ff_filter_frame(outlink, out);
305 }
306 
307 static const AVFilterPad gblur_inputs[] = {
308  {
309  .name = "default",
310  .type = AVMEDIA_TYPE_VIDEO,
311  .config_props = config_input,
312  .filter_frame = filter_frame,
313  },
314 };
315 
317  .name = "gblur",
318  .description = NULL_IF_CONFIG_SMALL("Apply Gaussian Blur filter."),
319  .priv_size = sizeof(GBlurContext),
320  .priv_class = &gblur_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: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
planes
static const struct @385 planes[]
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
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
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_PIX_FMT_FLAG_FLOAT
#define AV_PIX_FMT_FLAG_FLOAT
The pixel format contains IEEE-754 floating point values.
Definition: pixdesc.h:158
av_frame_free
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:160
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:375
pixdesc.h
AV_PIX_FMT_YUVA420P16
#define AV_PIX_FMT_YUVA420P16
Definition: pixfmt.h:521
AV_PIX_FMT_YUVA420P10
#define AV_PIX_FMT_YUVA420P10
Definition: pixfmt.h:516
AVOption
AVOption.
Definition: opt.h:346
AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:478
filter_horizontally
static int filter_horizontally(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: vf_gblur.c:57
float.h
filter_vertically
static int filter_vertically(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: vf_gblur.c:79
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
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:396
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
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
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_gblur.c:163
AV_PIX_FMT_YUV422P9
#define AV_PIX_FMT_YUV422P9
Definition: pixfmt.h:476
AV_PIX_FMT_GRAY16
#define AV_PIX_FMT_GRAY16
Definition: pixfmt.h:462
OFFSET
#define OFFSET(x)
Definition: vf_gblur.c:39
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
slice_start
static int slice_start(SliceContext *sc, VVCContext *s, VVCFrameContext *fc, const CodedBitstreamUnit *unit, const int is_first_slice)
Definition: vvcdec.c:685
gblur_inputs
static const AVFilterPad gblur_inputs[]
Definition: vf_gblur.c:307
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
gblur.h
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
float
float
Definition: af_crystalizer.c:121
width
#define width
filter_postscale
static int filter_postscale(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: vf_gblur.c:98
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
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
slice_end
static int slice_end(AVCodecContext *avctx, AVFrame *pict)
Handle slice ends.
Definition: mpeg12dec.c:1725
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
AV_PIX_FMT_GRAYF32
#define AV_PIX_FMT_GRAYF32
Definition: pixfmt.h:511
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
NULL
#define NULL
Definition: coverity.c:32
FLAGS
#define FLAGS
Definition: vf_gblur.c:40
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:709
config_input
static int config_input(AVFilterLink *inlink)
Definition: vf_gblur.c:171
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
vf_gblur_init.h
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
postscale
static const FLOAT postscale[64]
Definition: faandct.c:55
f
f
Definition: af_crystalizer.c:121
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
AV_PIX_FMT_GBRPF32
#define AV_PIX_FMT_GBRPF32
Definition: pixfmt.h:508
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
av_frame_is_writable
int av_frame_is_writable(AVFrame *frame)
Check if the frame data is writable.
Definition: frame.c:645
gblur_options
static const AVOption gblur_options[]
Definition: vf_gblur.c:42
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
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
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Definition: opt.h:238
lrintf
#define lrintf(x)
Definition: libm_mips.h:72
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_gblur.c:216
av_malloc_array
#define av_malloc_array(a, b)
Definition: tableprint_vlc.h:31
AV_PIX_FMT_GBRP12
#define AV_PIX_FMT_GBRP12
Definition: pixfmt.h:495
ff_filter_get_nb_threads
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
Definition: avfilter.c:825
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_PIX_FMT_YUV444P9
#define AV_PIX_FMT_YUV444P9
Definition: pixfmt.h:477
AVFilter
Filter definition.
Definition: avfilter.h:166
AVFILTER_DEFINE_CLASS
AVFILTER_DEFINE_CLASS(gblur)
ff_gblur_init
static av_unused void ff_gblur_init(GBlurContext *s)
Definition: vf_gblur_init.h:112
AV_PIX_FMT_YUVA444P9
#define AV_PIX_FMT_YUVA444P9
Definition: pixfmt.h:515
set_params
static void set_params(float sigma, int steps, float *postscale, float *boundaryscale, float *nu)
Definition: vf_gblur.c:199
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
ff_vf_gblur
const AVFilter ff_vf_gblur
Definition: vf_gblur.c:316
steps
static const int16_t steps[16]
Definition: misc4.c:30
buffer
the frame and frame reference mechanism is intended to as much as expensive copies of that data while still allowing the filters to produce correct results The data is stored in buffers represented by AVFrame structures Several references can point to the same frame buffer
Definition: filter_design.txt:49
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
AV_PIX_FMT_GBRAPF32
#define AV_PIX_FMT_GBRAPF32
Definition: pixfmt.h:509
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:407
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:117
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
gaussianiir2d
static void gaussianiir2d(AVFilterContext *ctx, int plane)
Definition: vf_gblur.c:118
FFALIGN
#define FFALIGN(x, a)
Definition: macros.h:78
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:183
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:34
GBlurContext
Definition: gblur.h:32
src
INIT_CLIP pixel * src
Definition: h264pred_template.c:418
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
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:420
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
pix_fmts
static enum AVPixelFormat pix_fmts[]
Definition: vf_gblur.c:139
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
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:134
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
min
float min
Definition: vorbis_enc_data.h:429