| OLD | NEW |
| 1 // Copyright 2014 Google Inc. All Rights Reserved. | 1 // Copyright 2014 Google Inc. All Rights Reserved. |
| 2 // | 2 // |
| 3 // Use of this source code is governed by a BSD-style license | 3 // Use of this source code is governed by a BSD-style license |
| 4 // that can be found in the COPYING file in the root of the source | 4 // that can be found in the COPYING file in the root of the source |
| 5 // tree. An additional intellectual property rights grant can be found | 5 // tree. An additional intellectual property rights grant can be found |
| 6 // in the file PATENTS. All contributing project authors may | 6 // in the file PATENTS. All contributing project authors may |
| 7 // be found in the AUTHORS file in the root of the source tree. | 7 // be found in the AUTHORS file in the root of the source tree. |
| 8 // ----------------------------------------------------------------------------- | 8 // ----------------------------------------------------------------------------- |
| 9 // | 9 // |
| 10 // Specific inlined methods for boolean decoder [VP8GetBit() ...] | 10 // Specific inlined methods for boolean decoder [VP8GetBit() ...] |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 typedef uint64_t lbit_t; | 39 typedef uint64_t lbit_t; |
| 40 #elif (BITS > 16) | 40 #elif (BITS > 16) |
| 41 typedef uint32_t lbit_t; | 41 typedef uint32_t lbit_t; |
| 42 #elif (BITS > 8) | 42 #elif (BITS > 8) |
| 43 typedef uint16_t lbit_t; | 43 typedef uint16_t lbit_t; |
| 44 #else | 44 #else |
| 45 typedef uint8_t lbit_t; | 45 typedef uint8_t lbit_t; |
| 46 #endif | 46 #endif |
| 47 | 47 |
| 48 extern const uint8_t kVP8Log2Range[128]; | 48 extern const uint8_t kVP8Log2Range[128]; |
| 49 extern const range_t kVP8NewRange[128]; | 49 extern const uint8_t kVP8NewRange[128]; |
| 50 | 50 |
| 51 // special case for the tail byte-reading | 51 // special case for the tail byte-reading |
| 52 void VP8LoadFinalBytes(VP8BitReader* const br); | 52 void VP8LoadFinalBytes(VP8BitReader* const br); |
| 53 | 53 |
| 54 //------------------------------------------------------------------------------ | 54 //------------------------------------------------------------------------------ |
| 55 // Inlined critical functions | 55 // Inlined critical functions |
| 56 | 56 |
| 57 // makes sure br->value_ has at least BITS bits worth of data | 57 // makes sure br->value_ has at least BITS bits worth of data |
| 58 static WEBP_INLINE void VP8LoadNewBytes(VP8BitReader* const br) { | 58 static WEBP_INLINE void VP8LoadNewBytes(VP8BitReader* const br) { |
| 59 assert(br != NULL && br->buf_ != NULL); | 59 assert(br != NULL && br->buf_ != NULL); |
| 60 // Read 'BITS' bits at a time if possible. | 60 // Read 'BITS' bits at a time if possible. |
| 61 if (br->buf_ + sizeof(lbit_t) <= br->buf_end_) { | 61 if (br->buf_ < br->buf_max_) { |
| 62 // convert memory type to register type (with some zero'ing!) | 62 // convert memory type to register type (with some zero'ing!) |
| 63 bit_t bits; | 63 bit_t bits; |
| 64 #if defined(WEBP_FORCE_ALIGNED) | 64 #if defined(WEBP_FORCE_ALIGNED) |
| 65 lbit_t in_bits; | 65 lbit_t in_bits; |
| 66 memcpy(&in_bits, br->buf_, sizeof(in_bits)); | 66 memcpy(&in_bits, br->buf_, sizeof(in_bits)); |
| 67 #elif defined(WEBP_USE_MIPS32) | 67 #elif defined(WEBP_USE_MIPS32) |
| 68 // This is needed because of un-aligned read. | 68 // This is needed because of un-aligned read. |
| 69 lbit_t in_bits; | 69 lbit_t in_bits; |
| 70 lbit_t* p_buf_ = (lbit_t*)br->buf_; | 70 lbit_t* p_buf_ = (lbit_t*)br->buf_; |
| 71 __asm__ volatile( | 71 __asm__ volatile( |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 br->value_ -= (bit_t)((split + 1) & mask) << pos; | 163 br->value_ -= (bit_t)((split + 1) & mask) << pos; |
| 164 return (v ^ mask) - mask; | 164 return (v ^ mask) - mask; |
| 165 } | 165 } |
| 166 } | 166 } |
| 167 | 167 |
| 168 #ifdef __cplusplus | 168 #ifdef __cplusplus |
| 169 } // extern "C" | 169 } // extern "C" |
| 170 #endif | 170 #endif |
| 171 | 171 |
| 172 #endif // WEBP_UTILS_BIT_READER_INL_H_ | 172 #endif // WEBP_UTILS_BIT_READER_INL_H_ |
| OLD | NEW |