Created
April 23, 2012 21:23
-
-
Save nclack/2473960 to your computer and use it in GitHub Desktop.
Arithmetic coding example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void encode() | |
{ unsigned char *input, *output=0; // input and output buffer | |
size_t countof_input, countof_output; // number of symbols in input and output buffer | |
float *cdf=0; | |
size_t nsym; // number of symbols in the input alphabet | |
// somehow load the data into input array | |
cdf_build(&cdf,&nsym,input,countof_input); | |
encode_u1_u8( // encode unsigned chars to a string of bits (1 bit per output symbol) | |
(void**)&out,&countof_output, | |
input, countof_input, | |
cdf, nsym); | |
// do something with the output | |
free(out); | |
free(cdf); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment