diff options
author | agalin89 <[email protected]> | 2020-12-01 22:58:22 +0000 |
---|---|---|
committer | Scott <[email protected]> | 2021-01-22 20:26:05 +0000 |
commit | 758abbafc029a11afe09793723ced037959d577c (patch) | |
tree | 77e3ec538c71aa9d53483315e384347ea6cfa505 /contrib/ffmpeg | |
parent | ce57e7a23872c299854d76201a5e000a98d11acf (diff) |
qsv: add scaling modes and interpolation methods for qsv scale filter
Diffstat (limited to 'contrib/ffmpeg')
-rw-r--r-- | contrib/ffmpeg/A23-qsv-interpolation.patch | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/contrib/ffmpeg/A23-qsv-interpolation.patch b/contrib/ffmpeg/A23-qsv-interpolation.patch new file mode 100644 index 000000000..a27540ea5 --- /dev/null +++ b/contrib/ffmpeg/A23-qsv-interpolation.patch @@ -0,0 +1,49 @@ +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 }, + }; |