FFmpeg
Classes | Macros | Typedefs | Functions
elbg.c File Reference

Codebook Generator using the ELBG algorithm. More...

#include <string.h>
#include "libavutil/avassert.h"
#include "libavutil/common.h"
#include "libavutil/lfg.h"
#include "elbg.h"
#include "avcodec.h"

Classes

struct  cell_s
 In the ELBG jargon, a cell is the set of points that are closest to a codebook entry. More...
 
struct  elbg_data
 ELBG internal data. More...
 

Macros

#define DELTA_ERR_MAX   0.1
 Precision of the ELBG algorithm (as percentage error)
 
#define BIG_PRIME   433494437LL
 

Typedefs

typedef struct cell_s cell
 In the ELBG jargon, a cell is the set of points that are closest to a codebook entry. More...
 
typedef struct elbg_data elbg_data
 ELBG internal data.
 

Functions

int avpriv_init_elbg (int *points, int dim, int numpoints, int *codebook, int numCB, int max_steps, int *closest_cb, AVLFG *rand_state)
 Initialize the **codebook vector for the elbg algorithm. More...
 
int avpriv_do_elbg (int *points, int dim, int numpoints, int *codebook, int numCB, int max_steps, int *closest_cb, AVLFG *rand_state)
 Implementation of the Enhanced LBG Algorithm Based on the paper "Neural Networks 14:1219-1237" that can be found in http://citeseer.ist.psu.edu/patan01enhanced.html . More...
 

Detailed Description

Codebook Generator using the ELBG algorithm.

Typedef Documentation

§ cell

typedef struct cell_s cell

In the ELBG jargon, a cell is the set of points that are closest to a codebook entry.

Not to be confused with a RoQ Video cell.

Function Documentation

§ avpriv_do_elbg()

int avpriv_do_elbg ( int *  points,
int  dim,
int  numpoints,
int *  codebook,
int  numCB,
int  num_steps,
int *  closest_cb,
AVLFG rand_state 
)

Implementation of the Enhanced LBG Algorithm Based on the paper "Neural Networks 14:1219-1237" that can be found in http://citeseer.ist.psu.edu/patan01enhanced.html .

Parameters
pointsInput points.
dimDimension of the points.
numpointsNum of points in **points.
codebookPointer to the output codebook. Must be allocated.
numCBNumber of points in the codebook.
num_stepsThe maximum number of steps. One step is already a good compromise between time and quality.
closest_cbReturn the closest codebook to each point. Must be allocated.
rand_stateA random number generator state. Should be already initialized by av_lfg_init().
Returns
< 0 in case of error, 0 otherwise

§ avpriv_init_elbg()

int avpriv_init_elbg ( int *  points,
int  dim,
int  numpoints,
int *  codebook,
int  numCB,
int  num_steps,
int *  closest_cb,
AVLFG rand_state 
)

Initialize the **codebook vector for the elbg algorithm.

If you have already a codebook and you want to refine it, you shouldn't call this function. If numpoints < 8*numCB this function fills **codebook with random numbers. If not, it calls avpriv_do_elbg for a (smaller) random sample of the points in **points. Get the same parameters as avpriv_do_elbg.

Returns
< 0 in case of error, 0 otherwise