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 |
| 27 #include "../dsp/dsp.h" |
27 #include "./bit_reader.h" | 28 #include "./bit_reader.h" |
28 #include "./endian_inl.h" | 29 #include "./endian_inl.h" |
29 | 30 |
30 #ifdef __cplusplus | 31 #ifdef __cplusplus |
31 extern "C" { | 32 extern "C" { |
32 #endif | 33 #endif |
33 | 34 |
34 //------------------------------------------------------------------------------ | 35 //------------------------------------------------------------------------------ |
35 // Derived type lbit_t = natural type for memory I/O | 36 // Derived type lbit_t = natural type for memory I/O |
36 | 37 |
(...skipping 19 matching lines...) Expand all Loading... |
56 // 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 |
57 static WEBP_INLINE void VP8LoadNewBytes(VP8BitReader* const br) { | 58 static WEBP_INLINE void VP8LoadNewBytes(VP8BitReader* const br) { |
58 assert(br != NULL && br->buf_ != NULL); | 59 assert(br != NULL && br->buf_ != NULL); |
59 // Read 'BITS' bits at a time if possible. | 60 // Read 'BITS' bits at a time if possible. |
60 if (br->buf_ + sizeof(lbit_t) <= br->buf_end_) { | 61 if (br->buf_ + sizeof(lbit_t) <= br->buf_end_) { |
61 // convert memory type to register type (with some zero'ing!) | 62 // convert memory type to register type (with some zero'ing!) |
62 bit_t bits; | 63 bit_t bits; |
63 #if defined(WEBP_FORCE_ALIGNED) | 64 #if defined(WEBP_FORCE_ALIGNED) |
64 lbit_t in_bits; | 65 lbit_t in_bits; |
65 memcpy(&in_bits, br->buf_, sizeof(in_bits)); | 66 memcpy(&in_bits, br->buf_, sizeof(in_bits)); |
66 #elif defined(__mips__) // MIPS | 67 #elif defined(WEBP_USE_MIPS32) |
67 // This is needed because of un-aligned read. | 68 // This is needed because of un-aligned read. |
68 lbit_t in_bits; | 69 lbit_t in_bits; |
69 lbit_t* p_buf_ = (lbit_t*)br->buf_; | 70 lbit_t* p_buf_ = (lbit_t*)br->buf_; |
70 __asm__ volatile( | 71 __asm__ volatile( |
71 ".set push \n\t" | 72 ".set push \n\t" |
72 ".set at \n\t" | 73 ".set at \n\t" |
73 ".set macro \n\t" | 74 ".set macro \n\t" |
74 "ulw %[in_bits], 0(%[p_buf_]) \n\t" | 75 "ulw %[in_bits], 0(%[p_buf_]) \n\t" |
75 ".set pop \n\t" | 76 ".set pop \n\t" |
76 : [in_bits]"=r"(in_bits) | 77 : [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; | 163 br->value_ -= (bit_t)((split + 1) & mask) << pos; |
163 return (v ^ mask) - mask; | 164 return (v ^ mask) - mask; |
164 } | 165 } |
165 } | 166 } |
166 | 167 |
167 #ifdef __cplusplus | 168 #ifdef __cplusplus |
168 } // extern "C" | 169 } // extern "C" |
169 #endif | 170 #endif |
170 | 171 |
171 #endif // WEBP_UTILS_BIT_READER_INL_H_ | 172 #endif // WEBP_UTILS_BIT_READER_INL_H_ |
OLD | NEW |