From patchwork Tue Jan 25 07:12:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Chen, Wenbin" X-Patchwork-Id: 33833 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2c4e:0:0:0:0 with SMTP id x14csp378871iov; Mon, 24 Jan 2022 23:13:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJx7yBtY/6lSw8gdwNoujBr31s39tH1eCKzaqiTGEUfZqXedxVBVRAXleUagoerHaV2pc1wy X-Received: by 2002:a17:907:1607:: with SMTP id hb7mr8135271ejc.726.1643094796945; Mon, 24 Jan 2022 23:13:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643094796; cv=none; d=google.com; s=arc-20160816; b=DsxSudbrmAwsMejhKxqcxonXTeD25NL0+0BfoFhpVaiXxl0Zm5Af2MOt5PmbHs1SDF tbJUU/yVYs9BN5Q+pQ42hbqIp/fMZjW9EcenRV3xlZSHTYzuHanZhVEA4zmxI1fQPPa8 OAIvYoyz73TF+ujqFMYBuAW8RZpwy4bk8ThjYvob8QaktrWPVw2vnutRtk9XcMkMAGcY 72BmEHuEJ54rpy/MM4wzJSdYt6DQxOcsIWGbZrFQtXERZDD29SFpBbuTD2eEp1I86Wsy POdSCRjI46WR6mEkrU1+renXbxO2ZBJQK7borB7riVxZNZUsJvLqIGoPs5ysNshlInuf dKng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=8UBKWvxnW9nlJSHMq69N4TPEexVjquLEpVwgvBotm1Q=; b=vNZ/7a00DaiRmMyekgMCUdvCulqQ8a3SAY94BRRPuMFQNvOGVXkq6HolHt6mw7hXP3 4yBVbFeNvnDdKE4rrmZZ+VWdi7k8jdl5rCp758mmHfhcaS8UtV4pX9BQbqXu/kX+ksXk kg9xu/zw8sLckgXZaC7dXwXtk+f7q/BWrURy3dNocEanrE0peafmt6YrH20lae8+uekr y348UI+xzDTgOSclHA9gWLTNLw+kW/1ucIpoZztXm8+E3u29owNae1UChaX+DUDVu96E WeZyaEGOM0KeLbfhqplLR98eIjsIfYUHW1dO6S99Q2m41MCf7QCR9G+v581e4cQ0MdKs M6sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b=AUCMFdKr; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id y25si8838162ejk.148.2022.01.24.23.13.08; Mon, 24 Jan 2022 23:13:16 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b=AUCMFdKr; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id ED16768AF12; Tue, 25 Jan 2022 09:13:04 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E873368B036 for ; Tue, 25 Jan 2022 09:12:57 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643094783; x=1674630783; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=RSTqmcKBmXNOOeLIi9ZxheO7+x4wj4kM8ZWhSWw3t+A=; b=AUCMFdKrRxAyaluKXLvnH50hCEHBNGtlgEfhTE20CVmurmtljqFxMiBe VT6uaRNlJxbXdWPVJe818rLhbeu5JZh5o+ZgZ5uHGiCn9Sbh4TjOf9JUK dCRNKeFp9ZTQ/ZXtoGJC5yfmhGXHvFR5GUSQJRVL+1CsoZwSF8stg+mXY 9rTmvtk74D0Zt2kKJ/VsXxR+ueG9BJzUpns7i6MY98VJpsVlhCzRKR9Xy npQL9JMT8Me3Amn+RABc7IqwTO+OQPdsnr4CbnI5ghDjyi3Z+dOZn3j48 bpS4aVnZDffE8CULWXCttpfNbUTGMm/GsMfHsUamGuHPazIhHKIZRCgDV w==; X-IronPort-AV: E=McAfee;i="6200,9189,10237"; a="309557549" X-IronPort-AV: E=Sophos;i="5.88,314,1635231600"; d="scan'208";a="309557549" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jan 2022 23:12:38 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,314,1635231600"; d="scan'208";a="695729645" Received: from wenbin-z390-aorus-ultra.sh.intel.com ([10.239.35.110]) by orsmga005.jf.intel.com with ESMTP; 24 Jan 2022 23:12:38 -0800 From: Wenbin Chen To: ffmpeg-devel@ffmpeg.org Date: Tue, 25 Jan 2022 15:12:36 +0800 Message-Id: <20220125071237.58735-2-wenbin.chen@intel.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220125071237.58735-1-wenbin.chen@intel.com> References: <20220125071237.58735-1-wenbin.chen@intel.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH V2 2/3] libavcodec/qsvenc: Add b_strategy option to hevc_qsv 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: HLty/XkG0zv5 Add b_strategy option to hevc_qsv. By enabling this option, encoder can use b frames as reference. Signed-off-by: Wenbin Chen --- doc/encoders.texi | 3 +++ libavcodec/qsvenc.c | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/doc/encoders.texi b/doc/encoders.texi index 8966610263..6c1c4df57a 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -3403,6 +3403,9 @@ Maximum encoded slice size in bytes. @item @var{p_strategy} Enable P-pyramid: 0-default 1-simple 2-pyramid(bf need to be set to 0). +@item @var{b_strategy} +This option controls usage of B frames as reference. + @item @var{dblk_idc} This option disable deblocking. It has value in range 0~2. diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index f311cd9ce4..a8d876d6d9 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -888,8 +888,6 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q) q->extco2.LookAheadDS = q->look_ahead_downsampling; q->extco2.RepeatPPS = q->repeat_pps ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF; - if (q->b_strategy >= 0) - q->extco2.BRefType = q->b_strategy ? MFX_B_REF_PYRAMID : MFX_B_REF_OFF; if (q->adaptive_i >= 0) q->extco2.AdaptiveI = q->adaptive_i ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF; if (q->adaptive_b >= 0) @@ -910,6 +908,10 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q) q->extco2.DisableDeblockingIdc = q->dblk_idc; #endif +#if QSV_VERSION_ATLEAST(1, 8) + if (q->b_strategy >= 0) + q->extco2.BRefType = q->b_strategy ? MFX_B_REF_PYRAMID : MFX_B_REF_OFF; +#endif #if QSV_VERSION_ATLEAST(1, 9) if (avctx->qmin >= 0 && avctx->qmax >= 0 && avctx->qmin > avctx->qmax) { av_log(avctx, AV_LOG_ERROR, "qmin and or qmax are set but invalid, please make sure min <= max\n");