16#ifndef RANS_INTERNAL_DECODE_DECODER_H_
17#define RANS_INTERNAL_DECODE_DECODER_H_
24#include <fairlogger/Logger.h>
32template <
typename source_T,
class decoder_T>
44 static_assert(std::is_same_v<typename lowRangeTable_type::symbol_type, typename highRangeTable_type::symbol_type>);
50 using decoder_type = std::variant<lowRangeDecoder_type, highRangDecoder_type>;
59 template <typename container_T>
66 if (renormedHistogram.getRenormingBits() > alphabetRangeBits) {
67 mImpl.template emplace<lowRangeDecoder_type>(renormedHistogram);
69 mImpl.template emplace<highRangDecoder_type>(renormedHistogram);
80 template <
typename stream_IT,
typename source_IT,
typename literals_IT = std::
nullptr_t>
81 void process(stream_IT inputEnd, source_IT outputBegin,
size_t messageLength,
size_t nStreams, literals_IT literalsEnd =
nullptr)
const
83 static_assert(utils::isCompatibleIter_v<source_type, source_IT>);
84 std::visit([&](
auto&& decoder) { decoder.process(inputEnd, outputBegin, messageLength, nStreams, literalsEnd); },
mImpl);
87 template <
typename literals_IT = std::
nullptr_t>
88 inline void process(gsl::span<const stream_type> inputStream, gsl::span<source_type> outputStream,
size_t messageLength,
size_t nStreams, literals_IT literalsEnd =
nullptr)
const
90 process(inputStream.data() + inputStream.size(), outputStream.data(), nStreams, literalsEnd);
96 static_assert(coder_type::getNstreams() == 1,
"implementation supports only single stream encoders");
DecoderConcept - User facing class to decode a rANS encoded stream back into the source data based on...
Maps rANS state information back to source symbol, used for decoding.
Maps rANS state information back to source symbol, used for decoding.
Histogram renormed to sum of frequencies being 2^P for use in fast rans coding.
common helper classes and functions
size_t getSymbolTablePrecision() const noexcept
typename coder_type::stream_type stream_type
void process(stream_IT inputEnd, source_IT outputBegin, size_t messageLength, size_t nStreams, literals_IT literalsEnd=nullptr) const
std::ptrdiff_t difference_type
void process(gsl::span< const stream_type > inputStream, gsl::span< source_type > outputStream, size_t messageLength, size_t nStreams, literals_IT literalsEnd=nullptr) const
Decoder() noexcept=default
internal::Symbol symbol_type
GLenum GLint GLint * precision
auto getMinMax(const container_T &container, typename container_T::const_iterator begin, typename container_T::const_iterator end, typename container_T::const_reference zeroElem={}) -> std::pair< typename container_T::source_type, typename container_T::source_type >
constexpr uint32_t getRangeBits(T min, T max) noexcept