GameApi 28
Library used by GameApi Builder tool
Loading...
Searching...
No Matches
rans_bit_decoder.h
Go to the documentation of this file.
1// Copyright 2016 The Draco Authors.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// File provides basic classes and functions for rANS coding.
16#ifndef DRACO_COMPRESSION_BIT_CODERS_RANS_BIT_DECODER_H_
17#define DRACO_COMPRESSION_BIT_CODERS_RANS_BIT_DECODER_H_
18
19#include <vector>
20
24
25namespace draco {
26
27// Class for decoding a sequence of bits that were encoded with RAnsBitEncoder.
29 public:
32
33 // Sets |source_buffer| as the buffer to decode bits from.
34 // Returns false when the data is invalid.
35 bool StartDecoding(DecoderBuffer *source_buffer);
36
37 // Decode one bit. Returns true if the bit is a 1, otherwise false.
38 bool DecodeNextBit();
39
40 // Decode the next |nbits| and return the sequence in |value|. |nbits| must be
41 // > 0 and <= 32.
42 void DecodeLeastSignificantBits32(int nbits, uint32_t *value);
43
44 void EndDecoding() {}
45
46 private:
47 void Clear();
48
49 AnsDecoder ans_decoder_;
50 uint8_t prob_zero_;
51};
52
53} // namespace draco
54
55#endif // DRACO_COMPRESSION_BIT_CODERS_RANS_BIT_DECODER_H_
Definition decoder_buffer.h:30
RAnsBitDecoder()
Definition rans_bit_decoder.cc:25
bool StartDecoding(DecoderBuffer *source_buffer)
Definition rans_bit_decoder.cc:29
void EndDecoding()
Definition rans_bit_decoder.h:44
void DecodeLeastSignificantBits32(int nbits, uint32_t *value)
Definition rans_bit_decoder.cc:70
~RAnsBitDecoder()
Definition rans_bit_decoder.cc:27
bool DecodeNextBit()
Definition rans_bit_decoder.cc:65
Definition attribute_octahedron_transform.cc:21
Definition ans.h:55