| OLD | NEW |
| 1 // Copyright 2010 Google Inc. All Rights Reserved. | 1 // Copyright 2010 Google Inc. All Rights Reserved. |
| 2 // | 2 // |
| 3 // This code is licensed under the same terms as WebM: | 3 // Use of this source code is governed by a BSD-style license |
| 4 // Software License Agreement: http://www.webmproject.org/license/software/ | 4 // that can be found in the COPYING file in the root of the source |
| 5 // Additional IP Rights Grant: http://www.webmproject.org/license/additional/ | 5 // tree. An additional intellectual property rights grant can be found |
| 6 // in the file PATENTS. All contributing project authors may |
| 7 // be found in the AUTHORS file in the root of the source tree. |
| 6 // ----------------------------------------------------------------------------- | 8 // ----------------------------------------------------------------------------- |
| 7 // | 9 // |
| 8 // Boolean decoder | 10 // Boolean decoder |
| 9 // | 11 // |
| 10 // Author: Skal (pascal.massimino@gmail.com) | 12 // Author: Skal (pascal.massimino@gmail.com) |
| 11 // Vikas Arora (vikaas.arora@gmail.com) | 13 // Vikas Arora (vikaas.arora@gmail.com) |
| 12 | 14 |
| 13 #ifndef WEBP_UTILS_BIT_READER_H_ | 15 #ifndef WEBP_UTILS_BIT_READER_H_ |
| 14 #define WEBP_UTILS_BIT_READER_H_ | 16 #define WEBP_UTILS_BIT_READER_H_ |
| 15 | 17 |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 #endif // x86 | 189 #endif // x86 |
| 188 bits >>= (32 - BITS); | 190 bits >>= (32 - BITS); |
| 189 #elif (BITS == 16) | 191 #elif (BITS == 16) |
| 190 // gcc will recognize a 'rorw $8, ...' here: | 192 // gcc will recognize a 'rorw $8, ...' here: |
| 191 bits = (bit_t)(in_bits >> 8) | ((in_bits & 0xff) << 8); | 193 bits = (bit_t)(in_bits >> 8) | ((in_bits & 0xff) << 8); |
| 192 #else // BITS == 8 | 194 #else // BITS == 8 |
| 193 bits = (bit_t)in_bits; | 195 bits = (bit_t)in_bits; |
| 194 #endif | 196 #endif |
| 195 #else // BIG_ENDIAN | 197 #else // BIG_ENDIAN |
| 196 bits = (bit_t)in_bits; | 198 bits = (bit_t)in_bits; |
| 199 if (BITS != 8 * sizeof(bit_t)) bits >>= (8 * sizeof(bit_t) - BITS); |
| 197 #endif | 200 #endif |
| 198 #ifndef USE_RIGHT_JUSTIFY | 201 #ifndef USE_RIGHT_JUSTIFY |
| 199 br->value_ |= bits << (-br->bits_); | 202 br->value_ |= bits << (-br->bits_); |
| 200 #else | 203 #else |
| 201 br->value_ = bits | (br->value_ << (BITS)); | 204 br->value_ = bits | (br->value_ << (BITS)); |
| 202 #endif | 205 #endif |
| 203 br->bits_ += (BITS); | 206 br->bits_ += (BITS); |
| 204 } else { | 207 } else { |
| 205 VP8LoadFinalBytes(br); // no need to be inlined | 208 VP8LoadFinalBytes(br); // no need to be inlined |
| 206 } | 209 } |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 } | 322 } |
| 320 | 323 |
| 321 // Advances the Read buffer by 4 bytes to make room for reading next 32 bits. | 324 // Advances the Read buffer by 4 bytes to make room for reading next 32 bits. |
| 322 void VP8LFillBitWindow(VP8LBitReader* const br); | 325 void VP8LFillBitWindow(VP8LBitReader* const br); |
| 323 | 326 |
| 324 #if defined(__cplusplus) || defined(c_plusplus) | 327 #if defined(__cplusplus) || defined(c_plusplus) |
| 325 } // extern "C" | 328 } // extern "C" |
| 326 #endif | 329 #endif |
| 327 | 330 |
| 328 #endif /* WEBP_UTILS_BIT_READER_H_ */ | 331 #endif /* WEBP_UTILS_BIT_READER_H_ */ |
| OLD | NEW |