FFmpeg
vf_amplify.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 Paul B Mahol
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #include "libavutil/imgutils.h"
22 #include "libavutil/intreadwrite.h"
23 #include "libavutil/opt.h"
24 #include "libavutil/pixdesc.h"
25 
26 #include "avfilter.h"
27 #include "formats.h"
28 #include "internal.h"
29 #include "video.h"
30 
31 typedef struct AmplifyContext {
32  const AVClass *class;
34  int radius;
35  float factor;
36  float threshold;
37  float tolerance;
38  int planes;
39 
40  int llimit;
41  int hlimit;
42  int nb_inputs;
43  int nb_frames;
44 
45  int depth;
46  int nb_planes;
47  int linesize[4];
48  int height[4];
49 
52 
54 {
55  static const enum AVPixelFormat pixel_fmts[] = {
80  };
81  return ff_set_common_formats_from_list(ctx, pixel_fmts);
82 }
83 
85 {
86  AmplifyContext *s = ctx->priv;
87 
88  s->nb_inputs = s->radius * 2 + 1;
89 
90  s->frames = av_calloc(s->nb_inputs, sizeof(*s->frames));
91  if (!s->frames)
92  return AVERROR(ENOMEM);
93 
94  return 0;
95 }
96 
97 typedef struct ThreadData {
98  AVFrame **in, *out;
99 } ThreadData;
100 
101 static int amplify_frame(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
102 {
103  AmplifyContext *s = ctx->priv;
104  ThreadData *td = arg;
105  AVFrame **in = td->in;
106  AVFrame *out = td->out;
107  const int radius = s->radius;
108  const int nb_inputs = s->nb_inputs;
109  const float threshold = s->threshold;
110  const float tolerance = s->tolerance;
111  const float factor = s->factor;
112  const int llimit = s->llimit;
113  const int hlimit = s->hlimit;
114  const int depth = s->depth;
115  int i, p, x, y;
116 
117  if (s->depth <= 8) {
118  for (p = 0; p < s->nb_planes; p++) {
119  const int slice_start = (s->height[p] * jobnr) / nb_jobs;
120  const int slice_end = (s->height[p] * (jobnr+1)) / nb_jobs;
121  uint8_t *dst = out->data[p] + slice_start * out->linesize[p];
122 
123  if (!((1 << p) & s->planes)) {
124  av_image_copy_plane(dst, out->linesize[p],
125  in[radius]->data[p] + slice_start * in[radius]->linesize[p],
126  in[radius]->linesize[p],
127  s->linesize[p], slice_end - slice_start);
128  continue;
129  }
130 
131  for (y = slice_start; y < slice_end; y++) {
132  for (x = 0; x < s->linesize[p]; x++) {
133  int src = in[radius]->data[p][y * in[radius]->linesize[p] + x];
134  float diff, avg;
135  int sum = 0;
136 
137  for (i = 0; i < nb_inputs; i++) {
138  sum += in[i]->data[p][y * in[i]->linesize[p] + x];
139  }
140 
141  avg = sum / (float)nb_inputs;
142  diff = src - avg;
143  if (fabsf(diff) < threshold && fabsf(diff) > tolerance) {
144  int amp;
145  if (diff < 0) {
146  amp = -FFMIN(FFABS(diff * factor), llimit);
147  } else {
148  amp = FFMIN(FFABS(diff * factor), hlimit);
149  }
150  dst[x] = av_clip_uint8(src + amp);
151  } else {
152  dst[x] = src;
153  }
154  }
155 
156  dst += out->linesize[p];
157  }
158  }
159  } else {
160  for (p = 0; p < s->nb_planes; p++) {
161  const int slice_start = (s->height[p] * jobnr) / nb_jobs;
162  const int slice_end = (s->height[p] * (jobnr+1)) / nb_jobs;
163  uint16_t *dst = (uint16_t *)(out->data[p] + slice_start * out->linesize[p]);
164 
165  if (!((1 << p) & s->planes)) {
166  av_image_copy_plane((uint8_t *)dst, out->linesize[p],
167  in[radius]->data[p] + slice_start * in[radius]->linesize[p],
168  in[radius]->linesize[p],
169  s->linesize[p], slice_end - slice_start);
170  continue;
171  }
172 
173  for (y = slice_start; y < slice_end; y++) {
174  for (x = 0; x < s->linesize[p] / 2; x++) {
175  int src = AV_RN16(in[radius]->data[p] + y * in[radius]->linesize[p] + x * 2);
176  float diff, avg;
177  int sum = 0;
178 
179  for (i = 0; i < nb_inputs; i++) {
180  sum += AV_RN16(in[i]->data[p] + y * in[i]->linesize[p] + x * 2);
181  }
182 
183  avg = sum / (float)nb_inputs;
184  diff = src - avg;
185 
186  if (fabsf(diff) < threshold && fabsf(diff) > tolerance) {
187  int amp;
188  if (diff < 0) {
189  amp = -FFMIN(FFABS(diff * factor), llimit);
190  } else {
191  amp = FFMIN(FFABS(diff * factor), hlimit);
192  }
193  dst[x] = av_clip_uintp2_c(src + amp, depth);
194  } else {
195  dst[x] = src;
196  }
197  }
198 
199  dst += out->linesize[p] / 2;
200  }
201  }
202  }
203 
204  return 0;
205 }
206 
207 static int config_output(AVFilterLink *outlink)
208 {
209  AVFilterContext *ctx = outlink->src;
210  AmplifyContext *s = ctx->priv;
211  AVFilterLink *inlink = ctx->inputs[0];
212  int ret;
213 
214  s->desc = av_pix_fmt_desc_get(outlink->format);
215  if (!s->desc)
216  return AVERROR_BUG;
217  s->nb_planes = av_pix_fmt_count_planes(outlink->format);
218  s->depth = s->desc->comp[0].depth;
219 
220  if ((ret = av_image_fill_linesizes(s->linesize, inlink->format, inlink->w)) < 0)
221  return ret;
222 
223  s->height[1] = s->height[2] = AV_CEIL_RSHIFT(inlink->h, s->desc->log2_chroma_h);
224  s->height[0] = s->height[3] = inlink->h;
225 
226  return 0;
227 }
228 
230 {
231  AmplifyContext *s = ctx->priv;
232  int i;
233 
234  if (s->frames) {
235  for (i = 0; i < s->nb_frames; i++)
236  av_frame_free(&s->frames[i]);
237  }
238  av_freep(&s->frames);
239 }
240 
242 {
243  AVFilterContext *ctx = inlink->dst;
244  AVFilterLink *outlink = ctx->outputs[0];
245  AmplifyContext *s = ctx->priv;
246  ThreadData td;
247  AVFrame *out;
248 
249  if (s->nb_frames < s->nb_inputs) {
250  s->frames[s->nb_frames] = in;
251  s->nb_frames++;
252  return 0;
253  } else {
254  av_frame_free(&s->frames[0]);
255  memmove(&s->frames[0], &s->frames[1], sizeof(*s->frames) * (s->nb_inputs - 1));
256  s->frames[s->nb_inputs - 1] = in;
257  }
258 
259  if (!ctx->is_disabled) {
260  out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
261  if (!out)
262  return AVERROR(ENOMEM);
263  av_frame_copy_props(out, s->frames[0]);
264 
265  td.out = out;
266  td.in = s->frames;
268  FFMIN(s->height[1], ff_filter_get_nb_threads(ctx)));
269  } else {
270  out = av_frame_clone(s->frames[s->radius]);
271  if (!out)
272  return AVERROR(ENOMEM);
273  out->pts = s->frames[0]->pts;
274  }
275 
276  return ff_filter_frame(outlink, out);
277 }
278 
279 #define OFFSET(x) offsetof(AmplifyContext, x)
280 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM
281 #define VFT AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_RUNTIME_PARAM
282 
283 static const AVOption amplify_options[] = {
284  { "radius", "set radius", OFFSET(radius), AV_OPT_TYPE_INT, {.i64=2}, 1, 63, .flags = FLAGS },
285  { "factor", "set factor", OFFSET(factor), AV_OPT_TYPE_FLOAT, {.dbl=2}, 0, UINT16_MAX, .flags = VFT },
286  { "threshold", "set threshold", OFFSET(threshold), AV_OPT_TYPE_FLOAT, {.dbl=10}, 0, UINT16_MAX, .flags = VFT },
287  { "tolerance", "set tolerance", OFFSET(tolerance), AV_OPT_TYPE_FLOAT, {.dbl=0}, 0, UINT16_MAX, .flags = VFT },
288  { "low", "set low limit for amplification", OFFSET(llimit), AV_OPT_TYPE_INT, {.i64=UINT16_MAX}, 0, UINT16_MAX, .flags = VFT },
289  { "high", "set high limit for amplification", OFFSET(hlimit), AV_OPT_TYPE_INT, {.i64=UINT16_MAX}, 0, UINT16_MAX, .flags = VFT },
290  { "planes", "set what planes to filter", OFFSET(planes), AV_OPT_TYPE_FLAGS, {.i64=7}, 0, 15, VFT },
291  { NULL },
292 };
293 
294 static const AVFilterPad inputs[] = {
295  {
296  .name = "default",
297  .type = AVMEDIA_TYPE_VIDEO,
298  .filter_frame = filter_frame,
299  },
300 };
301 
302 static const AVFilterPad outputs[] = {
303  {
304  .name = "default",
305  .type = AVMEDIA_TYPE_VIDEO,
306  .config_props = config_output,
307  },
308 };
309 
310 AVFILTER_DEFINE_CLASS(amplify);
311 
313  .name = "amplify",
314  .description = NULL_IF_CONFIG_SMALL("Amplify changes between successive video frames."),
315  .priv_size = sizeof(AmplifyContext),
316  .priv_class = &amplify_class,
320  .init = init,
321  .uninit = uninit,
323  .process_command = ff_filter_process_command,
324 };
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:432
AV_PIX_FMT_GBRAP16
#define AV_PIX_FMT_GBRAP16
Definition: pixfmt.h:411
td
#define td
Definition: regdef.h:70
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
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:1019
av_pix_fmt_desc_get
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2540
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: vf_amplify.c:53
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_amplify.c:229
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
ff_vf_amplify
const AVFilter ff_vf_amplify
Definition: vf_amplify.c:312
AV_RN16
#define AV_RN16(p)
Definition: intreadwrite.h:360
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
AV_PIX_FMT_YUVA422P9
#define AV_PIX_FMT_YUVA422P9
Definition: pixfmt.h:424
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:303
AVFILTER_DEFINE_CLASS
AVFILTER_DEFINE_CLASS(amplify)
pixdesc.h
av_clip_uintp2_c
static av_always_inline av_const unsigned av_clip_uintp2_c(int a, int p)
Clip a signed integer to an unsigned power of two range.
Definition: common.h:276
AV_PIX_FMT_YUVA420P16
#define AV_PIX_FMT_YUVA420P16
Definition: pixfmt.h:431
AV_PIX_FMT_YUVA420P10
#define AV_PIX_FMT_YUVA420P10
Definition: pixfmt.h:426
AVOption
AVOption.
Definition: opt.h:247
data
const char data[16]
Definition: mxf.c:143
FLAGS
#define FLAGS
Definition: vf_amplify.c:280
AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:389
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_amplify.c:241
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
AVFilter::name
const char * name
Filter name.
Definition: avfilter.h:153
ThreadData::out
AVFrame * out
Definition: af_adeclick.c:492
AmplifyContext::nb_frames
int nb_frames
Definition: vf_amplify.c:43
video.h
AV_PIX_FMT_YUVA422P10
#define AV_PIX_FMT_YUVA422P10
Definition: pixfmt.h:427
AV_PIX_FMT_GRAY9
#define AV_PIX_FMT_GRAY9
Definition: pixfmt.h:369
AVFrame::data
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:317
AmplifyContext::llimit
int llimit
Definition: vf_amplify.c:40
AmplifyContext::nb_planes
int nb_planes
Definition: vf_amplify.c:46
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
formats.h
AmplifyContext::tolerance
float tolerance
Definition: vf_amplify.c:37
av_pix_fmt_count_planes
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2580
AV_PIX_FMT_YUVA420P9
#define AV_PIX_FMT_YUVA420P9
Definition: pixfmt.h:423
AV_PIX_FMT_GBRP14
#define AV_PIX_FMT_GBRP14
Definition: pixfmt.h:407
AV_PIX_FMT_GBRAP
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
Definition: pixfmt.h:205
AmplifyContext
Definition: vf_amplify.c:31
AV_PIX_FMT_GBRP10
#define AV_PIX_FMT_GBRP10
Definition: pixfmt.h:405
AV_PIX_FMT_YUVA444P16
#define AV_PIX_FMT_YUVA444P16
Definition: pixfmt.h:433
AV_PIX_FMT_YUV422P9
#define AV_PIX_FMT_YUV422P9
Definition: pixfmt.h:387
AV_PIX_FMT_GRAY16
#define AV_PIX_FMT_GRAY16
Definition: pixfmt.h:373
ThreadData::in
AVFrame ** in
Definition: vf_amplify.c:98
fabsf
static __device__ float fabsf(float a)
Definition: cuda_runtime.h:181
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:392
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
planes
static const struct @318 planes[]
AmplifyContext::linesize
int linesize[4]
Definition: vf_amplify.c:47
av_cold
#define av_cold
Definition: attributes.h:90
AV_PIX_FMT_YUV422P16
#define AV_PIX_FMT_YUV422P16
Definition: pixfmt.h:401
VFT
#define VFT
Definition: vf_amplify.c:281
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:409
av_image_fill_linesizes
int av_image_fill_linesizes(int linesizes[4], enum AVPixelFormat pix_fmt, int width)
Fill plane linesizes for an image with pixel format pix_fmt and width width.
Definition: imgutils.c:89
intreadwrite.h
s
#define s(width, name)
Definition: cbs_vp9.c:257
AV_PIX_FMT_GBRAP12
#define AV_PIX_FMT_GBRAP12
Definition: pixfmt.h:410
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:402
AV_CEIL_RSHIFT
#define AV_CEIL_RSHIFT(a, b)
Definition: common.h:51
slice_end
static int slice_end(AVCodecContext *avctx, AVFrame *pict)
Handle slice ends.
Definition: mpeg12dec.c:2041
ff_set_common_formats_from_list
int ff_set_common_formats_from_list(AVFilterContext *ctx, const int *fmts)
Equivalent to ff_set_common_formats(ctx, ff_make_format_list(fmts))
Definition: formats.c:703
AmplifyContext::height
int height[4]
Definition: vf_amplify.c:48
AV_PIX_FMT_YUVA444P12
#define AV_PIX_FMT_YUVA444P12
Definition: pixfmt.h:430
AV_PIX_FMT_YUV420P9
#define AV_PIX_FMT_YUV420P9
Definition: pixfmt.h:386
AV_PIX_FMT_YUV420P16
#define AV_PIX_FMT_YUV420P16
Definition: pixfmt.h:400
ctx
AVFormatContext * ctx
Definition: movenc.c:48
AV_PIX_FMT_GRAY14
#define AV_PIX_FMT_GRAY14
Definition: pixfmt.h:372
av_frame_clone
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
Definition: frame.c:424
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
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:152
OFFSET
#define OFFSET(x)
Definition: vf_amplify.c:279
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
FFABS
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
Definition: common.h:65
AV_PIX_FMT_GRAY10
#define AV_PIX_FMT_GRAY10
Definition: pixfmt.h:370
AV_PIX_FMT_GBRP16
#define AV_PIX_FMT_GBRP16
Definition: pixfmt.h:408
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
src
#define src
Definition: vp8dsp.c:255
AV_PIX_FMT_YUV440P10
#define AV_PIX_FMT_YUV440P10
Definition: pixfmt.h:391
AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_YUV422P10
Definition: pixfmt.h:390
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:404
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
AmplifyContext::planes
int planes
Definition: vf_amplify.c:38
AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_YUV422P12
Definition: pixfmt.h:394
inputs
static const AVFilterPad inputs[]
Definition: vf_amplify.c:294
AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV444P12
Definition: pixfmt.h:396
AmplifyContext::hlimit
int hlimit
Definition: vf_amplify.c:41
avg
#define avg(a, b, c, d)
Definition: colorspacedsp_template.c:28
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:883
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:428
amplify_options
static const AVOption amplify_options[]
Definition: vf_amplify.c:283
internal.h
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Definition: opt.h:227
AmplifyContext::radius
int radius
Definition: vf_amplify.c:34
i
int i
Definition: input.c:406
AmplifyContext::desc
const AVPixFmtDescriptor * desc
Definition: vf_amplify.c:33
outputs
static const AVFilterPad outputs[]
Definition: vf_amplify.c:302
AV_PIX_FMT_GBRP12
#define AV_PIX_FMT_GBRP12
Definition: pixfmt.h:406
ff_filter_get_nb_threads
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
Definition: avfilter.c:804
ThreadData
Used for passing data between threads.
Definition: dsddec.c:67
init
static av_cold int init(AVFilterContext *ctx)
Definition: vf_amplify.c:84
AmplifyContext::factor
float factor
Definition: vf_amplify.c:35
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:100
AmplifyContext::nb_inputs
int nb_inputs
Definition: vf_amplify.c:42
AVFilterPad::name
const char * name
Pad name.
Definition: internal.h:56
config_output
static int config_output(AVFilterLink *outlink)
Definition: vf_amplify.c:207
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:388
AVFilter
Filter definition.
Definition: avfilter.h:149
AmplifyContext::frames
AVFrame ** frames
Definition: vf_amplify.c:50
ret
ret
Definition: filter_design.txt:187
AV_PIX_FMT_YUVA444P9
#define AV_PIX_FMT_YUVA444P9
Definition: pixfmt.h:425
AV_PIX_FMT_YUV420P12
#define AV_PIX_FMT_YUV420P12
Definition: pixfmt.h:393
AmplifyContext::depth
int depth
Definition: vf_amplify.c:45
AV_PIX_FMT_YUV422P14
#define AV_PIX_FMT_YUV422P14
Definition: pixfmt.h:398
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:65
AV_PIX_FMT_YUVA422P12
#define AV_PIX_FMT_YUVA422P12
Definition: pixfmt.h:429
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:224
avfilter.h
av_clip_uint8
#define av_clip_uint8
Definition: common.h:102
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
AVFilterContext
An instance of a filter.
Definition: avfilter.h:346
factor
static const int factor[16]
Definition: vf_pp7.c:76
AV_PIX_FMT_GBRP
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
Definition: pixfmt.h:158
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:121
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
AVPixFmtDescriptor
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:69
diff
static av_always_inline int diff(const uint32_t a, const uint32_t b)
Definition: vf_palettegen.c:136
amplify_frame
static int amplify_frame(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: vf_amplify.c:101
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:153
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
AV_OPT_TYPE_FLAGS
@ AV_OPT_TYPE_FLAGS
Definition: opt.h:223
AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL
#define AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL
Same as AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, except that the filter will have its filter_frame() c...
Definition: avfilter.h:138
imgutils.h
AVERROR_BUG
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
Definition: error.h:52
AVFrame::linesize
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Definition: frame.h:334
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:395
AV_PIX_FMT_YUV444P14
#define AV_PIX_FMT_YUV444P14
Definition: pixfmt.h:399
AV_PIX_FMT_GRAY12
#define AV_PIX_FMT_GRAY12
Definition: pixfmt.h:371
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:143
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:397
AmplifyContext::threshold
float threshold
Definition: vf_amplify.c:36