OLD | NEW |
1 // Copyright 2011 Google Inc. All Rights Reserved. | 1 // Copyright 2011 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 // Bit writing and boolean coder | 10 // Bit writing and boolean coder |
11 // | 11 // |
12 // Author: Skal (pascal.massimino@gmail.com) | 12 // Author: Skal (pascal.massimino@gmail.com) |
13 | 13 |
14 #ifndef WEBP_UTILS_BIT_WRITER_H_ | 14 #ifndef WEBP_UTILS_BIT_WRITER_H_ |
15 #define WEBP_UTILS_BIT_WRITER_H_ | 15 #define WEBP_UTILS_BIT_WRITER_H_ |
16 | 16 |
17 #include "../webp/types.h" | 17 #include "../webp/types.h" |
18 | 18 |
19 #if defined(__cplusplus) || defined(c_plusplus) | 19 #ifdef __cplusplus |
20 extern "C" { | 20 extern "C" { |
21 #endif | 21 #endif |
22 | 22 |
23 //------------------------------------------------------------------------------ | 23 //------------------------------------------------------------------------------ |
24 // Bit-writing | 24 // Bit-writing |
25 | 25 |
26 typedef struct VP8BitWriter VP8BitWriter; | 26 typedef struct VP8BitWriter VP8BitWriter; |
27 struct VP8BitWriter { | 27 struct VP8BitWriter { |
28 int32_t range_; // range-1 | 28 int32_t range_; // range-1 |
29 int32_t value_; | 29 int32_t value_; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 // and OR'ing to BYTE-0. | 111 // and OR'ing to BYTE-0. |
112 // | 112 // |
113 // For n bits, we take the last 5 bytes, OR that with high bits in BYTE-0, | 113 // For n bits, we take the last 5 bytes, OR that with high bits in BYTE-0, |
114 // and locate the rest in BYTE+1 and BYTE+2. | 114 // and locate the rest in BYTE+1 and BYTE+2. |
115 // | 115 // |
116 // VP8LBitWriter's error_ flag is set in case of memory allocation error. | 116 // VP8LBitWriter's error_ flag is set in case of memory allocation error. |
117 void VP8LWriteBits(VP8LBitWriter* const bw, int n_bits, uint32_t bits); | 117 void VP8LWriteBits(VP8LBitWriter* const bw, int n_bits, uint32_t bits); |
118 | 118 |
119 //------------------------------------------------------------------------------ | 119 //------------------------------------------------------------------------------ |
120 | 120 |
121 #if defined(__cplusplus) || defined(c_plusplus) | 121 #ifdef __cplusplus |
122 } // extern "C" | 122 } // extern "C" |
123 #endif | 123 #endif |
124 | 124 |
125 #endif /* WEBP_UTILS_BIT_WRITER_H_ */ | 125 #endif /* WEBP_UTILS_BIT_WRITER_H_ */ |
OLD | NEW |