Changeset View
Changeset View
Standalone View
Standalone View
extern/draco/draco/src/draco/core/decoder_buffer.cc
- This file was moved from extern/draco/dracoenc/src/draco/core/decoder_buffer.cc.
| Show All 35 Lines | void DecoderBuffer::Init(const char *data, size_t data_size, uint16_t version) { | ||||
| bitstream_version_ = version; | bitstream_version_ = version; | ||||
| pos_ = 0; | pos_ = 0; | ||||
| } | } | ||||
| bool DecoderBuffer::StartBitDecoding(bool decode_size, uint64_t *out_size) { | bool DecoderBuffer::StartBitDecoding(bool decode_size, uint64_t *out_size) { | ||||
| if (decode_size) { | if (decode_size) { | ||||
| #ifdef DRACO_BACKWARDS_COMPATIBILITY_SUPPORTED | #ifdef DRACO_BACKWARDS_COMPATIBILITY_SUPPORTED | ||||
| if (bitstream_version_ < DRACO_BITSTREAM_VERSION(2, 2)) { | if (bitstream_version_ < DRACO_BITSTREAM_VERSION(2, 2)) { | ||||
| if (!Decode(out_size)) | if (!Decode(out_size)) { | ||||
| return false; | return false; | ||||
| } | |||||
| } else | } else | ||||
| #endif | #endif | ||||
| { | { | ||||
| if (!DecodeVarint(out_size, this)) | if (!DecodeVarint(out_size, this)) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| } | } | ||||
| } | |||||
| bit_mode_ = true; | bit_mode_ = true; | ||||
| bit_decoder_.reset(data_head(), remaining_size()); | bit_decoder_.reset(data_head(), remaining_size()); | ||||
| return true; | return true; | ||||
| } | } | ||||
| void DecoderBuffer::EndBitDecoding() { | void DecoderBuffer::EndBitDecoding() { | ||||
| bit_mode_ = false; | bit_mode_ = false; | ||||
| const uint64_t bits_decoded = bit_decoder_.BitsDecoded(); | const uint64_t bits_decoded = bit_decoder_.BitsDecoded(); | ||||
| Show All 10 Lines | |||||