61 #define D(name) case VA_FILTER_SCALING_ ## name: return #name
88 ctx->force_original_aspect_ratio,
ctx->force_divisible_by);
109 VAProcPipelineParameterBuffer params;
146 params.filter_flags |=
ctx->mode;
175 if (
ctx->output_format_string) {
186 #define STRING_OPTION(var_name, func_name, default_value) do { \
187 if (ctx->var_name ## _string) { \
188 int var = av_ ## func_name ## _from_name(ctx->var_name ## _string); \
190 av_log(avctx, AV_LOG_ERROR, "Invalid %s.\n", #var_name); \
191 return AVERROR(EINVAL); \
193 ctx->var_name = var; \
195 ctx->var_name = default_value; \
207 #define OFFSET(x) offsetof(ScaleVAAPIContext, x)
208 #define FLAGS (AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM)
210 {
"w",
"Output video width",
212 {
"h",
"Output video height",
214 {
"format",
"Output video format (software format of hardware frames)",
216 {
"mode",
"Scaling mode",
218 0, VA_FILTER_SCALING_NL_ANAMORPHIC,
FLAGS,
"mode" },
219 {
"default",
"Use the default (depend on the driver) scaling algorithm",
221 {
"fast",
"Use fast scaling algorithm",
223 {
"hq",
"Use high quality scaling algorithm",
225 {
"nl_anamorphic",
"Use nolinear anamorphic scaling algorithm",
229 {
"out_color_matrix",
"Output colour matrix coefficient set",
231 {
"out_range",
"Output colour range",
234 {
"full",
"Full range",
236 {
"limited",
"Limited range",
238 {
"jpeg",
"Full range",
240 {
"mpeg",
"Limited range",
242 {
"tv",
"Limited range",
244 {
"pc",
"Full range",
247 {
"out_color_primaries",
"Output colour primaries",
250 {
"out_color_transfer",
"Output colour transfer characteristics",
253 {
"out_chroma_location",
"Output chroma sample location",
256 {
"force_original_aspect_ratio",
"decrease or increase w/h if necessary to keep the original AR",
OFFSET(force_original_aspect_ratio),
AV_OPT_TYPE_INT, { .i64 = 0}, 0, 2,
FLAGS,
"force_oar" },
260 {
"force_divisible_by",
"enforce that the output resolution is divisible by a defined integer when force_original_aspect_ratio is used",
OFFSET(force_divisible_by),
AV_OPT_TYPE_INT, { .i64 = 1}, 1, 256,
FLAGS },
287 .
name =
"scale_vaapi",
295 .priv_class = &scale_vaapi_class,
static int query_formats(AVFilterContext *ctx)
static const AVFilterPad inputs[]
static const AVFilterPad outputs[]
simple assert() macros that are a bit more flexible than ISO C assert().
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Main libavfilter public API header.
static av_cold int init(AVCodecContext *avctx)
static av_cold int uninit(AVCodecContext *avctx)
mode
Use these values in ebur128_init (or'ed).
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
AVRational av_mul_q(AVRational b, AVRational c)
Multiply two rationals.
static int output_frame(H264Context *h, AVFrame *dst, H264Picture *srcp)
#define FF_FILTER_FLAG_HWFRAME_AWARE
The filter is aware of hardware frames, and any hardware frame context should not be automatically pr...
static const struct ColorPrimaries color_primaries[AVCOL_PRI_NB]
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Memory handling functions.
enum AVPixelFormat av_get_pix_fmt(const char *name)
Return the pixel format corresponding to name.
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.
AVChromaLocation
Location of chroma samples.
@ AVCHROMA_LOC_UNSPECIFIED
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
@ AVCOL_RANGE_UNSPECIFIED
@ AVCOL_RANGE_JPEG
Full range content.
AVColorPrimaries
Chromaticity coordinates of the source primaries.
AVColorTransferCharacteristic
Color Transfer Characteristic.
AVColorSpace
YUV colorspace type.
int ff_scale_adjust_dimensions(AVFilterLink *inlink, int *ret_w, int *ret_h, int force_original_aspect_ratio, int force_divisible_by)
Transform evaluated width and height obtained from ff_scale_eval_dimensions into actual target width ...
int ff_scale_eval_dimensions(void *log_ctx, const char *w_expr, const char *h_expr, AVFilterLink *inlink, AVFilterLink *outlink, int *ret_w, int *ret_h)
Parse and evaluate string expressions for width and height.
AVFilterLink ** inputs
array of pointers to input links
void * priv
private data for use by the filter
AVFilterLink ** outputs
array of pointers to output links
A link between two filters.
int w
agreed upon image width
int h
agreed upon image height
AVFilterContext * src
source filter
AVRational sample_aspect_ratio
agreed upon sample aspect ratio
AVFilterContext * dst
dest filter
A filter pad used for either input or output.
const char * name
Pad name.
const char * name
Filter name.
This structure describes decoded (raw) audio or video data.
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames,...
Rational number (pair of numerator and denominator).
enum AVChromaLocation chroma_location
char * chroma_location_string
enum AVColorPrimaries colour_primaries
char * colour_transfer_string
char * output_format_string
char * colour_matrix_string
int force_original_aspect_ratio
char * colour_primaries_string
enum AVColorSpace colour_matrix
enum AVColorTransferCharacteristic colour_transfer
void(* pipeline_uninit)(AVFilterContext *avctx)
enum AVPixelFormat output_format
int ff_vaapi_vpp_config_output(AVFilterLink *outlink)
int ff_vaapi_vpp_config_input(AVFilterLink *inlink)
void ff_vaapi_vpp_pipeline_uninit(AVFilterContext *avctx)
void ff_vaapi_vpp_ctx_init(AVFilterContext *avctx)
int ff_vaapi_vpp_init_params(AVFilterContext *avctx, VAProcPipelineParameterBuffer *params, const AVFrame *input_frame, AVFrame *output_frame)
int ff_vaapi_vpp_render_picture(AVFilterContext *avctx, VAProcPipelineParameterBuffer *params, AVFrame *output_frame)
void ff_vaapi_vpp_ctx_uninit(AVFilterContext *avctx)
int ff_vaapi_vpp_query_formats(AVFilterContext *avctx)
AVFilter ff_vf_scale_vaapi
static const AVFilterPad scale_vaapi_outputs[]
static int scale_vaapi_config_output(AVFilterLink *outlink)
static int scale_vaapi_filter_frame(AVFilterLink *inlink, AVFrame *input_frame)
static const AVFilterPad scale_vaapi_inputs[]
AVFILTER_DEFINE_CLASS(scale_vaapi)
static av_cold int scale_vaapi_init(AVFilterContext *avctx)
static const AVOption scale_vaapi_options[]
#define STRING_OPTION(var_name, func_name, default_value)
static const char * scale_vaapi_mode_name(int mode)
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.