FFmpeg
vf_bilateral.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 Ming Yang
3  * Copyright (c) 2019 Paul B Mahol
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a copy
6  * of this software and associated documentation files (the "Software"), to deal
7  * in the Software without restriction, including without limitation the rights
8  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9  * copies of the Software, and to permit persons to whom the Software is
10  * furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included in all
13  * copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21  * SOFTWARE.
22  */
23 
24 #include "libavutil/imgutils.h"
25 #include "libavutil/opt.h"
26 #include "libavutil/pixdesc.h"
27 #include "avfilter.h"
28 #include "formats.h"
29 #include "internal.h"
30 #include "video.h"
31 
32 typedef struct BilateralContext {
33  const AVClass *class;
34 
35  float sigmaS;
36  float sigmaR;
37  int planes;
38 
39  int nb_planes;
40  int depth;
41  int planewidth[4];
42  int planeheight[4];
43 
44  float alpha;
45  float range_table[65536];
46 
47  float *img_out_f;
48  float *img_temp;
49  float *map_factor_a;
50  float *map_factor_b;
53  float *line_factor_a;
54  float *line_factor_b;
56 
57 #define OFFSET(x) offsetof(BilateralContext, x)
58 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
59 
60 static const AVOption bilateral_options[] = {
61  { "sigmaS", "set spatial sigma", OFFSET(sigmaS), AV_OPT_TYPE_FLOAT, {.dbl=0.1}, 0.0, 512, FLAGS },
62  { "sigmaR", "set range sigma", OFFSET(sigmaR), AV_OPT_TYPE_FLOAT, {.dbl=0.1}, 0.0, 1, FLAGS },
63  { "planes", "set planes to filter", OFFSET(planes), AV_OPT_TYPE_INT, {.i64=1}, 0, 0xF, FLAGS },
64  { NULL }
65 };
66 
67 AVFILTER_DEFINE_CLASS(bilateral);
68 
69 static const enum AVPixelFormat pix_fmts[] = {
88 };
89 
91 {
92  BilateralContext *s = ctx->priv;
93  float inv_sigma_range;
94 
95  inv_sigma_range = 1.0f / (s->sigmaR * ((1 << s->depth) - 1));
96  s->alpha = expf(-sqrtf(2.f) / s->sigmaS);
97 
98  //compute a lookup table
99  for (int i = 0; i < (1 << s->depth); i++)
100  s->range_table[i] = s->alpha * expf(-i * inv_sigma_range);
101 
102  return 0;
103 }
104 
106 {
107  AVFilterContext *ctx = inlink->dst;
108  BilateralContext *s = ctx->priv;
110 
111  s->depth = desc->comp[0].depth;
112 
114 
115  s->planewidth[1] = s->planewidth[2] = AV_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w);
116  s->planewidth[0] = s->planewidth[3] = inlink->w;
117  s->planeheight[1] = s->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
118  s->planeheight[0] = s->planeheight[3] = inlink->h;
119 
120  s->nb_planes = av_pix_fmt_count_planes(inlink->format);
121 
122  s->img_out_f = av_calloc(inlink->w * inlink->h, sizeof(float));
123  s->img_temp = av_calloc(inlink->w * inlink->h, sizeof(float));
124  s->map_factor_a = av_calloc(inlink->w * inlink->h, sizeof(float));
125  s->map_factor_b = av_calloc(inlink->w * inlink->h, sizeof(float));
126  s->slice_factor_a = av_calloc(inlink->w, sizeof(float));
127  s->slice_factor_b = av_calloc(inlink->w, sizeof(float));
128  s->line_factor_a = av_calloc(inlink->w, sizeof(float));
129  s->line_factor_b = av_calloc(inlink->w, sizeof(float));
130 
131  if (!s->img_out_f ||
132  !s->img_temp ||
133  !s->map_factor_a ||
134  !s->map_factor_b ||
135  !s->slice_factor_a ||
136  !s->slice_factor_a ||
137  !s->line_factor_a ||
138  !s->line_factor_a)
139  return AVERROR(ENOMEM);
140 
141  return 0;
142 }
143 
144 #define BILATERAL(type, name) \
145 static void bilateral_##name(BilateralContext *s, const uint8_t *ssrc, uint8_t *ddst, \
146  float sigma_spatial, float sigma_range, \
147  int width, int height, int src_linesize, int dst_linesize) \
148 { \
149  type *dst = (type *)ddst; \
150  const type *src = (const type *)ssrc; \
151  float *img_out_f = s->img_out_f, *img_temp = s->img_temp; \
152  float *map_factor_a = s->map_factor_a, *map_factor_b = s->map_factor_b; \
153  float *slice_factor_a = s->slice_factor_a, *slice_factor_b = s->slice_factor_b; \
154  float *line_factor_a = s->line_factor_a, *line_factor_b = s->line_factor_b; \
155  const float *range_table = s->range_table; \
156  const float alpha = s->alpha; \
157  float ypr, ycr, *ycy, *ypy, *xcy, fp, fc; \
158  const float inv_alpha_ = 1.f - alpha; \
159  float *ycf, *ypf, *xcf, *in_factor; \
160  const type *tcy, *tpy; \
161  int h1; \
162  \
163  for (int y = 0; y < height; y++) { \
164  float *temp_factor_x, *temp_x = &img_temp[y * width]; \
165  const type *in_x = &src[y * src_linesize]; \
166  const type *texture_x = &src[y * src_linesize]; \
167  type tpr; \
168  \
169  *temp_x++ = ypr = *in_x++; \
170  tpr = *texture_x++; \
171  \
172  temp_factor_x = &map_factor_a[y * width]; \
173  *temp_factor_x++ = fp = 1; \
174  \
175  for (int x = 1; x < width; x++) { \
176  float alpha_; \
177  int range_dist; \
178  type tcr = *texture_x++; \
179  type dr = abs(tcr - tpr); \
180  \
181  range_dist = dr; \
182  alpha_ = range_table[range_dist]; \
183  *temp_x++ = ycr = inv_alpha_*(*in_x++) + alpha_*ypr; \
184  tpr = tcr; \
185  ypr = ycr; \
186  *temp_factor_x++ = fc = inv_alpha_ + alpha_ * fp; \
187  fp = fc; \
188  } \
189  --temp_x; *temp_x = 0.5f*((*temp_x) + (*--in_x)); \
190  tpr = *--texture_x; \
191  ypr = *in_x; \
192  \
193  --temp_factor_x; *temp_factor_x = 0.5f*((*temp_factor_x) + 1); \
194  fp = 1; \
195  \
196  for (int x = width - 2; x >= 0; x--) { \
197  type tcr = *--texture_x; \
198  type dr = abs(tcr - tpr); \
199  int range_dist = dr; \
200  float alpha_ = range_table[range_dist]; \
201  \
202  ycr = inv_alpha_ * (*--in_x) + alpha_ * ypr; \
203  --temp_x; *temp_x = 0.5f*((*temp_x) + ycr); \
204  tpr = tcr; \
205  ypr = ycr; \
206  \
207  fc = inv_alpha_ + alpha_*fp; \
208  --temp_factor_x; \
209  *temp_factor_x = 0.5f*((*temp_factor_x) + fc); \
210  fp = fc; \
211  } \
212  } \
213  memcpy(img_out_f, img_temp, sizeof(float) * width); \
214  \
215  in_factor = map_factor_a; \
216  memcpy(map_factor_b, in_factor, sizeof(float) * width); \
217  for (int y = 1; y < height; y++) { \
218  tpy = &src[(y - 1) * src_linesize]; \
219  tcy = &src[y * src_linesize]; \
220  xcy = &img_temp[y * width]; \
221  ypy = &img_out_f[(y - 1) * width]; \
222  ycy = &img_out_f[y * width]; \
223  \
224  xcf = &in_factor[y * width]; \
225  ypf = &map_factor_b[(y - 1) * width]; \
226  ycf = &map_factor_b[y * width]; \
227  for (int x = 0; x < width; x++) { \
228  type dr = abs((*tcy++) - (*tpy++)); \
229  int range_dist = dr; \
230  float alpha_ = range_table[range_dist]; \
231  \
232  *ycy++ = inv_alpha_*(*xcy++) + alpha_*(*ypy++); \
233  *ycf++ = inv_alpha_*(*xcf++) + alpha_*(*ypf++); \
234  } \
235  } \
236  h1 = height - 1; \
237  ycf = line_factor_a; \
238  ypf = line_factor_b; \
239  memcpy(ypf, &in_factor[h1 * width], sizeof(float) * width); \
240  for (int x = 0; x < width; x++) \
241  map_factor_b[h1 * width + x] = 0.5f*(map_factor_b[h1 * width + x] + ypf[x]); \
242  \
243  ycy = slice_factor_a; \
244  ypy = slice_factor_b; \
245  memcpy(ypy, &img_temp[h1 * width], sizeof(float) * width); \
246  for (int x = 0, k = 0; x < width; x++) { \
247  int idx = h1 * width + x; \
248  img_out_f[idx] = 0.5f*(img_out_f[idx] + ypy[k++]) / map_factor_b[h1 * width + x]; \
249  } \
250  \
251  for (int y = h1 - 1; y >= 0; y--) { \
252  float *ycf_, *ypf_, *factor_; \
253  float *ycy_, *ypy_, *out_; \
254  \
255  tpy = &src[(y + 1) * src_linesize]; \
256  tcy = &src[y * src_linesize]; \
257  xcy = &img_temp[y * width]; \
258  ycy_ = ycy; \
259  ypy_ = ypy; \
260  out_ = &img_out_f[y * width]; \
261  \
262  xcf = &in_factor[y * width]; \
263  ycf_ = ycf; \
264  ypf_ = ypf; \
265  factor_ = &map_factor_b[y * width]; \
266  for (int x = 0; x < width; x++) { \
267  type dr = abs((*tcy++) - (*tpy++)); \
268  int range_dist = dr; \
269  float alpha_ = range_table[range_dist]; \
270  float ycc, fcc = inv_alpha_*(*xcf++) + alpha_*(*ypf_++); \
271  \
272  *ycf_++ = fcc; \
273  *factor_ = 0.5f * (*factor_ + fcc); \
274  \
275  ycc = inv_alpha_*(*xcy++) + alpha_*(*ypy_++); \
276  *ycy_++ = ycc; \
277  *out_ = 0.5f * (*out_ + ycc) / (*factor_); \
278  out_++; \
279  factor_++; \
280  } \
281  \
282  ypy = ycy; \
283  ypf = ycf; \
284  } \
285  \
286  for (int i = 0; i < height; i++) \
287  for (int j = 0; j < width; j++) \
288  dst[j + i * dst_linesize] = img_out_f[i * width + j]; \
289 }
290 
291 BILATERAL(uint8_t, byte)
292 BILATERAL(uint16_t, word)
293 
295 {
296  AVFilterContext *ctx = inlink->dst;
297  BilateralContext *s = ctx->priv;
298  AVFilterLink *outlink = ctx->outputs[0];
299  AVFrame *out;
300 
301  out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
302  if (!out) {
303  av_frame_free(&in);
304  return AVERROR(ENOMEM);
305  }
307 
308  for (int plane = 0; plane < s->nb_planes; plane++) {
309  if (!(s->planes & (1 << plane))) {
310  av_image_copy_plane(out->data[plane], out->linesize[plane],
311  in->data[plane], in->linesize[plane],
312  s->planewidth[plane] * ((s->depth + 7) / 8), s->planeheight[plane]);
313  continue;
314  }
315 
316  if (s->depth <= 8)
317  bilateral_byte(s, in->data[plane], out->data[plane], s->sigmaS, s->sigmaR,
318  s->planewidth[plane], s->planeheight[plane],
319  in->linesize[plane], out->linesize[plane]);
320  else
321  bilateral_word(s, in->data[plane], out->data[plane], s->sigmaS, s->sigmaR,
322  s->planewidth[plane], s->planeheight[plane],
323  in->linesize[plane] / 2, out->linesize[plane] / 2);
324  }
325 
326  av_frame_free(&in);
327  return ff_filter_frame(outlink, out);
328 }
329 
331 {
332  BilateralContext *s = ctx->priv;
333 
334  av_freep(&s->img_out_f);
335  av_freep(&s->img_temp);
336  av_freep(&s->map_factor_a);
337  av_freep(&s->map_factor_b);
338  av_freep(&s->slice_factor_a);
339  av_freep(&s->slice_factor_b);
340  av_freep(&s->line_factor_a);
341  av_freep(&s->line_factor_b);
342 }
343 
345  const char *cmd,
346  const char *arg,
347  char *res,
348  int res_len,
349  int flags)
350 {
351  int ret = ff_filter_process_command(ctx, cmd, arg, res, res_len, flags);
352 
353  if (ret < 0)
354  return ret;
355 
356  return config_params(ctx);
357 }
358 
359 static const AVFilterPad bilateral_inputs[] = {
360  {
361  .name = "default",
362  .type = AVMEDIA_TYPE_VIDEO,
363  .config_props = config_input,
364  .filter_frame = filter_frame,
365  },
366 };
367 
368 static const AVFilterPad bilateral_outputs[] = {
369  {
370  .name = "default",
371  .type = AVMEDIA_TYPE_VIDEO,
372  },
373 };
374 
376  .name = "bilateral",
377  .description = NULL_IF_CONFIG_SMALL("Apply Bilateral filter."),
378  .priv_size = sizeof(BilateralContext),
379  .priv_class = &bilateral_class,
380  .uninit = uninit,
385  .process_command = process_command,
386 };
ff_get_video_buffer
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
Definition: video.c:98
AV_PIX_FMT_YUVA422P16
#define AV_PIX_FMT_YUVA422P16
Definition: pixfmt.h:434
AV_PIX_FMT_GBRAP16
#define AV_PIX_FMT_GBRAP16
Definition: pixfmt.h:413
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
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
config_params
static int config_params(AVFilterContext *ctx)
Definition: vf_bilateral.c:90
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:2564
FILTER_PIXFMTS_ARRAY
#define FILTER_PIXFMTS_ARRAY(array)
Definition: internal.h:171
inlink
The exact code depends on how similar the blocks are and how related they are to the and needs to apply these operations to the correct inlink or outlink if there are several Macros are available to factor that when no extra processing is inlink
Definition: filter_design.txt:212
av_frame_free
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:112
BilateralContext::sigmaR
float sigmaR
Definition: vf_bilateral.c:36
AV_PIX_FMT_YUVA422P9
#define AV_PIX_FMT_YUVA422P9
Definition: pixfmt.h:426
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:303
pixdesc.h
AV_PIX_FMT_YUVA420P16
#define AV_PIX_FMT_YUVA420P16
Definition: pixfmt.h:433
AV_PIX_FMT_YUVA420P10
#define AV_PIX_FMT_YUVA420P10
Definition: pixfmt.h:428
AVOption
AVOption.
Definition: opt.h:247
BilateralContext::img_temp
float * img_temp
Definition: vf_bilateral.c:48
BilateralContext::planewidth
int planewidth[4]
Definition: vf_bilateral.c:41
expf
#define expf(x)
Definition: libm.h:283
AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:391
AV_PIX_FMT_YUV440P
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition: pixfmt.h:99
BilateralContext::map_factor_a
float * map_factor_a
Definition: vf_bilateral.c:49
AVFilter::name
const char * name
Filter name.
Definition: avfilter.h:153
FLAGS
#define FLAGS
Definition: vf_bilateral.c:58
video.h
AV_PIX_FMT_YUVA422P10
#define AV_PIX_FMT_YUVA422P10
Definition: pixfmt.h:429
AV_PIX_FMT_GRAY9
#define AV_PIX_FMT_GRAY9
Definition: pixfmt.h:371
BilateralContext::slice_factor_b
float * slice_factor_b
Definition: vf_bilateral.c:52
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
planes
static const struct @320 planes[]
formats.h
BilateralContext::map_factor_b
float * map_factor_b
Definition: vf_bilateral.c:50
av_pix_fmt_count_planes
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2604
AV_PIX_FMT_YUVA420P9
#define AV_PIX_FMT_YUVA420P9
Definition: pixfmt.h:425
AV_PIX_FMT_GBRP14
#define AV_PIX_FMT_GBRP14
Definition: pixfmt.h:409
AV_PIX_FMT_GBRAP
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
Definition: pixfmt.h:205
AV_PIX_FMT_GBRP10
#define AV_PIX_FMT_GBRP10
Definition: pixfmt.h:407
AV_PIX_FMT_YUVA444P16
#define AV_PIX_FMT_YUVA444P16
Definition: pixfmt.h:435
AV_PIX_FMT_YUV422P9
#define AV_PIX_FMT_YUV422P9
Definition: pixfmt.h:389
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_bilateral.c:330
BilateralContext::range_table
float range_table[65536]
Definition: vf_bilateral.c:45
pix_fmts
static enum AVPixelFormat pix_fmts[]
Definition: vf_bilateral.c:69
AV_PIX_FMT_GRAY16
#define AV_PIX_FMT_GRAY16
Definition: pixfmt.h:375
AVFilterPad
A filter pad used for either input or output.
Definition: internal.h:50
AV_PIX_FMT_YUV444P10
#define AV_PIX_FMT_YUV444P10
Definition: pixfmt.h:394
AV_PIX_FMT_YUVJ411P
@ AV_PIX_FMT_YUVJ411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor ...
Definition: pixfmt.h:248
av_cold
#define av_cold
Definition: attributes.h:90
AV_PIX_FMT_YUV422P16
#define AV_PIX_FMT_YUV422P16
Definition: pixfmt.h:403
AV_PIX_FMT_YUVJ422P
@ AV_PIX_FMT_YUVJ422P
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
Definition: pixfmt.h:79
AV_PIX_FMT_GBRAP10
#define AV_PIX_FMT_GBRAP10
Definition: pixfmt.h:411
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_bilateral.c:294
s
#define s(width, name)
Definition: cbs_vp9.c:257
config_input
static int config_input(AVFilterLink *inlink)
Definition: vf_bilateral.c:105
AV_PIX_FMT_GBRAP12
#define AV_PIX_FMT_GBRAP12
Definition: pixfmt.h:412
AV_PIX_FMT_YUVA420P
@ AV_PIX_FMT_YUVA420P
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
Definition: pixfmt.h:101
AV_PIX_FMT_YUV444P16
#define AV_PIX_FMT_YUV444P16
Definition: pixfmt.h:404
AV_CEIL_RSHIFT
#define AV_CEIL_RSHIFT(a, b)
Definition: common.h:51
BilateralContext::nb_planes
int nb_planes
Definition: vf_bilateral.c:39
AV_PIX_FMT_YUV420P9
#define AV_PIX_FMT_YUV420P9
Definition: pixfmt.h:388
AV_PIX_FMT_YUV420P16
#define AV_PIX_FMT_YUV420P16
Definition: pixfmt.h:402
ctx
AVFormatContext * ctx
Definition: movenc.c:48
AV_PIX_FMT_GRAY14
#define AV_PIX_FMT_GRAY14
Definition: pixfmt.h:374
AV_PIX_FMT_YUV420P
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:66
AVFILTER_DEFINE_CLASS
AVFILTER_DEFINE_CLASS(bilateral)
f
#define f(width, name)
Definition: cbs_vp9.c:255
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:191
bilateral_options
static const AVOption bilateral_options[]
Definition: vf_bilateral.c:60
AV_PIX_FMT_YUVJ444P
@ AV_PIX_FMT_YUVJ444P
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
Definition: pixfmt.h:80
arg
const char * arg
Definition: jacosubdec.c:67
AV_PIX_FMT_GRAY10
#define AV_PIX_FMT_GRAY10
Definition: pixfmt.h:372
AV_PIX_FMT_GBRP16
#define AV_PIX_FMT_GBRP16
Definition: pixfmt.h:410
OFFSET
#define OFFSET(x)
Definition: vf_bilateral.c:57
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:66
NULL
#define NULL
Definition: coverity.c:32
av_frame_copy_props
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
Definition: frame.c:537
AV_PIX_FMT_YUVJ420P
@ AV_PIX_FMT_YUVJ420P
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
Definition: pixfmt.h:78
BilateralContext::slice_factor_a
float * slice_factor_a
Definition: vf_bilateral.c:51
AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_YUV422P10
Definition: pixfmt.h:392
AV_PIX_FMT_GRAY8
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition: pixfmt.h:74
AV_PIX_FMT_GBRP9
#define AV_PIX_FMT_GBRP9
Definition: pixfmt.h:406
BilateralContext::sigmaS
float sigmaS
Definition: vf_bilateral.c:35
BILATERAL
#define BILATERAL(type, name)
Definition: vf_bilateral.c:144
bilateral_inputs
static const AVFilterPad bilateral_inputs[]
Definition: vf_bilateral.c:359
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:117
AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_YUV422P12
Definition: pixfmt.h:396
BilateralContext::planes
int planes
Definition: vf_bilateral.c:37
AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV444P12
Definition: pixfmt.h:398
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:882
AV_PIX_FMT_YUVA444P
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Definition: pixfmt.h:167
AV_PIX_FMT_YUVA444P10
#define AV_PIX_FMT_YUVA444P10
Definition: pixfmt.h:430
internal.h
AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
#define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
Some filters support a generic "enable" expression option that can be used to enable or disable a fil...
Definition: avfilter.h:130
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Definition: opt.h:227
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:271
BilateralContext::planeheight
int planeheight[4]
Definition: vf_bilateral.c:42
AV_PIX_FMT_GBRP12
#define AV_PIX_FMT_GBRP12
Definition: pixfmt.h:408
AV_PIX_FMT_YUVJ440P
@ AV_PIX_FMT_YUVJ440P
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range
Definition: pixfmt.h:100
AVFilterPad::name
const char * name
Pad name.
Definition: internal.h:56
av_calloc
void * av_calloc(size_t nmemb, size_t size)
Definition: mem.c:271
AV_PIX_FMT_YUV444P9
#define AV_PIX_FMT_YUV444P9
Definition: pixfmt.h:390
AVFilter
Filter definition.
Definition: avfilter.h:149
ret
ret
Definition: filter_design.txt:187
bilateral_outputs
static const AVFilterPad bilateral_outputs[]
Definition: vf_bilateral.c:368
AV_PIX_FMT_YUVA444P9
#define AV_PIX_FMT_YUVA444P9
Definition: pixfmt.h:427
AV_PIX_FMT_YUV420P12
#define AV_PIX_FMT_YUV420P12
Definition: pixfmt.h:395
BilateralContext::depth
int depth
Definition: vf_bilateral.c:40
AV_PIX_FMT_YUV422P14
#define AV_PIX_FMT_YUV422P14
Definition: pixfmt.h:400
process_command
static int process_command(AVFilterContext *ctx, const char *cmd, const char *arg, char *res, int res_len, int flags)
Definition: vf_bilateral.c:344
BilateralContext::alpha
float alpha
Definition: vf_bilateral.c:44
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:65
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:224
avfilter.h
BilateralContext::line_factor_b
float * line_factor_b
Definition: vf_bilateral.c:54
AV_PIX_FMT_YUV444P
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:71
BilateralContext
Definition: vf_bilateral.c:32
AVFilterContext
An instance of a filter.
Definition: avfilter.h:386
BilateralContext::line_factor_a
float * line_factor_a
Definition: vf_bilateral.c:53
AV_PIX_FMT_GBRP
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
Definition: pixfmt.h:158
desc
const char * desc
Definition: libsvtav1.c:79
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AV_PIX_FMT_YUV422P
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:70
BilateralContext::img_out_f
float * img_out_f
Definition: vf_bilateral.c:47
AVPixFmtDescriptor
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:69
ff_vf_bilateral
const AVFilter ff_vf_bilateral
Definition: vf_bilateral.c:375
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:192
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:35
AV_PIX_FMT_YUV411P
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
Definition: pixfmt.h:73
imgutils.h
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:561
AV_PIX_FMT_YUV410P
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Definition: pixfmt.h:72
AV_PIX_FMT_YUV440P12
#define AV_PIX_FMT_YUV440P12
Definition: pixfmt.h:397
AV_PIX_FMT_YUV444P14
#define AV_PIX_FMT_YUV444P14
Definition: pixfmt.h:401
AV_PIX_FMT_GRAY12
#define AV_PIX_FMT_GRAY12
Definition: pixfmt.h:373
AV_PIX_FMT_YUVA422P
@ AV_PIX_FMT_YUVA422P
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
Definition: pixfmt.h:166
AV_PIX_FMT_YUV420P14
#define AV_PIX_FMT_YUV420P14
Definition: pixfmt.h:399