FFmpeg
Loading...
Searching...
No Matches
vf_crop.c
Go to the documentation of this file.
1/*
2 * Copyright (c) 2007 Bobby Bingham
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/**
22 * @file
23 * video crop filter
24 */
25
26#include <math.h>
27#include <stdio.h>
28
29#include "avfilter.h"
30#include "filters.h"
31#include "formats.h"
32#include "video.h"
33#include "libavutil/eval.h"
34#include "libavutil/avstring.h"
35#include "libavutil/internal.h"
36#include "libavutil/imgutils.h"
38#include "libavutil/opt.h"
39
40static const char *const var_names[] = {
41 "in_w", "iw", ///< width of the input video
42 "in_h", "ih", ///< height of the input video
43 "out_w", "ow", ///< width of the cropped video
44 "out_h", "oh", ///< height of the cropped video
45 "a",
46 "sar",
47 "dar",
48 "hsub",
49 "vsub",
50 "x",
51 "y",
52 "n", ///< number of frame
53 "t", ///< timestamp expressed in seconds
54 NULL
55};
56
73
74typedef struct CropContext {
75 const AVClass *class;
76 int x; ///< x offset of the non-cropped area with respect to the input area
77 int y; ///< y offset of the non-cropped area with respect to the input area
78 int w; ///< width of the cropped area
79 int h; ///< height of the cropped area
80 int in_w, in_h; ///< input size the cropped area was computed for
81
82 AVRational out_sar; ///< output sample aspect ratio
83 int keep_aspect; ///< keep display aspect ratio when cropping
84 int exact; ///< exact cropping, for subsampled formats
85
86 int max_step[4]; ///< max pixel step for each plane, expressed as a number of bytes
87 int hsub, vsub; ///< chroma subsampling
89 AVExpr *x_pexpr, *y_pexpr; /* parsed expressions for x and y */
92
94 AVFilterFormatsConfig **cfg_in,
95 AVFilterFormatsConfig **cfg_out)
96{
98
99 return ff_set_common_formats2(ctx, cfg_in, cfg_out,
100 ff_formats_pixdesc_filter(0, reject_flags));
101}
102
104{
105 CropContext *s = ctx->priv;
106
107 av_expr_free(s->x_pexpr);
108 s->x_pexpr = NULL;
109 av_expr_free(s->y_pexpr);
110 s->y_pexpr = NULL;
111}
112
113static inline int normalize_double(int *n, double d)
114{
115 int ret = 0;
116
117 if (isnan(d)) {
118 ret = AVERROR(EINVAL);
119 } else if (d > INT_MAX || d < INT_MIN) {
120 *n = d > INT_MAX ? INT_MAX : INT_MIN;
121 ret = AVERROR(EINVAL);
122 } else
123 *n = lrint(d);
124
125 return ret;
126}
127
129{
130 AVFilterContext *ctx = link->dst;
131 CropContext *s = ctx->priv;
132 const AVPixFmtDescriptor *pix_desc = av_pix_fmt_desc_get(link->format);
133 int ret;
134 const char *expr;
135 double res;
136
137 s->var_values[VAR_IN_W] = s->var_values[VAR_IW] = ctx->inputs[0]->w;
138 s->var_values[VAR_IN_H] = s->var_values[VAR_IH] = ctx->inputs[0]->h;
139 s->var_values[VAR_A] = (float) link->w / link->h;
140 s->var_values[VAR_SAR] = link->sample_aspect_ratio.num ? av_q2d(link->sample_aspect_ratio) : 1;
141 s->var_values[VAR_DAR] = s->var_values[VAR_A] * s->var_values[VAR_SAR];
142 s->var_values[VAR_HSUB] = 1<<pix_desc->log2_chroma_w;
143 s->var_values[VAR_VSUB] = 1<<pix_desc->log2_chroma_h;
144 s->var_values[VAR_OUT_W] = s->var_values[VAR_OW] = NAN;
145 s->var_values[VAR_OUT_H] = s->var_values[VAR_OH] = NAN;
146 s->var_values[VAR_N] = 0;
147 s->var_values[VAR_T] = NAN;
148
149 av_image_fill_max_pixsteps(s->max_step, NULL, pix_desc);
150
151 if (pix_desc->flags & AV_PIX_FMT_FLAG_HWACCEL) {
152 s->hsub = 1;
153 s->vsub = 1;
154 } else {
155 s->hsub = pix_desc->log2_chroma_w;
156 s->vsub = pix_desc->log2_chroma_h;
157 }
158
159 av_expr_parse_and_eval(&res, (expr = s->w_expr),
160 var_names, s->var_values,
161 NULL, NULL, NULL, NULL, NULL, 0, ctx);
162 s->var_values[VAR_OUT_W] = s->var_values[VAR_OW] = res;
163 if ((ret = av_expr_parse_and_eval(&res, (expr = s->h_expr),
164 var_names, s->var_values,
165 NULL, NULL, NULL, NULL, NULL, 0, ctx)) < 0)
166 goto fail_expr;
167 s->var_values[VAR_OUT_H] = s->var_values[VAR_OH] = res;
168 /* evaluate again ow as it may depend on oh */
169 if ((ret = av_expr_parse_and_eval(&res, (expr = s->w_expr),
170 var_names, s->var_values,
171 NULL, NULL, NULL, NULL, NULL, 0, ctx)) < 0)
172 goto fail_expr;
173
174 s->var_values[VAR_OUT_W] = s->var_values[VAR_OW] = res;
175 if (normalize_double(&s->w, s->var_values[VAR_OUT_W]) < 0 ||
176 normalize_double(&s->h, s->var_values[VAR_OUT_H]) < 0) {
178 "Too big value or invalid expression for out_w/ow or out_h/oh. "
179 "Maybe the expression for out_w:'%s' or for out_h:'%s' is self-referencing.\n",
180 s->w_expr, s->h_expr);
181 return AVERROR(EINVAL);
182 }
183
184 if (!s->exact) {
185 s->w &= ~((1 << s->hsub) - 1);
186 s->h &= ~((1 << s->vsub) - 1);
187 }
188
189 if (s->keep_aspect) {
191 (AVRational){ link->w, link->h });
192 av_reduce(&s->out_sar.num, &s->out_sar.den,
193 (int64_t)dar.num * s->h, (int64_t)dar.den * s->w, INT_MAX);
194 } else
195 s->out_sar = link->sample_aspect_ratio;
196
197 av_log(ctx, AV_LOG_VERBOSE, "w:%d h:%d sar:%d/%d -> w:%d h:%d sar:%d/%d\n",
198 link->w, link->h, link->sample_aspect_ratio.num, link->sample_aspect_ratio.den,
199 s->w, s->h, s->out_sar.num, s->out_sar.den);
200
201 if (s->w <= 0 || s->h <= 0 ||
202 s->w > link->w || s->h > link->h) {
204 "Invalid too big or non positive size for width '%d' or height '%d'\n",
205 s->w, s->h);
206 return AVERROR(EINVAL);
207 }
208
209 /* set default, required in the case the first computed value for x/y is NAN */
210 s->x = (link->w - s->w) / 2;
211 s->y = (link->h - s->h) / 2;
212 if (!s->exact) {
213 s->x &= ~((1 << s->hsub) - 1);
214 s->y &= ~((1 << s->vsub) - 1);
215 }
216 s->in_w = link->w;
217 s->in_h = link->h;
218 return 0;
219
220fail_expr:
221 av_log(ctx, AV_LOG_ERROR, "Error when evaluating the expression '%s'\n", expr);
222 return ret;
223}
224
225static int config_input(AVFilterLink *link)
226{
227 CropContext *s = link->dst->priv;
228
229 s->var_values[VAR_X] = NAN;
230 s->var_values[VAR_Y] = NAN;
231 av_expr_free(s->x_pexpr);
232 av_expr_free(s->y_pexpr);
233 s->x_pexpr = s->y_pexpr = NULL;
234 if (av_expr_parse(&s->x_pexpr, s->x_expr, var_names,
235 NULL, NULL, NULL, NULL, 0, link->dst) < 0 ||
236 av_expr_parse(&s->y_pexpr, s->y_expr, var_names,
237 NULL, NULL, NULL, NULL, 0, link->dst) < 0)
238 return AVERROR(EINVAL);
239
240 return config_crop_area(link);
241}
242
244{
245 CropContext *s = link->src->priv;
247
248 if (desc->flags & AV_PIX_FMT_FLAG_HWACCEL) {
249 // Hardware frames adjust the cropping regions rather than
250 // changing the frame size.
251 } else {
252 link->w = s->w;
253 link->h = s->h;
254 }
255 link->sample_aspect_ratio = s->out_sar;
256
257 return 0;
258}
259
261{
262 FilterLink *l = ff_filter_link(link);
263 AVFilterContext *ctx = link->dst;
264 CropContext *s = ctx->priv;
266 int i, ret;
267
268 if (frame->width != s->in_w || frame->height != s->in_h) {
269 link->w = frame->width;
270 link->h = frame->height;
271 if ((ret = config_crop_area(link)) < 0 ||
272 (ret = config_output(ctx->outputs[0])) < 0) {
273 s->in_w = -1;
275 return ret;
276 }
277 }
278
279 s->var_values[VAR_N] = l->frame_count_out;
280 s->var_values[VAR_T] = frame->pts == AV_NOPTS_VALUE ?
281 NAN : frame->pts * av_q2d(link->time_base);
282 s->var_values[VAR_X] = av_expr_eval(s->x_pexpr, s->var_values, NULL);
283 s->var_values[VAR_Y] = av_expr_eval(s->y_pexpr, s->var_values, NULL);
284 /* It is necessary if x is expressed from y */
285 s->var_values[VAR_X] = av_expr_eval(s->x_pexpr, s->var_values, NULL);
286
287 normalize_double(&s->x, s->var_values[VAR_X]);
288 normalize_double(&s->y, s->var_values[VAR_Y]);
289
290 if (s->x < 0)
291 s->x = 0;
292 if (s->y < 0)
293 s->y = 0;
294 if ((unsigned)s->x + (unsigned)s->w > link->w)
295 s->x = link->w - s->w;
296 if ((unsigned)s->y + (unsigned)s->h > link->h)
297 s->y = link->h - s->h;
298 if (!s->exact) {
299 s->x &= ~((1 << s->hsub) - 1);
300 s->y &= ~((1 << s->vsub) - 1);
301 }
302
303 av_log(ctx, AV_LOG_TRACE, "n:%d t:%f x:%d y:%d x+w:%d y+h:%d\n",
304 (int)s->var_values[VAR_N], s->var_values[VAR_T],
305 s->x, s->y, s->x+s->w, s->y+s->h);
306
307 if (desc->flags & AV_PIX_FMT_FLAG_HWACCEL) {
308 frame->crop_top += s->y;
309 frame->crop_left += s->x;
310 frame->crop_bottom = frame->height - frame->crop_top - frame->crop_bottom - s->h;
311 frame->crop_right = frame->width - frame->crop_left - frame->crop_right - s->w;
312 } else {
313 frame->width = s->w;
314 frame->height = s->h;
315
316 frame->data[0] += s->y * frame->linesize[0];
317 frame->data[0] += s->x * s->max_step[0];
318
319 if (!(desc->flags & AV_PIX_FMT_FLAG_PAL)) {
320 for (i = 1; i < 3; i ++) {
321 if (frame->data[i]) {
322 frame->data[i] += (s->y >> s->vsub) * frame->linesize[i];
323 frame->data[i] += (s->x * s->max_step[i]) >> s->hsub;
324 }
325 }
326 }
327
328 /* alpha plane */
329 if (frame->data[3]) {
330 frame->data[3] += s->y * frame->linesize[3];
331 frame->data[3] += s->x * s->max_step[3];
332 }
333 }
334
335 return ff_filter_frame(link->dst->outputs[0], frame);
336}
337
338static int process_command(AVFilterContext *ctx, const char *cmd, const char *args,
339 char *res, int res_len, int flags)
340{
341 CropContext *s = ctx->priv;
342 int ret;
343
344 if ( !strcmp(cmd, "out_w") || !strcmp(cmd, "w")
345 || !strcmp(cmd, "out_h") || !strcmp(cmd, "h")
346 || !strcmp(cmd, "x") || !strcmp(cmd, "y")) {
347
348 int old_x = s->x;
349 int old_y = s->y;
350 int old_w = s->w;
351 int old_h = s->h;
352
353 AVFilterLink *outlink = ctx->outputs[0];
354 AVFilterLink *inlink = ctx->inputs[0];
355
356 av_opt_set(s, cmd, args, 0);
357
358 if ((ret = config_input(inlink)) < 0) {
359 s->x = old_x;
360 s->y = old_y;
361 s->w = old_w;
362 s->h = old_h;
363 return ret;
364 }
365
366 ret = config_output(outlink);
367
368 } else
369 ret = AVERROR(ENOSYS);
370
371 return ret;
372}
373
374#define OFFSET(x) offsetof(CropContext, x)
375#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
376#define TFLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
377
378static const AVOption crop_options[] = {
379 { "out_w", "set the width crop area expression", OFFSET(w_expr), AV_OPT_TYPE_STRING, {.str = "iw"}, 0, 0, TFLAGS },
380 { "w", "set the width crop area expression", OFFSET(w_expr), AV_OPT_TYPE_STRING, {.str = "iw"}, 0, 0, TFLAGS },
381 { "out_h", "set the height crop area expression", OFFSET(h_expr), AV_OPT_TYPE_STRING, {.str = "ih"}, 0, 0, TFLAGS },
382 { "h", "set the height crop area expression", OFFSET(h_expr), AV_OPT_TYPE_STRING, {.str = "ih"}, 0, 0, TFLAGS },
383 { "x", "set the x crop area expression", OFFSET(x_expr), AV_OPT_TYPE_STRING, {.str = "(in_w-out_w)/2"}, 0, 0, TFLAGS },
384 { "y", "set the y crop area expression", OFFSET(y_expr), AV_OPT_TYPE_STRING, {.str = "(in_h-out_h)/2"}, 0, 0, TFLAGS },
385 { "keep_aspect", "keep aspect ratio", OFFSET(keep_aspect), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS },
386 { "exact", "do exact cropping", OFFSET(exact), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS },
387 { NULL }
388};
389
391
393 {
394 .name = "default",
395 .type = AVMEDIA_TYPE_VIDEO,
396 .filter_frame = filter_frame,
397 .config_props = config_input,
398 },
399};
400
402 {
403 .name = "default",
404 .type = AVMEDIA_TYPE_VIDEO,
405 .config_props = config_output,
406 },
407};
408
410 .p.name = "crop",
411 .p.description = NULL_IF_CONFIG_SMALL("Crop the input video."),
412 .p.priv_class = &crop_class,
413 .priv_size = sizeof(CropContext),
414 .uninit = uninit,
418 .process_command = process_command,
419 .flags_internal = FF_FILTER_FLAG_DYNAMIC_FRAME_SIZE,
420};
@ VAR_T
Definition aeval.c:53
static int query_formats(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
Definition aeval.c:246
static int config_input(AVFilterLink *inlink)
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
#define TFLAGS
Definition af_afade.c:66
const FFFilter ff_vf_crop
Definition vf_crop.c:409
static AVFormatContext * ctx
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition avfilter.c:1076
Main libavfilter public API header.
@ VAR_VSUB
Definition boxblur.c:42
@ VAR_HSUB
Definition boxblur.c:41
#define flags(name, subs,...)
Definition cbs_h264.c:74
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
#define s(width, name)
Definition cbs_vp9.c:198
#define FLAGS
Definition cmdutils.c:596
#define NULL
Definition coverity.c:32
long long int64_t
Definition coverity.c:34
static AVFrame * frame
static int filter_frame(DBEDecodeContext *s, AVFrame *frame)
Definition dolby_e.c:1067
void av_expr_free(AVExpr *e)
Free a parsed expression previously created with av_expr_parse().
Definition eval.c:368
double av_expr_eval(AVExpr *e, const double *const_values, void *opaque)
Evaluate a previously parsed expression.
Definition eval.c:824
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:839
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:735
simple arithmetic expression evaluator
@ VAR_IW
Definition f_select.c:147
@ VAR_IH
Definition f_select.c:146
int ff_set_common_formats2(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out, AVFilterFormats *formats)
Definition formats.c:1200
AVFilterFormats * ff_formats_pixdesc_filter(unsigned want, unsigned rej)
Construct a formats list containing all pixel formats with certain properties.
Definition formats.c:629
#define FF_PIX_FMT_FLAG_SW_FLAT_SUB
Definition formats.h:503
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
Definition opt.h:326
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
Definition opt.h:275
#define AVERROR(e)
Definition error.h:45
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition frame.c:64
#define AV_LOG_TRACE
Extremely verbose debugging, useful for libav* development.
Definition log.h:236
#define AV_LOG_VERBOSE
Detailed information.
Definition log.h:226
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition log.h:210
AVRational av_mul_q(AVRational b, AVRational c)
Multiply two rationals.
Definition rational.c:80
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
Definition rational.c:35
static double av_q2d(AVRational a)
Convert an AVRational to a double.
Definition rational.h:104
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
void av_image_fill_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4], const AVPixFmtDescriptor *pixdesc)
Compute the max pixel step for each plane of an image with a format described by pixdesc.
Definition imgutils.c:35
#define AV_NOPTS_VALUE
Undefined timestamp value.
Definition avutil.h:247
int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
Definition opt.c:891
misc image utilities
static av_cold void uninit(AVBitStreamFilterContext *ctx)
static int config_output(AVBitStreamFilterLink *outlink)
#define FILTER_INPUTS(array)
Definition filters.h:279
#define FILTER_OUTPUTS(array)
Definition filters.h:280
#define FF_FILTER_FLAG_DYNAMIC_FRAME_SIZE
The filter handles input frames whose size differs from the one its input link was configured with.
Definition filters.h:214
static FilterLink * ff_filter_link(AVFilterLink *link)
Definition filters.h:199
#define AVFILTER_DEFINE_CLASS(fname)
Definition filters.h:493
#define FILTER_QUERY_FUNC2(func)
Definition filters.h:256
@ VAR_X
Definition vf_blend.c:55
@ VAR_Y
Definition vf_blend.c:55
#define av_cold
Definition attributes.h:117
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:97
const char * desc
Definition libsvtav1.c:83
#define NAN
var_name
Definition noise.c:46
@ VAR_N
Definition noise.c:47
@ VAR_VARS_NB
Definition noise.c:59
static const char *const var_names[]
Definition noise.c:30
AVOptions.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition pixdesc.c:3484
#define AV_PIX_FMT_FLAG_BITSTREAM
All values of a component are bit-wise packed end to end.
Definition pixdesc.h:124
#define AV_PIX_FMT_FLAG_HWACCEL
Pixel format is an HW accelerated format.
Definition pixdesc.h:128
#define AV_PIX_FMT_FLAG_PAL
Pixel format has a palette in data[1], values are indexes in this palette.
Definition pixdesc.h:120
@ VAR_OUT_H
Definition scale_eval.c:47
@ VAR_SAR
Definition scale_eval.c:49
@ VAR_OH
Definition scale_eval.c:47
@ VAR_IN_W
Definition scale_eval.c:44
@ VAR_OW
Definition scale_eval.c:46
@ VAR_A
Definition scale_eval.c:48
@ VAR_OUT_W
Definition scale_eval.c:46
@ VAR_IN_H
Definition scale_eval.c:45
@ VAR_DAR
Definition scale_eval.c:50
Describe the class of an AVClass context structure.
Definition log.h:76
Definition eval.c:171
An instance of a filter.
Definition avfilter.h:279
void * priv
private data for use by the filter
Definition avfilter.h:294
AVFilterLink ** outputs
array of pointers to output links
Definition avfilter.h:291
Lists of formats / etc.
Definition avfilter.h:120
A filter pad used for either input or output.
Definition filters.h:40
This structure describes decoded (raw) audio or video data.
Definition frame.h:479
AVOption.
Definition opt.h:428
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition pixdesc.h:69
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
Definition pixdesc.h:80
uint64_t flags
Combination of AV_PIX_FMT_FLAG_... flags.
Definition pixdesc.h:94
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
Definition pixdesc.h:89
Rational number (pair of numerator and denominator).
Definition rational.h:58
int num
Numerator.
Definition rational.h:59
int den
Denominator.
Definition rational.h:60
char * y_expr
Definition vf_crop.c:88
int exact
exact cropping, for subsampled formats
Definition vf_crop.c:84
int in_h
input size the cropped area was computed for
Definition vf_crop.c:80
int w
width of the cropped area
Definition vf_crop.c:78
int h
height of the cropped area
Definition vf_crop.c:79
int y
y offset of the non-cropped area with respect to the input area
Definition vf_crop.c:77
char * w_expr
Definition vf_crop.c:88
AVRational out_sar
output sample aspect ratio
Definition vf_crop.c:82
char * x_expr
Definition vf_crop.c:88
char * h_expr
Definition vf_crop.c:88
AVExpr * x_pexpr
Definition vf_crop.c:89
int x
x offset of the non-cropped area with respect to the input area
Definition vf_crop.c:76
int max_step[4]
max pixel step for each plane, expressed as a number of bytes
Definition vf_crop.c:86
int vsub
chroma subsampling
Definition vf_crop.c:87
int keep_aspect
keep display aspect ratio when cropping
Definition vf_crop.c:83
double var_values[VAR_VARS_NB]
Definition vf_crop.c:90
AVExpr * y_pexpr
Definition vf_crop.c:89
#define lrint
Definition tablegen.h:53
#define av_log(a,...)
@ VAR_VARS_NB
Definition vf_crop.c:71
static int config_crop_area(AVFilterLink *link)
Definition vf_crop.c:128
static int normalize_double(int *n, double d)
Definition vf_crop.c:113
static const AVFilterPad avfilter_vf_crop_outputs[]
Definition vf_crop.c:401
static const AVFilterPad avfilter_vf_crop_inputs[]
Definition vf_crop.c:392
static const AVOption crop_options[]
Definition vf_crop.c:378
static int filter_frame(AVFilterLink *link, AVFrame *frame)
Definition vf_crop.c:260
static int query_formats(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
Definition vf_crop.c:93
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
Definition vf_crop.c:338
static int config_input(AVFilterLink *link)
Definition vf_crop.c:225
static av_cold void uninit(AVFilterContext *ctx)
Definition vf_crop.c:103
#define OFFSET(x)
Definition vf_crop.c:374
static int config_output(AVFilterLink *link)
Definition vf_crop.c:243