From patchwork Thu Jan 13 07:36:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Chen, Wenbin" X-Patchwork-Id: 33548 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp214855iog; Wed, 12 Jan 2022 23:38:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJwwRQ7vB+vjnim9dw65oynb9zoK5I0ZLz2h6TJgxvlE4Ky32MXm4n2EB3S0oTb58jDZ9EkJ X-Received: by 2002:a05:6402:649:: with SMTP id u9mr2456644edx.325.1642059521731; Wed, 12 Jan 2022 23:38:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642059521; cv=none; d=google.com; s=arc-20160816; b=kosgtmFazv0i8/FfG9GUxkOorGBxMc6I49dXGvNcTy/CPMY5G8gEHwZWRMKyaf00Or AD2LrxaNXz2gJ+UB1IZUjhRIOL7L0n3j1LDERhXdNNydISok/Y4P78GLcGv6w+ARdZ93 6Rgs+/kox8SheKJO0h10UWWaoy5JpHFsSXKloErZb+KSwUGXboL4efOzRmCwUkM8RKcK rhh6jPfpYxsOoLtSeAiGhphRBtUXVM+VZokRovnlEbkgWUGh8wAZTdMyfpwM6+gfJ/+D UPnOLqnBJze3+ZAlbYw9cSM7TCivL/A2ryehnxthJI2s+MHj0DmfuufFVlgyUlfVkg3o tKXA== 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:message-id:date:to:from :dkim-signature:delivered-to; bh=CB7pdnfm95joWHxwGDFFXu7yLfNZ8jmQPNcOgpp9Ga4=; b=g+H7j3TIbZ+8Ls2P1PqRnKTbmrxcAlynIRxFOBjvMmwP+s34jL3oQ+yfF6e/fy3pvG h4cqA25SGU8UdCjYr2HlmgKbb66mErG76LuWOT0Ucr1cAhxrZghVEpYkOTFSQT0SW2e3 uGOYsoq6pzsdh1wRLZkrV2W2znz7GxwZBLggG288TQKyj33xRc+0svpMJWaHW9xDGTQH gkwqgEpltAo4Yj17ddhcHRbQ0eWspEKcwfvXWvsdtk+oNydH5X4i9+K3BL9iNUMcdu/5 vZyI9corCvV4t8eVv0f09n4dE3EHH+1VH+0wj7s3dP5LehC6PPy18dpV2CGQExo1yFuj Z6Cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b=hVyudaKC; 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 cs18si1141359ejc.964.2022.01.12.23.38.41; Wed, 12 Jan 2022 23:38:41 -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=hVyudaKC; 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 15F7A68B4A4; Thu, 13 Jan 2022 09:38:36 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D749C68B4A4 for ; Thu, 13 Jan 2022 09:38:28 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1642059514; x=1673595514; h=from:to:subject:date:message-id:mime-version: content-transfer-encoding; bh=T6aGtPlM4FJwhVKXDWlmYSBz4uY2mGRV+YXwNdQBJBI=; b=hVyudaKC8uoVm4fxy++N/7yFf7Sxkv1PFBQF3Ti3lVRg3sCiENbGB8nI PxpbvOZYGrFQr2Milg8nPOToex15QhYb9/kAElV5ErhTB9UkTMNYL9JB5 CzzhJlr76/WPSNmuHGhZ7W/UCiHqDEExMuNZI9QA8/iNhVhXS7hqfffUV L7W7GoaFQHpdDZjNjLLUzG3RCxj17hvPLuCKKxnNyFlz9xATHlPpiJaAW PPyjAKY6YRltjSl2F4wpJpZmIg8cCH/9t/ygGQEWFYFc7H2ddkk1RoLbP 3yTSlCFOx+vUSWJ6DQSDhkBYYOfDW8oEfcaSPSfib9zO9+3KI1PoMqpXJ A==; X-IronPort-AV: E=McAfee;i="6200,9189,10225"; a="223933967" X-IronPort-AV: E=Sophos;i="5.88,284,1635231600"; d="scan'208";a="223933967" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jan 2022 23:38:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,284,1635231600"; d="scan'208";a="576847887" Received: from chenwenbin-z390-aorus-ultra.sh.intel.com ([10.239.35.110]) by fmsmga008.fm.intel.com with ESMTP; 12 Jan 2022 23:38:08 -0800 From: Wenbin Chen To: ffmpeg-devel@ffmpeg.org Date: Thu, 13 Jan 2022 15:36:44 +0800 Message-Id: <20220113073647.114995-1-wenbin.chen@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH V4 1/4] libavcodec/qsvenc: Add max_frame_size support 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: Ge7SpmFkbqkC Add max_frame_size support to hevc_qsv as well. Signed-off-by: Wenbin Chen --- doc/encoders.texi | 3 +++ libavcodec/qsvenc.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/doc/encoders.texi b/doc/encoders.texi index 7cc8be1209..68921fbd40 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -3388,6 +3388,9 @@ intra refresh cycle. @item @var{rdo} Enable rate distortion optimization. +@item @var{max_frame_size} +Maximum encoded frame size in bytes. + @item @var{idr_interval} Distance (in I-frames) between IDR frames. @table @samp diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index 4e7a15f060..b3728d28d5 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -859,8 +859,6 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q) if (q->mbbrc >= 0) q->extco2.MBBRC = q->mbbrc ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF; - if (q->max_frame_size >= 0) - q->extco2.MaxFrameSize = q->max_frame_size; #if QSV_HAVE_MAX_SLICE_SIZE if (q->max_slice_size >= 0) q->extco2.MaxSliceSize = q->max_slice_size; @@ -889,6 +887,8 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q) if (avctx->codec_id == AV_CODEC_ID_H264 || avctx->codec_id == AV_CODEC_ID_HEVC) { if (q->extbrc >= 0) q->extco2.ExtBRC = q->extbrc ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF; + if (q->max_frame_size >= 0) + q->extco2.MaxFrameSize = q->max_frame_size; #if QSV_VERSION_ATLEAST(1, 9) if (avctx->qmin >= 0 && avctx->qmax >= 0 && avctx->qmin > avctx->qmax) {