Context algorithm
Semi-predictive context algorithm implementation
 All Data Structures Files Functions Variables Typedefs Macros Pages
encoder.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <math.h>
#include "encoder.h"
#include "alpha.h"
#include "debug.h"
#include "text.h"
#include "spacedef.h"
#include "arithmetic/coder.h"
#include "arithmetic/bitio.h"
#include "see.h"
#include "reset.h"

Go to the source code of this file.

Functions

static void fixParents (fsmTree_t tree, BOOL *deletedChars)
 Remove symbols from the statistics of the ancestors of this node in case that is necessary. More...
 
static void rescale (fsmTree_t tree)
 
void encode (fsmTree_t tree, FILE *compressedFile, const Uchar *text, const Uint textlen, const BOOL useSee)
 Encode the input data into the output file using the tree as model. More...
 

Function Documentation

void encode ( fsmTree_t  tree,
FILE *  compressedFile,
const Uchar text,
const Uint  textlen,
const BOOL  useSee 
)

Encode the input data into the output file using the tree as model.

Parameters
[in]treemodel tree.
[in]compressedFilefile to output the compressed data.
[in]texttext to compress.
[in]textlenlength of the text to compress
[in]useSeeif see will be used

Definition at line 126 of file encoder.c.

static void fixParents ( fsmTree_t  tree,
BOOL deletedChars 
)
static

Remove symbols from the statistics of the ancestors of this node in case that is necessary.

Symbols are removed from the ancestors if they only have the same symbols as the child node (including the ones indicated in deletedChars).

Parameters
[in]treenode of the tree.
[in]deletedCharsbit vector indicating which characters have been erased from the node statistics.

Definition at line 55 of file encoder.c.

static void rescale ( fsmTree_t  tree)
static

Definition at line 86 of file encoder.c.