APE range decoder


Defines

#define CODE_BITS   32
#define TOP_VALUE   ((unsigned int)1 << (CODE_BITS-1))
#define SHIFT_BITS   (CODE_BITS - 9)
#define EXTRA_BITS   ((CODE_BITS-2) % 8 + 1)
#define BOTTOM_VALUE   (TOP_VALUE >> 8)
#define MODEL_ELEMENTS   64

Functions

static void range_start_decoding (APEContext *ctx)
 Start the decoder.
static void range_dec_normalize (APEContext *ctx)
 Perform normalization.
static int range_decode_culfreq (APEContext *ctx, int tot_f)
 Calculate culmulative frequency for next symbol.
static int range_decode_culshift (APEContext *ctx, int shift)
 Decode value with given size in bits.
static void range_decode_update (APEContext *ctx, int sy_f, int lt_f)
 Update decoding state.
static int range_decode_bits (APEContext *ctx, int n)
 Decode n bits (n <= 16) without modelling.
static int range_get_symbol (APEContext *ctx, const uint32_t counts[], const uint16_t counts_diff[])
 Decode symbol.

Variables

static const uint32_t counts_3970 [65]
 Fixed probabilities for symbols in Monkey Audio version 3.97.
static const uint16_t counts_diff_3970 [64]
 Probability ranges for symbols in Monkey Audio version 3.97.
static const uint32_t counts_3980 [65]
 Fixed probabilities for symbols in Monkey Audio version 3.98.
static const uint16_t counts_diff_3980 [64]
 Probability ranges for symbols in Monkey Audio version 3.98.

Define Documentation

#define BOTTOM_VALUE   (TOP_VALUE >> 8)

Definition at line 245 of file apedec.c.

Referenced by range_dec_normalize().

#define CODE_BITS   32

Definition at line 241 of file apedec.c.

#define EXTRA_BITS   ((CODE_BITS-2) % 8 + 1)

Definition at line 244 of file apedec.c.

Referenced by range_start_decoding().

#define MODEL_ELEMENTS   64

Definition at line 309 of file apedec.c.

Referenced by ape_decode_value().

#define SHIFT_BITS   (CODE_BITS - 9)

Definition at line 243 of file apedec.c.

#define TOP_VALUE   ((unsigned int)1 << (CODE_BITS-1))

Definition at line 242 of file apedec.c.


Function Documentation

static void range_dec_normalize ( APEContext ctx  )  [inline, static]

Perform normalization.

Definition at line 256 of file apedec.c.

Referenced by entropy_decode(), range_decode_culfreq(), and range_decode_culshift().

static int range_decode_bits ( APEContext ctx,
int  n 
) [inline, static]

Decode n bits (n <= 16) without modelling.

Definition at line 301 of file apedec.c.

Referenced by ape_decode_value().

static int range_decode_culfreq ( APEContext ctx,
int  tot_f 
) [inline, static]

Calculate culmulative frequency for next symbol.

Does NO update!

Parameters:
tot_f is the total frequency or (code_value)1<<shift
Returns:
the culmulative frequency

Definition at line 270 of file apedec.c.

Referenced by ape_decode_value().

static int range_decode_culshift ( APEContext ctx,
int  shift 
) [inline, static]

Decode value with given size in bits.

Parameters:
shift number of bits to decode

Definition at line 281 of file apedec.c.

Referenced by range_decode_bits(), and range_get_symbol().

static void range_decode_update ( APEContext ctx,
int  sy_f,
int  lt_f 
) [inline, static]

Update decoding state.

Parameters:
sy_f the interval length (frequency of the symbol)
lt_f the lower end (frequency sum of < symbols)

Definition at line 294 of file apedec.c.

Referenced by ape_decode_value(), range_decode_bits(), and range_get_symbol().

static int range_get_symbol ( APEContext ctx,
const uint32_t  counts[],
const uint16_t  counts_diff[] 
) [inline, static]

Decode symbol.

Parameters:
counts probability range start position
count_diffs probability range widths

Definition at line 374 of file apedec.c.

Referenced by ape_decode_value().

static void range_start_decoding ( APEContext ctx  )  [inline, static]

Start the decoder.

Definition at line 248 of file apedec.c.

Referenced by init_entropy_decoder().


Variable Documentation

const uint32_t counts_3970[65] [static]

Initial value:

 {
        0, 14824, 28224, 39348, 47855, 53994, 58171, 60926,
    62682, 63786, 64463, 64878, 65126, 65276, 65365, 65419,
    65450, 65469, 65480, 65487, 65491, 65493, 65494, 65495,
    65496, 65497, 65498, 65499, 65500, 65501, 65502, 65503,
    65504, 65505, 65506, 65507, 65508, 65509, 65510, 65511,
    65512, 65513, 65514, 65515, 65516, 65517, 65518, 65519,
    65520, 65521, 65522, 65523, 65524, 65525, 65526, 65527,
    65528, 65529, 65530, 65531, 65532, 65533, 65534, 65535,
    65536
}
Fixed probabilities for symbols in Monkey Audio version 3.97.

Definition at line 314 of file apedec.c.

Referenced by ape_decode_value().

const uint32_t counts_3980[65] [static]

Initial value:

 {
        0, 19578, 36160, 48417, 56323, 60899, 63265, 64435,
    64971, 65232, 65351, 65416, 65447, 65466, 65476, 65482,
    65485, 65488, 65490, 65491, 65492, 65493, 65494, 65495,
    65496, 65497, 65498, 65499, 65500, 65501, 65502, 65503,
    65504, 65505, 65506, 65507, 65508, 65509, 65510, 65511,
    65512, 65513, 65514, 65515, 65516, 65517, 65518, 65519,
    65520, 65521, 65522, 65523, 65524, 65525, 65526, 65527,
    65528, 65529, 65530, 65531, 65532, 65533, 65534, 65535,
    65536
}
Fixed probabilities for symbols in Monkey Audio version 3.98.

Definition at line 343 of file apedec.c.

Referenced by ape_decode_value().

const uint16_t counts_diff_3970[64] [static]

Initial value:

 {
    14824, 13400, 11124, 8507, 6139, 4177, 2755, 1756,
    1104, 677, 415, 248, 150, 89, 54, 31,
    19, 11, 7, 4, 2, 1, 1, 1,
    1, 1, 1, 1, 1, 1, 1, 1,
    1, 1, 1, 1, 1, 1, 1, 1,
    1, 1, 1, 1, 1, 1, 1, 1,
    1, 1, 1, 1, 1, 1, 1, 1,
    1, 1, 1, 1, 1, 1, 1, 1
}
Probability ranges for symbols in Monkey Audio version 3.97.

Definition at line 329 of file apedec.c.

Referenced by ape_decode_value().

const uint16_t counts_diff_3980[64] [static]

Initial value:

 {
    19578, 16582, 12257, 7906, 4576, 2366, 1170, 536,
    261, 119, 65, 31, 19, 10, 6, 3,
    3, 2, 1, 1, 1, 1, 1, 1,
    1, 1, 1, 1, 1, 1, 1, 1,
    1, 1, 1, 1, 1, 1, 1, 1,
    1, 1, 1, 1, 1, 1, 1, 1,
    1, 1, 1, 1, 1, 1, 1, 1,
    1, 1, 1, 1, 1, 1, 1, 1
}
Probability ranges for symbols in Monkey Audio version 3.98.

Definition at line 358 of file apedec.c.

Referenced by ape_decode_value().


Generated on Thu Apr 2 07:16:14 2009 for ffmpeg by  doxygen 1.5.6