From patchwork Sat Oct 10 06:22:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Xiang, Haihao" X-Patchwork-Id: 22830 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 15F0A44A594 for ; Sat, 10 Oct 2020 09:23:00 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E487A68BA61; Sat, 10 Oct 2020 09:22:59 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5C0BA68B9E7 for ; Sat, 10 Oct 2020 09:22:53 +0300 (EEST) IronPort-SDR: IKFuYni2QAiTqHv7z0et3PYCKDVcznpWQbWWf+sHnFZeTS/fMegBXAC3Z1jraqjmv86R52oH8i 28LgnjboigUw== X-IronPort-AV: E=McAfee;i="6000,8403,9769"; a="164776952" X-IronPort-AV: E=Sophos;i="5.77,358,1596524400"; d="scan'208";a="164776952" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Oct 2020 23:22:50 -0700 IronPort-SDR: 4GIpt61b/QOJDDf8ApoP+W+AExChHXO+cUII7A1NUc8VWWZXZDCp8tYHS/m1of2LN61gtcBSBS oxH70qPIOP2Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,357,1596524400"; d="scan'208";a="529214394" Received: from xhh-tgl64.sh.intel.com ([10.239.159.152]) by orsmga005.jf.intel.com with ESMTP; 09 Oct 2020 23:22:49 -0700 From: Haihao Xiang To: ffmpeg-devel@ffmpeg.org Date: Sat, 10 Oct 2020 14:22:43 +0800 Message-Id: <20201010062243.1478719-1-haihao.xiang@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] lavc/qsvenc: allows the SDK runtime to choose LowPower/non-LowPower modes X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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: Haihao Xiang Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" The SDK supports LowPower and non-LowPower modes, but some features are available only under one of the two modes. Currently non-LowPower mode is always chosen in FFmpeg if the mode is not set explicitly, which will result in some SDK errors if a feature is unavailable under non-LowPower mode. With this patch, the mode is unknown in FFmpeg if the mode is not set explicitly, the SDK is responsible for mode selection --- This is the new version for "lavc/qsvenc: let the SDK to choose the encoding mode by default" and the git commit log is updated only libavcodec/qsvenc.c | 6 ++++-- libavcodec/qsvenc.h | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index 1ed8f5d973..cff96e59c9 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -510,7 +510,7 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q) } } - if (q->low_power) { + if (q->low_power == 1) { #if QSV_HAVE_VDENC q->param.mfx.LowPower = MFX_CODINGOPTION_ON; #else @@ -519,7 +519,9 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q) q->low_power = 0; q->param.mfx.LowPower = MFX_CODINGOPTION_OFF; #endif - } else + } else if (q->low_power == -1) + q->param.mfx.LowPower = MFX_CODINGOPTION_UNKNOWN; + else q->param.mfx.LowPower = MFX_CODINGOPTION_OFF; q->param.mfx.CodecProfile = q->profile; diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h index 4f579d1db1..577775cc1a 100644 --- a/libavcodec/qsvenc.h +++ b/libavcodec/qsvenc.h @@ -96,7 +96,7 @@ { "adaptive_b", "Adaptive B-frame placement", OFFSET(qsv.adaptive_b), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, VE }, \ { "b_strategy", "Strategy to choose between I/P/B-frames", OFFSET(qsv.b_strategy), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, VE }, \ { "forced_idr", "Forcing I frames as IDR frames", OFFSET(qsv.forced_idr), AV_OPT_TYPE_BOOL,{ .i64 = 0 }, 0, 1, VE }, \ -{ "low_power", "enable low power mode(experimental: many limitations by mfx version, BRC modes, etc.)", OFFSET(qsv.low_power), AV_OPT_TYPE_BOOL, { .i64 = 0}, 0, 1, VE},\ +{ "low_power", "enable low power mode(experimental: many limitations by mfx version, BRC modes, etc.)", OFFSET(qsv.low_power), AV_OPT_TYPE_BOOL, { .i64 = -1}, -1, 1, VE},\ extern const AVCodecHWConfigInternal *ff_qsv_enc_hw_configs[];