ac3dec.c File Reference

Go to the source code of this file.

Classes

struct  AC3DecodeContext
struct  mant_groups
 Grouped mantissas for 3-level 5-level and 11-level quantization. More...

Functions

static void ac3_window_init (float *window)
 Generate a Kaiser-Bessel Derived Window.
static float symmetric_dequant (int code, int levels)
 Symmetrical Dequantization reference: Section 7.3.3 Expansion of Mantissas for Symmetrical Quantization Tables 7.19 to 7.23.
static void ac3_tables_init (void)
static int ac3_decode_init (AVCodecContext *avctx)
 AVCodec initialization.
static int ac3_parse_header (AC3DecodeContext *ctx)
 Parse the 'sync info' and 'bit stream info' from the AC-3 bitstream.
static void decode_exponents (GetBitContext *gb, int expstr, int ngrps, uint8_t absexp, int8_t *dexps)
 Decode the grouped exponents according to exponent strategy.
static void uncouple_channels (AC3DecodeContext *ctx)
 Generate transform coefficients for each coupled channel in the coupling range using the coupling coefficients and coupling coordinates.
static int get_transform_coeffs_ch (AC3DecodeContext *ctx, int ch_index, mant_groups *m)
 Get the transform coefficients for a particular channel reference: Section 7.3 Quantization and Decoding of Mantissas.
static void remove_dithering (AC3DecodeContext *ctx)
 Remove random dithering from coefficients with zero-bit mantissas reference: Section 7.3.4 Dither for Zero Bit Mantissas (bap=0).
static int get_transform_coeffs (AC3DecodeContext *ctx)
 Get the transform coefficients.
static void do_rematrixing (AC3DecodeContext *ctx)
 Stereo rematrixing.
static void do_imdct_256 (AC3DecodeContext *ctx, int chindex)
 Perform the 256-point IMDCT.
static void do_imdct (AC3DecodeContext *ctx)
 Inverse MDCT Transform.
static void ac3_downmix (float samples[AC3_MAX_CHANNELS][256], int nfchans, int output_mode, float coef[AC3_MAX_CHANNELS][2])
 Downmix the output to mono or stereo.
static int ac3_parse_audio_block (AC3DecodeContext *ctx, int blk)
 Parse an audio block from AC-3 bitstream.
static int ac3_decode_frame (AVCodecContext *avctx, void *data, int *data_size, uint8_t *buf, int buf_size)
 Decode a single AC-3 frame.
static int ac3_decode_end (AVCodecContext *avctx)
 Uninitialize the AC-3 decoder.

Variables

static const uint8_t rematrix_band_tab [5] = { 13, 25, 37, 61, 253 }
 Table of bin locations for rematrixing bands reference: Section 7.5.2 Rematrixing : Frequency Band Definitions.
static float scale_factors [25]
 table for exponent to scale_factor mapping scale_factors[i] = 2 ^ -i
static uint8_t exp_ungroup_tab [128][3]
 table for grouping exponents
static float b1_mantissas [32][3]
 tables for ungrouping mantissas
static float b2_mantissas [128][3]
static float b3_mantissas [8]
static float b4_mantissas [128][2]
static float b5_mantissas [16]
static const uint8_t qntztab [16]
 Quantization table: levels for symmetric.
static float dynrng_tab [256]
 dynamic range table.
static float dialnorm_tab [32]
 dialogue normalization table
static const float gain_levels [6]
static const uint8_t clevs [4] = { 2, 3, 4, 3 }
 Table for center mix levels reference: Section 5.4.2.4 cmixlev.
static const uint8_t slevs [4] = { 2, 4, 0, 4 }
 Table for surround mix levels reference: Section 5.4.2.5 surmixlev.
static const uint8_t ac3_default_coeffs [8][5][2]
 Table for default stereo downmixing coefficients reference: Section 7.8.2 Downmixing Into Two Channels.
AVCodec ac3_decoder


Function Documentation

static void ac3_window_init ( float *  window  )  [static]

Generate a Kaiser-Bessel Derived Window.

Definition at line 205 of file ac3dec.c.

Referenced by ac3_decode_init().

static float symmetric_dequant ( int  code,
int  levels 
) [inline, static]

Symmetrical Dequantization reference: Section 7.3.3 Expansion of Mantissas for Symmetrical Quantization Tables 7.19 to 7.23.

Definition at line 232 of file ac3dec.c.

Referenced by ac3_tables_init().

static void ac3_tables_init ( void   )  [static]

Definition at line 240 of file ac3dec.c.

Referenced by ac3_decode_init().

static int ac3_decode_init ( AVCodecContext avctx  )  [static]

AVCodec initialization.

Definition at line 306 of file ac3dec.c.

static int ac3_parse_header ( AC3DecodeContext ctx  )  [static]

Parse the 'sync info' and 'bit stream info' from the AC-3 bitstream.

GetBitContext within AC3DecodeContext must point to start of the synchronized ac3 bitstream.

Definition at line 336 of file ac3dec.c.

Referenced by ac3_decode_frame().

static void decode_exponents ( GetBitContext gb,
int  expstr,
int  ngrps,
uint8_t  absexp,
int8_t dexps 
) [static]

Decode the grouped exponents according to exponent strategy.

reference: Section 7.1.3 Exponent Decoding

Definition at line 437 of file ac3dec.c.

Referenced by ac3_parse_audio_block().

static void uncouple_channels ( AC3DecodeContext ctx  )  [static]

Generate transform coefficients for each coupled channel in the coupling range using the coupling coefficients and coupling coordinates.

reference: Section 7.4.3 Coupling Coordinate Format

Definition at line 468 of file ac3dec.c.

Referenced by get_transform_coeffs().

static int get_transform_coeffs_ch ( AC3DecodeContext ctx,
int  ch_index,
mant_groups m 
) [static]

Get the transform coefficients for a particular channel reference: Section 7.3 Quantization and Decoding of Mantissas.

Definition at line 504 of file ac3dec.c.

Referenced by get_transform_coeffs().

static void remove_dithering ( AC3DecodeContext ctx  )  [static]

Remove random dithering from coefficients with zero-bit mantissas reference: Section 7.3.4 Dither for Zero Bit Mantissas (bap=0).

Definition at line 580 of file ac3dec.c.

Referenced by get_transform_coeffs().

static int get_transform_coeffs ( AC3DecodeContext ctx  )  [static]

Get the transform coefficients.

Definition at line 612 of file ac3dec.c.

Referenced by ac3_parse_audio_block().

static void do_rematrixing ( AC3DecodeContext ctx  )  [static]

Stereo rematrixing.

reference: Section 7.5.4 Rematrixing : Decoding Technique

Definition at line 655 of file ac3dec.c.

Referenced by ac3_parse_audio_block().

static void do_imdct_256 ( AC3DecodeContext ctx,
int  chindex 
) [static]

Perform the 256-point IMDCT.

Definition at line 679 of file ac3dec.c.

Referenced by do_imdct().

static void do_imdct ( AC3DecodeContext ctx  )  [inline, static]

Inverse MDCT Transform.

Convert frequency domain coefficients to time-domain audio samples. reference: Section 7.9.4 Transformation Equations

Definition at line 722 of file ac3dec.c.

Referenced by ac3_parse_audio_block().

static void ac3_downmix ( float  samples[AC3_MAX_CHANNELS][256],
int  nfchans,
int  output_mode,
float  coef[AC3_MAX_CHANNELS][2] 
) [static]

Downmix the output to mono or stereo.

Definition at line 754 of file ac3dec.c.

Referenced by ac3_parse_audio_block().

static int ac3_parse_audio_block ( AC3DecodeContext ctx,
int  blk 
) [static]

Parse an audio block from AC-3 bitstream.

Definition at line 786 of file ac3dec.c.

Referenced by ac3_decode_frame().

static int ac3_decode_frame ( AVCodecContext avctx,
void *  data,
int *  data_size,
uint8_t *  buf,
int  buf_size 
) [static]

Decode a single AC-3 frame.

Definition at line 1093 of file ac3dec.c.

static int ac3_decode_end ( AVCodecContext avctx  )  [static]

Uninitialize the AC-3 decoder.

Definition at line 1188 of file ac3dec.c.


Variable Documentation

const uint8_t rematrix_band_tab[5] = { 13, 25, 37, 61, 253 } [static]

Table of bin locations for rematrixing bands reference: Section 7.5.2 Rematrixing : Frequency Band Definitions.

Definition at line 46 of file ac3dec.c.

Referenced by do_rematrixing().

float scale_factors[25] [static]

table for exponent to scale_factor mapping scale_factors[i] = 2 ^ -i

Definition at line 52 of file ac3dec.c.

Referenced by ac3_parse_audio_block(), ac3_tables_init(), compute_scale_factors(), get_transform_coeffs_ch(), mp_decode_layer1(), and mp_decode_layer2().

uint8_t exp_ungroup_tab[128][3] [static]

table for grouping exponents

Definition at line 55 of file ac3dec.c.

Referenced by ac3_tables_init(), and decode_exponents().

float b1_mantissas[32][3] [static]

tables for ungrouping mantissas

Definition at line 59 of file ac3dec.c.

Referenced by ac3_tables_init(), and get_transform_coeffs_ch().

float b2_mantissas[128][3] [static]

Definition at line 60 of file ac3dec.c.

Referenced by ac3_tables_init(), and get_transform_coeffs_ch().

float b3_mantissas[8] [static]

Definition at line 61 of file ac3dec.c.

Referenced by ac3_tables_init(), and get_transform_coeffs_ch().

float b4_mantissas[128][2] [static]

Definition at line 62 of file ac3dec.c.

Referenced by ac3_tables_init(), and get_transform_coeffs_ch().

float b5_mantissas[16] [static]

Definition at line 63 of file ac3dec.c.

Referenced by ac3_tables_init(), and get_transform_coeffs_ch().

const uint8_t qntztab[16] [static]

Initial value:

 {
    0, 3, 5, 7, 11, 15,
    5, 6, 7, 8, 9, 10, 11, 12, 14, 16
}
Quantization table: levels for symmetric.

bits for asymmetric. reference: Table 7.18 Mapping of bap to Quantizer

Definition at line 69 of file ac3dec.c.

Referenced by get_transform_coeffs_ch().

float dynrng_tab[256] [static]

dynamic range table.

converts codes to scale factors.

Definition at line 75 of file ac3dec.c.

Referenced by ac3_parse_audio_block(), and ac3_tables_init().

float dialnorm_tab[32] [static]

dialogue normalization table

Definition at line 78 of file ac3dec.c.

Referenced by ac3_parse_header(), and ac3_tables_init().

const float gain_levels[6] [static]

Initial value:

 {
    LEVEL_ZERO,
    LEVEL_ONE,
    LEVEL_MINUS_3DB,
    LEVEL_MINUS_4POINT5DB,
    LEVEL_MINUS_6DB,
    LEVEL_MINUS_9DB
}

Definition at line 88 of file ac3dec.c.

Referenced by ac3_parse_header().

const uint8_t clevs[4] = { 2, 3, 4, 3 } [static]

Table for center mix levels reference: Section 5.4.2.4 cmixlev.

Definition at line 101 of file ac3dec.c.

Referenced by ac3_parse_header().

const uint8_t slevs[4] = { 2, 4, 0, 4 } [static]

Table for surround mix levels reference: Section 5.4.2.5 surmixlev.

Definition at line 107 of file ac3dec.c.

Referenced by ac3_parse_header().

const uint8_t ac3_default_coeffs[8][5][2] [static]

Initial value:

 {
    { { 1, 0 }, { 0, 1 },                               },
    { { 2, 2 },                                         },
    { { 1, 0 }, { 0, 1 },                               },
    { { 1, 0 }, { 3, 3 }, { 0, 1 },                     },
    { { 1, 0 }, { 0, 1 }, { 4, 4 },                     },
    { { 1, 0 }, { 3, 3 }, { 0, 1 }, { 5, 5 },           },
    { { 1, 0 }, { 0, 1 }, { 4, 0 }, { 0, 4 },           },
    { { 1, 0 }, { 3, 3 }, { 0, 1 }, { 4, 0 }, { 0, 4 }, },
}
Table for default stereo downmixing coefficients reference: Section 7.8.2 Downmixing Into Two Channels.

Definition at line 113 of file ac3dec.c.

Referenced by ac3_parse_header().

Initial value:

 {
    .name = "ac3",
    .type = CODEC_TYPE_AUDIO,
    .id = CODEC_ID_AC3,
    .priv_data_size = sizeof (AC3DecodeContext),
    .init = ac3_decode_init,
    .close = ac3_decode_end,
    .decode = ac3_decode_frame,
}

Definition at line 1197 of file ac3dec.c.


Generated on Sat Dec 18 05:15:50 2010 for MythTV by  doxygen 1.5.5