ac3.h File Reference


Detailed Description

Common code between AC3 encoder and decoder.

Definition in file ac3.h.

Go to the source code of this file.

Classes

struct  AC3BitAllocParameters
struct  AC3HeaderInfo
 Coded AC-3 header values up to the lfeon element, plus derived values. More...

Enumerations

enum  AC3DeltaStrategy { DBA_REUSE = 0, DBA_NEW, DBA_NONE, DBA_RESERVED }
 Delta bit allocation strategy. More...
enum  AC3ChannelMode {
  AC3_ACMOD_DUALMONO = 0, AC3_ACMOD_MONO, AC3_ACMOD_STEREO, AC3_ACMOD_3F,
  AC3_ACMOD_2F1R, AC3_ACMOD_3F1R, AC3_ACMOD_2F2R, AC3_ACMOD_3F2R
}
 Channel mode (audio coding mode). More...

Functions

void ac3_common_init (void)
 Initializes some tables.
void ff_ac3_bit_alloc_calc_psd (int8_t *exp, int start, int end, int16_t *psd, int16_t *bndpsd)
 Calculates the log power-spectral density of the input signal.
void ff_ac3_bit_alloc_calc_mask (AC3BitAllocParameters *s, int16_t *bndpsd, int start, int end, int fgain, int is_lfe, int deltbae, int deltnseg, uint8_t *deltoffst, uint8_t *deltlen, uint8_t *deltba, int16_t *mask)
 Calculates the masking curve.
void ff_ac3_bit_alloc_calc_bap (int16_t *mask, int16_t *psd, int start, int end, int snroffset, int floor, uint8_t *bap)
 Calculates bit allocation pointers.
void ac3_parametric_bit_allocation (AC3BitAllocParameters *s, uint8_t *bap, int8_t *exp, int start, int end, int snroffset, int fgain, int is_lfe, int deltbae, int deltnseg, uint8_t *deltoffst, uint8_t *deltlen, uint8_t *deltba)


Enumeration Type Documentation

Delta bit allocation strategy.

Enumerator:
DBA_REUSE 
DBA_NEW 
DBA_NONE 
DBA_RESERVED 

Definition at line 47 of file ac3.h.

Channel mode (audio coding mode).

Enumerator:
AC3_ACMOD_DUALMONO 
AC3_ACMOD_MONO 
AC3_ACMOD_STEREO 
AC3_ACMOD_3F 
AC3_ACMOD_2F1R 
AC3_ACMOD_3F1R 
AC3_ACMOD_2F2R 
AC3_ACMOD_3F2R 

Definition at line 55 of file ac3.h.


Function Documentation

void ac3_common_init ( void   ) 

Initializes some tables.

note: This function must remain thread safe because it is called by the AVParser init code.

Definition at line 226 of file ac3.c.

Referenced by ac3_decode_init(), and AC3_encode_init().

void ff_ac3_bit_alloc_calc_psd ( int8_t exp,
int  start,
int  end,
int16_t psd,
int16_t bndpsd 
)

Calculates the log power-spectral density of the input signal.

This gives a rough estimate of signal power in the frequency domain by using the spectral envelope (exponents). The psd is also separately grouped into critical bands for use in the calculating the masking curve. 128 units in psd = -6 dB. The dbknee parameter in AC3BitAllocParameters determines the reference level.

Parameters:
[in] exp frequency coefficient exponents
[in] start starting bin location
[in] end ending bin location
[out] psd signal power for each frequency bin
[out] bndpsd signal power for each critical band

Definition at line 55 of file ac3.c.

Referenced by ac3_parametric_bit_allocation(), ac3_parse_audio_block(), and bit_alloc_masking().

void ff_ac3_bit_alloc_calc_mask ( AC3BitAllocParameters s,
int16_t bndpsd,
int  start,
int  end,
int  fgain,
int  is_lfe,
int  deltbae,
int  deltnseg,
uint8_t *  deltoffst,
uint8_t *  deltlen,
uint8_t *  deltba,
int16_t mask 
)

Calculates the masking curve.

First, the excitation is calculated using parameters in s and the signal power in each critical band. The excitation is compared with a predefined hearing threshold table to produce the masking curve. If delta bit allocation information is provided, it is used for adjusting the masking curve, usually to give a closer match to a better psychoacoustic model.

Parameters:
[in] s adjustable bit allocation parameters
[in] bndpsd signal power for each critical band
[in] start starting bin location
[in] end ending bin location
[in] fgain fast gain (estimated signal-to-mask ratio)
[in] is_lfe whether or not the channel being processed is the LFE
[in] deltbae delta bit allocation exists (none, reuse, or new)
[in] deltnseg number of delta segments
[in] deltoffst location offsets for each segment
[in] deltlen length of each segment
[in] deltba delta bit allocation for each segment
[out] mask calculated masking curve

Definition at line 83 of file ac3.c.

Referenced by ac3_parametric_bit_allocation(), ac3_parse_audio_block(), and bit_alloc_masking().

void ff_ac3_bit_alloc_calc_bap ( int16_t mask,
int16_t psd,
int  start,
int  end,
int  snroffset,
int  floor,
uint8_t *  bap 
)

Calculates bit allocation pointers.

The SNR is the difference between the masking curve and the signal. AC-3 uses this value for each frequency bin to allocate bits. The snroffset parameter is a global adjustment to the SNR for all bins.

Parameters:
[in] mask masking curve
[in] psd signal power for each frequency bin
[in] start starting bin location
[in] end ending bin location
[in] snroffset SNR adjustment
[in] floor noise floor
[out] bap bit allocation pointers

Definition at line 175 of file ac3.c.

Referenced by ac3_parametric_bit_allocation(), ac3_parse_audio_block(), and bit_alloc().

void ac3_parametric_bit_allocation ( AC3BitAllocParameters s,
uint8_t *  bap,
int8_t exp,
int  start,
int  end,
int  snroffset,
int  fgain,
int  is_lfe,
int  deltbae,
int  deltnseg,
uint8_t *  deltoffst,
uint8_t *  deltlen,
uint8_t *  deltba 
)

Definition at line 201 of file ac3.c.


Generated on Sat Sep 4 05:15:51 2010 for MythTV by  doxygen 1.5.5