16#ifndef RANS_INTERNAL_DECODE_DECODERIMPL_H_
17#define RANS_INTERNAL_DECODE_DECODERIMPL_H_
31template <
size_t LowerBound_V>
42 explicit DecoderImpl(
size_type symbolTablePrecission) noexcept : mSymbolTablePrecission{symbolTablePrecission} {};
44 template <
typename stream_IT>
45 stream_IT
init(stream_IT inputIter);
49 template <
typename stream_IT>
58 template <
typename stream_IT>
59 std::tuple<state_type, stream_IT> renorm(
state_type x, stream_IT iter);
61 inline static constexpr size_type N_STREAMS = 1;
65 inline static constexpr state_type STREAM_BITS = utils::toBits<stream_type>();
68template <
size_t LowerBound_V>
69template <
typename stream_IT>
74 stream_IT streamPosition = inputIter;
76 newState =
static_cast<state_type>(*streamPosition) << 0;
78 newState |=
static_cast<state_type>(*streamPosition) << 32;
80 assert(std::distance(streamPosition, inputIter) == 2);
83 return streamPosition;
86template <
size_t LowerBound_V>
87template <
typename stream_IT>
90 static_assert(std::is_same<typename std::iterator_traits<stream_IT>::value_type,
stream_type>
::value);
99 const auto [renormedState, newStreamPosition] = this->
renorm(newState, inputIter);
100 mState = renormedState;
101 return newStreamPosition;
104template <
size_t LowerBound_V>
105template <
typename stream_IT>
108 static_assert(std::is_same<typename std::iterator_traits<stream_IT>::value_type,
stream_type>
::value);
110 stream_IT streamPosition = inputIter;
114 state = (
state << STREAM_BITS) | *streamPosition;
118 return std::make_tuple(
state, streamPosition);
Contains statistical information for one source symbol, required for encoding/decoding.
common helper classes and functions
constexpr size_t LOWER_BOUND
cumulative_frequency_type get()
static constexpr size_type getNstreams() noexcept
std::ptrdiff_t difference_type
DecoderImpl(size_type symbolTablePrecission) noexcept
stream_IT init(stream_IT inputIter)
uint32_t cumulative_frequency_type
stream_IT advanceSymbol(stream_IT inputIter, const symbol_type &sym)
constexpr value_type getCumulative() const noexcept
constexpr value_type getFrequency() const noexcept
GLsizei const GLfloat * value
constexpr size_t pow2(size_t n) noexcept
decltype(auto) renorm(histogram_T histogram, size_t newPrecision, RenormingPolicy renormingPolicy=RenormingPolicy::Auto, size_t lowProbabilityCutoffBits=0)