17#ifndef RANS_INTERNAL_CONTAINERS_ADAPTIVESYMBOLTABLE_H_
18#define RANS_INTERNAL_CONTAINERS_ADAPTIVESYMBOLTABLE_H_
23#include <fairlogger/Logger.h>
32template <
class source_T,
class symbol_T>
52 template <
typename container_T>
93template <
class source_T,
class value_T>
94template <
typename container_T>
97 using namespace utils;
99 using count_type =
typename value_T::value_type;
102 this->mEscapeSymbol = [&]() -> value_T {
104 const count_type cumulatedFrequency = renormedHistogram.getNumSamples() - symbolFrequency;
105 return {symbolFrequency, cumulatedFrequency, this->getPrecision()};
110 count_type cumulatedFrequency = 0;
111 forEachIndexValue(renormedHistogram, [&,
this](
const source_type& sourceSymbol,
const count_type& symbolFrequency) {
112 if (symbolFrequency) {
113 this->mContainer[sourceSymbol] =
symbol_type{symbolFrequency, cumulatedFrequency, this->getPrecision()};
114 cumulatedFrequency += symbolFrequency;
117 mSize = this->mContainer.size();
120template <
typename source_T,
typename symbol_T>
126template <
typename source_T,
typename symbol_T>
131 return std::count_if(histogram.
begin(), histogram.
end(),
132 [&](
const auto&
value) {
133 return !histogram.isEscapeSymbol(internal::getValue(value));
configStandalone Light OpenGL display display_light Apply smoothing to points Enable Z buffer Highlight links Highlight seeds Highlight sector tracks Highlight final tracks Show individual Show related Highlight grid Show only individual collision Color clusters belonging to track objects Set line Enable drawing TPC data Enable drawing TOF data Enable drawing magnetic field Set field line step count Invert colors configStandalone Heavy OpenGL display display_heavy Show tracks with ITS contribution Show tracks with TOF contribution Enable propagation of loopers Show clusters at nominal x of pad row for early transformed data Split CE tracks when they cross the central Mark clusters Mark adjacent clusters Hide rejected tracks Apply filter on tracks to be displayed Separate increase X h configStandalone Camera window renderer OpenGL display display_camera Orient the camera such that the y axis is always upwards Full Screen MultiSample Anti Downsampling Anti Enable Vertical Sync Target frame or if the backend cannot limit to the refresh Use OpenGL indirect draws to reduce number of draw calls Display h configStandalone Vulkan display display_vulkan Have uniform buffers in host accessible device memory h internal
Histogram renormed to sum of frequencies being 2^P for use in fast rans coding.
Abstract container class that defines and implements basic properties shared by histograms and lookup...
helper functionalities useful for packing operations
typename base_type::const_reference const_reference
typename base_type::value_type symbol_type
size_type getPrecision() const noexcept
typename base_type::size_type size_type
typename base_type::source_type source_type
AdaptiveSymbolTable()=default
typename base_type::pointer pointer
const_pointer lookupUnsafe(source_type sourceSymbol) const
typename base_type::container_type container_type
const_reference getEscapeSymbol() const noexcept
typename base_type::const_iterator const_iterator
typename base_type::reference reference
bool isEscapeSymbol(const_reference symbol) const noexcept
const_pointer lookupSafe(source_type sourceSymbol) const
symbol_type mEscapeSymbol
bool isEscapeSymbol(source_type sourceSymbol) const noexcept
size_type mSymbolTablePrecision
size_type size() const noexcept
bool isValidSymbol(const symbol_type &value) const noexcept
bool hasEscapeSymbol() const noexcept
typename base_type::difference_type difference_type
const_reference operator[](source_type sourceSymbol) const noexcept
typename base_type::const_pointer const_pointer
value_type getIncompressibleSymbolFrequency() const noexcept
size_t getRenormingBits() const noexcept
container_type mContainer
const_iterator begin() const noexcept
const_iterator end() const noexcept
typename base_type::pointer pointer
typename base_type::difference_type difference_type
typename base_type::source_type source_type
typename base_type::const_iterator const_iterator
typename base_type::value_type value_type
typename base_type::reference reference
typename base_type::container_type container_type
typename base_type::const_pointer const_pointer
typename base_type::const_reference const_reference
typename base_type::size_type size_type
GLsizei const GLfloat * value
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 >
size_t countNUsedAlphabetSymbols(const AdaptiveHistogram< source_T > &histogram)
std::pair< source_T, source_T > getMinMax(const AdaptiveSymbolTable< source_T, symbol_T > &symbolTable)
Common utility functions.