Chromium Code Reviews| 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() ...] |
| 11 // This file should be included by the .c sources that actually need to call | 11 // This file should be included by the .c sources that actually need to call |
| 12 // these methods. | 12 // these methods. |
| 13 // | 13 // |
| 14 // Author: Skal (pascal.massimino@gmail.com) | 14 // Author: Skal (pascal.massimino@gmail.com) |
| 15 | 15 |
| 16 #ifndef WEBP_UTILS_BIT_READER_INL_H_ | 16 #ifndef WEBP_UTILS_BIT_READER_INL_H_ |
| 17 #define WEBP_UTILS_BIT_READER_INL_H_ | 17 #define WEBP_UTILS_BIT_READER_INL_H_ |
| 18 | 18 |
| 19 #ifdef HAVE_CONFIG_H | 19 #ifdef HAVE_CONFIG_H |
| 20 #include "../webp/config.h" | 20 #include "../webp/config.h" |
| 21 #endif | 21 #endif |
| 22 | 22 |
| 23 #ifdef WEBP_FORCE_ALIGNED | 23 #ifdef WEBP_FORCE_ALIGNED |
| 24 #include <string.h> // memcpy | 24 #include <string.h> // memcpy |
| 25 #endif | 25 #endif |
| 26 | 26 |
|
urvang (Google)
2014/08/12 18:21:40
I see "#include "../dsp/dsp.h" in the original pat
gordanac
2014/08/12 18:47:35
Done.
| |
| 27 #include "./bit_reader.h" | 27 #include "./bit_reader.h" |
| 28 #include "./endian_inl.h" | 28 #include "./endian_inl.h" |
| 29 | 29 |
| 30 #ifdef __cplusplus | 30 #ifdef __cplusplus |
| 31 extern "C" { | 31 extern "C" { |
| 32 #endif | 32 #endif |
| 33 | 33 |
| 34 //------------------------------------------------------------------------------ | 34 //------------------------------------------------------------------------------ |
| 35 // Derived type lbit_t = natural type for memory I/O | 35 // Derived type lbit_t = natural type for memory I/O |
| 36 | 36 |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 56 // makes sure br->value_ has at least BITS bits worth of data | 56 // makes sure br->value_ has at least BITS bits worth of data |
| 57 static WEBP_INLINE void VP8LoadNewBytes(VP8BitReader* const br) { | 57 static WEBP_INLINE void VP8LoadNewBytes(VP8BitReader* const br) { |
| 58 assert(br != NULL && br->buf_ != NULL); | 58 assert(br != NULL && br->buf_ != NULL); |
| 59 // Read 'BITS' bits at a time if possible. | 59 // Read 'BITS' bits at a time if possible. |
| 60 if (br->buf_ + sizeof(lbit_t) <= br->buf_end_) { | 60 if (br->buf_ + sizeof(lbit_t) <= br->buf_end_) { |
| 61 // convert memory type to register type (with some zero'ing!) | 61 // convert memory type to register type (with some zero'ing!) |
| 62 bit_t bits; | 62 bit_t bits; |
| 63 #if defined(WEBP_FORCE_ALIGNED) | 63 #if defined(WEBP_FORCE_ALIGNED) |
| 64 lbit_t in_bits; | 64 lbit_t in_bits; |
| 65 memcpy(&in_bits, br->buf_, sizeof(in_bits)); | 65 memcpy(&in_bits, br->buf_, sizeof(in_bits)); |
| 66 #elif defined(__mips__) // MIPS | 66 #elif defined(WEBP_USE_MIPS32) |
| 67 // This is needed because of un-aligned read. | 67 // This is needed because of un-aligned read. |
| 68 lbit_t in_bits; | 68 lbit_t in_bits; |
| 69 lbit_t* p_buf_ = (lbit_t*)br->buf_; | 69 lbit_t* p_buf_ = (lbit_t*)br->buf_; |
| 70 __asm__ volatile( | 70 __asm__ volatile( |
| 71 ".set push \n\t" | 71 ".set push \n\t" |
| 72 ".set at \n\t" | 72 ".set at \n\t" |
| 73 ".set macro \n\t" | 73 ".set macro \n\t" |
| 74 "ulw %[in_bits], 0(%[p_buf_]) \n\t" | 74 "ulw %[in_bits], 0(%[p_buf_]) \n\t" |
| 75 ".set pop \n\t" | 75 ".set pop \n\t" |
| 76 : [in_bits]"=r"(in_bits) | 76 : [in_bits]"=r"(in_bits) |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 162 br->value_ -= (bit_t)((split + 1) & mask) << pos; | 162 br->value_ -= (bit_t)((split + 1) & mask) << pos; |
| 163 return (v ^ mask) - mask; | 163 return (v ^ mask) - mask; |
| 164 } | 164 } |
| 165 } | 165 } |
| 166 | 166 |
| 167 #ifdef __cplusplus | 167 #ifdef __cplusplus |
| 168 } // extern "C" | 168 } // extern "C" |
| 169 #endif | 169 #endif |
| 170 | 170 |
| 171 #endif // WEBP_UTILS_BIT_READER_INL_H_ | 171 #endif // WEBP_UTILS_BIT_READER_INL_H_ |
| OLD | NEW |