[FFmpeg-devel] [PATCH 2/4] tablegen: Don't use cbrtf in host tools

Michael Niedermayer michaelni at gmx.at
Wed Jan 16 00:43:35 CET 2013


On Tue, Jan 15, 2013 at 04:28:03PM -0500, Derek Buitenhuis wrote:
> You cannot count on them being present on all systems, and you
> cannot include libm.h in a host tool, so just hard code baseline
> implementations.
> 
> Signed-off-by: Derek Buitenhuis <derek.buitenhuis at gmail.com>
> ---
>  libavcodec/cbrt_tablegen.h      |    3 ++-
>  libavcodec/mpegaudio_tablegen.h |    6 ++++--
>  2 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/libavcodec/cbrt_tablegen.h b/libavcodec/cbrt_tablegen.h
> index a9d34dc..5ef97c8 100644
> --- a/libavcodec/cbrt_tablegen.h
> +++ b/libavcodec/cbrt_tablegen.h
> @@ -36,12 +36,13 @@ static void cbrt_tableinit(void)
>  {
>      if (!cbrt_tab[(1<<13) - 1]) {
>          int i;
> +        /* cbrtf() isn't available on all systems, so we use powf(). */
>          for (i = 0; i < 1<<13; i++) {
>              union {
>                  float f;
>                  uint32_t i;
>              } f;
> -            f.f = cbrtf(i) * i;
> +            f.f = powf(i, 1.0 / 3.0) * i;
>              cbrt_tab[i] = f.i;

is there a reason you dont use pow () ?
pow should be even more widespread than powf


[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Concerning the gods, I have no means of knowing whether they exist or not
or of what sort they may be, because of the obscurity of the subject, and
the brevity of human life -- Protagoras
-------------- 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/683b5902/attachment.asc>


More information about the ffmpeg-devel mailing list