59#define D(name) case VA_FILTER_SCALING_ ## name: return #name
91 ctx->force_original_aspect_ratio,
92 ctx->force_divisible_by, w_adj);
127 VAProcPipelineParameterBuffer
params;
202 if (
ctx->output_format_string) {
213#define STRING_OPTION(var_name, func_name, default_value) do { \
214 if (ctx->var_name ## _string) { \
215 int var = av_ ## func_name ## _from_name(ctx->var_name ## _string); \
217 av_log(avctx, AV_LOG_ERROR, "Invalid %s.\n", #var_name); \
218 return AVERROR(EINVAL); \
220 ctx->var_name = var; \
222 ctx->var_name = default_value; \
234#define OFFSET(x) offsetof(ScaleVAAPIContext, x)
235#define FLAGS (AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM)
237 {
"w",
"Output video width",
239 {
"h",
"Output video height",
241 {
"format",
"Output video format (software format of hardware frames)",
243 {
"mode",
"Scaling mode",
245 0, VA_FILTER_SCALING_NL_ANAMORPHIC,
FLAGS, .unit =
"mode" },
246 {
"default",
"Use the default (depend on the driver) scaling algorithm",
248 {
"fast",
"Use fast scaling algorithm",
250 {
"hq",
"Use high quality scaling algorithm",
252 {
"nl_anamorphic",
"Use nolinear anamorphic scaling algorithm",
256 {
"out_color_matrix",
"Output colour matrix coefficient set",
258 {
"out_range",
"Output colour range",
261 {
"full",
"Full range",
263 {
"limited",
"Limited range",
265 {
"jpeg",
"Full range",
267 {
"mpeg",
"Limited range",
269 {
"tv",
"Limited range",
271 {
"pc",
"Full range",
274 {
"out_color_primaries",
"Output colour primaries",
277 {
"out_color_transfer",
"Output colour transfer characteristics",
280 {
"out_chroma_location",
"Output chroma sample location",
283 {
"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,
SCALE_FORCE_OAR_NB-1,
FLAGS, .unit =
"force_oar" },
287 {
"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 },
288 {
"reset_sar",
"reset SAR to 1 and scale to square pixels if scaling proportionally",
OFFSET(reset_sar),
AV_OPT_TYPE_BOOL, { .i64 = 0}, 0, 1,
FLAGS },
313 .p.name =
"scale_vaapi",
315 .p.priv_class = &scale_vaapi_class,
SwsAArch64OpImplParams params
const FFFilter ff_vf_scale_vaapi
static AVFormatContext * ctx
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Main libavfilter public API header.
static const AVColorPrimariesDesc color_primaries[AVCOL_PRI_NB]
int(* init)(AVBSFContext *ctx)
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
@ AV_OPT_TYPE_INT
Underlying C type is int.
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
void av_frame_side_data_remove_by_props(AVFrameSideData ***sd, int *nb_sd, int props)
Remove and free all side data instances that match any of the given side data properties.
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.
@ AV_SIDE_DATA_PROP_SIZE_DEPENDENT
Side data depends on the video dimensions.
#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 av_cold void uninit(AVBitStreamFilterContext *ctx)
static int output_frame(H264Context *h, AVFrame *dst, H264Picture *srcp)
#define FILTER_INPUTS(array)
#define FILTER_OUTPUTS(array)
#define FF_FILTER_FLAG_HWFRAME_AWARE
The filter is aware of hardware frames, and any hardware frame context should not be automatically pr...
#define AVFILTER_DEFINE_CLASS(fname)
#define FILTER_QUERY_FUNC2(func)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
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.
enum AVPixelFormat av_get_pix_fmt(const char *name)
Return the pixel format corresponding to name.
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, double w_adj)
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.
@ SCALE_FORCE_OAR_DISABLE
@ SCALE_FORCE_OAR_INCREASE
@ SCALE_FORCE_OAR_DECREASE
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.
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,...
enum AVPixelFormat sw_format
The pixel format identifying the actual data layout of the hardware 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
AVHWFramesContext * input_frames
int ff_vaapi_vpp_config_output(AVFilterLink *outlink)
int ff_vaapi_vpp_config_input(AVFilterLink *inlink)
int ff_vaapi_vpp_query_formats(const AVFilterContext *avctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
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)
static const AVFilterPad scale_vaapi_outputs[]
static const char * scale_vaapi_mode_name(int mode)
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[]
static av_cold int scale_vaapi_init(AVFilterContext *avctx)
static const AVOption scale_vaapi_options[]
#define STRING_OPTION(var_name, func_name, default_value)
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.