diff options
author | Hendrik Leppkes <h.leppkes@gmail.com> | 2016-02-20 20:44:41 +0300 |
---|---|---|
committer | Hendrik Leppkes <h.leppkes@gmail.com> | 2016-02-20 20:46:04 +0300 |
commit | 347031f7e989dbb7e49e4114cfcaab62581a513e (patch) | |
tree | 7294f92b592ccc25ef33d64847825b466bc0f0d1 /common | |
parent | 6c42368aa9902b01855822379ae03c5718f52b3d (diff) |
Add bit skipping function
Diffstat (limited to 'common')
-rw-r--r-- | common/DSUtilLite/ByteParser.cpp | 8 | ||||
-rw-r--r-- | common/DSUtilLite/ByteParser.h | 3 |
2 files changed, 11 insertions, 0 deletions
diff --git a/common/DSUtilLite/ByteParser.cpp b/common/DSUtilLite/ByteParser.cpp index adf34188..92c8b838 100644 --- a/common/DSUtilLite/ByteParser.cpp +++ b/common/DSUtilLite/ByteParser.cpp @@ -54,6 +54,14 @@ unsigned int CByteParser::BitRead(unsigned int numBits, bool peek) return get_bits_long(m_gbCtx, numBits); } +void CByteParser::BitSkip(unsigned int numBits) +{ + if (numBits == 0) + return; + + skip_bits_long(m_gbCtx, numBits); +} + size_t CByteParser::RemainingBits() const { int bits = get_bits_left(m_gbCtx); diff --git a/common/DSUtilLite/ByteParser.h b/common/DSUtilLite/ByteParser.h index c81ea9d7..b78cc844 100644 --- a/common/DSUtilLite/ByteParser.h +++ b/common/DSUtilLite/ByteParser.h @@ -36,6 +36,9 @@ public: /** Read 1 to 32 Bits from the Byte Array. If peek is set, the data will just be returned, and the buffer not advanced. */ unsigned int BitRead(unsigned int numBits, bool peek = false); + /** Skip any number of bits from the byte array */ + void BitSkip(unsigned int numBits); + /** Read a unsigned number in Exponential Golomb encoding (with k = 0) */ unsigned int UExpGolombRead(); /** Read a signed number in Exponential Golomb encoding (with k = 0) */ |