[opus] incorrect use of MAX16

Jean-Marc Valin jmvalin at jmvalin.ca
Mon Dec 9 13:43:31 PST 2013


Thanks, it's fixed now.

	Jean-Marc

On 12/09/2013 01:19 PM, Pedro Becerra wrote:
> Hello,
> in celt/celt_encoder.c line 369, the 'b' argument to MAX16
> can sometimes be greater than what can be represented by
> a 16bit integer.  The default definition of MAX16 is type-less,
> but I am working on an architecture with hardware support for
> min/max of 16bit. Changing the default definition to take
> advantage of this hardware changes the result of that
> computation.
> 
> Please consider the change below for inclusion in the opus
> code base.
> 
>      /* *tf_estimate = 1 + MIN16(1, sqrt(MAX16(0, tf_max-30))/20); */
> -   *tf_estimate = celt_sqrt(MAX16(0, 
> SHL32(MULT16_16(QCONST16(0.0069,14),MIN16(163,tf_max)),14)-QCONST32(0.139,28)));
> +   *tf_estimate = celt_sqrt(MAX32(0, 
> SHL32(MULT16_16(QCONST16(0.0069,14),MIN16(163,tf_max)),14)-QCONST32(0.139,28)));
>      /*printf("%d %f\n", tf_max, mask_metric);*/
> 
> --
> _______________________________________________
> opus mailing list
> opus at xiph.org
> http://lists.xiph.org/mailman/listinfo/opus
> 



More information about the opus mailing list