Go to the documentation of this file.
61 #define D(name) case VA_FILTER_SCALING_ ## name: return #name
88 ctx->force_original_aspect_ratio,
ctx->force_divisible_by);
94 if (
inlink->sample_aspect_ratio.num)
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,
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
void ff_vaapi_vpp_pipeline_uninit(AVFilterContext *avctx)
void ff_vaapi_vpp_ctx_init(AVFilterContext *avctx)
static av_cold int init(AVCodecContext *avctx)
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
AVColorTransferCharacteristic
Color Transfer Characteristic.
int ff_vaapi_vpp_render_picture(AVFilterContext *avctx, VAProcPipelineParameterBuffer *params, AVFrame *output_frame)
#define FF_FILTER_FLAG_HWFRAME_AWARE
The filter is aware of hardware frames, and any hardware frame context should not be automatically pr...
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
The exact code depends on how similar the blocks are and how related they are to the and needs to apply these operations to the correct inlink or outlink if there are several Macros are available to factor that when no extra processing is inlink
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
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).
char * colour_transfer_string
@ AVCOL_RANGE_JPEG
the normal 2^n-1 "JPEG" YUV ranges
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.
#define STRING_OPTION(var_name, func_name, default_value)
enum AVColorPrimaries colour_primaries
AVColorPrimaries
Chromaticity coordinates of the source primaries.
const char * name
Filter name.
char * colour_primaries_string
A link between two filters.
void * priv
private data for use by the filter
A filter pad used for either input or output.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
AVRational sample_aspect_ratio
agreed upon sample aspect ratio
static const AVFilterPad outputs[]
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
enum AVPixelFormat output_format
static const char * scale_vaapi_mode_name(int mode)
enum AVChromaLocation chroma_location
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
Rational number (pair of numerator and denominator).
AVFilterLink ** inputs
array of pointers to input links
static const AVFilterPad scale_vaapi_inputs[]
int ff_vaapi_vpp_config_input(AVFilterLink *inlink)
AVFilter ff_vf_scale_vaapi
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several inputs
void ff_vaapi_vpp_ctx_uninit(AVFilterContext *avctx)
@ AVCOL_RANGE_UNSPECIFIED
char * output_format_string
int ff_vaapi_vpp_query_formats(AVFilterContext *avctx)
enum AVColorTransferCharacteristic colour_transfer
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static int scale_vaapi_config_output(AVFilterLink *outlink)
@ AVCHROMA_LOC_UNSPECIFIED
enum AVColorSpace colour_matrix
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames,...
static int scale_vaapi_filter_frame(AVFilterLink *inlink, AVFrame *input_frame)
AVFilterContext * src
source filter
static int output_frame(H264Context *h, AVFrame *dst, H264Picture *srcp)
AVChromaLocation
Location of chroma samples.
static av_cold int scale_vaapi_init(AVFilterContext *avctx)
int w
agreed upon image width
int force_original_aspect_ratio
AVColorSpace
YUV colorspace type.
AVFILTER_DEFINE_CLASS(scale_vaapi)
const char * name
Pad name.
@ AVCOL_RANGE_MPEG
the normal 219*2^(n-8) "MPEG" YUV ranges
static const AVOption scale_vaapi_options[]
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 ...
enum AVPixelFormat av_get_pix_fmt(const char *name)
Return the pixel format corresponding to name.
static const AVFilterPad scale_vaapi_outputs[]
int ff_vaapi_vpp_config_output(AVFilterLink *outlink)
int h
agreed upon image height
char * chroma_location_string
void(* pipeline_uninit)(AVFilterContext *avctx)
AVRational av_mul_q(AVRational b, AVRational c)
Multiply two rationals.
static int query_formats(AVFilterContext *ctx)
static av_cold int uninit(AVCodecContext *avctx)
static const struct ColorPrimaries color_primaries[AVCOL_PRI_NB]
char * colour_matrix_string
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.
int ff_vaapi_vpp_init_params(AVFilterContext *avctx, VAProcPipelineParameterBuffer *params, const AVFrame *input_frame, AVFrame *output_frame)
AVFilterLink ** outputs
array of pointers to output links