diff mbox

[FFmpeg-devel] lavc/libvpxenc: fix -auto-alt-ref option type

Message ID 1477087573-6466-1-git-send-email-jzern@google.com
State Accepted
Commit 41da4f8cb3a7ac6888dbe6a6bbe1a573a74062ff
Headers show

Commit Message

James Zern Oct. 21, 2016, 10:06 p.m. UTC
From: Kagami Hiiragi <kagami@genshiken.org>

vp9_cx_iface actually allows values in range [0..2].
This fixes ticket #5894.

Signed-off-by: Kagami Hiiragi <kagami@genshiken.org>
---
 libavcodec/libvpxenc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Kagami Hiiragi Oct. 21, 2016, 10:10 p.m. UTC | #1
On 22/10/16 01:06, James Zern wrote:
> From: Kagami Hiiragi <kagami@genshiken.org>
> 
> vp9_cx_iface actually allows values in range [0..2].
> This fixes ticket #5894.
> 
> Signed-off-by: Kagami Hiiragi <kagami@genshiken.org>
> ---
>  libavcodec/libvpxenc.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
> index 2db87f7..68f25a4 100644
> --- a/libavcodec/libvpxenc.c
> +++ b/libavcodec/libvpxenc.c
> @@ -621,7 +621,8 @@ FF_ENABLE_DEPRECATION_WARNINGS
>      if (ctx->flags & VP8F_AUTO_ALT_REF)
>          ctx->auto_alt_ref = 1;
>      if (ctx->auto_alt_ref >= 0)
> -        codecctl_int(avctx, VP8E_SET_ENABLEAUTOALTREF, ctx->auto_alt_ref);
> +        codecctl_int(avctx, VP8E_SET_ENABLEAUTOALTREF,
> +                     avctx->codec_id == AV_CODEC_ID_VP8 ? !!ctx->auto_alt_ref : ctx->auto_alt_ref);
>      if (ctx->arnr_max_frames >= 0)
>          codecctl_int(avctx, VP8E_SET_ARNR_MAXFRAMES,   ctx->arnr_max_frames);
>      if (ctx->arnr_strength >= 0)
> @@ -1025,7 +1026,7 @@ static int vpx_encode(AVCodecContext *avctx, AVPacket *pkt,
>  
>  #define COMMON_OPTIONS \
>      { "auto-alt-ref",    "Enable use of alternate reference " \
> -                         "frames (2-pass only)",                   OFFSET(auto_alt_ref),    AV_OPT_TYPE_BOOL, {.i64 = -1},     -1,      1,       VE}, \
> +                         "frames (2-pass only)",                   OFFSET(auto_alt_ref),    AV_OPT_TYPE_INT, {.i64 = -1},      -1,      2,       VE}, \
>      { "lag-in-frames",   "Number of frames to look ahead for " \
>                           "alternate reference frame selection",    OFFSET(lag_in_frames),   AV_OPT_TYPE_INT, {.i64 = -1},      -1,      INT_MAX, VE}, \
>      { "arnr-maxframes",  "altref noise reduction max frame count", OFFSET(arnr_max_frames), AV_OPT_TYPE_INT, {.i64 = -1},      -1,      INT_MAX, VE}, \
> 

Thanks, your variant is better.
James Zern Oct. 22, 2016, 1:19 a.m. UTC | #2
On Fri, Oct 21, 2016 at 3:10 PM, Kagami Hiiragi <kagami@genshiken.org> wrote:
> On 22/10/16 01:06, James Zern wrote:
>> From: Kagami Hiiragi <kagami@genshiken.org>
>>
>> vp9_cx_iface actually allows values in range [0..2].
>> This fixes ticket #5894.
>>
>> Signed-off-by: Kagami Hiiragi <kagami@genshiken.org>
>> ---
>>  libavcodec/libvpxenc.c | 5 +++--
>>  1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> [...]
>>
>
> Thanks, your variant is better.
>

applied. thanks.
diff mbox

Patch

diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index 2db87f7..68f25a4 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -621,7 +621,8 @@  FF_ENABLE_DEPRECATION_WARNINGS
     if (ctx->flags & VP8F_AUTO_ALT_REF)
         ctx->auto_alt_ref = 1;
     if (ctx->auto_alt_ref >= 0)
-        codecctl_int(avctx, VP8E_SET_ENABLEAUTOALTREF, ctx->auto_alt_ref);
+        codecctl_int(avctx, VP8E_SET_ENABLEAUTOALTREF,
+                     avctx->codec_id == AV_CODEC_ID_VP8 ? !!ctx->auto_alt_ref : ctx->auto_alt_ref);
     if (ctx->arnr_max_frames >= 0)
         codecctl_int(avctx, VP8E_SET_ARNR_MAXFRAMES,   ctx->arnr_max_frames);
     if (ctx->arnr_strength >= 0)
@@ -1025,7 +1026,7 @@  static int vpx_encode(AVCodecContext *avctx, AVPacket *pkt,
 
 #define COMMON_OPTIONS \
     { "auto-alt-ref",    "Enable use of alternate reference " \
-                         "frames (2-pass only)",                   OFFSET(auto_alt_ref),    AV_OPT_TYPE_BOOL, {.i64 = -1},     -1,      1,       VE}, \
+                         "frames (2-pass only)",                   OFFSET(auto_alt_ref),    AV_OPT_TYPE_INT, {.i64 = -1},      -1,      2,       VE}, \
     { "lag-in-frames",   "Number of frames to look ahead for " \
                          "alternate reference frame selection",    OFFSET(lag_in_frames),   AV_OPT_TYPE_INT, {.i64 = -1},      -1,      INT_MAX, VE}, \
     { "arnr-maxframes",  "altref noise reduction max frame count", OFFSET(arnr_max_frames), AV_OPT_TYPE_INT, {.i64 = -1},      -1,      INT_MAX, VE}, \