Hi,

On Fri, Jan 6, 2012 at 1:33 PM, Justin Ruggles <[email protected]> wrote:
> We clip the value to prevent data type overflows and undefined behavior.
> Using larger values is insanely slow anyway.
> ---
>  libavcodec/g722enc.c |   11 +++++++++++
>  1 files changed, 11 insertions(+), 0 deletions(-)
>
> diff --git a/libavcodec/g722enc.c b/libavcodec/g722enc.c
> index 1e6fe87..4625ab9 100644
> --- a/libavcodec/g722enc.c
> +++ b/libavcodec/g722enc.c
> @@ -80,6 +80,17 @@ static av_cold int g722_encode_init(AVCodecContext * avctx)
>         avctx->frame_size = 320;
>     }
>
> +    if (avctx->trellis) {
> +        /* validate trellis */
> +        if (avctx->trellis < 0 || avctx->trellis > 16) {
> +            int new_trellis = av_clip(avctx->trellis, 0, 16);
> +            av_log(avctx, AV_LOG_WARNING, "Requested trellis value is not "
> +                   "allowed. Using %d instead of %d\n", new_trellis,
> +                   avctx->trellis);
> +            avctx->trellis = new_trellis;
> +        }
> +    }

Make this a min/max trellis setting as #define's on top of the file?
We may at some point change our opinion on what is slow and what is
fast.

Ronald
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to