diff options
Diffstat (limited to 'libavcodec/cbrt_tablegen.h')
-rw-r--r-- | libavcodec/cbrt_tablegen.h | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/libavcodec/cbrt_tablegen.h b/libavcodec/cbrt_tablegen.h index d8c77c2221..07ef392f65 100644 --- a/libavcodec/cbrt_tablegen.h +++ b/libavcodec/cbrt_tablegen.h @@ -27,13 +27,26 @@ #include <math.h> #include "libavutil/attributes.h" +#if USE_FIXED +#define CBRT_RENAME(a) a ## _fixed +#define CBRT(x) (int)floor((x).f * 8192 + 0.5) +#else +#define CBRT_RENAME(a) a +#define CBRT(x) x.i +#endif + #if CONFIG_HARDCODED_TABLES +#if USE_FIXED +#define cbrt_tableinit_fixed() +#include "libavcodec/cbrt_fixed_tables.h" +#else #define cbrt_tableinit() #include "libavcodec/cbrt_tables.h" +#endif #else static uint32_t cbrt_tab[1 << 13]; -static av_cold void cbrt_tableinit(void) +static av_cold void CBRT_RENAME(cbrt_tableinit)(void) { if (!cbrt_tab[(1<<13) - 1]) { int i; @@ -44,7 +57,7 @@ static av_cold void cbrt_tableinit(void) uint32_t i; } f; f.f = pow(i, 1.0 / 3.0) * i; - cbrt_tab[i] = f.i; + cbrt_tab[i] = CBRT(f); } } } |