From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 240AC40F6F for ; Sun, 2 Jan 2022 03:12:28 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1D63968B144; Sun, 2 Jan 2022 05:12:25 +0200 (EET) Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1D29E687F96 for ; Sun, 2 Jan 2022 05:12:19 +0200 (EET) Received: by mail-pf1-f173.google.com with SMTP id t19so26710036pfg.9 for ; Sat, 01 Jan 2022 19:12:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:from:date:subject:fcc:content-transfer-encoding :mime-version:to:cc; bh=9rxJdJEpd0CKC8k1uBReGueoRYh6A8C71AlXmy5Y+U4=; b=mr2K7+xbD770spi1nAVEup+4G24TmprWTuylx3RG56of/sB8SY/XOQP0Xy64r92V5W IxAKu3MrNW1inrTMofdbYwYn36+l6FBM9DsyaYwkLEAOJ4xhteIK+ehQK/RkDqaixwzv Sdl84pb8HAuiyipAqFu3xosER1BT12Z4ii/pcx5jehp80a4IBsm4hl6HkEtgbnz8HwmM qdNH5nyXgV1umzCAzl4YwTbJjmFu5Rn2286UKLk+NvTMxKIuSBbGLcy4kkJPzhH2jjGp lbO52oxTus2bgVY1XNX3kQy/ALO/jg45InXcwnij5fZ4ixLcU5B2ANnUuKeu+0SRd0ur f2nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=9rxJdJEpd0CKC8k1uBReGueoRYh6A8C71AlXmy5Y+U4=; b=TOMdVkdvSLb7xWGtgda/4isVeWUNJo6dJUUc4UsL8NowGFOK/8hVHcEEos+GgFUdsd ftdvjBn8ezGm6go4qaEj4irRrb8AxtNS2HIGrTT1KfeeoLcCrX3/9xxvFxTcsaSlzoh0 FGOkHhtAUKaUeJWudp6MeyzwRX1JbkRcI8iaEgyNiUGhTCJZMe7mFixrmFpgdJwgN0iR TX+a8lEHz1iOhFAx7VITxGM8pcsP101TbtzrNSdEnEsWFkUAvKs9ss2JtvHIi6U5VAPy 96KamUEILHCAGxhXFptzJEoeipM+vWDQaSzJkvojD7W12uaw0MrSTQ4IRN6xMexDY24x hRGQ== X-Gm-Message-State: AOAM531V4vENsETZ0LZHDnNpW3BdYfD3TxzKAnjBm7PH6oAZjh4fnMyb w4VelUsUR1YWC8iQrZfVG7oiNk+KE0cHx3xb X-Google-Smtp-Source: ABdhPJxR7jyShYyWojo4/UzYzIdI9mSAiLtOOgmYMounvkMeRl6qGiYZo5huq8kAEj+HJREu07TBSA== X-Received: by 2002:aa7:9598:0:b0:4bb:1d3a:524c with SMTP id z24-20020aa79598000000b004bb1d3a524cmr41135517pfj.83.1641093137248; Sat, 01 Jan 2022 19:12:17 -0800 (PST) Received: from [127.0.0.1] (master.gitmailbox.com. [34.83.118.50]) by smtp.gmail.com with ESMTPSA id z14sm35210388pfh.60.2022.01.01.19.12.16 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 01 Jan 2022 19:12:16 -0800 (PST) Message-Id: From: ffmpegagent Date: Sun, 02 Jan 2022 03:12:16 +0000 Fcc: Sent MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH] avfilter/vpp_qsv: fix regression on older api versions (e.g. 1.11) X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: softworkz Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: From: softworkz Commit 8b83dad82512a6948b63408f964463b063ad24c9 introduced a regression in a way that scaling via vpp_qsv didn't work any longer for devices with an MSDK runtime version lower than 1.19. This is true for older CPUs which are stuck at 1.11. The commit added checks for the compile-sdk version but it didn't test for the runtime version. Signed-off-by: softworkz --- avfilter/vpp_qsv: fix regression on older api versions (e.g. 1.11) Fix a recently introduced regression when using QSV VPP. Published-As: https://github.com/ffstaging/FFmpeg/releases/tag/pr-ffstaging-15%2Fsoftworkz%2Fqsv_vpp_regression-v1 Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg pr-ffstaging-15/softworkz/qsv_vpp_regression-v1 Pull-Request: https://github.com/ffstaging/FFmpeg/pull/15 libavfilter/vf_vpp_qsv.c | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c index ab58a5777e..09590157e3 100644 --- a/libavfilter/vf_vpp_qsv.c +++ b/libavfilter/vf_vpp_qsv.c @@ -139,8 +139,9 @@ static const AVOption options[] = { { "height", "Output video height", 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(async_depth), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, .flags = FLAGS }, +#ifdef QSV_HAVE_SCALING_CONFIG { "scale_mode", "scale mode: 0=auto, 1=low power, 2=high quality", OFFSET(scale_mode), AV_OPT_TYPE_INT, { .i64 = MFX_SCALING_MODE_DEFAULT }, MFX_SCALING_MODE_DEFAULT, MFX_SCALING_MODE_QUALITY, .flags = FLAGS, "scale mode" }, - +#endif { NULL } }; @@ -304,6 +305,7 @@ static int config_output(AVFilterLink *outlink) QSVVPPParam param = { NULL }; QSVVPPCrop crop = { 0 }; mfxExtBuffer *ext_buf[ENH_FILTERS_COUNT]; + mfxVersion mfx_version; AVFilterLink *inlink = ctx->inputs[0]; enum AVPixelFormat in_format; @@ -317,6 +319,11 @@ static int config_output(AVFilterLink *outlink) param.ext_buf = ext_buf; param.async_depth = vpp->async_depth; + if (MFXQueryVersion(vpp->qsv->session, &mfx_version) < 0) { + av_log(ctx, AV_LOG_ERROR, "Failed to query mfx version.\n"); + return AVERROR(EINVAL); + } + if (inlink->format == AV_PIX_FMT_QSV) { if (!inlink->hw_frames_ctx || !inlink->hw_frames_ctx->data) return AVERROR(EINVAL); @@ -467,19 +474,20 @@ static int config_output(AVFilterLink *outlink) #endif } - if (inlink->w != outlink->w || inlink->h != outlink->h) { #ifdef QSV_HAVE_SCALING_CONFIG - memset(&vpp->scale_conf, 0, sizeof(mfxExtVPPScaling)); - vpp->scale_conf.Header.BufferId = MFX_EXTBUFF_VPP_SCALING; - vpp->scale_conf.Header.BufferSz = sizeof(mfxExtVPPScaling); - vpp->scale_conf.ScalingMode = vpp->scale_mode; - - param.ext_buf[param.num_ext_buf++] = (mfxExtBuffer*)&vpp->scale_conf; -#else - av_log(ctx, AV_LOG_WARNING, "The QSV VPP Scale option is " - "not supported with this MSDK version.\n"); -#endif + if (inlink->w != outlink->w || inlink->h != outlink->h) { + if (QSV_RUNTIME_VERSION_ATLEAST(mfx_version, 1, 19)) { + memset(&vpp->scale_conf, 0, sizeof(mfxExtVPPScaling)); + vpp->scale_conf.Header.BufferId = MFX_EXTBUFF_VPP_SCALING; + vpp->scale_conf.Header.BufferSz = sizeof(mfxExtVPPScaling); + vpp->scale_conf.ScalingMode = vpp->scale_mode; + + param.ext_buf[param.num_ext_buf++] = (mfxExtBuffer*)&vpp->scale_conf; + } else + av_log(ctx, AV_LOG_WARNING, "The QSV VPP Scale option is " + "not supported with this MSDK version.\n"); } +#endif if (vpp->use_frc || vpp->use_crop || vpp->deinterlace || vpp->denoise || vpp->detail || vpp->procamp || vpp->rotate || vpp->hflip || base-commit: d6b2357eddca392ee137cb2a92ff178a0a7d0cce -- ffmpeg-codebot _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".