100 sscanf(args,
"%255[^:]:%255[^:]", scale->
w_expr, scale->
h_expr);
101 p = strstr(args,
"flags=");
160 double var_values[
VARS_NB], res;
164 var_values[
VAR_PI] = M_PI;
171 var_values[
VAR_DAR] = var_values[
VAR_A] = (double) inlink->
w / inlink->
h;
198 if (w < -1 || h < -1) {
202 if (w == -1 && h == -1)
203 scale->
w = scale->
h = 0;
214 if (w > INT_MAX || h > INT_MAX ||
215 (h * inlink->
w) > INT_MAX ||
216 (w * inlink->
h) > INT_MAX)
233 if (inlink->
w == outlink->
w && inlink->
h == outlink->
h &&
238 outlink->
w, outlink->
h, outlink->
format,
247 outlink->
w*inlink->
h},
256 "Error when evaluating the expression '%s'\n", expr);
316 .description =
NULL_IF_CONFIG_SMALL(
"Scale the input video to width:height size and/or convert the image format."),
325 .
inputs = avfilter_vf_scale_inputs,
326 .
outputs = avfilter_vf_scale_outputs,
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
AVFilterBufferRefVideoProps * video
video buffer specific properties
void sws_freeContext(struct SwsContext *swsContext)
Free the swscaler context swsContext.
int linesize[8]
number of bytes per line
static const AVFilterPad outputs[]
int h
agreed upon image height
int sws_scale(struct SwsContext *c, const uint8_t *const srcSlice[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[])
Scale the image slice in srcSlice and put the resulting scaled slice in the image in dst...
int ff_filter_frame(AVFilterLink *link, AVFilterBufferRef *frame)
Send a frame of data to the next filter.
static enum AVSampleFormat formats[]
int vsub
chroma subsampling
const AVClass * sws_get_class(void)
Get the AVClass for swsContext.
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
static int filter_frame(AVFilterLink *link, AVFilterBufferRef *in)
#define AV_OPT_SEARCH_FAKE_OBJ
#define AV_PERM_READ
can read from the buffer
const char * name
Pad name.
AVFilterLink ** inputs
array of pointers to input links
static int query_formats(AVFilterContext *ctx)
char h_expr[256]
height expression string
void avfilter_unref_bufferp(AVFilterBufferRef **ref)
Remove a reference to a buffer and set the pointer to NULL.
AVRational av_mul_q(AVRational b, AVRational c)
Multiply two rationals.
external api for the swscale stuff
AVRational pixel_aspect
pixel aspect ratio
A filter pad used for either input or output.
A link between two filters.
static av_cold int init(AVFilterContext *ctx, const char *args)
struct SwsContext * sws_getContext(int srcW, int srcH, enum AVPixelFormat srcFormat, int dstW, int dstH, enum AVPixelFormat dstFormat, int flags, SwsFilter *srcFilter, SwsFilter *dstFilter, const double *param)
Allocate and return an SwsContext.
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.
AVFilterBufferRef * ff_get_video_buffer(AVFilterLink *link, int perms, int w, int h)
Request a picture buffer with a specific set of permissions.
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
char w_expr[256]
width expression string
int av_opt_eval_flags(void *obj, const AVOption *o, const char *val, int *flags_out)
#define sws_isSupportedOutput(x)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void * priv
private data for use by the filter
#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,...)
AVFilterFormats * in_formats
Lists of formats supported by the input and output filters respectively.
AVFilter avfilter_vf_scale
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.
static int config_props(AVFilterLink *outlink)
int w
agreed upon image width
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
const AVOption * av_opt_find(void *obj, const char *name, const char *unit, int opt_flags, int search_flags)
Look for an option in an object.
common internal API header
static av_cold void uninit(AVFilterContext *ctx)
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
static const AVFilterPad avfilter_vf_scale_outputs[]
AVFilterContext * src
source filter
#define sws_isSupportedInput(x)
enum AVPixelFormat pix_fmt
int format
agreed upon media format
A reference to an AVFilterBuffer.
struct SwsContext * sws
software scaler context
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
static const AVFilterPad avfilter_vf_scale_inputs[]
Describe the class of an AVClass context structure.
static const AVFilterPad inputs[]
rational number numerator/denominator
const char * name
filter name
AVRational sample_aspect_ratio
agreed upon sample aspect ratio
int input_is_pal
set to 1 if the input format is paletted
static const char *const var_names[]
AVFilterLink ** outputs
array of pointers to output links
static const uint16_t scale[4]
void avfilter_copy_buffer_ref_props(AVFilterBufferRef *dst, AVFilterBufferRef *src)
Copy properties of src to dst, without copying the actual data.
int slice_y
top of current output slice
#define AV_PERM_WRITE
can write to the buffer
#define PIX_FMT_PSEUDOPAL
The pixel format is "pseudo-paletted".
AVFilterContext * dst
dest filter
uint8_t * data[8]
picture/audio data for each plane
number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of...
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.
AVPixelFormat
Pixel format.
AVFilterFormats * out_formats
simple arithmetic expression evaluator