GameApi 28
Library used by GameApi Builder tool
Loading...
Searching...
No Matches
symbol_bit_encoder.h
Go to the documentation of this file.
1#ifndef DRACO_COMPRESSION_BIT_CODERS_SYMBOL_BIT_ENCODER_H_
2#define DRACO_COMPRESSION_BIT_CODERS_SYMBOL_BIT_ENCODER_H_
3
4#include <algorithm>
5#include <vector>
6
8
9namespace draco {
10
11// Class for encoding bits using the symbol entropy encoding. Wraps
12// |EncodeSymbols|. Note that this uses a symbol-based encoding scheme for
13// encoding bits.
15 public:
16 // Must be called before any Encode* function is called.
17 void StartEncoding() { Clear(); }
18
19 // Encode one bit. If |bit| is true encode a 1, otherwise encode a 0.
20 void EncodeBit(bool bit) { EncodeLeastSignificantBits32(1, bit ? 1 : 0); }
21
22 // Encode |nbits| LSBs of |value| as a symbol. |nbits| must be > 0 and <= 32.
23 void EncodeLeastSignificantBits32(int nbits, uint32_t value);
24
25 // Ends the bit encoding and stores the result into the target_buffer.
26 void EndEncoding(EncoderBuffer *target_buffer);
27
28 private:
29 void Clear();
30
31 std::vector<uint32_t> symbols_;
32};
33
34} // namespace draco
35
36#endif // DRACO_COMPRESSION_BIT_CODERS_SYMBOL_BIT_ENCODER_H_
Definition encoder_buffer.h:29
Definition symbol_bit_encoder.h:14
void EndEncoding(EncoderBuffer *target_buffer)
Definition symbol_bit_encoder.cc:20
void EncodeLeastSignificantBits32(int nbits, uint32_t value)
Definition symbol_bit_encoder.cc:9
void StartEncoding()
Definition symbol_bit_encoder.h:17
void EncodeBit(bool bit)
Definition symbol_bit_encoder.h:20
Definition attribute_octahedron_transform.cc:21