17#ifndef RANS_INTERNAL_CONTAINERS_HASHSYMBOLTABLE_H_
18#define RANS_INTERNAL_CONTAINERS_HASHSYMBOLTABLE_H_
23#include <fairlogger/Logger.h>
33template <
class source_T,
class symbol_T>
53 template <
typename container_T>
78template <
class source_T,
class value_T>
79template <
typename container_T>
82 using namespace utils;
84 using count_type =
typename value_T::value_type;
87 auto nullElement = [&]() -> value_T {
89 const count_type cumulatedFrequency = renormedHistogram.getNumSamples() - symbolFrequency;
90 return {symbolFrequency, cumulatedFrequency, this->getPrecision()};
95 const auto [trimmedBegin, trimmedEnd] =
trim(renormedHistogram);
97 count_type cumulatedFrequency = 0;
99 renormedHistogram, trimmedBegin, trimmedEnd, [&,
this](
const source_type& sourceSymbol,
const count_type& symbolFrequency) {
100 if (symbolFrequency) {
101 this->mContainer[sourceSymbol] =
symbol_type{symbolFrequency, cumulatedFrequency, this->getPrecision()};
102 cumulatedFrequency += symbolFrequency;
107template <
class source_T,
class value_T>
110 auto iter = this->mContainer.find(sourceSymbol);
111 if (iter == this->mContainer.end()) {
114 return &iter->second;
118template <
typename source_T,
typename symbol_T>
124template <
typename source_T,
typename symbol_T>
127 return std::count_if(symbolTable.
begin(), symbolTable.
end(), [&symbolTable](
const auto&
v) { return !symbolTable.isEscapeSymbol(v.second); });
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
value_type getIncompressibleSymbolFrequency() const noexcept
size_t getRenormingBits() const noexcept
bool isEscapeSymbol(source_type sourceSymbol) const noexcept
size_type mSymbolTablePrecision
bool isValidSymbol(const symbol_type &value) const noexcept
const_pointer lookupUnsafe(source_type sourceSymbol) const
size_type getPrecision() const noexcept
typename base_type::source_type source_type
SparseSymbolTable()=default
typename base_type::pointer pointer
typename base_type::value_type symbol_type
typename base_type::const_reference const_reference
bool isEscapeSymbol(const_reference symbol) const noexcept
typename base_type::const_pointer const_pointer
const_reference getEscapeSymbol() const noexcept
typename base_type::difference_type difference_type
size_type size() const noexcept
bool hasEscapeSymbol() const noexcept
typename base_type::container_type container_type
const_pointer lookupSafe(source_type sourceSymbol) const
typename base_type::const_iterator const_iterator
typename base_type::reference reference
typename base_type::size_type size_type
container_type mContainer
const_iterator begin() const noexcept
const_iterator end() const noexcept
typename base_type::value_type value_type
typename base_type::size_type size_type
typename base_type::const_pointer const_pointer
typename base_type::const_reference const_reference
typename base_type::difference_type difference_type
typename base_type::reference reference
typename base_type::container_type container_type
typename base_type::pointer pointer
typename base_type::const_iterator const_iterator
typename base_type::source_type source_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 >
HistogramView< Hist_IT > trim(const HistogramView< Hist_IT > &buffer)
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.
manipulation of types at compile time