PR #26233 opened by Anton Kesy (antonkesy) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26233 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26233.patch
# Summary of changes Add opt-in oneVPL AI super resolution support to `vpp_qsv` through the stable [`mfxExtVPPAISuperResolution` API](https://intel.github.io/libvpl/latest/API_ref/VPL_structs_vpp.html#mfxextvppaisuperresolution). The new `ai_sr` option requests the default AI-SR mode, while the existing `w` and `h` options set the output dimensions. The feature is compiled only with oneVPL API 2.13 or newer headers, preserving compatibility with older supported headers and the existing libvpl configure minimum. At runtime, the filter checks the oneVPL version and uses the existing VPP Query/init path to validate implementation support. When AI-SR is enabled, the filter does not attach `mfxExtVPPScaling`, which is incompatible with AI-SR during initialization. <!-- If this PR requires new FATE test samples, attach them to the PR and list their target paths below (relative to the fate-suite root). Attached filenames must match the sample's filename: ```fate-samples # e.g. vorbis/new-sample.ogg ``` --> >From 2db2ae15c62881fdf16256238a24e42ed40ab73e Mon Sep 17 00:00:00 2001 From: Anton Kesy <[email protected]> Date: Thu, 19 Nov 2026 13:16:14 +0100 Subject: [PATCH] avfilter/vpp_qsv: add AI super resolution --- doc/filters.texi | 24 ++++++++++++++++++++++++ libavfilter/vf_vpp_qsv.c | 29 ++++++++++++++++++++++++++++- 2 files changed, 52 insertions(+), 1 deletion(-) diff --git a/doc/filters.texi b/doc/filters.texi index 98d3e9f6406..e4759b2116a 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -30547,6 +30547,30 @@ To enable compilation of these filters you need to configure FFmpeg with To use QSV filters, you need to setup the QSV device correctly. For more information, please read @url{https://trac.ffmpeg.org/wiki/Hardware/QuickSync} +@section vpp_qsv +Apply Quick Sync Video VPP filters. + +It accepts the following options: + +@table @option +@item ai_sr +Enable AI super resolution. The default is disabled. This option requires +oneVPL API 2.13 or later and an implementation that supports AI super +resolution. Set @option{w} and @option{h} to the desired output dimensions. +The requested parameters are checked by the VPP implementation. + +@item w +Set the output width. The default is the input width. + +@item h +Set the output height. The default is the input height. +@end table + +For example, to upscale a 960x540 input to 1920x1080: +@example +vpp_qsv=ai_sr=1:w=1920:h=1080 +@end example + @section hstack_qsv Stack input videos horizontally. diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c index 4de99d6490d..cce2841d3c1 100644 --- a/libavfilter/vf_vpp_qsv.c +++ b/libavfilter/vf_vpp_qsv.c @@ -43,6 +43,12 @@ #define OFFSET(x) offsetof(VPPContext, x) #define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM) +#if QSV_ONEVPL && MFX_VERSION >= 2013 +#define QSV_HAVE_AI_SR 1 +#else +#define QSV_HAVE_AI_SR 0 +#endif + /* number of video enhancement filters */ #define ENH_FILTERS_COUNT (8) @@ -58,6 +64,9 @@ typedef struct VPPContext{ mfxExtVPPRotation rotation_conf; mfxExtVPPMirroring mirroring_conf; mfxExtVPPScaling scale_conf; +#if QSV_HAVE_AI_SR + mfxExtVPPAISuperResolution ai_sr_conf; +#endif #if QSV_ONEVPL /** Video signal info attached on the input frame */ mfxExtVideoSignalInfo invsi_conf; @@ -122,6 +131,7 @@ typedef struct VPPContext{ int has_passthrough; /* apply pass through mode if possible */ int field_rate; /* Generate output at frame rate or field rate for deinterlace mode, 0: frame, 1: field */ int tonemap; /* 1: perform tonemapping if the input has HDR metadata, 0: always disable tonemapping */ + int ai_sr; } VPPContext; static const char *const var_names[] = { @@ -687,7 +697,20 @@ static int config_output(AVFilterLink *outlink) } } - if (inlink->w != outlink->w || inlink->h != outlink->h || in_format != vpp->out_format) { +#if QSV_HAVE_AI_SR + if (vpp->ai_sr) { + if (!QSV_RUNTIME_VERSION_ATLEAST(mfx_version, 2, 13)) { + av_log(ctx, AV_LOG_ERROR, "AI super resolution requires a oneVPL 2.13 or newer runtime.\n"); + return AVERROR(ENOSYS); + } + + INIT_MFX_EXTBUF(ai_sr_conf, MFX_EXTBUFF_VPP_AI_SUPER_RESOLUTION); + SET_MFX_PARAM_FIELD(ai_sr_conf, SRMode, MFX_AI_SUPER_RESOLUTION_MODE_DEFAULT); + } +#endif + + if ((inlink->w != outlink->w || inlink->h != outlink->h || in_format != vpp->out_format) && + !vpp->ai_sr) { if (QSV_RUNTIME_VERSION_ATLEAST(mfx_version, 1, 19)) { int mode = vpp->scale_mode; @@ -708,6 +731,7 @@ static int config_output(AVFilterLink *outlink) if (vpp->use_frc || vpp->use_crop || vpp->deinterlace || vpp->denoise || vpp->detail || vpp->procamp || vpp->rotate || vpp->hflip || + vpp->ai_sr || inlink->w != outlink->w || inlink->h != outlink->h || in_format != vpp->out_format || vpp->color_range != AVCOL_RANGE_UNSPECIFIED || vpp->color_primaries != AVCOL_PRI_UNSPECIFIED || @@ -884,6 +908,9 @@ static const AVOption vpp_options[] = { { "height", "Output video height(0=input video height, -1=keep input video aspect)", OFFSET(oh), AV_OPT_TYPE_STRING, { .str="w*ch/cw" }, 0, 255, .flags = FLAGS }, { "format", "Output pixel format", OFFSET(output_format_str), AV_OPT_TYPE_STRING, { .str = "same" }, .flags = FLAGS }, { "async_depth", "Internal parallelization depth, the higher the value the higher the latency.", OFFSET(qsv.async_depth), AV_OPT_TYPE_INT, { .i64 = 4 }, 0, INT_MAX, .flags = FLAGS }, +#if QSV_HAVE_AI_SR + { "ai_sr", "Enable AI super resolution", OFFSET(ai_sr), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, .flags = FLAGS }, +#endif #if QSV_ONEVPL { "scale_mode", "scaling & format conversion mode (mode compute(3), vd(4) and ve(5) are only available on some platforms)", OFFSET(scale_mode), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 5, .flags = FLAGS, .unit = "scale mode" }, #else -- 2.54.1 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
