Encoder  4.4
VC-5 Sample Encoder
codebooks.h File Reference

Go to the source code of this file.

Functions

CODEC_ERROR PrepareCodebooks (ALLOCATOR *allocator, CODESET *cs)
 Initialize the codeset by creating more efficient tables for encoding. More...
 
CODEC_ERROR ReleaseCodebooks (ALLOCATOR *allocator, CODESET *cs)
 Free all data structures allocated for the codebooks.
 
CODEC_ERROR ComputeRunLengthCodeTable (ALLOCATOR *allocator, RLV *input_codes, int input_length, RLC *output_codes, int output_length)
 Compute a table of codewords for runs of zeros. More...
 
CODEC_ERROR SortDecreasingRunLength (RLC *codebook, int length)
 Sort the codebook into decreasing length of the run.
 
CODEC_ERROR FillRunLengthEncodingTable (RLC *codebook, int codebook_length, RLC *table, int table_length)
 Use a sparse run length code table to create an indexable table for faster encoding.
 
CODEC_ERROR FillMagnitudeEncodingTable (const CODEBOOK *codebook, VLE *table, int size, uint32_t flags)
 Fill lookup table for encoding coefficient magnitudes. More...
 

Detailed Description

Declaration of the routines for computing the encoding tables from a codebook.

A codebooks contains the variable-length codes for coefficient magnitudes, runs of zeros, and special codewords that mark entropy codec locations in bitstream.

The codebook is used to create tables and simplify entropy coding of signed values and runs of zeros.

(c) 2013-2017 Society of Motion Picture & Television Engineers LLC and Woodman Labs, Inc. All rights reserved–use subject to compliance with end user license agreement.

Function Documentation

◆ ComputeRunLengthCodeTable()

CODEC_ERROR ComputeRunLengthCodeTable ( ALLOCATOR allocator,
RLV input_codes,
int  input_length,
RLC output_codes,
int  output_length 
)

Compute a table of codewords for runs of zeros.

The table is indexed by the length of the run of zeros.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FillMagnitudeEncodingTable()

CODEC_ERROR FillMagnitudeEncodingTable ( const CODEBOOK codebook,
VLE mags_table_entry,
int  mags_table_length,
uint32_t  flags 
)

Fill lookup table for encoding coefficient magnitudes.

The table for encoding coefficient magnitudes is indexed by the magnitude. Each entry is a codeword and the size in bits.

Todo:
Implement cubic companding
Here is the call graph for this function:
Here is the caller graph for this function:

◆ PrepareCodebooks()

CODEC_ERROR PrepareCodebooks ( ALLOCATOR allocator,
CODESET cs 
)

Initialize the codeset by creating more efficient tables for encoding.

This routine takes the original codebook in the codeset and creates a table of codewords for runs of zeros, indexed by the run length, and a table for coefficient magnitudes, indexed by the coefficient magnitude. This allows runs of zeros and non-zero coefficients to be entropy coded using a simple table lookup.

Here is the call graph for this function: