aboutsummaryrefslogtreecommitdiff
path: root/src/dsp/lossless.h
diff options
context:
space:
mode:
authorVikas Arora <vikasa@google.com>2013-03-13 16:43:18 -0700
committerVikas Arora <vikasa@google.com>2013-03-14 10:15:22 -0700
commit1e7bf8805bd030c19924a5306837ecd72c295751 (patch)
tree20a7189518b1824f7805016e9718e26e9c3a6668 /src/dsp/lossless.h
parentb6dbce6bfeaabde2a7b581c4c6888d532d32f3ac (diff)
downloadwebp-tools_r22.2.tar.gz
Added 16bit swapping of RGB565 / RGB4444 colorspace. Added ARM/NEON code for decoder/encoder modules. Speedup in WebP compression (method 3 and above). Change-Id: I95a697338bef7c3ea08054eb5f850a97d1889eb9
Diffstat (limited to 'src/dsp/lossless.h')
-rw-r--r--src/dsp/lossless.h16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/dsp/lossless.h b/src/dsp/lossless.h
index 22a91cbf..f14e2ea7 100644
--- a/src/dsp/lossless.h
+++ b/src/dsp/lossless.h
@@ -59,10 +59,20 @@ static WEBP_INLINE uint32_t VP8LSubSampleSize(uint32_t size,
return (size + (1 << sampling_bits) - 1) >> sampling_bits;
}
-// Faster logarithm for integers, with the property of log2(0) == 0.
-float VP8LFastLog2(int v);
+// Faster logarithm for integers. Small values use a look-up table.
+#define LOG_LOOKUP_IDX_MAX 256
+extern const float kLog2Table[LOG_LOOKUP_IDX_MAX];
+extern const float kSLog2Table[LOG_LOOKUP_IDX_MAX];
+extern float VP8LFastLog2Slow(int v);
+extern float VP8LFastSLog2Slow(int v);
+static WEBP_INLINE float VP8LFastLog2(int v) {
+ return (v < LOG_LOOKUP_IDX_MAX) ? kLog2Table[v] : VP8LFastLog2Slow(v);
+}
// Fast calculation of v * log2(v) for integer input.
-static WEBP_INLINE float VP8LFastSLog2(int v) { return VP8LFastLog2(v) * v; }
+static WEBP_INLINE float VP8LFastSLog2(int v) {
+ return (v < LOG_LOOKUP_IDX_MAX) ? kSLog2Table[v] : VP8LFastSLog2Slow(v);
+}
+
// In-place difference of each component with mod 256.
static WEBP_INLINE uint32_t VP8LSubPixels(uint32_t a, uint32_t b) {