From b0547ff0b490b8ba01d4dfa32c3c1e27f0b248c0 Mon Sep 17 00:00:00 2001 From: Pascal Massimino Date: Thu, 17 Dec 2015 15:11:56 +0100 Subject: [PATCH] move back common constants for lossless_enc*.c into the .h Change-Id: I11bc979db691f6518d85e2e1c3ac7f05d69681b0 --- src/dsp/lossless.h | 8 ++++++++ src/dsp/lossless_enc.c | 7 ------- src/dsp/lossless_enc_mips32.c | 4 ---- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/dsp/lossless.h b/src/dsp/lossless.h index d6418898..28f6ae20 100644 --- a/src/dsp/lossless.h +++ b/src/dsp/lossless.h @@ -174,6 +174,14 @@ static WEBP_INLINE uint32_t VP8LSubSampleSize(uint32_t size, // ----------------------------------------------------------------------------- // Faster logarithm for integers. Small values use a look-up table. + +// The threshold till approximate version of log_2 can be used. +// Practically, we can get rid of the call to log() as the two values match to +// very high degree (the ratio of these two is 0.99999x). +// Keeping a high threshold for now. +#define APPROX_LOG_WITH_CORRECTION_MAX 65536 +#define APPROX_LOG_MAX 4096 +#define LOG_2_RECIPROCAL 1.44269504088896338700465094007086 #define LOG_LOOKUP_IDX_MAX 256 extern const float kLog2Table[LOG_LOOKUP_IDX_MAX]; extern const float kSLog2Table[LOG_LOOKUP_IDX_MAX]; diff --git a/src/dsp/lossless_enc.c b/src/dsp/lossless_enc.c index e9dbe82e..0061008b 100644 --- a/src/dsp/lossless_enc.c +++ b/src/dsp/lossless_enc.c @@ -329,13 +329,6 @@ const uint8_t kPrefixEncodeExtraBitsValue[PREFIX_LOOKUP_IDX_MAX] = { 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126 }; -// The threshold till approximate version of log_2 can be used. -// Practically, we can get rid of the call to log() as the two values match to -// very high degree (the ratio of these two is 0.99999x). -// Keeping a high threshold for now. -#define APPROX_LOG_WITH_CORRECTION_MAX 65536 -#define APPROX_LOG_MAX 4096 -#define LOG_2_RECIPROCAL 1.44269504088896338700465094007086 static float FastSLog2Slow(uint32_t v) { assert(v >= LOG_LOOKUP_IDX_MAX); if (v < APPROX_LOG_WITH_CORRECTION_MAX) { diff --git a/src/dsp/lossless_enc_mips32.c b/src/dsp/lossless_enc_mips32.c index 0468a5aa..2f1988c3 100644 --- a/src/dsp/lossless_enc_mips32.c +++ b/src/dsp/lossless_enc_mips32.c @@ -22,10 +22,6 @@ #include #include -#define APPROX_LOG_WITH_CORRECTION_MAX 65536 -#define APPROX_LOG_MAX 4096 -#define LOG_2_RECIPROCAL 1.44269504088896338700465094007086 - static float FastSLog2Slow(uint32_t v) { assert(v >= LOG_LOOKUP_IDX_MAX); if (v < APPROX_LOG_WITH_CORRECTION_MAX) {