OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2015 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 53 |
54 // Reads the exponential golomb encoded value at the current offset. | 54 // Reads the exponential golomb encoded value at the current offset. |
55 // Exponential golomb values are encoded as: | 55 // Exponential golomb values are encoded as: |
56 // 1) x = source val + 1 | 56 // 1) x = source val + 1 |
57 // 2) In binary, write [countbits(x) - 1] 0s, then x | 57 // 2) In binary, write [countbits(x) - 1] 0s, then x |
58 // To decode, we count the number of leading 0 bits, read that many + 1 bits, | 58 // To decode, we count the number of leading 0 bits, read that many + 1 bits, |
59 // and increment the result by 1. | 59 // and increment the result by 1. |
60 // Returns false if there isn't enough data left for the specified type, or if | 60 // Returns false if there isn't enough data left for the specified type, or if |
61 // the value wouldn't fit in a uint32_t. | 61 // the value wouldn't fit in a uint32_t. |
62 bool ReadExponentialGolomb(uint32_t* val); | 62 bool ReadExponentialGolomb(uint32_t* val); |
| 63 // Reads signed exponential golomb values at the current offset. Signed |
| 64 // exponential golomb values are just the unsigned values mapped to the |
| 65 // sequence 0, 1, -1, 2, -2, etc. in order. |
| 66 bool ReadSignedExponentialGolomb(int32_t* val); |
63 | 67 |
64 // Moves current position |byte_count| bytes forward. Returns false if | 68 // Moves current position |byte_count| bytes forward. Returns false if |
65 // there aren't enough bytes left in the buffer. | 69 // there aren't enough bytes left in the buffer. |
66 bool ConsumeBytes(size_t byte_count); | 70 bool ConsumeBytes(size_t byte_count); |
67 // Moves current position |bit_count| bits forward. Returns false if | 71 // Moves current position |bit_count| bits forward. Returns false if |
68 // there aren't enough bits left in the buffer. | 72 // there aren't enough bits left in the buffer. |
69 bool ConsumeBits(size_t bit_count); | 73 bool ConsumeBits(size_t bit_count); |
70 | 74 |
71 // Sets the current offset to the provied byte/bit offsets. The bit | 75 // Sets the current offset to the provied byte/bit offsets. The bit |
72 // offset is from the given byte, in the range [0,7]. | 76 // offset is from the given byte, in the range [0,7]. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 private: | 113 private: |
110 // The buffer, as a writable array. | 114 // The buffer, as a writable array. |
111 uint8_t* const writable_bytes_; | 115 uint8_t* const writable_bytes_; |
112 | 116 |
113 RTC_DISALLOW_COPY_AND_ASSIGN(BitBufferWriter); | 117 RTC_DISALLOW_COPY_AND_ASSIGN(BitBufferWriter); |
114 }; | 118 }; |
115 | 119 |
116 } // namespace rtc | 120 } // namespace rtc |
117 | 121 |
118 #endif // WEBRTC_BASE_BITBUFFER_H_ | 122 #endif // WEBRTC_BASE_BITBUFFER_H_ |
OLD | NEW |