ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
Rans.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------*/
2/*------------------------------ File Rans.h -------------------------------*/
3/*--------------------------------------------------------------------------*/
63/*--------------------------------------------------------------------------*/
64/*----------------------------- DEFINITIONS --------------------------------*/
65/*--------------------------------------------------------------------------*/
66
67#ifndef __ADS_Rans
68 #define __ADS_Rans
69/* self-identification: #endif constant */
70
71/*--------------------------------------------------------------------------*/
72/*------------------------------ INCLUDES ----------------------------------*/
73/*--------------------------------------------------------------------------*/
74
75#include "ADS/Contract.h"
76
77#include <algorithm>
78#include <array>
79#include <cstddef>
80#include <cstdint>
81#include <span>
82#include <vector>
83
84/*--------------------------------------------------------------------------*/
85/*--------------------------- NAMESPACE ------------------------------------*/
86/*--------------------------------------------------------------------------*/
87
88namespace ADS
89{
90
119[[nodiscard]] inline std::vector< std::uint8_t >
120ransCompress( std::span< const std::uint8_t > in );
121
143[[nodiscard]] inline std::vector< std::uint8_t >
144ransDecompress( std::span< const std::uint8_t > in );
145
169[[nodiscard]] inline std::array< std::uint32_t , 256 >
170scaleFrequencies( const std::array< std::uint64_t , 256 > & f , int b );
171
172/*--------------------------------------------------------------------------*/
173
174} // end( namespace ADS )
175
176/*--------------------------------------------------------------------------*/
177/*-------------------------- IMPLEMENTATION --------------------------------*/
178/*--------------------------------------------------------------------------*/
179
180#include "ADS/compression/impl/Rans.tpp"
181
182/*--------------------------------------------------------------------------*/
183
184#endif /* Rans.h included */
185
186/*--------------------------------------------------------------------------*/
187/*---------------------------- End File Rans.h -----------------------------*/
188/*--------------------------------------------------------------------------*/
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
std::vector< std::uint8_t > ransCompress(std::span< const std::uint8_t > in)
the rANS code of order 0 of the bytes of in, with the frequencies and the size
std::array< std::uint32_t, 256 > scaleFrequencies(const std::array< std::uint64_t, 256 > &f, int b)
the frequencies scaled to sum to , each positive one kept positive
std::vector< std::uint8_t > ransDecompress(std::span< const std::uint8_t > in)
the bytes that ransCompress() coded in in
Definition ADT.h:96