FFmpeg  4.4.8
vf_median.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019 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  * Redistribution and use in source and binary forms, with or without modification,
20  * are permitted provided that the following conditions are met:
21  */
22 
23 #include "libavutil/avassert.h"
24 #include "libavutil/imgutils.h"
25 #include "libavutil/opt.h"
26 #include "libavutil/pixdesc.h"
27 #include "avfilter.h"
28 #include "filters.h"
29 #include "formats.h"
30 #include "internal.h"
31 #include "median.h"
32 #include "video.h"
33 
34 #define DEPTH 8
35 #include "median_template.c"
36 
37 #undef DEPTH
38 #define DEPTH 9
39 #include "median_template.c"
40 
41 #undef DEPTH
42 #define DEPTH 10
43 #include "median_template.c"
44 
45 #undef DEPTH
46 #define DEPTH 12
47 #include "median_template.c"
48 
49 #undef DEPTH
50 #define DEPTH 14
51 #include "median_template.c"
52 
53 #undef DEPTH
54 #define DEPTH 16
55 #include "median_template.c"
56 
57 #define OFFSET(x) offsetof(MedianContext, x)
58 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
59 
60 static const AVOption median_options[] = {
61  { "radius", "set median radius", OFFSET(radius), AV_OPT_TYPE_INT, {.i64=1}, 1, 127, FLAGS },
62  { "planes", "set planes to filter", OFFSET(planes), AV_OPT_TYPE_INT, {.i64=0xF}, 0, 0xF, FLAGS },
63  { "radiusV", "set median vertical radius", OFFSET(radiusV), AV_OPT_TYPE_INT, {.i64=0},0, 127, FLAGS },
64  { "percentile", "set median percentile", OFFSET(percentile), AV_OPT_TYPE_FLOAT, {.dbl=.5}, 0., 1., FLAGS },
65  { NULL }
66 };
67 
69 
70 static void hadd(htype *dst, const htype *src, int bins)
71 {
72  for (int i = 0; i < bins; i++)
73  dst[i] += src[i];
74 }
75 
76 static void hsub(htype *dst, const htype *src, int bins)
77 {
78  for (int i = 0; i < bins; i++)
79  dst[i] -= src[i];
80 }
81 
82 static void hmuladd(htype *dst, const htype *src, int f, int bins)
83 {
84  for (int i = 0; i < bins; i++)
85  dst[i] += f * src[i];
86 }
87 
89 {
90  static const enum AVPixelFormat pix_fmts[] = {
110  };
111 
113 }
114 
115 static void check_params(MedianContext *s, AVFilterLink *inlink)
116 {
117  for (int i = 0; i < s->nb_planes; i++) {
118  if (!(s->planes & (1 << i)))
119  continue;
120 
121  if (s->planewidth[i] < s->radius * 2 + 1) {
122  av_log(inlink->dst, AV_LOG_WARNING, "The %d plane width %d must be not less than %d, clipping radius.\n", i, s->planewidth[i], s->radius * 2 + 1);
123  s->radius = (s->planewidth[i] - 1) / 2;
124  }
125 
126  if (s->planeheight[i] < s->radiusV * 2 + 1) {
127  av_log(inlink->dst, AV_LOG_WARNING, "The %d plane height %d must be not less than %d, clipping radiusV.\n", i, s->planeheight[i], s->radiusV * 2 + 1);
128  s->radiusV = (s->planeheight[i] - 1) / 2;
129  }
130  }
131 
132  s->t = (2 * s->radius * s->radiusV + s->radiusV + s->radius) * 2.f * s->percentile;
133 }
134 
135 static int config_input(AVFilterLink *inlink)
136 {
138  MedianContext *s = inlink->dst->priv;
139 
140  s->depth = desc->comp[0].depth;
141  s->planewidth[1] = s->planewidth[2] = AV_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w);
142  s->planewidth[0] = s->planewidth[3] = inlink->w;
143  s->planeheight[1] = s->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
144  s->planeheight[0] = s->planeheight[3] = inlink->h;
145 
146  s->radiusV = !s->radiusV ? s->radius : s->radiusV;
147  s->nb_planes = av_pix_fmt_count_planes(inlink->format);
148 
149  check_params(s, inlink);
150 
151  s->nb_threads = FFMAX(1, FFMIN(s->planeheight[1] / (s->radiusV + 1), ff_filter_get_nb_threads(inlink->dst)));
152  s->bins = 1 << ((s->depth + 1) / 2);
153  s->fine_size = s->bins * s->bins * inlink->w;
154  s->coarse_size = s->bins * inlink->w;
155  s->coarse = av_calloc(s->nb_threads, sizeof(*s->coarse));
156  s->fine = av_calloc(s->nb_threads, sizeof(*s->fine));
157  if (!s->coarse || !s->fine)
158  return AVERROR(ENOMEM);
159  for (int i = 0; i < s->nb_threads; i++) {
160  s->coarse[i] = av_malloc_array(s->coarse_size, sizeof(**s->coarse));
161  s->fine[i] = av_malloc_array(s->fine_size, sizeof(**s->fine));
162  if (!s->coarse[i] || !s->fine[i])
163  return AVERROR(ENOMEM);
164  }
165 
166  s->hadd = hadd;
167  s->hsub = hsub;
168  s->hmuladd = hmuladd;
169 
170  switch (s->depth) {
171  case 8: s->filter_plane = filter_plane_8; break;
172  case 9: s->filter_plane = filter_plane_9; break;
173  case 10: s->filter_plane = filter_plane_10; break;
174  case 12: s->filter_plane = filter_plane_12; break;
175  case 14: s->filter_plane = filter_plane_14; break;
176  case 16: s->filter_plane = filter_plane_16; break;
177  }
178 
179  return 0;
180 }
181 
182 typedef struct ThreadData {
183  AVFrame *in, *out;
184 } ThreadData;
185 
186 static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
187 {
188  MedianContext *s = ctx->priv;
189  ThreadData *td = arg;
190  AVFrame *in = td->in;
191  AVFrame *out = td->out;
192 
193  for (int plane = 0; plane < s->nb_planes; plane++) {
194  const int h = s->planeheight[plane];
195  const int w = s->planewidth[plane];
196  const int slice_h_start = ff_slice_pos(h, jobnr, nb_jobs);
197  const int slice_h_end = ff_slice_pos(h, jobnr + 1, nb_jobs);
198 
199  if (!(s->planes & (1 << plane))) {
200  av_image_copy_plane(out->data[plane] + slice_h_start * out->linesize[plane],
201  out->linesize[plane],
202  in->data[plane] + slice_h_start * in->linesize[plane],
203  in->linesize[plane],
204  w * ((s->depth + 7) / 8),
205  slice_h_end - slice_h_start);
206  continue;
207  }
208 
209  s->filter_plane(ctx, in->data[plane],
210  in->linesize[plane],
211  out->data[plane] + slice_h_start * out->linesize[plane],
212  out->linesize[plane], w, h,
213  slice_h_start, slice_h_end, jobnr);
214  }
215 
216  return 0;
217 }
218 
219 static int filter_frame(AVFilterLink *inlink, AVFrame *in)
220 {
221  AVFilterContext *ctx = inlink->dst;
222  MedianContext *s = ctx->priv;
223  AVFilterLink *outlink = ctx->outputs[0];
224  ThreadData td;
225  AVFrame *out;
226 
227  out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
228  if (!out) {
229  av_frame_free(&in);
230  return AVERROR(ENOMEM);
231  }
233 
234  td.in = in; td.out = out;
235  ctx->internal->execute(ctx, filter_slice, &td, NULL, s->nb_threads);
236 
237  av_frame_free(&in);
238  return ff_filter_frame(outlink, out);
239 }
240 
242 {
243  MedianContext *s = ctx->priv;
244 
245  for (int i = 0; i < s->nb_threads && s->coarse && s->fine; i++) {
246  av_freep(&s->coarse[i]);
247  av_freep(&s->fine[i]);
248  }
249 
250  av_freep(&s->coarse);
251  av_freep(&s->fine);
252 }
253 
254 static int process_command(AVFilterContext *ctx, const char *cmd, const char *args,
255  char *res, int res_len, int flags)
256 {
257  MedianContext *s = ctx->priv;
258  int ret;
259 
260  ret = ff_filter_process_command(ctx, cmd, args, res, res_len, flags);
261  if (ret < 0)
262  return ret;
263 
264  if (!s->radiusV)
265  s->radiusV = s->radius;
266  check_params(s, ctx->inputs[0]);
267 
268  return 0;
269 }
270 
271 static const AVFilterPad median_inputs[] = {
272  {
273  .name = "default",
274  .type = AVMEDIA_TYPE_VIDEO,
275  .config_props = config_input,
276  .filter_frame = filter_frame,
277  },
278  { NULL }
279 };
280 
281 static const AVFilterPad median_outputs[] = {
282  {
283  .name = "default",
284  .type = AVMEDIA_TYPE_VIDEO,
285  },
286  { NULL }
287 };
288 
290  .name = "median",
291  .description = NULL_IF_CONFIG_SMALL("Apply Median filter."),
292  .priv_size = sizeof(MedianContext),
293  .priv_class = &median_class,
294  .uninit = uninit,
300 };
static const AVFilterPad inputs[]
Definition: af_acontrast.c:193
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
#define av_cold
Definition: attributes.h:88
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(const int16_t *) pi >> 8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(const int32_t *) pi >> 24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31)))) #define SET_CONV_FUNC_GROUP(ofmt, ifmt) static void set_generic_function(AudioConvert *ac) { } void ff_audio_convert_free(AudioConvert **ac) { if(! *ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);} AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, int sample_rate, int apply_map) { AudioConvert *ac;int in_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) return NULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method !=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt) > 2) { ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc) { av_free(ac);return NULL;} return ac;} in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar) { ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar ? ac->channels :1;} else if(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;else ac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);return ac;} int ff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in) { int use_generic=1;int len=in->nb_samples;int p;if(ac->dc) { av_log(ac->avr, AV_LOG_TRACE, "%d samples - audio_convert: %s to %s (dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));return ff_convert_dither(ac-> in
simple assert() macros that are a bit more flexible than ISO C assert().
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:1096
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
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
Definition: avfilter.c:802
Main libavfilter public API header.
#define flags(name, subs,...)
Definition: cbs_av1.c:572
#define s(width, name)
Definition: cbs_vp9.c:257
#define f(width, name)
Definition: cbs_vp9.c:255
#define FFMIN(a, b)
Definition: common.h:105
#define AV_CEIL_RSHIFT(a, b)
Definition: common.h:58
#define FFMAX(a, b)
Definition: common.h:103
#define NULL
Definition: coverity.c:32
static int ff_slice_pos(int total, int jobnr, int nb_jobs)
Compute the boundary index for a slice when work of size total is split into nb_jobs slices.
Definition: filters.h:271
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:587
AVFilterFormats * ff_make_format_list(const int *fmts)
Create a list of supported formats.
Definition: formats.c:286
@ AV_OPT_TYPE_INT
Definition: opt.h:225
@ AV_OPT_TYPE_FLOAT
Definition: opt.h:228
#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:126
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
Definition: avfilter.h:117
#define AVERROR(e)
Definition: error.h:43
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:203
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
Definition: frame.c:658
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:200
void * av_calloc(size_t nmemb, size_t size)
Non-inlined equivalent of av_mallocz_array().
Definition: mem.c:245
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
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:373
misc image utilities
int i
Definition: input.c:407
const char * arg
Definition: jacosubdec.c:66
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:117
static enum AVPixelFormat pix_fmts[]
Definition: libkvazaar.c:309
const char * desc
Definition: libsvtav1.c:79
uint8_t w
Definition: llviddspenc.c:39
static const struct @322 planes[]
#define htype
AVOptions.
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2613
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2573
#define AV_PIX_FMT_GBRAP12
Definition: pixfmt.h:420
#define AV_PIX_FMT_YUV420P16
Definition: pixfmt.h:410
#define AV_PIX_FMT_YUV444P12
Definition: pixfmt.h:406
#define AV_PIX_FMT_YUV444P9
Definition: pixfmt.h:398
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:399
#define AV_PIX_FMT_YUV440P12
Definition: pixfmt.h:405
#define AV_PIX_FMT_GRAY9
Definition: pixfmt.h:379
#define AV_PIX_FMT_GBRAP16
Definition: pixfmt.h:421
#define AV_PIX_FMT_GBRP9
Definition: pixfmt.h:414
#define AV_PIX_FMT_YUV422P9
Definition: pixfmt.h:397
#define AV_PIX_FMT_YUVA444P10
Definition: pixfmt.h:438
#define AV_PIX_FMT_YUVA420P16
Definition: pixfmt.h:441
#define AV_PIX_FMT_YUV420P12
Definition: pixfmt.h:403
#define AV_PIX_FMT_YUVA420P10
Definition: pixfmt.h:436
#define AV_PIX_FMT_YUVA422P9
Definition: pixfmt.h:434
#define AV_PIX_FMT_YUV422P12
Definition: pixfmt.h:404
#define AV_PIX_FMT_GBRP10
Definition: pixfmt.h:415
#define AV_PIX_FMT_YUV422P10
Definition: pixfmt.h:400
#define AV_PIX_FMT_GRAY12
Definition: pixfmt.h:381
#define AV_PIX_FMT_GBRP12
Definition: pixfmt.h:416
#define AV_PIX_FMT_YUV420P9
Definition: pixfmt.h:396
#define AV_PIX_FMT_YUVA420P9
Definition: pixfmt.h:433
#define AV_PIX_FMT_YUVA422P10
Definition: pixfmt.h:437
#define AV_PIX_FMT_YUV420P14
Definition: pixfmt.h:407
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:65
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:66
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition: pixfmt.h:99
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:70
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition: pixfmt.h:74
@ 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_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
@ 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_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
Definition: pixfmt.h:73
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:71
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Definition: pixfmt.h:177
@ 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:258
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
Definition: pixfmt.h:215
@ 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_YUVA422P
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
Definition: pixfmt.h:176
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
Definition: pixfmt.h:168
@ 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
@ 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
#define AV_PIX_FMT_YUVA422P12
Definition: pixfmt.h:439
#define AV_PIX_FMT_YUV422P14
Definition: pixfmt.h:408
#define AV_PIX_FMT_GRAY10
Definition: pixfmt.h:380
#define AV_PIX_FMT_GRAY14
Definition: pixfmt.h:382
#define AV_PIX_FMT_YUV422P16
Definition: pixfmt.h:411
#define AV_PIX_FMT_GRAY16
Definition: pixfmt.h:383
#define AV_PIX_FMT_GBRAP10
Definition: pixfmt.h:419
#define AV_PIX_FMT_YUVA444P16
Definition: pixfmt.h:443
#define AV_PIX_FMT_YUVA422P16
Definition: pixfmt.h:442
#define AV_PIX_FMT_GBRP16
Definition: pixfmt.h:418
#define AV_PIX_FMT_YUV444P14
Definition: pixfmt.h:409
#define AV_PIX_FMT_YUVA444P9
Definition: pixfmt.h:435
#define AV_PIX_FMT_GBRP14
Definition: pixfmt.h:417
#define AV_PIX_FMT_YUVA444P12
Definition: pixfmt.h:440
#define AV_PIX_FMT_YUV444P16
Definition: pixfmt.h:412
#define AV_PIX_FMT_YUV444P10
Definition: pixfmt.h:402
#define td
Definition: regdef.h:70
An instance of a filter.
Definition: avfilter.h:341
void * priv
private data for use by the filter
Definition: avfilter.h:356
A filter pad used for either input or output.
Definition: internal.h:54
const char * name
Pad name.
Definition: internal.h:60
Filter definition.
Definition: avfilter.h:145
const char * name
Filter name.
Definition: avfilter.h:149
AVFormatInternal * internal
An opaque field for libavformat internal usage.
Definition: avformat.h:1699
This structure describes decoded (raw) audio or video data.
Definition: frame.h:318
AVOption.
Definition: opt.h:248
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:81
Used for passing data between threads.
Definition: dsddec.c:67
AVFrame * out
Definition: af_adeclick.c:502
AVFrame * in
Definition: af_adenorm.c:223
#define av_malloc_array(a, b)
#define av_freep(p)
#define av_log(a,...)
#define src
Definition: vp8dsp.c:255
FILE * out
Definition: movenc.c:54
AVFormatContext * ctx
Definition: movenc.c:48
static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: vf_median.c:186
AVFILTER_DEFINE_CLASS(median)
static void check_params(MedianContext *s, AVFilterLink *inlink)
Definition: vf_median.c:115
static int query_formats(AVFilterContext *ctx)
Definition: vf_median.c:88
static int config_input(AVFilterLink *inlink)
Definition: vf_median.c:135
static void hmuladd(htype *dst, const htype *src, int f, int bins)
Definition: vf_median.c:82
static const AVOption median_options[]
Definition: vf_median.c:60
#define FLAGS
Definition: vf_median.c:58
static const AVFilterPad median_inputs[]
Definition: vf_median.c:271
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_median.c:219
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
Definition: vf_median.c:254
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_median.c:241
static void hsub(htype *dst, const htype *src, int bins)
Definition: vf_median.c:76
static const AVFilterPad median_outputs[]
Definition: vf_median.c:281
AVFilter ff_vf_median
Definition: vf_median.c:289
#define OFFSET(x)
Definition: vf_median.c:57
static void hadd(htype *dst, const htype *src, int bins)
Definition: vf_median.c:70
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
Definition: video.c:104