FFmpeg
vf_zoompan.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/eval.h"
22 #include "libavutil/opt.h"
23 #include "libavutil/pixdesc.h"
24 #include "avfilter.h"
25 #include "filters.h"
26 #include "internal.h"
27 #include "video.h"
28 #include "libswscale/swscale.h"
29 
30 static const char *const var_names[] = {
31  "in_w", "iw",
32  "in_h", "ih",
33  "out_w", "ow",
34  "out_h", "oh",
35  "in",
36  "on",
37  "duration",
38  "pduration",
39  "in_time", "it",
40  "out_time", "time", "ot",
41  "frame",
42  "zoom",
43  "pzoom",
44  "x", "px",
45  "y", "py",
46  "a",
47  "sar",
48  "dar",
49  "hsub",
50  "vsub",
51  NULL
52 };
53 
54 enum var_name {
76 };
77 
78 typedef struct ZPcontext {
79  const AVClass *class;
81  char *x_expr_str;
82  char *y_expr_str;
84 
86 
87  int w, h;
88  double x, y;
89  double prev_zoom;
91  struct SwsContext *sws;
92  int64_t frame_count;
96  int nb_frames;
98  int finished;
100 } ZPContext;
101 
102 #define OFFSET(x) offsetof(ZPContext, x)
103 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
104 static const AVOption zoompan_options[] = {
105  { "zoom", "set the zoom expression", OFFSET(zoom_expr_str), AV_OPT_TYPE_STRING, {.str = "1" }, .flags = FLAGS },
106  { "z", "set the zoom expression", OFFSET(zoom_expr_str), AV_OPT_TYPE_STRING, {.str = "1" }, .flags = FLAGS },
107  { "x", "set the x expression", OFFSET(x_expr_str), AV_OPT_TYPE_STRING, {.str="0"}, .flags = FLAGS },
108  { "y", "set the y expression", OFFSET(y_expr_str), AV_OPT_TYPE_STRING, {.str="0"}, .flags = FLAGS },
109  { "d", "set the duration expression", OFFSET(duration_expr_str), AV_OPT_TYPE_STRING, {.str="90"}, .flags = FLAGS },
110  { "s", "set the output image size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str="hd720"}, .flags = FLAGS },
111  { "fps", "set the output framerate", OFFSET(framerate), AV_OPT_TYPE_VIDEO_RATE, { .str = "25" }, 0, INT_MAX, .flags = FLAGS },
112  { NULL }
113 };
114 
115 AVFILTER_DEFINE_CLASS(zoompan);
116 
118 {
119  ZPContext *s = ctx->priv;
120 
121  s->prev_zoom = 1;
122  return 0;
123 }
124 
125 static int config_output(AVFilterLink *outlink)
126 {
127  AVFilterContext *ctx = outlink->src;
128  ZPContext *s = ctx->priv;
129  int ret;
130 
131  outlink->w = s->w;
132  outlink->h = s->h;
133  outlink->time_base = av_inv_q(s->framerate);
134  outlink->frame_rate = s->framerate;
135  s->desc = av_pix_fmt_desc_get(outlink->format);
136  s->finished = 1;
137 
138  ret = av_expr_parse(&s->zoom_expr, s->zoom_expr_str, var_names, NULL, NULL, NULL, NULL, 0, ctx);
139  if (ret < 0)
140  return ret;
141 
142  ret = av_expr_parse(&s->x_expr, s->x_expr_str, var_names, NULL, NULL, NULL, NULL, 0, ctx);
143  if (ret < 0)
144  return ret;
145 
146  ret = av_expr_parse(&s->y_expr, s->y_expr_str, var_names, NULL, NULL, NULL, NULL, 0, ctx);
147  if (ret < 0)
148  return ret;
149 
150  return 0;
151 }
152 
153 static int output_single_frame(AVFilterContext *ctx, AVFrame *in, double *var_values, int i,
154  double *zoom, double *dx, double *dy)
155 {
156  ZPContext *s = ctx->priv;
157  AVFilterLink *outlink = ctx->outputs[0];
158  AVFilterLink *inlink = ctx->inputs[0];
159  int64_t pts = s->frame_count;
160  int k, x, y, w, h, ret = 0;
161  uint8_t *input[4];
162  int px[4], py[4];
163  AVFrame *out;
164 
165  var_values[VAR_PX] = s->x;
166  var_values[VAR_PY] = s->y;
167  var_values[VAR_PZOOM] = s->prev_zoom;
168  var_values[VAR_PDURATION] = s->prev_nb_frames;
169  var_values[VAR_IN_TIME] = var_values[VAR_IT] = in->pts == AV_NOPTS_VALUE ?
170  NAN : in->pts * av_q2d(inlink->time_base);
171  var_values[VAR_OUT_TIME] = pts * av_q2d(outlink->time_base);
172  var_values[VAR_TIME] = var_values[VAR_OT] = var_values[VAR_OUT_TIME];
173  var_values[VAR_FRAME] = i;
174  var_values[VAR_ON] = outlink->frame_count_in;
175 
176  *zoom = av_expr_eval(s->zoom_expr, var_values, NULL);
177 
178  *zoom = av_clipd(*zoom, 1, 10);
179  var_values[VAR_ZOOM] = *zoom;
180  w = in->width * (1.0 / *zoom);
181  h = in->height * (1.0 / *zoom);
182 
183  *dx = av_expr_eval(s->x_expr, var_values, NULL);
184 
185  x = *dx = av_clipd(*dx, 0, FFMAX(in->width - w, 0));
186  var_values[VAR_X] = *dx;
187  x &= ~((1 << s->desc->log2_chroma_w) - 1);
188 
189  *dy = av_expr_eval(s->y_expr, var_values, NULL);
190 
191  y = *dy = av_clipd(*dy, 0, FFMAX(in->height - h, 0));
192  var_values[VAR_Y] = *dy;
193  y &= ~((1 << s->desc->log2_chroma_h) - 1);
194 
195  out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
196  if (!out) {
197  ret = AVERROR(ENOMEM);
198  return ret;
199  }
200 
201  px[1] = px[2] = AV_CEIL_RSHIFT(x, s->desc->log2_chroma_w);
202  px[0] = px[3] = x;
203 
204  py[1] = py[2] = AV_CEIL_RSHIFT(y, s->desc->log2_chroma_h);
205  py[0] = py[3] = y;
206 
207  s->sws = sws_alloc_context();
208  if (!s->sws) {
209  ret = AVERROR(ENOMEM);
210  goto error;
211  }
212 
213  for (k = 0; in->data[k]; k++)
214  input[k] = in->data[k] + py[k] * in->linesize[k] + px[k];
215 
216  av_opt_set_int(s->sws, "srcw", w, 0);
217  av_opt_set_int(s->sws, "srch", h, 0);
218  av_opt_set_int(s->sws, "src_format", in->format, 0);
219  av_opt_set_int(s->sws, "dstw", outlink->w, 0);
220  av_opt_set_int(s->sws, "dsth", outlink->h, 0);
221  av_opt_set_int(s->sws, "dst_format", outlink->format, 0);
222  av_opt_set_int(s->sws, "sws_flags", SWS_BICUBIC, 0);
223 
224  if ((ret = sws_init_context(s->sws, NULL, NULL)) < 0)
225  goto error;
226 
227  sws_scale(s->sws, (const uint8_t *const *)&input, in->linesize, 0, h, out->data, out->linesize);
228 
229  out->pts = pts;
230  s->frame_count++;
231 
232  ret = ff_filter_frame(outlink, out);
233  sws_freeContext(s->sws);
234  s->sws = NULL;
235  s->current_frame++;
236 
237  if (s->current_frame >= s->nb_frames) {
238  if (*dx != -1)
239  s->x = *dx;
240  if (*dy != -1)
241  s->y = *dy;
242  if (*zoom != -1)
243  s->prev_zoom = *zoom;
244  s->prev_nb_frames = s->nb_frames;
245  s->nb_frames = 0;
246  s->current_frame = 0;
247  av_frame_free(&s->in);
248  s->finished = 1;
249  }
250  return ret;
251 error:
252  sws_freeContext(s->sws);
253  s->sws = NULL;
254  av_frame_free(&out);
255  return ret;
256 }
257 
259 {
260  ZPContext *s = ctx->priv;
261  AVFilterLink *inlink = ctx->inputs[0];
262  AVFilterLink *outlink = ctx->outputs[0];
263  int status, ret = 0;
264  int64_t pts;
265 
267 
268  if (s->in && ff_outlink_frame_wanted(outlink)) {
269  double zoom = -1, dx = -1, dy = -1;
270 
271  ret = output_single_frame(ctx, s->in, s->var_values, s->current_frame,
272  &zoom, &dx, &dy);
273  if (ret < 0)
274  return ret;
275  }
276 
277  if (!s->in && (ret = ff_inlink_consume_frame(inlink, &s->in)) > 0) {
278  double zoom = -1, dx = -1, dy = -1, nb_frames;
279 
280  s->finished = 0;
281  s->var_values[VAR_IN_W] = s->var_values[VAR_IW] = s->in->width;
282  s->var_values[VAR_IN_H] = s->var_values[VAR_IH] = s->in->height;
283  s->var_values[VAR_OUT_W] = s->var_values[VAR_OW] = s->w;
284  s->var_values[VAR_OUT_H] = s->var_values[VAR_OH] = s->h;
285  s->var_values[VAR_IN] = inlink->frame_count_out - 1;
286  s->var_values[VAR_ON] = outlink->frame_count_in;
287  s->var_values[VAR_PX] = s->x;
288  s->var_values[VAR_PY] = s->y;
289  s->var_values[VAR_X] = 0;
290  s->var_values[VAR_Y] = 0;
291  s->var_values[VAR_PZOOM] = s->prev_zoom;
292  s->var_values[VAR_ZOOM] = 1;
293  s->var_values[VAR_PDURATION] = s->prev_nb_frames;
294  s->var_values[VAR_A] = (double) s->in->width / s->in->height;
295  s->var_values[VAR_SAR] = inlink->sample_aspect_ratio.num ?
296  (double) inlink->sample_aspect_ratio.num / inlink->sample_aspect_ratio.den : 1;
297  s->var_values[VAR_DAR] = s->var_values[VAR_A] * s->var_values[VAR_SAR];
298  s->var_values[VAR_HSUB] = 1 << s->desc->log2_chroma_w;
299  s->var_values[VAR_VSUB] = 1 << s->desc->log2_chroma_h;
300 
301  if ((ret = av_expr_parse_and_eval(&nb_frames, s->duration_expr_str,
302  var_names, s->var_values,
303  NULL, NULL, NULL, NULL, NULL, 0, ctx)) < 0) {
304  av_frame_free(&s->in);
305  return ret;
306  }
307 
308  s->var_values[VAR_DURATION] = s->nb_frames = nb_frames;
309 
310  ret = output_single_frame(ctx, s->in, s->var_values, s->current_frame,
311  &zoom, &dx, &dy);
312  if (ret < 0)
313  return ret;
314  }
315  if (ret < 0) {
316  return ret;
317  } else if (s->finished && ff_inlink_acknowledge_status(inlink, &status, &pts)) {
318  ff_outlink_set_status(outlink, status, pts);
319  return 0;
320  } else {
321  if (ff_outlink_frame_wanted(outlink) && s->finished)
323  return 0;
324  }
325 }
326 
327 static const enum AVPixelFormat pix_fmts[] = {
339 };
340 
342 {
343  ZPContext *s = ctx->priv;
344 
345  sws_freeContext(s->sws);
346  s->sws = NULL;
347  av_expr_free(s->x_expr);
348  av_expr_free(s->y_expr);
349  av_expr_free(s->zoom_expr);
350  av_frame_free(&s->in);
351 }
352 
353 static const AVFilterPad outputs[] = {
354  {
355  .name = "default",
356  .type = AVMEDIA_TYPE_VIDEO,
357  .config_props = config_output,
358  },
359 };
360 
362  .name = "zoompan",
363  .description = NULL_IF_CONFIG_SMALL("Apply Zoom & Pan effect."),
364  .priv_size = sizeof(ZPContext),
365  .priv_class = &zoompan_class,
366  .init = init,
367  .uninit = uninit,
368  .activate = activate,
372 };
error
static void error(const char *err)
Definition: target_bsf_fuzzer.c:32
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:112
ZPcontext::current_frame
int current_frame
Definition: vf_zoompan.c:97
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:71
ZPcontext::y_expr
AVExpr * y_expr
Definition: vf_zoompan.c:85
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
var_name
var_name
Definition: noise.c:47
VAR_ZOOM
@ VAR_ZOOM
Definition: vf_zoompan.c:66
VAR_OUT_TIME
@ VAR_OUT_TIME
Definition: vf_zoompan.c:64
VAR_ON
@ VAR_ON
Definition: vf_zoompan.c:60
out
FILE * out
Definition: movenc.c:55
ff_filter_frame
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:1015
av_pix_fmt_desc_get
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2965
VAR_IN
@ VAR_IN
Definition: vf_zoompan.c:59
AV_OPT_TYPE_VIDEO_RATE
@ AV_OPT_TYPE_VIDEO_RATE
offset must point to AVRational
Definition: opt.h:258
FILTER_PIXFMTS_ARRAY
#define FILTER_PIXFMTS_ARRAY(array)
Definition: internal.h:162
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
zoom
static void zoom(float *u, float *v, float amount)
Definition: vf_xfade.c:1696
VAR_PZOOM
@ VAR_PZOOM
Definition: vf_zoompan.c:67
av_frame_free
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:160
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:374
pixdesc.h
VAR_IH
@ VAR_IH
Definition: vf_zoompan.c:56
AVFrame::pts
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
Definition: frame.h:486
AVFrame::width
int width
Definition: frame.h:446
w
uint8_t w
Definition: llviddspenc.c:38
AVOption
AVOption.
Definition: opt.h:357
VAR_TIME
@ VAR_TIME
Definition: vf_zoompan.c:64
VAR_IW
@ VAR_IW
Definition: vf_zoompan.c:55
AV_PIX_FMT_YUV440P
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition: pixfmt.h:106
sws_scale
int attribute_align_arg sws_scale(struct SwsContext *c, const uint8_t *const srcSlice[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[])
swscale wrapper, so we don't need to export the SwsContext.
Definition: swscale.c:1208
FFMAX
#define FFMAX(a, b)
Definition: macros.h:47
ZPcontext
Definition: vf_zoompan.c:78
ZPcontext::desc
const AVPixFmtDescriptor * desc
Definition: vf_zoompan.c:93
AVFilter::name
const char * name
Filter name.
Definition: avfilter.h:170
outputs
static const AVFilterPad outputs[]
Definition: vf_zoompan.c:353
AVFILTER_DEFINE_CLASS
AVFILTER_DEFINE_CLASS(zoompan)
VAR_VSUB
@ VAR_VSUB
Definition: vf_zoompan.c:74
video.h
FF_FILTER_FORWARD_STATUS_BACK
#define FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink)
Forward the status on an output link to an input link.
Definition: filters.h:199
VAR_OH
@ VAR_OH
Definition: vf_zoompan.c:58
AVFrame::data
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:395
av_expr_parse
int av_expr_parse(AVExpr **expr, const char *s, const char *const *const_names, const char *const *func1_names, double(*const *funcs1)(void *, double), const char *const *func2_names, double(*const *funcs2)(void *, double, double), int log_offset, void *log_ctx)
Parse an expression.
Definition: eval.c:710
VAR_PY
@ VAR_PY
Definition: vf_zoompan.c:69
VARS_NB
@ VARS_NB
Definition: vf_zoompan.c:75
ff_inlink_consume_frame
int ff_inlink_consume_frame(AVFilterLink *link, AVFrame **rframe)
Take a frame from the link's FIFO and update the link's stats.
Definition: avfilter.c:1442
VAR_A
@ VAR_A
Definition: vf_zoompan.c:70
AV_PIX_FMT_GBRAP
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
Definition: pixfmt.h:212
init
static av_cold int init(AVFilterContext *ctx)
Definition: vf_zoompan.c:117
VAR_IN_H
@ VAR_IN_H
Definition: vf_zoompan.c:56
pts
static int64_t pts
Definition: transcode_aac.c:644
av_expr_free
void av_expr_free(AVExpr *e)
Free a parsed expression previously created with av_expr_parse().
Definition: eval.c:358
AVFilterPad
A filter pad used for either input or output.
Definition: internal.h:33
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:283
VAR_DURATION
@ VAR_DURATION
Definition: vf_zoompan.c:61
ZPcontext::nb_frames
int nb_frames
Definition: vf_zoompan.c:96
av_cold
#define av_cold
Definition: attributes.h:90
ZPcontext::x_expr_str
char * x_expr_str
Definition: vf_zoompan.c:81
ff_video_default_filterpad
const AVFilterPad ff_video_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_VIDEO.
Definition: video.c:37
VAR_PX
@ VAR_PX
Definition: vf_zoompan.c:68
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:86
ZPcontext::y
double y
Definition: vf_zoompan.c:88
ff_outlink_set_status
static void ff_outlink_set_status(AVFilterLink *link, int status, int64_t pts)
Set the status field of a link from the source filter.
Definition: filters.h:189
ff_inlink_request_frame
void ff_inlink_request_frame(AVFilterLink *link)
Mark that a frame is wanted on the link.
Definition: avfilter.c:1568
s
#define s(width, name)
Definition: cbs_vp9.c:198
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:108
activate
static int activate(AVFilterContext *ctx)
Definition: vf_zoompan.c:258
AV_CEIL_RSHIFT
#define AV_CEIL_RSHIFT(a, b)
Definition: common.h:60
ZPcontext::finished
int finished
Definition: vf_zoompan.c:98
av_q2d
static double av_q2d(AVRational a)
Convert an AVRational to a double.
Definition: rational.h:104
VAR_SAR
@ VAR_SAR
Definition: vf_zoompan.c:71
ZPcontext::var_values
double var_values[VARS_NB]
Definition: vf_zoompan.c:95
filters.h
ctx
AVFormatContext * ctx
Definition: movenc.c:49
av_expr_eval
double av_expr_eval(AVExpr *e, const double *const_values, void *opaque)
Evaluate a previously parsed expression.
Definition: eval.c:792
AVExpr
Definition: eval.c:158
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:73
NAN
#define NAN
Definition: mathematics.h:115
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:182
VAR_IN_W
@ VAR_IN_W
Definition: vf_zoompan.c:55
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:87
VAR_Y
@ VAR_Y
Definition: vf_zoompan.c:69
ZPcontext::frame_count
int64_t frame_count
Definition: vf_zoompan.c:92
framerate
float framerate
Definition: av1_levels.c:29
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:66
ZPcontext::framerate
AVRational framerate
Definition: vf_zoompan.c:99
NULL
#define NULL
Definition: coverity.c:32
output_single_frame
static int output_single_frame(AVFilterContext *ctx, AVFrame *in, double *var_values, int i, double *zoom, double *dx, double *dy)
Definition: vf_zoompan.c:153
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
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:85
AV_OPT_TYPE_IMAGE_SIZE
@ AV_OPT_TYPE_IMAGE_SIZE
offset must point to two consecutive ints
Definition: opt.h:255
VAR_OUT_H
@ VAR_OUT_H
Definition: vf_zoompan.c:58
sws_alloc_context
struct SwsContext * sws_alloc_context(void)
Allocate an empty SwsContext.
Definition: utils.c:1217
pix_fmts
static enum AVPixelFormat pix_fmts[]
Definition: vf_zoompan.c:327
zoompan_options
static const AVOption zoompan_options[]
Definition: vf_zoompan.c:104
ZPcontext::x_expr
AVExpr * x_expr
Definition: vf_zoompan.c:85
ZPcontext::prev_zoom
double prev_zoom
Definition: vf_zoompan.c:89
ZPcontext::in
AVFrame * in
Definition: vf_zoompan.c:94
double
double
Definition: af_crystalizer.c:131
AV_PIX_FMT_GRAY8
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition: pixfmt.h:81
ff_inlink_acknowledge_status
int ff_inlink_acknowledge_status(AVFilterLink *link, int *rstatus, int64_t *rpts)
Test and acknowledge the change of status on the link.
Definition: avfilter.c:1389
FLAGS
#define FLAGS
Definition: vf_zoompan.c:103
av_opt_set_int
int av_opt_set_int(void *obj, const char *name, int64_t val, int search_flags)
Definition: opt.c:799
VAR_FRAME
@ VAR_FRAME
Definition: vf_zoompan.c:65
eval.h
var_names
static const char *const var_names[]
Definition: vf_zoompan.c:30
ZPcontext::zoom_expr
AVExpr * zoom_expr
Definition: vf_zoompan.c:85
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:94
av_expr_parse_and_eval
int av_expr_parse_and_eval(double *d, const char *s, const char *const *const_names, const double *const_values, const char *const *func1_names, double(*const *funcs1)(void *, double), const char *const *func2_names, double(*const *funcs2)(void *, double, double), void *opaque, int log_offset, void *log_ctx)
Parse and evaluate an expression.
Definition: eval.c:803
AV_NOPTS_VALUE
#define AV_NOPTS_VALUE
Undefined timestamp value.
Definition: avutil.h:248
VAR_OW
@ VAR_OW
Definition: vf_zoompan.c:57
AVFrame::format
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames,...
Definition: frame.h:461
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:174
VAR_X
@ VAR_X
Definition: vf_zoompan.c:68
input
and forward the test the status of outputs and forward it to the corresponding return FFERROR_NOT_READY If the filters stores internally one or a few frame for some input
Definition: filter_design.txt:172
VAR_OUT_W
@ VAR_OUT_W
Definition: vf_zoompan.c:57
internal.h
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
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:107
av_inv_q
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
Definition: rational.h:159
ZPcontext::sws
struct SwsContext * sws
Definition: vf_zoompan.c:91
AVFilterPad::name
const char * name
Pad name.
Definition: internal.h:39
ff_vf_zoompan
const AVFilter ff_vf_zoompan
Definition: vf_zoompan.c:361
AVFilter
Filter definition.
Definition: avfilter.h:166
VAR_HSUB
@ VAR_HSUB
Definition: vf_zoompan.c:73
ret
ret
Definition: filter_design.txt:187
ZPcontext::duration_expr_str
char * duration_expr_str
Definition: vf_zoompan.c:83
sws_init_context
av_warn_unused_result int sws_init_context(struct SwsContext *sws_context, SwsFilter *srcFilter, SwsFilter *dstFilter)
Initialize the swscaler context sws_context.
Definition: utils.c:2073
AVFrame::height
int height
Definition: frame.h:446
status
ov_status_e status
Definition: dnn_backend_openvino.c:101
sws_freeContext
void sws_freeContext(struct SwsContext *swsContext)
Free the swscaler context swsContext.
Definition: utils.c:2437
VAR_IN_TIME
@ VAR_IN_TIME
Definition: vf_zoompan.c:63
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:72
avfilter.h
config_output
static int config_output(AVFilterLink *outlink)
Definition: vf_zoompan.c:125
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:78
AVFilterContext
An instance of a filter.
Definition: avfilter.h:407
OFFSET
#define OFFSET(x)
Definition: vf_zoompan.c:102
AV_PIX_FMT_GBRP
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
Definition: pixfmt.h:165
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:77
VAR_IT
@ VAR_IT
Definition: vf_zoompan.c:63
ZPcontext::prev_nb_frames
int prev_nb_frames
Definition: vf_zoompan.c:90
AVPixFmtDescriptor
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:69
ZPcontext::h
int h
Definition: vf_zoompan.c:87
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:183
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:80
ZPcontext::y_expr_str
char * y_expr_str
Definition: vf_zoompan.c:82
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:419
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:79
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_zoompan.c:341
VAR_PDURATION
@ VAR_PDURATION
Definition: vf_zoompan.c:62
h
h
Definition: vp9dsp_template.c:2038
ff_outlink_frame_wanted
the definition of that something depends on the semantic of the filter The callback must examine the status of the filter s links and proceed accordingly The status of output links is stored in the status_in and status_out fields and tested by the ff_outlink_frame_wanted() function. If this function returns true
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:249
ZPcontext::zoom_expr_str
char * zoom_expr_str
Definition: vf_zoompan.c:80
VAR_OT
@ VAR_OT
Definition: vf_zoompan.c:64
SwsContext
Definition: swscale_internal.h:301
ZPcontext::x
double x
Definition: vf_zoompan.c:88
SWS_BICUBIC
#define SWS_BICUBIC
Definition: swscale.h:67
swscale.h
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:173
av_clipd
av_clipd
Definition: af_crystalizer.c:131
ZPcontext::w
int w
Definition: vf_zoompan.c:87
VAR_DAR
@ VAR_DAR
Definition: vf_zoompan.c:72