Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(266)

Unified Diff: webrtc/base/bitbuffer.cc

Issue 1314473008: H264 bitstream parser. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: add basic unittests Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/base/bitbuffer.cc
diff --git a/webrtc/base/bitbuffer.cc b/webrtc/base/bitbuffer.cc
index e8f69cbce0bd02f4c724914b14903aa82ea3a589..1aa245e78c7932309c8f8aa313a0177847cdd8c8 100644
--- a/webrtc/base/bitbuffer.cc
+++ b/webrtc/base/bitbuffer.cc
@@ -187,6 +187,19 @@ bool BitBuffer::ReadExponentialGolomb(uint32_t* val) {
return true;
}
+bool BitBuffer::ReadSignedExponentialGolomb(int32_t* val) {
+ uint32_t unsigned_val;
+ if (!ReadExponentialGolomb(&unsigned_val)) {
+ return false;
+ }
+ if ((unsigned_val & 1) == 0) {
+ *val = -static_cast<int32_t>(unsigned_val / 2);
+ } else {
+ *val = (unsigned_val + 1) / 2;
+ }
+ return true;
+}
+
void BitBuffer::GetCurrentOffset(
size_t* out_byte_offset, size_t* out_bit_offset) {
RTC_CHECK(out_byte_offset != NULL);

Powered by Google App Engine
This is Rietveld 408576698