diff --git a/libavfilter/vf_scale_qsv.c b/libavfilter/vf_scale_qsv.c index 82bb64eb42..2305797450 100644 --- a/libavfilter/vf_scale_qsv.c +++ b/libavfilter/vf_scale_qsv.c @@ -70,6 +70,7 @@ enum var_name { }; #define QSV_HAVE_SCALING_CONFIG QSV_VERSION_ATLEAST(1, 19) +#define QSV_HAVE_INTERPOLATION_METHOD QSV_VERSION_ATLEAST(1, 33) #define MFX_IMPL_VIA_MASK(impl) (0x0f00 & (impl)) typedef struct QSVScaleContext { @@ -96,6 +97,7 @@ typedef struct QSVScaleContext { mfxExtVPPScaling scale_conf; #endif int mode; + int method; mfxExtBuffer *ext_buffers[1 + QSV_HAVE_SCALING_CONFIG]; int num_ext_buf; @@ -419,6 +421,10 @@ static int init_out_session(AVFilterContext *ctx) s->scale_conf.Header.BufferId = MFX_EXTBUFF_VPP_SCALING; s->scale_conf.Header.BufferSz = sizeof(mfxExtVPPScaling); s->scale_conf.ScalingMode = s->mode; +#if QSV_HAVE_INTERPOLATION_METHOD + s->scale_conf.InterpolationMethod = s->method; + av_log(ctx, AV_LOG_VERBOSE, "Interpolation method: %d\n", s->method); +#endif s->ext_buffers[s->num_ext_buf++] = (mfxExtBuffer*)&s->scale_conf; av_log(ctx, AV_LOG_VERBOSE, "Scaling mode: %d\n", s->mode); #endif @@ -634,6 +640,17 @@ static const AVOption options[] = { { "low_power", "", 0, AV_OPT_TYPE_CONST, { .i64 = 1}, 0, 0, FLAGS, "mode"}, { "hq", "", 0, AV_OPT_TYPE_CONST, { .i64 = 2}, 0, 0, FLAGS, "mode"}, #endif +#if QSV_HAVE_INTERPOLATION_METHOD + { "method", "set interpolation method", OFFSET(method), AV_OPT_TYPE_INT, { .i64 = MFX_INTERPOLATION_DEFAULT}, MFX_INTERPOLATION_DEFAULT, MFX_INTERPOLATION_ADVANCED, FLAGS, "method"}, + { "nearest", "nearest neighbor method", 0, AV_OPT_TYPE_CONST, { .i64 = MFX_INTERPOLATION_NEAREST_NEIGHBOR}, INT_MIN, INT_MAX, FLAGS, "method"}, + { "bilinear", "bilinear method", 0, AV_OPT_TYPE_CONST, { .i64 = MFX_INTERPOLATION_BILINEAR}, INT_MIN, INT_MAX, FLAGS, "method"}, + { "advanced", "advanced method", 0, AV_OPT_TYPE_CONST, { .i64 = MFX_INTERPOLATION_ADVANCED}, INT_MIN, INT_MAX, FLAGS, "method"}, +#else + { "method", "(not supported)", OFFSET(method), AV_OPT_TYPE_INT, { .i64 = 0}, 0, INT_MAX, FLAGS, "method"}, + { "nearest", "", 0, AV_OPT_TYPE_CONST, { .i64 = 1}, 0, 0, FLAGS, "method"}, + { "bilinear", "", 0, AV_OPT_TYPE_CONST, { .i64 = 2}, 0, 0, FLAGS, "method"}, + { "advanced", "", 0, AV_OPT_TYPE_CONST, { .i64 = 3}, 0, 0, FLAGS, "method"}, +#endif { NULL }, };