134 }
else if (d > INT_MAX || d < INT_MIN) {
135 *n = d > INT_MAX ? INT_MAX : INT_MIN;
188 "Too big value or invalid expression for out_w/ow or out_h/oh. " 189 "Maybe the expression for out_w:'%s' or for out_h:'%s' is self-referencing.\n",
193 s->
w &= ~((1 << s->
hsub) - 1);
194 s->
h &= ~((1 << s->
vsub) - 1);
206 link->
w, link->
h, s->
w, s->
h);
208 if (s->
w <= 0 || s->
h <= 0 ||
209 s->
w > link->
w || s->
h > link->
h) {
211 "Invalid too big or non positive size for width '%d' or height '%d'\n",
217 s->
x = (link->
w - s->
w) / 2;
218 s->
y = (link->
h - s->
h) / 2;
219 s->
x &= ~((1 << s->
hsub) - 1);
220 s->
y &= ~((1 << s->
vsub) - 1);
261 if ((
unsigned)s->
x + (
unsigned)s->
w > link->
w)
262 s->
x = link->
w - s->
w;
263 if ((
unsigned)s->
y + (
unsigned)s->
h > link->
h)
264 s->
y = link->
h - s->
h;
265 s->
x &= ~((1 << s->
hsub) - 1);
266 s->
y &= ~((1 << s->
vsub) - 1);
268 av_dlog(ctx,
"n:%d t:%f x:%d y:%d x+w:%d y+h:%d\n",
270 s->
y, s->
x+s->
w, s->
y+s->
h);
276 for (i = 1; i < 3; i ++) {
277 if (frame->
data[i]) {
285 if (frame->
data[3]) {
295 #define OFFSET(x) offsetof(CropContext, x) 296 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM 300 {
"x",
"Horizontal position in the input video of the left edge of the cropped output video",
302 {
"y",
"Vertical position in the input video of the top edge of the cropped output video",
339 .priv_class = &crop_class,
#define AV_PIX_FMT_FLAG_PAL
Pixel format has a palette in data[1], values are indexes in this palette.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
This structure describes decoded (raw) audio or video data.
static int config_input(AVFilterLink *link)
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
static const AVFilterPad outputs[]
Main libavfilter public API header.
packed RGB 8:8:8, 24bpp, RGBRGB...
int h
agreed upon image height
packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), little-endian, most significant bit to 0 ...
AVFrame * ff_null_get_video_buffer(AVFilterLink *link, int w, int h)
packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), little-endian
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.
av_dlog(ac->avr, "%d samples - audio_convert: %s to %s (%s)\, 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)
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
AVFilterLink ** inputs
array of pointers to input links
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
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
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
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.
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_...
#define AV_LOG_VERBOSE
Detailed information.
static const AVFilterPad avfilter_vf_crop_inputs[]
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.
int width
width and height of the video frame
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
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...
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
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
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...
static const AVClass crop_class
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_...
#define AV_PIX_FMT_FLAG_PSEUDOPAL
The pixel format is "pseudo-paletted".
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
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().
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
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)
Describe the class of an AVClass context structure.
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 ...
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
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)
struct AVFilterPad AVFilterPad
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.
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)
static const AVOption options[]
int w
width of the cropped area
AVPixelFormat
Pixel format.
#define AV_NOPTS_VALUE
Undefined timestamp value.
simple arithmetic expression evaluator
static int filter_frame(AVFilterLink *link, AVFrame *frame)