[FFmpeg-devel] [PATCH 05/10] libavcodec/qsvenc: Add transform skip for hevc_qsv

wenbin.chen at intel.com wenbin.chen at intel.com
Tue Jan 26 04:32:08 EET 2021


From: Wenbinc-Bin <wenbin.chen at intel.com>

Add transform skip option for hevc_qsv. Command line option
is "transform_skip". By enabling this option, the
transform_skip_enabled_flag in PPS will be set to 1. This option
is only supported in the platform newer than ICL.

Signed-off-by Wenbin Chen <wenbin.chen at intel.com>
---
 libavcodec/qsvenc.c      | 10 ++++++++--
 libavcodec/qsvenc.h      |  1 +
 libavcodec/qsvenc_hevc.c |  3 +++
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index a811d06329..f2fcd09ae0 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -304,7 +304,9 @@ static void dump_video_param(AVCodecContext *avctx, QSVEncContext *q,
            info->FrameInfo.FrameRateExtD, info->FrameInfo.FrameRateExtN);
 
     av_log(avctx, AV_LOG_VERBOSE, "DisableDeblockingIdc: %"PRIu32" \n", co2->DisableDeblockingIdc);
-
+#if QSV_VERSION_ATLEAST(1, 26)
+    av_log(avctx, AV_LOG_VERBOSE, "TransformSkip: %s \n", print_threestate(co3->TransformSkip));
+#endif
 }
 
 static int select_rc_mode(AVCodecContext *avctx, QSVEncContext *q)
@@ -813,10 +815,14 @@ FF_ENABLE_DEPRECATION_WARNINGS
             av_log(avctx, AV_LOG_WARNING, "Please set max_b_frames(-bf) to 0 to enable P-pyramid\n");
         }
 
+        if (avctx->codec_id == AV_CODEC_ID_HEVC) {
+#if QSV_VERSION_ATLEAST(1, 26)
+            q->extco3.TransformSkip  = q->transform_skip ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF;
+#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 7da6e0a50f..d1de914724 100644
--- a/libavcodec/qsvenc.h
+++ b/libavcodec/qsvenc.h
@@ -197,6 +197,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 347f30655e..07a7e3b2be 100644
--- a/libavcodec/qsvenc_hevc.c
+++ b/libavcodec/qsvenc_hevc.c
@@ -246,6 +246,9 @@ static const AVOption options[] = {
 
     { "tile_cols",  "Number of columns for tiled encoding",   OFFSET(qsv.tile_cols),    AV_OPT_TYPE_INT, { .i64 = 0 }, 0, UINT16_MAX, VE },
     { "tile_rows",  "Number of rows for tiled encoding",      OFFSET(qsv.tile_rows),    AV_OPT_TYPE_INT, { .i64 = 0 }, 0, UINT16_MAX, 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 },
 };
-- 
2.25.1



More information about the ffmpeg-devel mailing list