From patchwork Mon Jan 17 05:11:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Chen, Wenbin" X-Patchwork-Id: 33640 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp2454061iog; Sun, 16 Jan 2022 21:13:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJxcxpCfXBaTntLaKn17QWv0mHNhobOertMLDzgHR6toiPaOmROiehyjDNY7xjzPb2efL5SY X-Received: by 2002:a17:906:9bc4:: with SMTP id de4mr11149933ejc.78.1642396409115; Sun, 16 Jan 2022 21:13:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642396409; cv=none; d=google.com; s=arc-20160816; b=dCdRHIZDbQKJt4q8D0lcjqlC3+ZJYhZgOHsjGBFqRiA0Ofs5+1Dz6WCMoLUv87d8x+ 1pbWPbh9Vt7sd4E59dejUzWi+0marZBSHPAq1sXUDPdN0fgPBVDvteSlOQAyY7/QhfjA 35oTKyrqSod/+gg+CY9/tNPhkzgDAe1exRg4MuOft1qq2CueQ8Sj14/FIz1icsgBAQMw I6sc5LRD7T8ATIU5CVWkA1oTFdbjQFIgJpmhl8yrVxfefs9Z4D/7jXavlAjcLXK9DDv5 Fc9yaFiRHHaoa3bvyMVpXLp/sc0niV4wOco38kXBvllk8u1n5rL17NCBPVgjd36zuV38 GZdA== 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=m1Zhk2kTXTzqvbHymhsoHEN3HiTE7NLjPZmrZSw41uA=; b=NzWU+y6FdzhQTq+syWMF5MQJKFxwJM9dvZsJGD+DNkMf3xHqrmaec9+DBQfDztEKPK q0y0x8PDpdsIGIRMksY3BhVZiqKuq1mE3mrkW3jDjUzd6tJQiDIYr6l6Rex8XzBpMiaY rzr7WoZNWPyv3EYaeScpDNCgeX/vaiMQR8Qo08ORcp8qgPVfwqhGoymqwfMlWoQbPH/E 9qJETQG3kF4df9jCZJOadbkhKzGGgGi6zSzWpnYH1PCuW/dckC3h+GPB+YFJxLZmwPXf CjU2/F2O1ZYGrk8TRk8YKf4eLVadewjwUMWlBZ6Y4JBJmeEHW3k79Hsrw2nMwlr6AQ4A m6zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b=YQbtR055; 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 i2si1259503ejw.719.2022.01.16.21.13.28; Sun, 16 Jan 2022 21:13:29 -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=YQbtR055; 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 5AA9468AF69; Mon, 17 Jan 2022 07:13:00 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 486D568AEE7 for ; Mon, 17 Jan 2022 07:12:52 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1642396377; x=1673932377; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=99Endm58F7RUw9MPK0iWzPS31OCyTmn+pl4bZQA0p8w=; b=YQbtR055gL63dalc8rb0DztqzzBAxn9c91E9MZlE1PT6CpCVO0szfIRn L7BXkaKlnRWLI+iHSz/VfE8LhyHHxBphIAS3ZG4CB5o4DzjZLWYq3T28J 5RgKahkkgZZ2a8xtEd3lJeh9BP+R7qThdmiXwcgu/a3MGCil0MsmaukFK IjHwjXRWFCSBCqM/Mb58oF/+c2CjpoVRlOeNoJSCWF+VVlmjT3wfE1BIF 0CbkpVWBV+kLJAIcYhFPJfOahpooqc2nRxlJlQmSWlDIQIa45aDhcZGLm lQPozgOGc1MCuLOLIk9MlmATBAId/nL6Lf3ifMUIYxnH3b1PFP/T19ghi Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10229"; a="242111667" X-IronPort-AV: E=Sophos;i="5.88,294,1635231600"; d="scan'208";a="242111667" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jan 2022 21:12:44 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,294,1635231600"; d="scan'208";a="517278350" Received: from chenwenbin-z390-aorus-ultra.sh.intel.com ([10.239.35.110]) by orsmga007.jf.intel.com with ESMTP; 16 Jan 2022 21:12:43 -0800 From: Wenbin Chen To: ffmpeg-devel@ffmpeg.org Date: Mon, 17 Jan 2022 13:11:22 +0800 Message-Id: <20220117051122.628422-4-wenbin.chen@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220117051122.628422-1-wenbin.chen@intel.com> References: <20220117051122.628422-1-wenbin.chen@intel.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH V5 4/4] libavcodec/qsvenc: Add transform skip 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: wq5nXyAhSz4M Add transform_skip option to hevc_qsv. By enabling this option, the transform_skip_enabled_flag in PPS will be set to 1. This option is supported on the platform equal or newer than ICL. Signed-off-by: Wenbin Chen --- doc/encoders.texi | 4 ++++ libavcodec/qsvenc.c | 13 ++++++++++++- libavcodec/qsvenc.h | 1 + libavcodec/qsvenc_hevc.c | 3 +++ 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/doc/encoders.texi b/doc/encoders.texi index 3d7c944fba..66e4753c2a 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -3447,6 +3447,10 @@ Number of rows for tiled encoding. @item @var{aud} Insert the Access Unit Delimiter NAL. + +@item @var{transform_skip} +Turn this option ON to enable transformskip. It is supported on platform equal +or newer than ICL. @end table @subsection MPEG2 Options diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index f16082c320..5ffe06d364 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -358,6 +358,9 @@ static void dump_video_param(AVCodecContext *avctx, QSVEncContext *q, av_log(avctx, AV_LOG_VERBOSE, "DisableDeblockingIdc: %"PRIu32" \n", co2->DisableDeblockingIdc); #endif +#if QSV_VERSION_ATLEAST(1, 26) + av_log(avctx, AV_LOG_VERBOSE, "TransformSkip: %s \n", print_threestate(co3->TransformSkip)); +#endif } static void dump_video_vp9_param(AVCodecContext *avctx, QSVEncContext *q, @@ -969,10 +972,18 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q) #endif } + if (avctx->codec_id == AV_CODEC_ID_HEVC) { +#if QSV_VERSION_ATLEAST(1, 26) + if (q->transform_skip >= 0) + q->extco3.TransformSkip = q->transform_skip ? MFX_CODINGOPTION_ON : + MFX_CODINGOPTION_OFF; + else + q->extco3.TransformSkip = MFX_CODINGOPTION_UNKNOWN; +#endif #if QSV_HAVE_GPB - if (avctx->codec_id == AV_CODEC_ID_HEVC) q->extco3.GPB = q->gpb ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF; #endif + } q->extparam_internal[q->nb_extparam_internal++] = (mfxExtBuffer *)&q->extco3; #endif } diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h index a8807e9d73..65f035045c 100644 --- a/libavcodec/qsvenc.h +++ b/libavcodec/qsvenc.h @@ -200,6 +200,7 @@ typedef struct QSVEncContext { int repeat_pps; int low_power; int gpb; + int transform_skip; int a53_cc; diff --git a/libavcodec/qsvenc_hevc.c b/libavcodec/qsvenc_hevc.c index 08aba3011d..679c09c858 100644 --- a/libavcodec/qsvenc_hevc.c +++ b/libavcodec/qsvenc_hevc.c @@ -251,6 +251,9 @@ static const AVOption options[] = { { "tile_rows", "Number of rows for tiled encoding", OFFSET(qsv.tile_rows), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, UINT16_MAX, VE }, { "recovery_point_sei", "Insert recovery point SEI messages", OFFSET(qsv.recovery_point_sei), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, VE }, { "aud", "Insert the Access Unit Delimiter NAL", OFFSET(qsv.aud), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE}, +#if QSV_VERSION_ATLEAST(1, 26) + { "transform_skip", "Turn this option ON to enable transformskip", OFFSET(qsv.transform_skip), AV_OPT_TYPE_INT, { .i64 = -1}, -1, 1, VE}, +#endif { NULL }, };