[FFmpeg-devel,v4,6/9] lavc/qsvenc: add an option to set h264 pps for every frame

Submitted by Zhong Li on Nov. 29, 2018, 8:29 a.m.

Details

Message ID 1543480147-4359-7-git-send-email-zhong.li@intel.com
State New
Headers show

Commit Message

Zhong Li Nov. 29, 2018, 8:29 a.m.
RepeatPPS is enabled by default in mfx. It is not necessary mostly and
wasting encoding bits.
Add an option to control it and disable it by default.

Signed-off-by: Zhong Li <zhong.li@intel.com>
---
 libavcodec/qsvenc.c      | 1 +
 libavcodec/qsvenc.h      | 2 ++
 libavcodec/qsvenc_h264.c | 2 ++
 libavcodec/version.h     | 2 +-
 4 files changed, 6 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index 91b8905..c2e7030 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -654,6 +654,7 @@  FF_ENABLE_DEPRECATION_WARNINGS
 
 #if QSV_VERSION_ATLEAST(1, 8)
             q->extco2.LookAheadDS = q->look_ahead_downsampling;
+            q->extco2.RepeatPPS   = q->repeat_pps ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF;
 
 #if FF_API_PRIVATE_OPT
 FF_DISABLE_DEPRECATION_WARNINGS
diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h
index fbdc199..4316a10 100644
--- a/libavcodec/qsvenc.h
+++ b/libavcodec/qsvenc.h
@@ -162,6 +162,8 @@  typedef struct QSVEncContext {
     int int_ref_qp_delta;
     int recovery_point_sei;
 
+    int repeat_pps;
+
     int a53_cc;
 
 #if QSV_HAVE_MF
diff --git a/libavcodec/qsvenc_h264.c b/libavcodec/qsvenc_h264.c
index ac7023e..13217b4 100644
--- a/libavcodec/qsvenc_h264.c
+++ b/libavcodec/qsvenc_h264.c
@@ -155,6 +155,8 @@  static const AVOption options[] = {
     { "auto"   , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_MF_AUTO     }, INT_MIN, INT_MAX,     VE, "mfmode" },
 #endif
 
+    { "repeat_pps", "repeat pps for every frame", OFFSET(qsv.repeat_pps), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
+
     { NULL },
 };
 
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 5e0b188..fbfe1fb 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@ 
 
 #define LIBAVCODEC_VERSION_MAJOR  58
 #define LIBAVCODEC_VERSION_MINOR  40
-#define LIBAVCODEC_VERSION_MICRO 100
+#define LIBAVCODEC_VERSION_MICRO 101
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
                                                LIBAVCODEC_VERSION_MINOR, \