Justin Ruggles <[email protected]> writes:

> ---
> removed isqrt64() and used ff_sqrt() instead.
>
>  libavcodec/ac3enc_fixed.c |    8 +++++++-
>  1 files changed, 7 insertions(+), 1 deletions(-)
>
> diff --git a/libavcodec/ac3enc_fixed.c b/libavcodec/ac3enc_fixed.c
> index 26bba0f..9443f01 100644
> --- a/libavcodec/ac3enc_fixed.c
> +++ b/libavcodec/ac3enc_fixed.c
> @@ -118,7 +118,13 @@ static void clip_coefficients(DSPContext *dsp, int32_t 
> *coef, unsigned int len)
>   */
>  static CoefType calc_cpl_coord(CoefSumType energy_ch, CoefSumType energy_cpl)
>  {
> -    return 1048576;
> +    if (energy_cpl <= COEF_MAX) {
> +        return 1048576;
> +    } else {
> +        uint64_t coord = energy_ch / (energy_cpl >> 24);
> +        coord = FFMIN(coord, 1073741824);
> +        return FFMIN(ff_sqrt(coord) << 9, COEF_MAX);

FFMIN() evaluates one of the arguments twice so ff_sqrt() might be called
twice if the compiler doesn't understand or ignores the av_const attribute.

-- 
Måns Rullgård
[email protected]
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to