[FFmpeg-devel] [PATCH] qsvenc: Add adaptive_i and adaptive_b toggles

Will Kelleher wkelleher at gogoair.com
Fri Nov 13 00:10:33 CET 2015


> Scene change detection ?
> and
> Content dependant B frame insertion
> 
> And if people agree then please someone submit a patch with it
> ill apply it
> 

New patch.

-------------- next part --------------
>From 983fb04e74c133de350da41bd5961f8c840ff327 Mon Sep 17 00:00:00 2001
From: Will Kelleher <wkelleher at gogoair.com>
Date: Tue, 10 Nov 2015 14:30:21 -0600
Subject: [PATCH] qsvenc: Add adaptive_i and adaptive_b toggles

Signed-off-by: Will Kelleher <wkelleher at gogoair.com>
---
 libavcodec/qsvenc.c      | 2 ++
 libavcodec/qsvenc.h      | 2 ++
 libavcodec/qsvenc_h264.c | 2 ++
 3 files changed, 6 insertions(+)

diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index df1f777..5e6ace1 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -173,6 +173,8 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q)
 #endif
 #if QSV_VERSION_ATLEAST(1,8)
         q->extco2.LookAheadDS           = q->look_ahead_downsampling;
+        q->extco2.AdaptiveI = q->adaptive_i ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_UNKNOWN;
+        q->extco2.AdaptiveB = q->adaptive_b ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_UNKNOWN;
 #endif
 
         q->extparam_internal[q->nb_extparam_internal++] = (mfxExtBuffer *)&q->extco2;
diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h
index 3dd7afe..a5f9463 100644
--- a/libavcodec/qsvenc.h
+++ b/libavcodec/qsvenc.h
@@ -76,6 +76,8 @@ typedef struct QSVEncContext {
     int look_ahead;
     int look_ahead_depth;
     int look_ahead_downsampling;
+    int adaptive_i;
+    int adaptive_b;
 
     char *load_plugins;
 } QSVEncContext;
diff --git a/libavcodec/qsvenc_h264.c b/libavcodec/qsvenc_h264.c
index 0e5a26c..1febe93 100644
--- a/libavcodec/qsvenc_h264.c
+++ b/libavcodec/qsvenc_h264.c
@@ -97,6 +97,8 @@ static const AVOption options[] = {
     { "slow",        NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_TARGETUSAGE_3  },            INT_MIN, INT_MAX, VE, "preset" },
     { "slower",      NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_TARGETUSAGE_2  },            INT_MIN, INT_MAX, VE, "preset" },
     { "veryslow",    NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_TARGETUSAGE_BEST_QUALITY  }, INT_MIN, INT_MAX, VE, "preset" },
+    { "adaptive_i",  "Scene detection", OFFSET(qsv.adaptive_i), AV_OPT_TYPE_BOOL,   {.i64 = 0}, 0, 1, VE},
+    { "adaptive_b",  "Content-dependent B-frame insertion", OFFSET(qsv.adaptive_b), AV_OPT_TYPE_BOOL,   {.i64 = 0}, 0, 1, VE},
 
     { NULL },
 };
-- 
2.6.2



More information about the ffmpeg-devel mailing list