Chromium Code Reviews| 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 bool ReadSignedExponentialGolomb(int32_t* val); | |
|
noahric
2015/09/09 20:51:42
// Reads the signed exponential golomb encoded val
pbos-webrtc
2015/09/21 15:55:32
Moved comment here, done.
| |
| 63 | 64 |
| 64 // Moves current position |byte_count| bytes forward. Returns false if | 65 // Moves current position |byte_count| bytes forward. Returns false if |
| 65 // there aren't enough bytes left in the buffer. | 66 // there aren't enough bytes left in the buffer. |
| 66 bool ConsumeBytes(size_t byte_count); | 67 bool ConsumeBytes(size_t byte_count); |
| 67 // Moves current position |bit_count| bits forward. Returns false if | 68 // Moves current position |bit_count| bits forward. Returns false if |
| 68 // there aren't enough bits left in the buffer. | 69 // there aren't enough bits left in the buffer. |
| 69 bool ConsumeBits(size_t bit_count); | 70 bool ConsumeBits(size_t bit_count); |
| 70 | 71 |
| 71 // Sets the current offset to the provied byte/bit offsets. The bit | 72 // Sets the current offset to the provied byte/bit offsets. The bit |
| 72 // offset is from the given byte, in the range [0,7]. | 73 // 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: | 110 private: |
| 110 // The buffer, as a writable array. | 111 // The buffer, as a writable array. |
| 111 uint8_t* const writable_bytes_; | 112 uint8_t* const writable_bytes_; |
| 112 | 113 |
| 113 DISALLOW_COPY_AND_ASSIGN(BitBufferWriter); | 114 DISALLOW_COPY_AND_ASSIGN(BitBufferWriter); |
| 114 }; | 115 }; |
| 115 | 116 |
| 116 } // namespace rtc | 117 } // namespace rtc |
| 117 | 118 |
| 118 #endif // WEBRTC_BASE_BITBUFFER_H_ | 119 #endif // WEBRTC_BASE_BITBUFFER_H_ |
| OLD | NEW |