Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2400)

Side by Side Diff: third_party/libwebp/dsp/lossless.h

Issue 12942006: libwebp: update snapshot to v0.3.0-rc6 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: local webkit layout expectations Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 Google Inc. All Rights Reserved. 1 // Copyright 2012 Google Inc. All Rights Reserved.
2 // 2 //
3 // This code is licensed under the same terms as WebM: 3 // This code is licensed under the same terms as WebM:
4 // Software License Agreement: http://www.webmproject.org/license/software/ 4 // Software License Agreement: http://www.webmproject.org/license/software/
5 // Additional IP Rights Grant: http://www.webmproject.org/license/additional/ 5 // Additional IP Rights Grant: http://www.webmproject.org/license/additional/
6 // ----------------------------------------------------------------------------- 6 // -----------------------------------------------------------------------------
7 // 7 //
8 // Image transforms and color space conversion methods for lossless decoder. 8 // Image transforms and color space conversion methods for lossless decoder.
9 // 9 //
10 // Authors: Vikas Arora (vikaas.arora@gmail.com) 10 // Authors: Vikas Arora (vikaas.arora@gmail.com)
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 52
53 //------------------------------------------------------------------------------ 53 //------------------------------------------------------------------------------
54 // Misc methods. 54 // Misc methods.
55 55
56 // Computes sampled size of 'size' when sampling using 'sampling bits'. 56 // Computes sampled size of 'size' when sampling using 'sampling bits'.
57 static WEBP_INLINE uint32_t VP8LSubSampleSize(uint32_t size, 57 static WEBP_INLINE uint32_t VP8LSubSampleSize(uint32_t size,
58 uint32_t sampling_bits) { 58 uint32_t sampling_bits) {
59 return (size + (1 << sampling_bits) - 1) >> sampling_bits; 59 return (size + (1 << sampling_bits) - 1) >> sampling_bits;
60 } 60 }
61 61
62 // Faster logarithm for integers, with the property of log2(0) == 0. 62 // Faster logarithm for integers. Small values use a look-up table.
63 float VP8LFastLog2(int v); 63 #define LOG_LOOKUP_IDX_MAX 256
64 extern const float kLog2Table[LOG_LOOKUP_IDX_MAX];
65 extern const float kSLog2Table[LOG_LOOKUP_IDX_MAX];
66 extern float VP8LFastLog2Slow(int v);
67 extern float VP8LFastSLog2Slow(int v);
68 static WEBP_INLINE float VP8LFastLog2(int v) {
69 return (v < LOG_LOOKUP_IDX_MAX) ? kLog2Table[v] : VP8LFastLog2Slow(v);
70 }
64 // Fast calculation of v * log2(v) for integer input. 71 // Fast calculation of v * log2(v) for integer input.
65 static WEBP_INLINE float VP8LFastSLog2(int v) { return VP8LFastLog2(v) * v; } 72 static WEBP_INLINE float VP8LFastSLog2(int v) {
73 return (v < LOG_LOOKUP_IDX_MAX) ? kSLog2Table[v] : VP8LFastSLog2Slow(v);
74 }
75
66 76
67 // In-place difference of each component with mod 256. 77 // In-place difference of each component with mod 256.
68 static WEBP_INLINE uint32_t VP8LSubPixels(uint32_t a, uint32_t b) { 78 static WEBP_INLINE uint32_t VP8LSubPixels(uint32_t a, uint32_t b) {
69 const uint32_t alpha_and_green = 79 const uint32_t alpha_and_green =
70 0x00ff00ffu + (a & 0xff00ff00u) - (b & 0xff00ff00u); 80 0x00ff00ffu + (a & 0xff00ff00u) - (b & 0xff00ff00u);
71 const uint32_t red_and_blue = 81 const uint32_t red_and_blue =
72 0xff00ff00u + (a & 0x00ff00ffu) - (b & 0x00ff00ffu); 82 0xff00ff00u + (a & 0x00ff00ffu) - (b & 0x00ff00ffu);
73 return (alpha_and_green & 0xff00ff00u) | (red_and_blue & 0x00ff00ffu); 83 return (alpha_and_green & 0xff00ff00u) | (red_and_blue & 0x00ff00ffu);
74 } 84 }
75 85
76 //------------------------------------------------------------------------------ 86 //------------------------------------------------------------------------------
77 87
78 #if defined(__cplusplus) || defined(c_plusplus) 88 #if defined(__cplusplus) || defined(c_plusplus)
79 } // extern "C" 89 } // extern "C"
80 #endif 90 #endif
81 91
82 #endif // WEBP_DSP_LOSSLESS_H_ 92 #endif // WEBP_DSP_LOSSLESS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698