16#ifndef RANS_FACTORY_H_
17#define RANS_FACTORY_H_
20#error rANS should not be exposed to root
58template <
template <
class...
types>
class histogram_T>
61 template <
typename source_T>
64 template <
typename source_IT>
65 [[nodiscard]]
inline static decltype(
auto)
fromSamples(source_IT begin, source_IT
end)
67 using source_type =
typename std::iterator_traits<source_IT>::value_type;
70 f.addSamples(begin,
end);
74 template <
typename source_T>
75 [[nodiscard]]
inline static decltype(
auto)
fromSamples(gsl::span<const source_T>
range)
77 using source_type =
typename std::remove_cv_t<source_T>;
85template <
template <
typename source_T,
typename symbol_T>
class symbolTable_T,
86 CoderTag coderTag_V = defaults::DefaultTag,
92 static constexpr size_t NStreams = nStreams_V;
93 static constexpr size_t RenormingLowerBound = renormingLowerBound_V;
94 static constexpr CoderTag coderTag = coderTag_V;
99 template <
typename source_T>
100 using symbolTable_type = symbolTable_T<source_T, symbol_type>;
101 template <
typename source_T>
105 template <
typename container_T>
112 template <
typename histogram_T>
115 static_assert(internal::isHistogram_v<histogram_T>);
116 const auto renormedHistogram =
renorm(std::move(histogram), renormingPolicy);
120 template <
typename histogram_T>
123 static_assert(internal::isHistogram_v<histogram_T>);
124 const auto renormedHistogram =
renorm(std::move(histogram),
metrics, renormingPolicy);
128 template <
typename histogram_T>
131 static_assert(internal::isHistogram_v<histogram_T>);
132 const auto renormedHistogram =
renorm(std::move(histogram), renormingPrecision, renormingPolicy);
143 template <
typename source_IT>
144 [[nodiscard]]
inline static decltype(
auto)
fromSamples(source_IT begin, source_IT
end,
145 typename std::iterator_traits<source_IT>::value_type
min,
146 typename std::iterator_traits<source_IT>::value_type
max)
148 using source_type =
typename std::iterator_traits<source_IT>::value_type;
156 template <
typename source_T>
159 using source_type =
typename std::remove_cv_t<source_T>;
172template <
CoderTag coderTag_V = defaults::DefaultTag,
177template <
CoderTag coderTag_V = defaults::DefaultTag,
182template <
CoderTag coderTag_V = defaults::DefaultTag,
187template <
size_t renormingLowerBound_V = defaults::
internal::RenormingLowerBound>
194 template <
typename source_T>
197 using namespace internal;
200 using coder_type = DecoderImpl<renormingLowerBound_V>;
203 return decoder_type{renormed};
206 template <
typename source_T>
209 const auto renormedHistogram =
renorm(std::move(histogram), renormingPolicy);
213 template <
typename source_T>
216 const auto renormedHistogram =
renorm(std::move(histogram),
metrics, renormingPolicy);
220 template <
typename source_T>
223 const auto renormedHistogram =
renorm(std::move(histogram), renormingPrecision);
228template <
typename source_T>
231template <
typename source_T>
234template <
typename source_T>
237template <
typename source_T>
Lookup table containing statistical information for each symbol in the alphabet required for encoding...
Operations to decode a rANS stream.
Histogram for source symbols used to estimate symbol probabilities for entropy coding.
Lookup table containing statistical information for each symbol in the alphabet required for encoding...
Maps rANS state information back to source symbol, used for decoding.
Maps rANS state information back to source symbol, used for decoding.
Computes and provides essential metrics on the dataset used for parameter and size estimates by other...
Histogram renormed to sum of frequencies being 2^P for use in fast rans coding.
rANS encoding operations that encode multiple symbols simultaniously using SIMD. Unified implementati...
rANS encoding operations based on ryg's fast algorithm and a naive rANS implementation for all 64Bit ...
Histogram to depict frequencies of source symbols for rANS compression, based on an ordered set.
Contains statistical information for one source symbol, required for encoding/decoding.
Decoder - User facing class to decode a rANS encoded stream back into the source data based on the sa...
Encoder - User facing class to perform rANS entropy coding of source symbols onto a rANS state based ...
typename base_type::source_type source_type
static constexpr decltype(auto) fromRenormed(const RenormedHistogramConcept< container_T > &renormed)
static decltype(auto) fromHistogram(histogram_T histogram, Metrics< typename histogram_T::source_type > &metrics, RenormingPolicy renormingPolicy=RenormingPolicy::Auto)
static decltype(auto) fromHistogram(histogram_T histogram, size_t renormingPrecision, RenormingPolicy renormingPolicy=RenormingPolicy::Auto)
static decltype(auto) fromHistogram(histogram_T histogram, RenormingPolicy renormingPolicy=RenormingPolicy::Auto)
static decltype(auto) fromHistogram(DenseHistogram< source_T > histogram, size_t renormingPrecision, RenormingPolicy renormingPolicy=RenormingPolicy::Auto)
static decltype(auto) fromHistogram(DenseHistogram< source_T > histogram, Metrics< source_T > &metrics, RenormingPolicy renormingPolicy=RenormingPolicy::Auto)
static constexpr decltype(auto) fromRenormed(const RenormedDenseHistogram< source_T > &renormed)
static decltype(auto) fromHistogram(DenseHistogram< source_T > histogram, RenormingPolicy renormingPolicy=RenormingPolicy::Auto)
sane compile time defaults for encoders/decoders
GLsizei GLenum GLenum * types
GLsizei GLenum const void GLuint GLsizei GLfloat * metrics
GLint GLint GLsizei GLint GLenum GLenum type
decltype(makeDenseEncoder<>::fromRenormed(RenormedDenseHistogram< source_T >{})) denseEncoder_type
decltype(makeSparseEncoder<>::fromRenormed(RenormedSparseHistogram< source_T >{})) sparseEncoder_type
decltype(makeDecoder<>::fromRenormed(RenormedDenseHistogram< source_T >{})) defaultDecoder_type
decltype(auto) renorm(histogram_T histogram, size_t newPrecision, RenormingPolicy renormingPolicy=RenormingPolicy::Auto, size_t lowProbabilityCutoffBits=0)
decltype(makeAdaptiveEncoder<>::fromRenormed(RenormedAdaptiveHistogram< source_T >{})) adaptiveEncoder_type
Renorm histogram to sum of frequencies = 2^P for use in fast rans coding. Includes estimation of P.
static decltype(auto) fromSamples(source_IT begin, source_IT end)
static decltype(auto) fromSamples(gsl::span< const source_T > range)
histogram_T< source_T > histogram_type
static decltype(auto) fromSamples(source_IT begin, source_IT end, typename std::iterator_traits< source_IT >::value_type min, typename std::iterator_traits< source_IT >::value_type max)
static decltype(auto) fromSamples(gsl::span< const source_T > range, source_T min, source_T max)
manipulation of types at compile time