> -    sample_rate = ldexp(val, exp - 16383 - 63);
> +    if (exp >= 0)
> +        sample_rate = val << exp;
> +    else
> +        sample_rate = (val + (1<<(-exp/2))) >> -exp;

To round the value it should probably be something like:
    sample_rate = (val + ((uint64_t)1<<(-exp-1))) >> -exp;

To avoid possible undefined behavior it would also need to check that
exp is within range.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to