[FFmpeg-devel] [PATCH 4/4] mpegaudio_tablegen: Don't use llrint

Michael Niedermayer michaelni at gmx.at
Wed Jan 16 00:46:26 CET 2013


On Tue, Jan 15, 2013 at 04:28:05PM -0500, Derek Buitenhuis wrote:
> You cannot count on it being present on all systems, and you
> cannot include libm.h in a host tool, so just hard code a baseline
> implementation.
> 
> Signed-off-by: Derek Buitenhuis <derek.buitenhuis at gmail.com>
> ---
>  libavcodec/mpegaudio_tablegen.h |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/mpegaudio_tablegen.h b/libavcodec/mpegaudio_tablegen.h
> index 1090ea5..1e1a382 100644
> --- a/libavcodec/mpegaudio_tablegen.h
> +++ b/libavcodec/mpegaudio_tablegen.h
> @@ -62,7 +62,8 @@ static void mpegaudio_tableinit(void)
>          for (value = 0; value < 16; value++) {
>              /* cbrtf() isn't available on all systems, so we use powf(). */
>              double f = (double)value * powf(value, 1.0 / 3.0) * pow(2, (exponent - 400) * 0.25 + FRAC_BITS + 5) / IMDCT_SCALAR;
> -            expval_table_fixed[exponent][value] = llrint(f);
> +            /* llrint() isn't always available, so round and cast manually. */
> +            expval_table_fixed[exponent][value] = (long long int) (f >= 0 ? floor(f + 0.5) : ceil(f - 0.5));

ok if it produces the same values
otherwise might be worth looking at the differences

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I know you won't believe me, but the highest form of Human Excellence is
to question oneself and others. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130116/21d6dac8/attachment.asc>


More information about the ffmpeg-devel mailing list