Autonomy Software C++ 24.5.1
Welcome to the Autonomy Software repository of the Mars Rover Design Team (MRDT) at Missouri University of Science and Technology (Missouri S&T)! API reference contains the source code and other resources for the development of the autonomy software for our Mars rover. The Autonomy Software project aims to compete in the University Rover Challenge (URC) by demonstrating advanced autonomous capabilities and robust navigation algorithms.
Loading...
Searching...
No Matches
duckdb::Chimp128Compression< CHIMP_TYPE, EMPTY > Class Template Reference

Public Types

using State = Chimp128CompressionState<CHIMP_TYPE, EMPTY>

Static Public Member Functions

static void Store (CHIMP_TYPE in, State &state)
static void Flush (State &state)
 Write the content of the bit buffer to the stream.
static void WriteFirst (CHIMP_TYPE in, State &state)
static void CompressValue (CHIMP_TYPE in, State &state)

Static Public Attributes

static constexpr uint8_t INDEX_BITS_SIZE = 7
 The amount of bits needed to store an index between 0-127.
static constexpr uint8_t BIT_SIZE = sizeof(CHIMP_TYPE) * 8
static constexpr uint8_t TRAILING_ZERO_THRESHOLD = SignificantBits<CHIMP_TYPE>::size + INDEX_BITS_SIZE

Member Function Documentation

◆ Store()

template<class CHIMP_TYPE, bool EMPTY>
void duckdb::Chimp128Compression< CHIMP_TYPE, EMPTY >::Store ( CHIMP_TYPE in,
State & state )
inlinestatic
397070 {
397071 if (state.first) {
397072 WriteFirst(in, state);
397073 } else {
397074 CompressValue(in, state);
397075 }
397076 }
Definition duckdb.cpp:397060

◆ Flush()

template<class CHIMP_TYPE, bool EMPTY>
void duckdb::Chimp128Compression< CHIMP_TYPE, EMPTY >::Flush ( State & state)
inlinestatic

Write the content of the bit buffer to the stream.

397079 {
397080 if (!EMPTY) {
397081 state.output.Flush();
397082 }
397083 }
static void Flush(State &state)
Write the content of the bit buffer to the stream.
Definition duckdb.cpp:397079

◆ WriteFirst()

template<class CHIMP_TYPE, bool EMPTY>
void duckdb::Chimp128Compression< CHIMP_TYPE, EMPTY >::WriteFirst ( CHIMP_TYPE in,
State & state )
inlinestatic
397085 {
397086 state.ring_buffer.template Insert<true>(in);
397087 state.output.template WriteValue<CHIMP_TYPE, BIT_SIZE>(in);
397088 state.previous_value = in;
397089 state.first = false;
397090 }

◆ CompressValue()

template<class CHIMP_TYPE, bool EMPTY>
void duckdb::Chimp128Compression< CHIMP_TYPE, EMPTY >::CompressValue ( CHIMP_TYPE in,
State & state )
inlinestatic
397092 {
397093 auto key = state.ring_buffer.Key(in);
397097 bool trailing_zeros_exceed_threshold = false;
397098 const CHIMP_TYPE reference_index = state.ring_buffer.IndexOf(key);
397099
397100 // Find the reference value to use when compressing the current value
397101 if (((int64_t)state.ring_buffer.Size() - (int64_t)reference_index) < (int64_t)ChimpConstants::BUFFER_SIZE) {
397102 // The reference index is within 128 values, we can use it
397103 auto current_index = state.ring_buffer.IndexOf(key);
397104 if (current_index > state.ring_buffer.Size()) {
397105 current_index = 0;
397106 }
397110 trailing_zeros_exceed_threshold = trailing_zeros > TRAILING_ZERO_THRESHOLD;
397114 } else {
397115 previous_index = state.ring_buffer.Size() % ChimpConstants::BUFFER_SIZE;
397116 xor_result = (CHIMP_TYPE)in ^ state.ring_buffer.Value(previous_index);
397117 }
397118 } else {
397119 // Reference index is not in range, use the directly previous value
397120 previous_index = state.ring_buffer.Size() % ChimpConstants::BUFFER_SIZE;
397121 xor_result = (CHIMP_TYPE)in ^ state.ring_buffer.Value(previous_index);
397122 }
397123
397124 // Compress the value
397125 if (xor_result == 0) {
397126 state.flag_buffer.Insert(ChimpConstants::Flags::VALUE_IDENTICAL);
397128 state.SetLeadingZeros();
397129 } else {
397130 // Values are not identical
397133
397140 state.packed_data_buffer.Insert(result & 0xFFFF);
397142 state.SetLeadingZeros();
397143 } else if (leading_zeros == state.previous_leading_zeros) {
397147 } else {
397149 const int32_t significant_bits = BIT_SIZE - leading_zeros;
397152 state.SetLeadingZeros(leading_zeros);
397153 }
397154 }
397155 state.previous_value = in;
397156 state.ring_buffer.Insert(in);
397157 }

The documentation for this class was generated from the following file: