FFmpeg
|
Common code between the AC-3 encoder and decoder. More...
Go to the source code of this file.
Data Structures | |
struct | AC3BitAllocParameters |
struct | AC3HeaderInfo |
Coded AC-3 header values up to the lfeon element, plus derived values. More... | |
Macros | |
#define | AC3_MAX_CODED_FRAME_SIZE 3840 /* in bytes */ |
#define | AC3_MAX_CHANNELS 7 |
maximum number of channels, including coupling channel More... | |
#define | CPL_CH 0 |
coupling channel index More... | |
#define | AC3_MAX_COEFS 256 |
#define | AC3_BLOCK_SIZE 256 |
#define | AC3_MAX_BLOCKS 6 |
#define | AC3_FRAME_SIZE (AC3_MAX_BLOCKS * 256) |
#define | AC3_WINDOW_SIZE (AC3_BLOCK_SIZE * 2) |
#define | AC3_CRITICAL_BANDS 50 |
#define | AC3_MAX_CPL_BANDS 18 |
#define | EXP_REUSE 0 |
#define | EXP_NEW 1 |
#define | EXP_D15 1 |
#define | EXP_D25 2 |
#define | EXP_D45 3 |
#define | FIXR(x) ((float)(x)) |
#define | FIXR12(x) ((float)(x)) |
#define | FIXR15(x) ((float)(x)) |
#define | ROUND15(x) (x) |
#define | AC3_RENAME(x) x |
#define | AC3_NORM(norm) (1.0f/(norm)) |
#define | AC3_MUL(a, b) ((a) * (b)) |
#define | AC3_RANGE(x) (dynamic_range_tab[(x)]) |
#define | AC3_HEAVY_RANGE(x) (heavy_dynamic_range_tab[(x)]) |
#define | AC3_DYNAMIC_RANGE(x) (powf(x, s->drc_scale)) |
#define | AC3_SPX_BLEND(x) (x)* (1.0f/32) |
#define | AC3_DYNAMIC_RANGE1 1.0f |
#define | AC3_LEVEL(x) ROUND15((x) * FIXR15(M_SQRT1_2)) |
#define | LEVEL_PLUS_3DB M_SQRT2 |
#define | LEVEL_PLUS_1POINT5DB 1.1892071150027209 |
#define | LEVEL_MINUS_1POINT5DB 0.8408964152537145 |
#define | LEVEL_MINUS_3DB M_SQRT1_2 |
#define | LEVEL_MINUS_4POINT5DB 0.5946035575013605 |
#define | LEVEL_MINUS_6DB 0.5000000000000000 |
#define | LEVEL_MINUS_9DB 0.3535533905932738 |
#define | LEVEL_ZERO 0.0000000000000000 |
#define | LEVEL_ONE 1.0000000000000000 |
Typedefs | |
typedef float | INTFLOAT |
typedef float | SHORTFLOAT |
Functions | |
void | ff_ac3_common_init (void) |
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... | |
Common code between the AC-3 encoder and decoder.
Definition in file ac3.h.
#define AC3_MAX_CODED_FRAME_SIZE 3840 /* in bytes */ |
Definition at line 30 of file ac3.h.
Referenced by ff_ac3_output_frame().
#define AC3_MAX_CHANNELS 7 |
maximum number of channels, including coupling channel
Definition at line 31 of file ac3.h.
Referenced by ac3_decode_frame(), ac3_decode_init(), apply_channel_coupling(), decode_audio_block(), ff_eac3_set_cpl_states(), set_channel_info(), and set_downmix_coeffs().
#define CPL_CH 0 |
coupling channel index
Definition at line 32 of file ac3.h.
Referenced by ac3_decode_transform_coeffs_ch(), apply_channel_coupling(), calc_transform_coeffs_cpl(), compute_exp_strategy(), compute_rematrixing_strategy(), count_exponent_bits(), count_mantissa_bits_update_ch(), decode_audio_block(), decode_transform_coeffs(), encode_exponents(), ff_ac3_compute_coupling_strategy(), ff_ac3_group_exponents(), ff_ac3_quantize_mantissas(), ff_eac3_parse_header(), output_audio_block(), remove_dithering(), and set_bandwidth().
#define AC3_MAX_COEFS 256 |
Definition at line 34 of file ac3.h.
Referenced by ac3_bit_alloc_calc_bap_c(), allocate_buffers(), compute_exp_strategy(), encode_exponents(), encode_frame(), extract_exponents(), ff_eac3_decode_transform_coeffs_aht_ch(), reset_block_bap(), scale_coefficients(), and set_bandwidth().
#define AC3_BLOCK_SIZE 256 |
Definition at line 35 of file ac3.h.
Referenced by ac3_decode_frame(), allocate_sample_buffers(), apply_mdct(), copy_input_samples(), ff_ac3_adjust_frame_size(), ff_ac3_encode_init(), and validate_options().
#define AC3_MAX_BLOCKS 6 |
Definition at line 36 of file ac3.h.
Referenced by ac3_compute_mantissa_size_c(), apply_channel_coupling(), count_mantissa_bits(), and count_mantissa_bits_init().
#define AC3_FRAME_SIZE (AC3_MAX_BLOCKS * 256) |
Definition at line 37 of file ac3.h.
Referenced by allocate_sample_buffers(), spdif_get_offset_and_codec(), spdif_header_ac3(), and validate_options().
#define AC3_WINDOW_SIZE (AC3_BLOCK_SIZE * 2) |
Definition at line 38 of file ac3.h.
Referenced by allocate_sample_buffers(), apply_mdct(), and normalize_samples().
#define AC3_CRITICAL_BANDS 50 |
Definition at line 39 of file ac3.h.
Referenced by ff_ac3_bit_alloc_calc_mask().
#define EXP_REUSE 0 |
Definition at line 47 of file ac3.h.
Referenced by bit_alloc(), bit_alloc_masking(), compute_exp_strategy(), count_exponent_bits(), count_frame_bits(), decode_audio_block(), encode_exponents(), ff_ac3_group_exponents(), ff_eac3_parse_header(), and output_audio_block().
#define EXP_NEW 1 |
Definition at line 48 of file ac3.h.
Referenced by compute_exp_strategy().
#define EXP_D15 1 |
Definition at line 50 of file ac3.h.
Referenced by compute_exp_strategy(), and exponent_init().
#define EXP_D25 2 |
Definition at line 51 of file ac3.h.
Referenced by encode_exponents_blk_ch().
#define EXP_D45 3 |
Definition at line 52 of file ac3.h.
Referenced by decode_exponents(), encode_exponents_blk_ch(), exponent_init(), and ff_ac3_group_exponents().
#define FIXR12 | ( | x | ) | ((float)(x)) |
Definition at line 82 of file ac3.h.
Referenced by set_downmix_coeffs().
#define AC3_RENAME | ( | x | ) | x |
Definition at line 86 of file ac3.h.
Referenced by ac3_decode_init().
#define AC3_RANGE | ( | x | ) | (dynamic_range_tab[(x)]) |
Definition at line 89 of file ac3.h.
Referenced by decode_audio_block().
#define AC3_HEAVY_RANGE | ( | x | ) | (heavy_dynamic_range_tab[(x)]) |
Definition at line 90 of file ac3.h.
Referenced by ac3_parse_header().
Definition at line 91 of file ac3.h.
Referenced by decode_audio_block().
#define AC3_SPX_BLEND | ( | x | ) | (x)* (1.0f/32) |
Definition at line 92 of file ac3.h.
Referenced by decode_audio_block().
#define AC3_DYNAMIC_RANGE1 1.0f |
Definition at line 93 of file ac3.h.
Referenced by decode_audio_block().
#define LEVEL_MINUS_3DB M_SQRT1_2 |
Definition at line 106 of file ac3.h.
Referenced by ac3_decode_frame(), and set_downmix_coeffs().
typedef float SHORTFLOAT |
enum AC3DeltaStrategy |
enum AC3ChannelMode |
enum AC3DolbySurroundMode |
enum EAC3FrameType |
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 91 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 117 of file ac3.c.
Referenced by bit_alloc_masking(), and decode_audio_block().