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 "libavutil/imgutils.h"
29 #include "libavutil/opt.h"
30 #include "libavutil/pixdesc.h"
31 #include "avfilter.h"
32 #include "formats.h"
33 #include "gblur.h"
34 #include "internal.h"
35 #include "video.h"
36 
37 #define OFFSET(x) offsetof(GBlurContext, x)
38 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
39 
40 static const AVOption gblur_options[] = {
41  { "sigma", "set sigma", OFFSET(sigma), AV_OPT_TYPE_FLOAT, {.dbl=0.5}, 0.0, 1024, FLAGS },
42  { "steps", "set number of steps", OFFSET(steps), AV_OPT_TYPE_INT, {.i64=1}, 1, 6, FLAGS },
43  { "planes", "set planes to filter", OFFSET(planes), AV_OPT_TYPE_INT, {.i64=0xF}, 0, 0xF, FLAGS },
44  { "sigmaV", "set vertical sigma", OFFSET(sigmaV), AV_OPT_TYPE_FLOAT, {.dbl=-1}, -1, 1024, FLAGS },
45  { NULL }
46 };
47 
49 
50 typedef struct ThreadData {
51  int height;
52  int width;
53 } ThreadData;
54 
55 static void horiz_slice_c(float *buffer, int width, int height, int steps,
56  float nu, float bscale)
57 {
58  int step, x, y;
59  float *ptr;
60  for (y = 0; y < height; y++) {
61  for (step = 0; step < steps; step++) {
62  ptr = buffer + width * y;
63  ptr[0] *= bscale;
64 
65  /* Filter rightwards */
66  for (x = 1; x < width; x++)
67  ptr[x] += nu * ptr[x - 1];
68  ptr[x = width - 1] *= bscale;
69 
70  /* Filter leftwards */
71  for (; x > 0; x--)
72  ptr[x - 1] += nu * ptr[x];
73  }
74  }
75 }
76 
77 static int filter_horizontally(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
78 {
79  GBlurContext *s = ctx->priv;
80  ThreadData *td = arg;
81  const int height = td->height;
82  const int width = td->width;
83  const int slice_start = (height * jobnr ) / nb_jobs;
84  const int slice_end = (height * (jobnr+1)) / nb_jobs;
85  const float boundaryscale = s->boundaryscale;
86  const int steps = s->steps;
87  const float nu = s->nu;
88  float *buffer = s->buffer;
89 
90  s->horiz_slice(buffer + width * slice_start, width, slice_end - slice_start,
91  steps, nu, boundaryscale);
92  emms_c();
93  return 0;
94 }
95 
96 static void do_vertical_columns(float *buffer, int width, int height,
97  int column_begin, int column_end, int steps,
98  float nu, float boundaryscale, int column_step)
99 {
100  const int numpixels = width * height;
101  int i, x, k, step;
102  float *ptr;
103  for (x = column_begin; x < column_end;) {
104  for (step = 0; step < steps; step++) {
105  ptr = buffer + x;
106  for (k = 0; k < column_step; k++) {
107  ptr[k] *= boundaryscale;
108  }
109  /* Filter downwards */
110  for (i = width; i < numpixels; i += width) {
111  for (k = 0; k < column_step; k++) {
112  ptr[i + k] += nu * ptr[i - width + k];
113  }
114  }
115  i = numpixels - width;
116 
117  for (k = 0; k < column_step; k++)
118  ptr[i + k] *= boundaryscale;
119 
120  /* Filter upwards */
121  for (; i > 0; i -= width) {
122  for (k = 0; k < column_step; k++)
123  ptr[i - width + k] += nu * ptr[i + k];
124  }
125  }
126  x += column_step;
127  }
128 }
129 
130 static int filter_vertically(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
131 {
132  GBlurContext *s = ctx->priv;
133  ThreadData *td = arg;
134  const int height = td->height;
135  const int width = td->width;
136  const int slice_start = (width * jobnr ) / nb_jobs;
137  const int slice_end = (width * (jobnr+1)) / nb_jobs;
138  const float boundaryscale = s->boundaryscaleV;
139  const int steps = s->steps;
140  const float nu = s->nuV;
141  float *buffer = s->buffer;
142  int aligned_end;
143 
144  aligned_end = slice_start + (((slice_end - slice_start) >> 3) << 3);
145  /* Filter vertically along columns (process 8 columns in each step) */
146  do_vertical_columns(buffer, width, height, slice_start, aligned_end,
147  steps, nu, boundaryscale, 8);
148 
149  /* Filter un-aligned columns one by one */
150  do_vertical_columns(buffer, width, height, aligned_end, slice_end,
151  steps, nu, boundaryscale, 1);
152  return 0;
153 }
154 
155 
156 static int filter_postscale(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
157 {
158  GBlurContext *s = ctx->priv;
159  ThreadData *td = arg;
160  const float max = (1 << s->depth) - 1;
161  const int height = td->height;
162  const int width = td->width;
163  const int64_t numpixels = width * (int64_t)height;
164  const unsigned slice_start = (numpixels * jobnr ) / nb_jobs;
165  const unsigned slice_end = (numpixels * (jobnr+1)) / nb_jobs;
166  const float postscale = s->postscale * s->postscaleV;
167  float *buffer = s->buffer;
168  unsigned i;
169 
170  for (i = slice_start; i < slice_end; i++) {
171  buffer[i] *= postscale;
172  buffer[i] = av_clipf(buffer[i], 0.f, max);
173  }
174 
175  return 0;
176 }
177 
179 {
180  GBlurContext *s = ctx->priv;
181  const int width = s->planewidth[plane];
182  const int height = s->planeheight[plane];
183  const int nb_threads = ff_filter_get_nb_threads(ctx);
184  ThreadData td;
185 
186  if (s->sigma <= 0 || s->steps < 0)
187  return;
188 
189  td.width = width;
190  td.height = height;
191  ctx->internal->execute(ctx, filter_horizontally, &td, NULL, FFMIN(height, nb_threads));
192  ctx->internal->execute(ctx, filter_vertically, &td, NULL, FFMIN(width, nb_threads));
193  ctx->internal->execute(ctx, filter_postscale, &td, NULL, FFMIN(width * height, nb_threads));
194 }
195 
197 {
198  static const enum AVPixelFormat pix_fmts[] = {
218  };
219 
220  return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
221 }
222 
224 {
226  if (ARCH_X86_64)
228 }
229 
231 {
233  GBlurContext *s = inlink->dst->priv;
234 
235  s->depth = desc->comp[0].depth;
236  s->planewidth[1] = s->planewidth[2] = AV_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w);
237  s->planewidth[0] = s->planewidth[3] = inlink->w;
238  s->planeheight[1] = s->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
239  s->planeheight[0] = s->planeheight[3] = inlink->h;
240 
242 
243  s->buffer = av_malloc_array(FFALIGN(inlink->w, 16), FFALIGN(inlink->h, 16) * sizeof(*s->buffer));
244  if (!s->buffer)
245  return AVERROR(ENOMEM);
246 
247  if (s->sigmaV < 0) {
248  s->sigmaV = s->sigma;
249  }
250  ff_gblur_init(s);
251 
252  return 0;
253 }
254 
255 static void set_params(float sigma, int steps, float *postscale, float *boundaryscale, float *nu)
256 {
257  double dnu, lambda;
258 
259  lambda = (sigma * sigma) / (2.0 * steps);
260  dnu = (1.0 + 2.0 * lambda - sqrt(1.0 + 4.0 * lambda)) / (2.0 * lambda);
261  *postscale = pow(dnu / lambda, steps);
262  *boundaryscale = 1.0 / (1.0 - dnu);
263  *nu = (float)dnu;
264 }
265 
267 {
268  AVFilterContext *ctx = inlink->dst;
269  GBlurContext *s = ctx->priv;
270  AVFilterLink *outlink = ctx->outputs[0];
271  AVFrame *out;
272  int plane;
273 
274  set_params(s->sigma, s->steps, &s->postscale, &s->boundaryscale, &s->nu);
275  set_params(s->sigmaV, s->steps, &s->postscaleV, &s->boundaryscaleV, &s->nuV);
276 
277  if (av_frame_is_writable(in)) {
278  out = in;
279  } else {
280  out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
281  if (!out) {
282  av_frame_free(&in);
283  return AVERROR(ENOMEM);
284  }
285  av_frame_copy_props(out, in);
286  }
287 
288  for (plane = 0; plane < s->nb_planes; plane++) {
289  const int height = s->planeheight[plane];
290  const int width = s->planewidth[plane];
291  float *bptr = s->buffer;
292  const uint8_t *src = in->data[plane];
293  const uint16_t *src16 = (const uint16_t *)in->data[plane];
294  uint8_t *dst = out->data[plane];
295  uint16_t *dst16 = (uint16_t *)out->data[plane];
296  int y, x;
297 
298  if (!s->sigma || !(s->planes & (1 << plane))) {
299  if (out != in)
300  av_image_copy_plane(out->data[plane], out->linesize[plane],
301  in->data[plane], in->linesize[plane],
302  width * ((s->depth + 7) / 8), height);
303  continue;
304  }
305 
306  if (s->depth == 8) {
307  for (y = 0; y < height; y++) {
308  for (x = 0; x < width; x++) {
309  bptr[x] = src[x];
310  }
311  bptr += width;
312  src += in->linesize[plane];
313  }
314  } else {
315  for (y = 0; y < height; y++) {
316  for (x = 0; x < width; x++) {
317  bptr[x] = src16[x];
318  }
319  bptr += width;
320  src16 += in->linesize[plane] / 2;
321  }
322  }
323 
324  gaussianiir2d(ctx, plane);
325 
326  bptr = s->buffer;
327  if (s->depth == 8) {
328  for (y = 0; y < height; y++) {
329  for (x = 0; x < width; x++) {
330  dst[x] = bptr[x];
331  }
332  bptr += width;
333  dst += out->linesize[plane];
334  }
335  } else {
336  for (y = 0; y < height; y++) {
337  for (x = 0; x < width; x++) {
338  dst16[x] = bptr[x];
339  }
340  bptr += width;
341  dst16 += out->linesize[plane] / 2;
342  }
343  }
344  }
345 
346  if (out != in)
347  av_frame_free(&in);
348  return ff_filter_frame(outlink, out);
349 }
350 
352 {
353  GBlurContext *s = ctx->priv;
354 
355  av_freep(&s->buffer);
356 }
357 
358 static const AVFilterPad gblur_inputs[] = {
359  {
360  .name = "default",
361  .type = AVMEDIA_TYPE_VIDEO,
362  .config_props = config_input,
363  .filter_frame = filter_frame,
364  },
365  { NULL }
366 };
367 
368 static const AVFilterPad gblur_outputs[] = {
369  {
370  .name = "default",
371  .type = AVMEDIA_TYPE_VIDEO,
372  },
373  { NULL }
374 };
375 
377  .name = "gblur",
378  .description = NULL_IF_CONFIG_SMALL("Apply Gaussian Blur filter."),
379  .priv_size = sizeof(GBlurContext),
380  .priv_class = &gblur_class,
381  .uninit = uninit,
383  .inputs = gblur_inputs,
384  .outputs = gblur_outputs,
387 };
float nu
Definition: gblur.h:48
float boundaryscale
Definition: gblur.h:44
#define NULL
Definition: coverity.c:32
static const AVFilterPad gblur_inputs[]
Definition: vf_gblur.c:358
#define AV_PIX_FMT_YUVA422P16
Definition: pixfmt.h:430
AVFrame * out
Definition: af_adeclick.c:488
static int filter_horizontally(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: vf_gblur.c:77
#define AV_PIX_FMT_YUVA422P9
Definition: pixfmt.h:422
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2522
static int filter_vertically(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: vf_gblur.c:130
This structure describes decoded (raw) audio or video data.
Definition: frame.h:295
AVOption.
Definition: opt.h:246
#define AV_PIX_FMT_YUVA420P10
Definition: pixfmt.h:424
float nuV
Definition: gblur.h:49
#define AV_PIX_FMT_YUV444P14
Definition: pixfmt.h:397
#define AV_PIX_FMT_GBRAP10
Definition: pixfmt.h:407
#define AV_PIX_FMT_YUVA422P10
Definition: pixfmt.h:425
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:71
misc image utilities
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2562
Main libavfilter public API header.
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_gblur.c:266
planar GBR 4:4:4 24bpp
Definition: pixfmt.h:168
#define AV_PIX_FMT_GBRP10
Definition: pixfmt.h:403
#define AV_PIX_FMT_GRAY9
Definition: pixfmt.h:367
#define AV_PIX_FMT_YUV420P12
Definition: pixfmt.h:391
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
Definition: video.c:99
static int config_input(AVFilterLink *inlink)
Definition: vf_gblur.c:230
static void do_vertical_columns(float *buffer, int width, int height, int column_begin, int column_end, int steps, float nu, float boundaryscale, int column_step)
Definition: vf_gblur.c:96
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
Definition: pixdesc.h:92
int planeheight[4]
Definition: gblur.h:42
AVFilterFormats * ff_make_format_list(const int *fmts)
Create a list of supported formats.
Definition: formats.c:283
#define AV_PIX_FMT_GRAY10
Definition: pixfmt.h:368
int planewidth[4]
Definition: gblur.h:41
#define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
Some filters support a generic "enable" expression option that can be used to enable or disable a fil...
Definition: avfilter.h:125
const char * name
Pad name.
Definition: internal.h:60
#define AV_PIX_FMT_GRAY12
Definition: pixfmt.h:369
float sigma
Definition: gblur.h:35
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:1093
#define FLAGS
Definition: vf_gblur.c:38
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
Definition: pixfmt.h:101
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
Definition: pixdesc.h:117
uint8_t
#define av_cold
Definition: attributes.h:82
AVOptions.
void ff_gblur_init_x86(GBlurContext *s)
Definition: vf_gblur_init.c:30
#define f(width, name)
Definition: cbs_vp9.c:255
float boundaryscaleV
Definition: gblur.h:45
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_gblur.c:351
#define AV_PIX_FMT_YUVA420P9
Definition: pixfmt.h:421
#define AV_PIX_FMT_GBRP9
Definition: pixfmt.h:402
int height
Definition: vf_avgblur.c:61
static int query_formats(AVFilterContext *ctx)
Definition: vf_gblur.c:196
AVFrame * dst
Definition: vf_blend.c:55
int plane
Definition: vf_blend.c:57
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range...
Definition: pixfmt.h:100
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
Definition: pixfmt.h:79
#define AV_PIX_FMT_YUV444P16
Definition: pixfmt.h:400
AVFilter ff_vf_gblur
Definition: vf_gblur.c:376
#define AV_PIX_FMT_YUV422P12
Definition: pixfmt.h:392
#define AV_PIX_FMT_YUVA420P16
Definition: pixfmt.h:429
void(* horiz_slice)(float *buffer, int width, int height, int steps, float nu, float bscale)
Definition: gblur.h:51
#define FFALIGN(x, a)
Definition: macros.h:48
A filter pad used for either input or output.
Definition: internal.h:54
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
Definition: pixfmt.h:176
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:259
int ff_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats)
A helper for query_formats() which sets all links to the same list of formats.
Definition: formats.c:569
#define td
Definition: regdef.h:70
int step
Definition: vf_remap.c:77
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
Definition: pixdesc.h:101
static const FLOAT postscale[64]
Definition: faandct.c:54
uint8_t * ptr
Definition: vf_avgblur.c:63
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:202
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:186
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:887
float sigmaV
Definition: gblur.h:36
void * priv
private data for use by the filter
Definition: avfilter.h:353
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
Definition: avfilter.h:116
#define AV_PIX_FMT_YUVA444P16
Definition: pixfmt.h:431
const char * arg
Definition: jacosubdec.c:66
#define AV_PIX_FMT_GBRAP12
Definition: pixfmt.h:408
#define AV_PIX_FMT_YUV444P10
Definition: pixfmt.h:390
AVFILTER_DEFINE_CLASS(gblur)
#define AV_PIX_FMT_GBRAP16
Definition: pixfmt.h:409
const uint8_t * src
Definition: vf_bm3d.c:56
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:70
static const struct @321 planes[]
#define AV_PIX_FMT_YUV422P9
Definition: pixfmt.h:385
static void gaussianiir2d(AVFilterContext *ctx, int plane)
Definition: vf_gblur.c:178
#define AV_PIX_FMT_GBRP16
Definition: pixfmt.h:406
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
Definition: avfilter.c:802
#define AV_PIX_FMT_GRAY16
Definition: pixfmt.h:371
#define FFMIN(a, b)
Definition: common.h:96
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
Definition: pixfmt.h:78
#define AV_PIX_FMT_YUVA444P12
Definition: pixfmt.h:428
AVFormatContext * ctx
Definition: movenc.c:48
#define AV_PIX_FMT_YUVA444P10
Definition: pixfmt.h:426
float * buffer
Definition: gblur.h:43
float postscaleV
Definition: gblur.h:47
#define AV_PIX_FMT_YUV444P9
Definition: pixfmt.h:386
#define AV_PIX_FMT_GBRP14
Definition: pixfmt.h:405
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
#define AV_PIX_FMT_YUV420P16
Definition: pixfmt.h:398
#define AV_PIX_FMT_YUV420P14
Definition: pixfmt.h:395
static int filter_postscale(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: vf_gblur.c:156
int av_frame_is_writable(AVFrame *frame)
Check if the frame data is writable.
Definition: frame.c:594
Used for passing data between threads.
Definition: dsddec.c:64
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Definition: frame.h:326
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Definition: pixfmt.h:177
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:81
#define AV_PIX_FMT_GRAY14
Definition: pixfmt.h:370
int planes
Definition: gblur.h:38
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several inputs
void ff_gblur_init(GBlurContext *s)
Definition: vf_gblur.c:223
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:387
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Definition: pixfmt.h:72
static const AVFilterPad gblur_outputs[]
Definition: vf_gblur.c:368
Filter definition.
Definition: avfilter.h:144
#define OFFSET(x)
Definition: vf_gblur.c:37
static void set_params(float sigma, int steps, float *postscale, float *boundaryscale, float *nu)
Definition: vf_gblur.c:255
int nb_planes
Definition: gblur.h:50
float postscale
Definition: gblur.h:46
const char * name
Filter name.
Definition: avfilter.h:148
#define AV_PIX_FMT_YUV440P12
Definition: pixfmt.h:393
#define AV_PIX_FMT_YUV420P9
Definition: pixfmt.h:384
AVFilterLink ** outputs
array of pointers to output links
Definition: avfilter.h:350
static enum AVPixelFormat pix_fmts[]
Definition: libkvazaar.c:275
#define AV_PIX_FMT_YUV422P14
Definition: pixfmt.h:396
#define AV_PIX_FMT_GBRP12
Definition: pixfmt.h:404
#define flags(name, subs,...)
Definition: cbs_av1.c:561
AVFilterInternal * internal
An opaque struct for libavfilter internal use.
Definition: avfilter.h:378
#define AV_PIX_FMT_YUV422P10
Definition: pixfmt.h:388
#define AV_PIX_FMT_YUV444P12
Definition: pixfmt.h:394
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:309
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:66
Y , 8bpp.
Definition: pixfmt.h:74
static const AVOption gblur_options[]
Definition: vf_gblur.c:40
planar GBRA 4:4:4:4 32bpp
Definition: pixfmt.h:215
#define AV_PIX_FMT_YUVA444P9
Definition: pixfmt.h:423
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
Definition: pixfmt.h:80
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
Definition: pixfmt.h:73
avfilter_execute_func * execute
Definition: internal.h:155
static int slice_end(AVCodecContext *avctx, AVFrame *pict)
Handle slice ends.
Definition: mpeg12dec.c:2036
const AVPixFmtDescriptor * desc
Definition: vf_tonemap.c:196
int depth
Definition: gblur.h:40
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor ...
Definition: pixfmt.h:258
An instance of a filter.
Definition: avfilter.h:338
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
Definition: af_afftdn.c:1373
#define av_freep(p)
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition: pixfmt.h:99
#define av_malloc_array(a, b)
AVFrame * in
Definition: af_afftdn.c:1082
void av_image_copy_plane(uint8_t *dst, int dst_linesize, const uint8_t *src, int src_linesize, int bytewidth, int height)
Copy image plane from src to dst.
Definition: imgutils.c:338
AVFilterLink * inlink
Definition: vf_blend.c:56
internal API functions
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later.That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another.Frame references ownership and permissions
int depth
Number of bits in the component.
Definition: pixdesc.h:58
static void horiz_slice_c(float *buffer, int width, int height, int steps, float nu, float bscale)
Definition: vf_gblur.c:55
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
#define AV_PIX_FMT_YUV422P16
Definition: pixfmt.h:399
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
Definition: frame.c:654
GLuint buffer
Definition: opengl_enc.c:101
AVFrame * max
Definition: vf_threshold.c:75
#define AV_PIX_FMT_YUVA422P12
Definition: pixfmt.h:427
#define AV_CEIL_RSHIFT(a, b)
Definition: common.h:58
int steps
Definition: gblur.h:37