From 69711704b99b9140e2be5e80d8eea94bc2b0eedf Mon Sep 17 00:00:00 2001 Subject: [PATCH 1/3] qsv scale interpolation method. --- libavfilter/vf_scale_qsv.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/libavfilter/vf_scale_qsv.c b/libavfilter/vf_scale_qsv.c index 2ac2373..3e6b516 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) typedef struct QSVScaleContext { const AVClass *class; @@ -95,6 +96,7 @@ typedef struct QSVScaleContext { mfxExtVPPScaling scale_conf; #endif int mode; + int method; mfxExtBuffer *ext_buffers[1 + QSV_HAVE_SCALING_CONFIG]; int num_ext_buf; @@ -411,6 +413,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 @@ -638,6 +644,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 }, }; -- 2.30.1 (Apple Git-130)