81 char x_expr[256], y_expr[256], ow_expr[256], oh_expr[256];
148 }
else if (d > INT_MAX || d < INT_MIN) {
149 *n = d > INT_MAX ? INT_MAX : INT_MIN;
199 "Too big value or invalid expression for out_w/ow or out_h/oh. "
200 "Maybe the expression for out_w:'%s' or for out_h:'%s' is self-referencing.\n",
204 crop->
w &= ~((1 << crop->
hsub) - 1);
205 crop->
h &= ~((1 << crop->
vsub) - 1);
214 link->
w, link->
h, crop->
w, crop->
h);
216 if (crop->
w <= 0 || crop->
h <= 0 ||
217 crop->
w > link->
w || crop->
h > link->
h) {
219 "Invalid too big or non positive size for width '%d' or height '%d'\n",
225 crop->
x = (link->
w - crop->
w) / 2;
226 crop->
y = (link->
h - crop->
h) / 2;
227 crop->
x &= ~((1 << crop->
hsub) - 1);
228 crop->
y &= ~((1 << crop->
vsub) - 1);
266 if (crop->
x < 0) crop->
x = 0;
267 if (crop->
y < 0) crop->
y = 0;
268 if ((
unsigned)crop->
x + (
unsigned)crop->
w > link->
w) crop->
x = link->
w - crop->
w;
269 if ((
unsigned)crop->
y + (
unsigned)crop->
h > link->
h) crop->
y = link->
h - crop->
h;
270 crop->
x &= ~((1 << crop->
hsub) - 1);
271 crop->
y &= ~((1 << crop->
vsub) - 1);
273 av_dlog(ctx,
"n:%d t:%f x:%d y:%d x+w:%d y+h:%d\n",
275 crop->
y, crop->
x+crop->
w, crop->
y+crop->
h);
281 for (i = 1; i < 3; i ++) {
282 if (frame->
data[i]) {
290 if (frame->
data[3]) {
330 .
inputs = avfilter_vf_crop_inputs,
331 .
outputs = avfilter_vf_crop_outputs,
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
AVFilterBufferRefVideoProps * video
video buffer specific properties
int linesize[8]
number of bytes per line
static int config_input(AVFilterLink *link)
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
static const AVFilterPad outputs[]
packed RGB 8:8:8, 24bpp, RGBRGB...
int h
agreed upon image height
int ff_filter_frame(AVFilterLink *link, AVFilterBufferRef *frame)
Send a frame of data to the next filter.
packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), little-endian, most significant bit to 0 ...
packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), little-endian
av_dlog(ac->avr,"%d samples - audio_convert: %s to %s (%s)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt), use_generic?ac->func_descr_generic:ac->func_descr)
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.
planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian
packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb)
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.
const char * name
Pad name.
AVFilterLink ** inputs
array of pointers to input links
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
int x
x offset of the non-cropped area with respect to the input area
8 bit with PIX_FMT_RGB32 palette
packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as lit...
int y
y offset of the non-cropped area with respect to the input area
static av_always_inline av_const int isnan(float x)
int max_step[4]
max pixel step for each plane, expressed as a number of bytes
packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian
static const AVFilterPad avfilter_vf_crop_outputs[]
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
static double av_q2d(AVRational a)
Convert rational to double.
AVFilter avfilter_vf_crop
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of PIX_FMT_YUV440P and setting color_range ...
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV422P and setting color_...
static const AVFilterPad avfilter_vf_crop_inputs[]
static av_cold int init(AVFilterContext *ctx, const char *args)
int64_t pts
presentation timestamp.
A filter pad used for either input or output.
A link between two filters.
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.
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
double var_values[VAR_VARS_NB]
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
void * priv
private data for use by the filter
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link...
#define PIX_FMT_PAL
Pixel format has a palette in data[1], values are indexes in this palette.
void av_log(void *avcl, int level, const char *fmt,...)
static av_always_inline av_const double round(double x)
planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
static int filter_frame(AVFilterLink *link, AVFilterBufferRef *frame)
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
size_t av_strlcpy(char *dst, const char *src, size_t size)
Copy the string src to dst, but no more than size - 1 bytes, and null-terminate dst.
packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as lit...
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
int w
agreed upon image width
common internal API header
packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb)
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV420P and setting color_...
packed RGB 8:8:8, 24bpp, BGRBGR...
AVFilterContext * src
source filter
static int query_formats(AVFilterContext *ctx)
packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as big...
packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), big-endian
int format
agreed upon media format
int h
height of the cropped area
int vsub
chroma subsampling
A reference to an AVFilterBuffer.
packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb)
planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
void av_expr_free(AVExpr *e)
Free a parsed expression previously created with av_expr_parse().
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
static av_cold void uninit(AVFilterContext *ctx)
Replacements for frequently missing libm functions.
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
static const AVFilterPad inputs[]
const char * name
filter name
packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), little-endian, most significant bit to 1 ...
AVFilterLink ** outputs
array of pointers to output links
static const char *const var_names[]
packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), big-endian, most significant bit to 0 ...
planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
static int normalize_double(int *n, double d)
static int config_output(AVFilterLink *link)
packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big...
planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV444P and setting color_...
packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb)
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
int64_t pos
byte position in stream, -1 if unknown
#define PIX_FMT_PSEUDOPAL
The pixel format is "pseudo-paletted".
double av_expr_eval(AVExpr *e, const double *const_values, void *opaque)
Evaluate a previously parsed expression.
AVFilterContext * dst
dest filter
Y , 16bpp, little-endian.
uint8_t * data[8]
picture/audio data for each plane
packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), big-endian, most significant bit to 1 ...
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
int w
width of the cropped area
AVFilterBufferRef * ff_null_get_video_buffer(AVFilterLink *link, int perms, int w, int h)
AVPixelFormat
Pixel format.
simple arithmetic expression evaluator