37#include "AMF/components/HQScaler.h"
38#include "AMF/components/ColorSpace.h"
78 output_pix_fmts = output_pix_fmts_default;
98 if (inlink->
w > outlink->
w || inlink->
h > outlink->
h) {
103 res =
ctx->amf_device_ctx->factory->pVtbl->CreateComponent(
ctx->amf_device_ctx->factory,
ctx->amf_device_ctx->context, AMFHQScaler, &
ctx->component);
108 AMF_ASSIGN_PROPERTY_SIZE(res,
ctx->component, AMF_HQ_SCALER_OUTPUT_SIZE,
out_size);
111 if (
ctx->algorithm != -1) {
112 AMF_ASSIGN_PROPERTY_INT64(res,
ctx->component, AMF_HQ_SCALER_ALGORITHM,
ctx->algorithm);
114 if (
ctx->sharpness != -1) {
115 AMF_ASSIGN_PROPERTY_DOUBLE(res,
ctx->component, AMF_HQ_SCALER_SHARPNESS,
ctx->sharpness);
117 AMF_ASSIGN_PROPERTY_BOOL(res,
ctx->component, AMF_HQ_SCALER_FILL,
ctx->fill);
118 AMF_ASSIGN_PROPERTY_BOOL(res,
ctx->component, AMF_HQ_SCALER_KEEP_ASPECT_RATIO,
ctx->keep_ratio);
120 ctx->in_color_range = AMF_COLOR_RANGE_UNDEFINED;
121 ctx->in_primaries = AMF_COLOR_PRIMARIES_UNDEFINED;
122 ctx->in_trc = AMF_COLOR_TRANSFER_CHARACTERISTIC_UNDEFINED;
123 ctx->color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_UNKNOWN;
124 ctx->out_color_range = AMF_COLOR_RANGE_UNDEFINED;
125 ctx->out_primaries = AMF_COLOR_PRIMARIES_UNDEFINED;
126 ctx->out_trc = AMF_COLOR_TRANSFER_CHARACTERISTIC_UNDEFINED;
134#define OFFSET(x) offsetof(AMFFilterContext, x)
135#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
145 {
"algorithm",
"Scaling algorithm",
OFFSET(algorithm),
AV_OPT_TYPE_INT, { .i64 = -1 }, -1, AMF_HQ_SCALER_ALGORITHM_VIDEOSR1_1,
FLAGS,
"algorithm" },
146 {
"bilinear",
"Bilinear", 0,
AV_OPT_TYPE_CONST, { .i64 = AMF_HQ_SCALER_ALGORITHM_BILINEAR }, 0, 0,
FLAGS,
"algorithm" },
147 {
"bicubic",
"Bicubic", 0,
AV_OPT_TYPE_CONST, { .i64 = AMF_HQ_SCALER_ALGORITHM_BICUBIC }, 0, 0,
FLAGS,
"algorithm" },
148 {
"sr1-0",
"Video SR1.0", 0,
AV_OPT_TYPE_CONST, { .i64 = AMF_HQ_SCALER_ALGORITHM_VIDEOSR1_0 }, 0, 0,
FLAGS,
"algorithm" },
149 {
"point",
"Point", 0,
AV_OPT_TYPE_CONST, { .i64 = AMF_HQ_SCALER_ALGORITHM_POINT }, 0, 0,
FLAGS,
"algorithm" },
150 {
"sr1-1",
"Video SR1.1", 0,
AV_OPT_TYPE_CONST, { .i64 = AMF_HQ_SCALER_ALGORITHM_VIDEOSR1_1 }, 0, 0,
FLAGS,
"algorithm" },
177 .p.priv_class = &sr_amf_class,
const FFFilter ff_vf_sr_amf
#define AMF_RETURN_IF_FALSE(avctx, exp, ret_value,...)
Error handling helper.
simple assert() macros that are a bit more flexible than ISO C assert().
Main libavfilter public API header.
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_FLOAT
Underlying C type is float.
@ 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...
#define AVFILTER_FLAG_HWDEVICE
The filter can create hardware frames using AVFilterContext.hw_device_ctx.
#define AVERROR_FILTER_NOT_FOUND
Filter not found.
#define AVERROR_UNKNOWN
Unknown error, typically from an external library.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
enum AMF_SURFACE_FORMAT av_av_to_amf_format(enum AVPixelFormat fmt)
static av_cold void uninit(AVBitStreamFilterContext *ctx)
#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 FILTER_QUERY_FUNC(func)
#define AVFILTER_DEFINE_CLASS(fname)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
#define AV_PIX_FMT_RGBAF16
AVPixelFormat
Pixel format.
@ AV_PIX_FMT_NV12
planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
@ AV_PIX_FMT_DXVA2_VLD
HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer.
@ AV_PIX_FMT_BGRA
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
@ AV_PIX_FMT_RGBA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
@ AV_PIX_FMT_D3D11
Hardware surfaces for Direct3D11.
@ AV_PIX_FMT_AMF_SURFACE
HW acceleration through AMF.
AVFilterLink ** inputs
array of pointers to input links
void * priv
private data for use by the filter
A link between two filters.
int w
agreed upon image width
int h
agreed upon image height
AVFilterContext * src
source filter
A filter pad used for either input or output.
static AVFormatContext * ctx
int amf_filter_init(AVFilterContext *avctx)
int amf_init_filter_config(AVFilterLink *outlink, enum AVPixelFormat *in_format)
int amf_filter_filter_frame(AVFilterLink *inlink, AVFrame *in)
int amf_setup_input_output_formats(AVFilterContext *avctx, const enum AVPixelFormat *input_pix_fmts, const enum AVPixelFormat *output_pix_fmts)
void amf_filter_uninit(AVFilterContext *avctx)
static const AVFilterPad amf_filter_inputs[]
static int amf_filter_query_formats(AVFilterContext *avctx)
static const AVFilterPad amf_filter_outputs[]
static int amf_filter_config_output(AVFilterLink *outlink)
static int amf_filter_query_formats(AVFilterContext *avctx)
static const AVOption sr_amf_options[]