16#ifndef RANS_INTERNAL_CONTAINERS_REVERSESYMBOLLOOKUPTABLE_H_
17#define RANS_INTERNAL_CONTAINERS_REVERSESYMBOLLOOKUPTABLE_H_
21#include <fairlogger/Logger.h>
29template <
typename source_T>
44 template <
typename container_T>
47 if (renormedHistogram.empty()) {
48 LOG(warning) <<
"SymbolStatistics of empty message passed to " << __func__;
51 mLut.reserve(renormedHistogram.getNumSamples());
52 const auto [trimmedBegin, trimmedEnd] =
internal::trim(renormedHistogram);
56 this->
mLut.insert(
mLut.end(), frequency, sourceSymbol);
65 return cumul >= this->
size();
70 assert(cumul < this->
size());
Histogram renormed to sum of frequencies being 2^P for use in fast rans coding.
common helper classes and functions
bool isIncompressible(count_type cumul) const noexcept
ReverseSymbolLookupTable() noexcept
std::ptrdiff_t difference_type
iterator_type begin() const noexcept
std::vector< source_type > container_type
size_type size() const noexcept
iterator_type end() const noexcept
ReverseSymbolLookupTable(const RenormedHistogramConcept< container_T > &renormedHistogram)
source_type operator[](count_type cumul) const noexcept
auto trim(typename container_T::iterator begin, typename container_T::iterator end, typename container_T::const_reference zeroElem={}) -> std::pair< typename container_T::iterator, typename container_T::iterator >
void forEachIndexValue(const container_T &container, typename container_T::const_iterator begin, typename container_T::const_iterator end, F functor)
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"