FFmpeg
vf_displace.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 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/pixdesc.h"
23 #include "libavutil/opt.h"
24 #include "avfilter.h"
25 #include "formats.h"
26 #include "framesync.h"
27 #include "internal.h"
28 #include "video.h"
29 
30 enum EdgeMode {
36 };
37 
38 typedef struct DisplaceContext {
39  const AVClass *class;
40  int width[4], height[4];
41  enum EdgeMode edge;
42  int nb_planes;
44  int step;
45  uint8_t blank[4];
47 
48  void (*displace)(struct DisplaceContext *s, const AVFrame *in,
49  const AVFrame *xpic, const AVFrame *ypic, AVFrame *out);
51 
52 #define OFFSET(x) offsetof(DisplaceContext, x)
53 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
54 
55 static const AVOption displace_options[] = {
56  { "edge", "set edge mode", OFFSET(edge), AV_OPT_TYPE_INT, {.i64=EDGE_SMEAR}, 0, EDGE_NB-1, FLAGS, "edge" },
57  { "blank", "", 0, AV_OPT_TYPE_CONST, {.i64=EDGE_BLANK}, 0, 0, FLAGS, "edge" },
58  { "smear", "", 0, AV_OPT_TYPE_CONST, {.i64=EDGE_SMEAR}, 0, 0, FLAGS, "edge" },
59  { "wrap" , "", 0, AV_OPT_TYPE_CONST, {.i64=EDGE_WRAP}, 0, 0, FLAGS, "edge" },
60  { "mirror" , "", 0, AV_OPT_TYPE_CONST, {.i64=EDGE_MIRROR}, 0, 0, FLAGS, "edge" },
61  { NULL }
62 };
63 
65 
66 static const enum AVPixelFormat pix_fmts[] = {
77 };
78 
79 static void displace_planar(DisplaceContext *s, const AVFrame *in,
80  const AVFrame *xpic, const AVFrame *ypic,
81  AVFrame *out)
82 {
83  int plane, x, y;
84 
85  for (plane = 0; plane < s->nb_planes; plane++) {
86  const int h = s->height[plane];
87  const int w = s->width[plane];
88  const int dlinesize = out->linesize[plane];
89  const int slinesize = in->linesize[plane];
90  const int xlinesize = xpic->linesize[plane];
91  const int ylinesize = ypic->linesize[plane];
92  const uint8_t *src = in->data[plane];
93  const uint8_t *ysrc = ypic->data[plane];
94  const uint8_t *xsrc = xpic->data[plane];
95  uint8_t *dst = out->data[plane];
96  const uint8_t blank = s->blank[plane];
97 
98  for (y = 0; y < h; y++) {
99  switch (s->edge) {
100  case EDGE_BLANK:
101  for (x = 0; x < w; x++) {
102  int Y = y + ysrc[x] - 128;
103  int X = x + xsrc[x] - 128;
104 
105  if (Y < 0 || Y >= h || X < 0 || X >= w)
106  dst[x] = blank;
107  else
108  dst[x] = src[Y * slinesize + X];
109  }
110  break;
111  case EDGE_SMEAR:
112  for (x = 0; x < w; x++) {
113  int Y = av_clip(y + ysrc[x] - 128, 0, h - 1);
114  int X = av_clip(x + xsrc[x] - 128, 0, w - 1);
115  dst[x] = src[Y * slinesize + X];
116  }
117  break;
118  case EDGE_WRAP:
119  for (x = 0; x < w; x++) {
120  int Y = (y + ysrc[x] - 128) % h;
121  int X = (x + xsrc[x] - 128) % w;
122 
123  if (Y < 0)
124  Y += h;
125  if (X < 0)
126  X += w;
127  dst[x] = src[Y * slinesize + X];
128  }
129  break;
130  case EDGE_MIRROR:
131  for (x = 0; x < w; x++) {
132  int Y = y + ysrc[x] - 128;
133  int X = x + xsrc[x] - 128;
134 
135  if (Y < 0)
136  Y = (-Y) % h;
137  if (X < 0)
138  X = (-X) % w;
139  if (Y >= h)
140  Y = h - (Y % h) - 1;
141  if (X >= w)
142  X = w - (X % w) - 1;
143  dst[x] = src[Y * slinesize + X];
144  }
145  break;
146  }
147 
148  ysrc += ylinesize;
149  xsrc += xlinesize;
150  dst += dlinesize;
151  }
152  }
153 }
154 
155 static void displace_packed(DisplaceContext *s, const AVFrame *in,
156  const AVFrame *xpic, const AVFrame *ypic,
157  AVFrame *out)
158 {
159  const int step = s->step;
160  const int h = s->height[0];
161  const int w = s->width[0];
162  const int dlinesize = out->linesize[0];
163  const int slinesize = in->linesize[0];
164  const int xlinesize = xpic->linesize[0];
165  const int ylinesize = ypic->linesize[0];
166  const uint8_t *src = in->data[0];
167  const uint8_t *ysrc = ypic->data[0];
168  const uint8_t *xsrc = xpic->data[0];
169  const uint8_t *blank = s->blank;
170  uint8_t *dst = out->data[0];
171  int c, x, y;
172 
173  for (y = 0; y < h; y++) {
174  switch (s->edge) {
175  case EDGE_BLANK:
176  for (x = 0; x < w; x++) {
177  for (c = 0; c < s->nb_components; c++) {
178  int Y = y + (ysrc[x * step + c] - 128);
179  int X = x + (xsrc[x * step + c] - 128);
180 
181  if (Y < 0 || Y >= h || X < 0 || X >= w)
182  dst[x * step + c] = blank[c];
183  else
184  dst[x * step + c] = src[Y * slinesize + X * step + c];
185  }
186  }
187  break;
188  case EDGE_SMEAR:
189  for (x = 0; x < w; x++) {
190  for (c = 0; c < s->nb_components; c++) {
191  int Y = av_clip(y + (ysrc[x * step + c] - 128), 0, h - 1);
192  int X = av_clip(x + (xsrc[x * step + c] - 128), 0, w - 1);
193 
194  dst[x * step + c] = src[Y * slinesize + X * step + c];
195  }
196  }
197  break;
198  case EDGE_WRAP:
199  for (x = 0; x < w; x++) {
200  for (c = 0; c < s->nb_components; c++) {
201  int Y = (y + (ysrc[x * step + c] - 128)) % h;
202  int X = (x + (xsrc[x * step + c] - 128)) % w;
203 
204  if (Y < 0)
205  Y += h;
206  if (X < 0)
207  X += w;
208  dst[x * step + c] = src[Y * slinesize + X * step + c];
209  }
210  }
211  break;
212  case EDGE_MIRROR:
213  for (x = 0; x < w; x++) {
214  for (c = 0; c < s->nb_components; c++) {
215  int Y = y + ysrc[x * step + c] - 128;
216  int X = x + xsrc[x * step + c] - 128;
217 
218  if (Y < 0)
219  Y = (-Y) % h;
220  if (X < 0)
221  X = (-X) % w;
222  if (Y >= h)
223  Y = h - (Y % h) - 1;
224  if (X >= w)
225  X = w - (X % w) - 1;
226  dst[x * step + c] = src[Y * slinesize + X * step + c];
227  }
228  }
229  break;
230  }
231 
232  ysrc += ylinesize;
233  xsrc += xlinesize;
234  dst += dlinesize;
235  }
236 }
237 
239 {
240  AVFilterContext *ctx = fs->parent;
241  DisplaceContext *s = fs->opaque;
242  AVFilterLink *outlink = ctx->outputs[0];
243  AVFrame *out, *in, *xpic, *ypic;
244  int ret;
245 
246  if ((ret = ff_framesync_get_frame(&s->fs, 0, &in, 0)) < 0 ||
247  (ret = ff_framesync_get_frame(&s->fs, 1, &xpic, 0)) < 0 ||
248  (ret = ff_framesync_get_frame(&s->fs, 2, &ypic, 0)) < 0)
249  return ret;
250 
251  if (ctx->is_disabled) {
252  out = av_frame_clone(in);
253  if (!out)
254  return AVERROR(ENOMEM);
255  } else {
256  out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
257  if (!out)
258  return AVERROR(ENOMEM);
260 
261  s->displace(s, in, xpic, ypic, out);
262  }
263  out->pts = av_rescale_q(s->fs.pts, s->fs.time_base, outlink->time_base);
264 
265  return ff_filter_frame(outlink, out);
266 }
267 
269 {
270  AVFilterContext *ctx = inlink->dst;
271  DisplaceContext *s = ctx->priv;
273  int vsub, hsub;
274 
275  s->nb_planes = av_pix_fmt_count_planes(inlink->format);
276  s->nb_components = desc->nb_components;
277 
278  if (s->nb_planes > 1 || s->nb_components == 1)
279  s->displace = displace_planar;
280  else
281  s->displace = displace_packed;
282 
283  if (!(desc->flags & AV_PIX_FMT_FLAG_RGB)) {
284  s->blank[1] = s->blank[2] = 128;
285  s->blank[0] = 16;
286  }
287 
288  s->step = av_get_padded_bits_per_pixel(desc) >> 3;
289  hsub = desc->log2_chroma_w;
290  vsub = desc->log2_chroma_h;
291  s->height[1] = s->height[2] = AV_CEIL_RSHIFT(inlink->h, vsub);
292  s->height[0] = s->height[3] = inlink->h;
293  s->width[1] = s->width[2] = AV_CEIL_RSHIFT(inlink->w, hsub);
294  s->width[0] = s->width[3] = inlink->w;
295 
296  return 0;
297 }
298 
299 static int config_output(AVFilterLink *outlink)
300 {
301  AVFilterContext *ctx = outlink->src;
302  DisplaceContext *s = ctx->priv;
303  AVFilterLink *srclink = ctx->inputs[0];
304  AVFilterLink *xlink = ctx->inputs[1];
305  AVFilterLink *ylink = ctx->inputs[2];
306  FFFrameSyncIn *in;
307  int ret;
308 
309  if (srclink->w != xlink->w ||
310  srclink->h != xlink->h ||
311  srclink->w != ylink->w ||
312  srclink->h != ylink->h) {
313  av_log(ctx, AV_LOG_ERROR, "First input link %s parameters "
314  "(size %dx%d) do not match the corresponding "
315  "second input link %s parameters (%dx%d) "
316  "and/or third input link %s parameters (%dx%d)\n",
317  ctx->input_pads[0].name, srclink->w, srclink->h,
318  ctx->input_pads[1].name, xlink->w, xlink->h,
319  ctx->input_pads[2].name, ylink->w, ylink->h);
320  return AVERROR(EINVAL);
321  }
322 
323  outlink->w = srclink->w;
324  outlink->h = srclink->h;
325  outlink->sample_aspect_ratio = srclink->sample_aspect_ratio;
326  outlink->frame_rate = srclink->frame_rate;
327 
328  ret = ff_framesync_init(&s->fs, ctx, 3);
329  if (ret < 0)
330  return ret;
331 
332  in = s->fs.in;
333  in[0].time_base = srclink->time_base;
334  in[1].time_base = xlink->time_base;
335  in[2].time_base = ylink->time_base;
336  in[0].sync = 2;
337  in[0].before = EXT_STOP;
338  in[0].after = EXT_STOP;
339  in[1].sync = 1;
340  in[1].before = EXT_NULL;
341  in[1].after = EXT_INFINITY;
342  in[2].sync = 1;
343  in[2].before = EXT_NULL;
344  in[2].after = EXT_INFINITY;
345  s->fs.opaque = s;
346  s->fs.on_event = process_frame;
347 
348  ret = ff_framesync_configure(&s->fs);
349  outlink->time_base = s->fs.time_base;
350 
351  return ret;
352 }
353 
355 {
356  DisplaceContext *s = ctx->priv;
357  return ff_framesync_activate(&s->fs);
358 }
359 
361 {
362  DisplaceContext *s = ctx->priv;
363 
364  ff_framesync_uninit(&s->fs);
365 }
366 
367 static const AVFilterPad displace_inputs[] = {
368  {
369  .name = "source",
370  .type = AVMEDIA_TYPE_VIDEO,
371  .config_props = config_input,
372  },
373  {
374  .name = "xmap",
375  .type = AVMEDIA_TYPE_VIDEO,
376  },
377  {
378  .name = "ymap",
379  .type = AVMEDIA_TYPE_VIDEO,
380  },
381 };
382 
383 static const AVFilterPad displace_outputs[] = {
384  {
385  .name = "default",
386  .type = AVMEDIA_TYPE_VIDEO,
387  .config_props = config_output,
388  },
389 };
390 
392  .name = "displace",
393  .description = NULL_IF_CONFIG_SMALL("Displace pixels."),
394  .priv_size = sizeof(DisplaceContext),
395  .uninit = uninit,
396  .activate = activate,
400  .priv_class = &displace_class,
402 };
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
displace_packed
static void displace_packed(DisplaceContext *s, const AVFrame *in, const AVFrame *xpic, const AVFrame *ypic, AVFrame *out)
Definition: vf_displace.c:155
FFFrameSyncIn::time_base
AVRational time_base
Time base for the incoming frames.
Definition: framesync.h:96
ff_framesync_configure
int ff_framesync_configure(FFFrameSync *fs)
Configure a frame sync structure.
Definition: framesync.c:119
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
av_clip
#define av_clip
Definition: common.h:96
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
ff_framesync_uninit
void ff_framesync_uninit(FFFrameSync *fs)
Free all memory currently allocated.
Definition: framesync.c:285
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:2660
ff_framesync_get_frame
int ff_framesync_get_frame(FFFrameSync *fs, unsigned in, AVFrame **rframe, unsigned get)
Get the current frame in an input.
Definition: framesync.c:248
FILTER_PIXFMTS_ARRAY
#define FILTER_PIXFMTS_ARRAY(array)
Definition: internal.h:171
X
@ X
Definition: vf_addroi.c:26
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
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:317
pixdesc.h
step
trying all byte sequences megabyte in length and selecting the best looking sequence will yield cases to try But a word about which is also called distortion Distortion can be quantified by almost any quality measurement one chooses the sum of squared differences is used but more complex methods that consider psychovisual effects can be used as well It makes no difference in this discussion First step
Definition: rate_distortion.txt:58
w
uint8_t w
Definition: llviddspenc.c:38
AVOption
AVOption.
Definition: opt.h:247
AV_PIX_FMT_BGR24
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
Definition: pixfmt.h:69
AV_PIX_FMT_BGRA
@ AV_PIX_FMT_BGRA
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
Definition: pixfmt.h:95
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:169
FFFrameSync
Frame sync structure.
Definition: framesync.h:146
EXT_INFINITY
@ EXT_INFINITY
Extend the frame to infinity.
Definition: framesync.h:75
DisplaceContext::nb_planes
int nb_planes
Definition: vf_displace.c:42
video.h
AVFrame::data
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:338
hsub
static void hsub(htype *dst, const htype *src, int bins)
Definition: vf_median.c:74
formats.h
av_pix_fmt_count_planes
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2700
EXT_STOP
@ EXT_STOP
Completely stop all streams with this one.
Definition: framesync.h:65
AV_PIX_FMT_GBRAP
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
Definition: pixfmt.h:205
FFFrameSyncIn
Input stream structure.
Definition: framesync.h:81
EXT_NULL
@ EXT_NULL
Ignore this stream and continue processing the other ones.
Definition: framesync.h:70
DisplaceContext
Definition: vf_displace.c:38
FFFrameSyncIn::sync
unsigned sync
Synchronization level: frames on input at the highest sync level will generate output frame events.
Definition: framesync.h:139
AVFILTER_DEFINE_CLASS
AVFILTER_DEFINE_CLASS(displace)
DisplaceContext::edge
enum EdgeMode edge
Definition: vf_displace.c:41
AVFilterPad
A filter pad used for either input or output.
Definition: internal.h:50
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_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
av_cold
#define av_cold
Definition: attributes.h:90
DisplaceContext::fs
FFFrameSync fs
Definition: vf_displace.c:46
DisplaceContext::displace
void(* displace)(struct DisplaceContext *s, const AVFrame *in, const AVFrame *xpic, const AVFrame *ypic, AVFrame *out)
Definition: vf_displace.c:48
displace_options
static const AVOption displace_options[]
Definition: vf_displace.c:55
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
s
#define s(width, name)
Definition: cbs_vp9.c:257
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_CEIL_RSHIFT
#define AV_CEIL_RSHIFT(a, b)
Definition: common.h:51
DisplaceContext::blank
uint8_t blank[4]
Definition: vf_displace.c:45
ctx
AVFormatContext * ctx
Definition: movenc.c:48
av_frame_clone
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
Definition: frame.c:422
av_rescale_q
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
Definition: mathematics.c:141
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
displace_inputs
static const AVFilterPad displace_inputs[]
Definition: vf_displace.c:367
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:191
AV_PIX_FMT_RGBA
@ AV_PIX_FMT_RGBA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
Definition: pixfmt.h:93
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
pix_fmts
static enum AVPixelFormat pix_fmts[]
Definition: vf_displace.c:66
ff_vf_displace
const AVFilter ff_vf_displace
Definition: vf_displace.c:391
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
DisplaceContext::step
int step
Definition: vf_displace.c:44
fs
#define fs(width, name, subs,...)
Definition: cbs_vp9.c:259
displace_outputs
static const AVFilterPad displace_outputs[]
Definition: vf_displace.c:383
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
displace_planar
static void displace_planar(DisplaceContext *s, const AVFrame *in, const AVFrame *xpic, const AVFrame *ypic, AVFrame *out)
Definition: vf_displace.c:79
EDGE_MIRROR
@ EDGE_MIRROR
Definition: vf_displace.c:34
src
#define src
Definition: vp8dsp.c:255
activate
static int activate(AVFilterContext *ctx)
Definition: vf_displace.c:354
config_input
static int config_input(AVFilterLink *inlink)
Definition: vf_displace.c:268
EDGE_SMEAR
@ EDGE_SMEAR
Definition: vf_displace.c:32
AV_PIX_FMT_BGR0
@ AV_PIX_FMT_BGR0
packed BGR 8:8:8, 32bpp, BGRXBGRX... X=unused/undefined
Definition: pixfmt.h:230
AV_PIX_FMT_GRAY8
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition: pixfmt.h:74
AV_PIX_FMT_ABGR
@ AV_PIX_FMT_ABGR
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
Definition: pixfmt.h:94
EDGE_NB
@ EDGE_NB
Definition: vf_displace.c:35
c
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
Definition: undefined.txt:32
FLAGS
#define FLAGS
Definition: vf_displace.c:53
AV_PIX_FMT_RGB24
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
Definition: pixfmt.h:68
DisplaceContext::nb_components
int nb_components
Definition: vf_displace.c:43
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_get_padded_bits_per_pixel
int av_get_padded_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
Return the number of bits per pixel for the pixel format described by pixdesc, including any padding ...
Definition: pixdesc.c:2625
AV_PIX_FMT_FLAG_RGB
#define AV_PIX_FMT_FLAG_RGB
The pixel format contains RGB-like data (as opposed to YUV/grayscale).
Definition: pixdesc.h:136
EDGE_WRAP
@ EDGE_WRAP
Definition: vf_displace.c:33
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_RGB0
@ AV_PIX_FMT_RGB0
packed RGB 8:8:8, 32bpp, RGBXRGBX... X=unused/undefined
Definition: pixfmt.h:228
Y
#define Y
Definition: boxblur.h:37
internal.h
AV_PIX_FMT_ARGB
@ AV_PIX_FMT_ARGB
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
Definition: pixfmt.h:92
process_frame
static int process_frame(FFFrameSync *fs)
Definition: vf_displace.c:238
config_output
static int config_output(AVFilterLink *outlink)
Definition: vf_displace.c:299
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
EDGE_BLANK
@ EDGE_BLANK
Definition: vf_displace.c:31
AVFilterPad::name
const char * name
Pad name.
Definition: internal.h:56
AVFilter
Filter definition.
Definition: avfilter.h:165
ret
ret
Definition: filter_design.txt:187
AV_PIX_FMT_0BGR
@ AV_PIX_FMT_0BGR
packed BGR 8:8:8, 32bpp, XBGRXBGR... X=unused/undefined
Definition: pixfmt.h:229
ff_framesync_init
int ff_framesync_init(FFFrameSync *fs, AVFilterContext *parent, unsigned nb_in)
Initialize a frame sync structure.
Definition: framesync.c:79
FFFrameSyncIn::before
enum FFFrameSyncExtMode before
Extrapolation mode for timestamps before the first frame.
Definition: framesync.h:86
framesync.h
EdgeMode
EdgeMode
Definition: vf_displace.c:30
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:65
DisplaceContext::width
int width[4]
Definition: vf_displace.c:40
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:224
avfilter.h
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:402
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
OFFSET
#define OFFSET(x)
Definition: vf_displace.c:52
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
DisplaceContext::height
int height[4]
Definition: vf_displace.c:40
AVPixFmtDescriptor
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:69
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:192
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
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:154
imgutils.h
AVFrame::linesize
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
Definition: frame.h:362
AV_PIX_FMT_0RGB
@ AV_PIX_FMT_0RGB
packed RGB 8:8:8, 32bpp, XRGBXRGB... X=unused/undefined
Definition: pixfmt.h:227
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_log
#define av_log(a,...)
Definition: tableprint_vlc.h:28
FFFrameSyncIn::after
enum FFFrameSyncExtMode after
Extrapolation mode for timestamps after the last frame.
Definition: framesync.h:91
h
h
Definition: vp9dsp_template.c:2038
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_displace.c:360
ff_framesync_activate
int ff_framesync_activate(FFFrameSync *fs)
Examine the frames in the filter's input and try to produce output.
Definition: framesync.c:336
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:233
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