FFmpeg
4.0
|
Common code between the AC-3 encoder and decoder. More...
Go to the source code of this file.
Functions | |
static int | calc_lowcomp1 (int a, int b0, int b1, int c) |
static int | calc_lowcomp (int a, int b0, int b1, int bin) |
void | ff_ac3_bit_alloc_calc_psd (int8_t *exp, int start, int end, int16_t *psd, int16_t *band_psd) |
Calculate the log power-spectral density of the input signal. More... | |
int | ff_ac3_bit_alloc_calc_mask (AC3BitAllocParameters *s, int16_t *band_psd, int start, int end, int fast_gain, int is_lfe, int dba_mode, int dba_nsegs, uint8_t *dba_offsets, uint8_t *dba_lengths, uint8_t *dba_values, int16_t *mask) |
Calculate the masking curve. More... | |
Variables | |
const uint8_t | ff_ac3_band_start_tab [AC3_CRITICAL_BANDS+1] |
Starting frequency coefficient bin for each critical band. More... | |
const uint8_t | ff_ac3_bin_to_band_tab [253] |
Map each frequency coefficient bin to the critical band that contains it. More... | |
Common code between the AC-3 encoder and decoder.
Definition in file ac3.c.
Definition at line 71 of file ac3.c.
Referenced by calc_lowcomp(), and ff_ac3_bit_alloc_calc_mask().
Definition at line 81 of file ac3.c.
Referenced by ff_ac3_bit_alloc_calc_mask().
void ff_ac3_bit_alloc_calc_psd | ( | int8_t * | exp, |
int | start, | ||
int | end, | ||
int16_t * | psd, | ||
int16_t * | band_psd | ||
) |
Calculate 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.
[in] | exp | frequency coefficient exponents |
[in] | start | starting bin location |
[in] | end | ending bin location |
[out] | psd | signal power for each frequency bin |
[out] | band_psd | signal power for each critical band |
Definition at line 92 of file ac3.c.
Referenced by bit_alloc_masking(), and decode_audio_block().
int ff_ac3_bit_alloc_calc_mask | ( | AC3BitAllocParameters * | s, |
int16_t * | band_psd, | ||
int | start, | ||
int | end, | ||
int | fast_gain, | ||
int | is_lfe, | ||
int | dba_mode, | ||
int | dba_nsegs, | ||
uint8_t * | dba_offsets, | ||
uint8_t * | dba_lengths, | ||
uint8_t * | dba_values, | ||
int16_t * | mask | ||
) |
Calculate 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.
[in] | s | adjustable bit allocation parameters |
[in] | band_psd | signal power for each critical band |
[in] | start | starting bin location |
[in] | end | ending bin location |
[in] | fast_gain | fast gain (estimated signal-to-mask ratio) |
[in] | is_lfe | whether or not the channel being processed is the LFE |
[in] | dba_mode | delta bit allocation mode (none, reuse, or new) |
[in] | dba_nsegs | number of delta segments |
[in] | dba_offsets | location offsets for each segment |
[in] | dba_lengths | length of each segment |
[in] | dba_values | delta bit allocation for each segment |
[out] | mask | calculated masking curve |
Definition at line 118 of file ac3.c.
Referenced by bit_alloc_masking(), and decode_audio_block().
const uint8_t ff_ac3_band_start_tab[AC3_CRITICAL_BANDS+1] |
Starting frequency coefficient bin for each critical band.
Definition at line 35 of file ac3.c.
Referenced by ac3_bit_alloc_calc_bap_c(), and ff_ac3_bit_alloc_calc_psd().
const uint8_t ff_ac3_bin_to_band_tab[253] |
Map each frequency coefficient bin to the critical band that contains it.
Definition at line 46 of file ac3.c.
Referenced by ac3_bit_alloc_calc_bap_c(), ff_ac3_bit_alloc_calc_mask(), and ff_ac3_bit_alloc_calc_psd().