Arithmetic coding tutorial code  1
AC
Namespaces | Macros | Typedefs | Functions | Variables
arith_code.cc File Reference
#include "stdio.h"
#include <stdlib.h>
#include <stdint.h>
#include "assert.h"
#include "math.h"
#include <string>
#include <inttypes.h>
#include <functional>
#include "arith_code.hh"
Include dependency graph for arith_code.cc:

Namespaces

 AC
 

Macros

#define ANSI_COLOR_RED   ""
 codes to output color More...
 
#define ANSI_COLOR_GREEN   ""
 
#define ANSI_COLOR_YELLOW   ""
 
#define ANSI_COLOR_BLUE   ""
 
#define ANSI_COLOR_MAGENTA   ""
 
#define ANSI_COLOR_CYAN   ""
 
#define ANSI_COLOR_RESET   ""
 
#define string_binary   string_hex
 
#define AC_PS(A)
 
#define AC_PB(A)
 
#define AC_PRINT(A...)
 

Typedefs

typedef std::function< void(int, int, F_t, F_t, double)> AC::printit_t
 

Functions

std::string AC::string_hex (I_t b)
 prints an integer in a string More...
 
std::string AC::string_binary_comma (I_t b, std::string sep="'")
 
void AC::freq2cum_freq (F_t cum_freq[], F_t freq[], int max_symb, int assert_non_zero=1)
 computes the cumulative cum_freq given the frequencies of symbols More...
 
void AC::prob2cum_freq (F_t cum_freq[], double prob[], int max_symb)
 computes the cum_freq given the probabilities More...
 
int AC::renormalize_frequencies (AC::F_t *fr, int n_symbols, unsigned int max_freq=AC::MAX_FREQ)
 
double AC::compute_entropy (F_t *freq, int MAX_SYMB)
 compute the entropy given the frequencies More...
 
void AC::print_table_generic (std::function< void(int)> head, printit_t printit, F_t *fr, F_t *cufr, int n_symbols, const int columns=6)
 
void AC::print_table_freq (F_t *fr, F_t *cufr, int n_symbols, const int columns=6, FILE *out=stderr)
 prints the table of frequencies More...
 
void AC::print_table_freq_ascii (F_t *fr, F_t *cufr, int n_symbols, const int columns=6, FILE *out=stderr)
 prints the table of frequencies, with ascii characters More...
 
void AC::print_table_cum_freq_ascii (F_t *fr, F_t *cufr, int n_symbols, FILE *out=stdout, int columns=4)
 prints the table of frequencies and cumulative frequencies, with ascii symbols More...
 
void AC::print_table_cum_freq (F_t *fr, F_t *cufr, int n_symbols, FILE *out=stdout, const int columns=4)
 prints the table of frequencies and cumulative frequencies More...
 

Variables

const char * AC::bit_rep [16]
 
const char * AC::hex_rep [16]
 

Macro Definition Documentation

◆ AC_PB

#define AC_PB (   A)

◆ AC_PRINT

#define AC_PRINT (   A...)

◆ AC_PS

#define AC_PS (   A)

◆ ANSI_COLOR_BLUE

#define ANSI_COLOR_BLUE   ""

◆ ANSI_COLOR_CYAN

#define ANSI_COLOR_CYAN   ""

◆ ANSI_COLOR_GREEN

#define ANSI_COLOR_GREEN   ""

◆ ANSI_COLOR_MAGENTA

#define ANSI_COLOR_MAGENTA   ""

◆ ANSI_COLOR_RED

#define ANSI_COLOR_RED   ""

codes to output color

◆ ANSI_COLOR_RESET

#define ANSI_COLOR_RESET   ""

◆ ANSI_COLOR_YELLOW

#define ANSI_COLOR_YELLOW   ""

◆ string_binary

#define string_binary   string_hex