[FFmpeg-devel] [PATCH 2/2] avcodec/libvpxenc: update the ranges for "cpu_used" so it matches the "speed" alias

James Zern jzern at google.com
Fri Jun 6 22:57:58 CEST 2014


On Fri, Jun 6, 2014 at 12:27 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
> Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> ---
>  libavcodec/libvpxenc.c |    5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>

lgtm. For error reporting purposes it's probably best to have the
range checks duplicated here, though it can be a bit fragile...

> diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
> index b56c02d..3dddffd 100644
> --- a/libavcodec/libvpxenc.c
> +++ b/libavcodec/libvpxenc.c
> @@ -415,8 +415,7 @@ static av_cold int vpx_init(AVCodecContext *avctx,
>
>      //codec control failures are currently treated only as warnings
>      av_log(avctx, AV_LOG_DEBUG, "vpx_codec_control\n");
> -    if (ctx->cpu_used != INT_MIN)
> -        codecctl_int(avctx, VP8E_SET_CPUUSED,          ctx->cpu_used);
> +    codecctl_int(avctx, VP8E_SET_CPUUSED,          ctx->cpu_used);
>      if (ctx->flags & VP8F_AUTO_ALT_REF)
>          ctx->auto_alt_ref = 1;
>      if (ctx->auto_alt_ref >= 0)
> @@ -754,7 +753,7 @@ static int vp8_encode(AVCodecContext *avctx, AVPacket *pkt,
>  #endif
>
>  #define COMMON_OPTIONS \
> -    { "cpu-used",        "Quality/Speed ratio modifier",           OFFSET(cpu_used),        AV_OPT_TYPE_INT, {.i64 = 1},       INT_MIN, INT_MAX, VE}, \
> +    { "cpu-used",        "Quality/Speed ratio modifier",           OFFSET(cpu_used),        AV_OPT_TYPE_INT, {.i64 = 1},       -16,     16,      VE}, \
>      { "auto-alt-ref",    "Enable use of alternate reference " \
>                           "frames (2-pass only)",                   OFFSET(auto_alt_ref),    AV_OPT_TYPE_INT, {.i64 = -1},      -1,      1,       VE}, \
>      { "lag-in-frames",   "Number of frames to look ahead for " \
> --
> 1.7.9.5
>


More information about the ffmpeg-devel mailing list