92 sscanf(args,
"%255[^:]:%255[^:]", scale->
w_expr, scale->
h_expr);
93 p = strstr(args,
"flags=");
94 if (p) scale->
flags = strtoul(p+6,
NULL, 0);
115 for (pix_fmt = 0; pix_fmt <
PIX_FMT_NB; pix_fmt++)
125 for (pix_fmt = 0; pix_fmt <
PIX_FMT_NB; pix_fmt++)
143 double var_values[
VARS_NB], res;
154 var_values[
VAR_DAR] = var_values[
VAR_A] = (double) inlink->
w / inlink->
h;
181 if (w < -1 || h < -1) {
185 if (w == -1 && h == -1)
186 scale->
w = scale->
h = 0;
197 if (w > INT_MAX || h > INT_MAX ||
198 (h * inlink->
w) > INT_MAX ||
199 (w * inlink->
h) > INT_MAX)
216 outlink->
w, outlink->
h, outlink->
format,
224 outlink->
w*inlink->
h},
233 "Error when evaluating the expression '%s'\n", expr);
248 outpicref->
video->
w = outlink->
w;
249 outpicref->
video->
h = outlink->
h;
267 const uint8_t *
data[4];
269 if (scale->
slice_y == 0 && slice_dir == -1)
292 .description =
NULL_IF_CONFIG_SMALL(
"Scale the input video to width:height size and/or convert the image format."),
AVFilterBufferRef * avfilter_get_video_buffer(AVFilterLink *link, int perms, int w, int h)
Request a picture buffer with a specific set of permissions.
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 void avfilter_copy_buffer_ref_props(AVFilterBufferRef *dst, AVFilterBufferRef *src)
Copy properties of src to dst, without copying the actual data.
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...
AVFilterBufferRef * out_buf
number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of...
int vsub
chroma subsampling
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
static void start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
#define AV_PERM_READ
can read from the buffer
AVFilterLink ** inputs
array of pointers to input links
static int query_formats(AVFilterContext *ctx)
char h_expr[256]
height expression string
int avfilter_add_format(AVFilterFormats **avff, int fmt)
Add fmt to the list of media formats contained in *avff.
AVRational av_mul_q(AVRational b, AVRational c)
Multiply two rationals.
static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
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.
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.
char w_expr[256]
width expression string
#define sws_isSupportedOutput(x)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
struct SwsContext * sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat, int dstW, int dstH, enum PixelFormat dstFormat, int flags, SwsFilter *srcFilter, SwsFilter *dstFilter, const double *param)
Allocate and return an SwsContext.
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
const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB]
The array of all the pixel format descriptors.
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.
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.
AVFilterContext * src
source filter
#define sws_isSupportedInput(x)
void avfilter_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
Send a slice to the next filter.
int format
agreed upon media format
A reference to an AVFilterBuffer.
static const char * var_names[]
struct SwsContext * sws
software scaler context
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void avfilter_formats_ref(AVFilterFormats *formats, AVFilterFormats **ref)
Add *ref as a new reference to formats.
AVFilterBufferRef * avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask)
Add a new reference to a buffer.
rational number numerator/denominator
void avfilter_start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
Notify the next filter of the start of a frame.
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
AVFilterLink ** outputs
array of pointers to output links
static const uint16_t scale[4]
int slice_y
top of current output slice
#define AV_PERM_WRITE
can write to the buffer
void avfilter_formats_unref(AVFilterFormats **ref)
If *ref is non-NULL, remove *ref as a reference to the format list it currently points to...
AVFilterContext * dst
dest filter
uint8_t * data[8]
picture/audio data for each plane
static void draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
AVFilterBufferRef * cur_buf
AVFilterFormats * out_formats
simple arithmetic expression evaluator