FFmpeg
|
AAC Spectral Band Replication decoding functions. More...
#include "aac.h"
#include "sbr.h"
#include "aacsbr.h"
#include "aacsbrdata.h"
#include "fft.h"
#include "aacps.h"
#include "sbrdsp.h"
#include "libavutil/libm.h"
#include "libavutil/avassert.h"
#include <stdint.h>
#include <float.h>
#include <math.h>
Go to the source code of this file.
Macros | |
#define | ENVELOPE_ADJUSTMENT_OFFSET 2 |
#define | NOISE_FLOOR_OFFSET 6.0f |
#define | SBR_INIT_VLC_STATIC(num, size) |
#define | SBR_VLC_ROW(name) { name ## _codes, name ## _bits, sizeof(name ## _codes), sizeof(name ## _codes[0]) } |
Enumerations | |
enum | { T_HUFFMAN_ENV_1_5DB, F_HUFFMAN_ENV_1_5DB, T_HUFFMAN_ENV_BAL_1_5DB, F_HUFFMAN_ENV_BAL_1_5DB, T_HUFFMAN_ENV_3_0DB, F_HUFFMAN_ENV_3_0DB, T_HUFFMAN_ENV_BAL_3_0DB, F_HUFFMAN_ENV_BAL_3_0DB, T_HUFFMAN_NOISE_3_0DB, T_HUFFMAN_NOISE_BAL_3_0DB } |
SBR VLC tables. More... | |
enum | { FIXFIX, FIXVAR, VARFIX, VARVAR } |
bs_frame_class - frame class of current SBR frame (14496-3 sp04 p98) More... | |
enum | { EXTENSION_ID_PS = 2 } |
Functions | |
av_cold void | ff_aac_sbr_init (void) |
Initialize SBR. | |
static void | sbr_turnoff (SpectralBandReplication *sbr) |
Places SBR in pure upsampling mode. | |
av_cold void | ff_aac_sbr_ctx_init (AACContext *ac, SpectralBandReplication *sbr) |
Initialize one SBR context. | |
av_cold void | ff_aac_sbr_ctx_close (SpectralBandReplication *sbr) |
Close one SBR context. | |
static int | qsort_comparison_function_int16 (const void *a, const void *b) |
static int | in_table_int16 (const int16_t *table, int last_el, int16_t needle) |
static void | sbr_make_f_tablelim (SpectralBandReplication *sbr) |
Limiter Frequency Band Table (14496-3 sp04 p198) | |
static unsigned int | read_sbr_header (SpectralBandReplication *sbr, GetBitContext *gb) |
static int | array_min_int16 (const int16_t *array, int nel) |
static void | make_bands (int16_t *bands, int start, int stop, int num_bands) |
static int | check_n_master (AVCodecContext *avctx, int n_master, int bs_xover_band) |
static int | sbr_make_f_master (AACContext *ac, SpectralBandReplication *sbr, SpectrumParameters *spectrum) |
Master Frequency Band Table (14496-3 sp04 p194) | |
static int | sbr_hf_calc_npatches (AACContext *ac, SpectralBandReplication *sbr) |
High Frequency Generation - Patch Construction (14496-3 sp04 p216 fig. 4.46) | |
static int | sbr_make_f_derived (AACContext *ac, SpectralBandReplication *sbr) |
Derived Frequency Band Tables (14496-3 sp04 p197) | |
static av_always_inline void | get_bits1_vector (GetBitContext *gb, uint8_t *vec, int elements) |
static int | read_sbr_grid (AACContext *ac, SpectralBandReplication *sbr, GetBitContext *gb, SBRData *ch_data) |
static void | copy_sbr_grid (SBRData *dst, const SBRData *src) |
static void | read_sbr_dtdf (SpectralBandReplication *sbr, GetBitContext *gb, SBRData *ch_data) |
Read how the envelope and noise floor data is delta coded. | |
static void | read_sbr_invf (SpectralBandReplication *sbr, GetBitContext *gb, SBRData *ch_data) |
Read inverse filtering data. | |
static void | read_sbr_envelope (SpectralBandReplication *sbr, GetBitContext *gb, SBRData *ch_data, int ch) |
static void | read_sbr_noise (SpectralBandReplication *sbr, GetBitContext *gb, SBRData *ch_data, int ch) |
static void | read_sbr_extension (AACContext *ac, SpectralBandReplication *sbr, GetBitContext *gb, int bs_extension_id, int *num_bits_left) |
static int | read_sbr_single_channel_element (AACContext *ac, SpectralBandReplication *sbr, GetBitContext *gb) |
static int | read_sbr_channel_pair_element (AACContext *ac, SpectralBandReplication *sbr, GetBitContext *gb) |
static unsigned int | read_sbr_data (AACContext *ac, SpectralBandReplication *sbr, GetBitContext *gb, int id_aac) |
static void | sbr_reset (AACContext *ac, SpectralBandReplication *sbr) |
int | ff_decode_sbr_extension (AACContext *ac, SpectralBandReplication *sbr, GetBitContext *gb_host, int crc, int cnt, int id_aac) |
Decode Spectral Band Replication extension data; reference: table 4.55. | |
static void | sbr_dequant (SpectralBandReplication *sbr, int id_aac) |
Dequantization and stereo decoding (14496-3 sp04 p203) | |
static void | sbr_qmf_analysis (DSPContext *dsp, FFTContext *mdct, SBRDSPContext *sbrdsp, const float *in, float *x, float z[320], float W[2][32][32][2], int buf_idx) |
Analysis QMF Bank (14496-3 sp04 p206) | |
static void | sbr_qmf_synthesis (DSPContext *dsp, FFTContext *mdct, SBRDSPContext *sbrdsp, AVFloatDSPContext *fdsp, float *out, float X[2][38][64], float mdct_buf[2][64], float *v0, int *v_off, const unsigned int div) |
Synthesis QMF Bank (14496-3 sp04 p206) and Downsampled Synthesis QMF Bank (14496-3 sp04 p206) | |
static void | sbr_hf_inverse_filter (SBRDSPContext *dsp, float(*alpha0)[2], float(*alpha1)[2], const float X_low[32][40][2], int k0) |
High Frequency Generation (14496-3 sp04 p214+) and Inverse Filtering (14496-3 sp04 p214) Warning: This routine does not seem numerically stable. | |
static void | sbr_chirp (SpectralBandReplication *sbr, SBRData *ch_data) |
Chirp Factors (14496-3 sp04 p214) | |
static int | sbr_lf_gen (AACContext *ac, SpectralBandReplication *sbr, float X_low[32][40][2], const float W[2][32][32][2], int buf_idx) |
Generate the subband filtered lowband. | |
static int | sbr_hf_gen (AACContext *ac, SpectralBandReplication *sbr, float X_high[64][40][2], const float X_low[32][40][2], const float(*alpha0)[2], const float(*alpha1)[2], const float bw_array[5], const uint8_t *t_env, int bs_num_env) |
High Frequency Generator (14496-3 sp04 p215) | |
static int | sbr_x_gen (SpectralBandReplication *sbr, float X[2][38][64], const float Y0[38][64][2], const float Y1[38][64][2], const float X_low[32][40][2], int ch) |
Generate the subband filtered lowband. | |
static int | sbr_mapping (AACContext *ac, SpectralBandReplication *sbr, SBRData *ch_data, int e_a[2]) |
High Frequency Adjustment (14496-3 sp04 p217) and Mapping (14496-3 sp04 p217) | |
static void | sbr_env_estimate (float(*e_curr)[48], float X_high[64][40][2], SpectralBandReplication *sbr, SBRData *ch_data) |
Estimation of current envelope (14496-3 sp04 p218) | |
static void | sbr_gain_calc (AACContext *ac, SpectralBandReplication *sbr, SBRData *ch_data, const int e_a[2]) |
Calculation of levels of additional HF signal components (14496-3 sp04 p219) and Calculation of gain (14496-3 sp04 p219) | |
static void | sbr_hf_assemble (float Y1[38][64][2], const float X_high[64][40][2], SpectralBandReplication *sbr, SBRData *ch_data, const int e_a[2]) |
Assembling HF Signals (14496-3 sp04 p220) | |
void | ff_sbr_apply (AACContext *ac, SpectralBandReplication *sbr, int id_aac, float *L, float *R) |
Apply one SBR element to one AAC element. | |
Variables | |
static VLC | vlc_sbr [10] |
static const int8_t | vlc_sbr_lav [10] |
static const int8_t | ceil_log2 [] |
ceil(log2(index+1)) | |
#define ENVELOPE_ADJUSTMENT_OFFSET 2 |
Definition at line 43 of file aacsbr.c.
Referenced by sbr_env_estimate(), sbr_hf_assemble(), sbr_hf_gen(), and sbr_x_gen().
#define NOISE_FLOOR_OFFSET 6.0f |
Definition at line 44 of file aacsbr.c.
Referenced by sbr_dequant().
#define SBR_INIT_VLC_STATIC | ( | num, | |
size | |||
) |
Definition at line 80 of file aacsbr.c.
Referenced by ff_aac_sbr_init().
#define SBR_VLC_ROW | ( | name | ) | { name ## _codes, name ## _bits, sizeof(name ## _codes), sizeof(name ## _codes[0]) } |
Definition at line 86 of file aacsbr.c.
Referenced by ff_aac_sbr_init().
anonymous enum |
anonymous enum |
|
static |
Places SBR in pure upsampling mode.
Definition at line 132 of file aacsbr.c.
Referenced by ff_aac_sbr_ctx_init(), read_sbr_data(), sbr_mapping(), and sbr_reset().
av_cold void ff_aac_sbr_ctx_init | ( | AACContext * | ac, |
SpectralBandReplication * | sbr | ||
) |
av_cold void ff_aac_sbr_ctx_close | ( | SpectralBandReplication * | sbr | ) |
Close one SBR context.
Definition at line 159 of file aacsbr.c.
Referenced by aac_decode_close(), and che_configure().
Definition at line 165 of file aacsbr.c.
Referenced by sbr_make_f_master(), and sbr_make_f_tablelim().
|
inlinestatic |
Definition at line 170 of file aacsbr.c.
Referenced by sbr_make_f_tablelim().
|
static |
Limiter Frequency Band Table (14496-3 sp04 p198)
Definition at line 180 of file aacsbr.c.
Referenced by read_sbr_header(), and sbr_make_f_derived().
|
static |
Definition at line 227 of file aacsbr.c.
Referenced by ff_decode_sbr_extension().
|
static |
Definition at line 281 of file aacsbr.c.
Referenced by sbr_make_f_master().
|
static |
Definition at line 289 of file aacsbr.c.
Referenced by sbr_make_f_master().
|
static |
Definition at line 307 of file aacsbr.c.
Referenced by sbr_make_f_master().
|
static |
Master Frequency Band Table (14496-3 sp04 p194)
Definition at line 324 of file aacsbr.c.
Referenced by sbr_reset().
|
static |
High Frequency Generation - Patch Construction (14496-3 sp04 p216 fig. 4.46)
Definition at line 511 of file aacsbr.c.
Referenced by sbr_make_f_derived().
|
static |
Derived Frequency Band Tables (14496-3 sp04 p197)
Definition at line 562 of file aacsbr.c.
Referenced by sbr_reset().
|
static |
Definition at line 615 of file aacsbr.c.
Referenced by read_sbr_channel_pair_element(), read_sbr_dtdf(), read_sbr_grid(), and read_sbr_single_channel_element().
|
static |
Definition at line 629 of file aacsbr.c.
Referenced by read_sbr_channel_pair_element(), and read_sbr_single_channel_element().
Definition at line 771 of file aacsbr.c.
Referenced by read_sbr_channel_pair_element().
|
static |
Read how the envelope and noise floor data is delta coded.
Definition at line 789 of file aacsbr.c.
Referenced by read_sbr_channel_pair_element(), and read_sbr_single_channel_element().
|
static |
Read inverse filtering data.
Definition at line 797 of file aacsbr.c.
Referenced by read_sbr_channel_pair_element(), and read_sbr_single_channel_element().
|
static |
Definition at line 807 of file aacsbr.c.
Referenced by read_sbr_channel_pair_element(), and read_sbr_single_channel_element().
|
static |
Definition at line 876 of file aacsbr.c.
Referenced by read_sbr_channel_pair_element(), and read_sbr_single_channel_element().
|
static |
Definition at line 912 of file aacsbr.c.
Referenced by read_sbr_data().
|
static |
Definition at line 942 of file aacsbr.c.
Referenced by read_sbr_data().
|
static |
Definition at line 962 of file aacsbr.c.
Referenced by read_sbr_data().
|
static |
Definition at line 1004 of file aacsbr.c.
Referenced by ff_decode_sbr_extension().
|
static |
Definition at line 1045 of file aacsbr.c.
Referenced by ff_decode_sbr_extension().
int ff_decode_sbr_extension | ( | AACContext * | ac, |
SpectralBandReplication * | sbr, | ||
GetBitContext * | gb_host, | ||
int | crc, | ||
int | cnt, | ||
int | id_aac | ||
) |
Decode Spectral Band Replication extension data; reference: table 4.55.
Decode one SBR element.
crc | flag indicating the presence of CRC checksum |
cnt | length of TYPE_FIL syntactic element in bytes |
Definition at line 1066 of file aacsbr.c.
Referenced by decode_extension_payload().
|
static |
Dequantization and stereo decoding (14496-3 sp04 p203)
Definition at line 1112 of file aacsbr.c.
Referenced by ff_sbr_apply().
|
static |
Analysis QMF Bank (14496-3 sp04 p206)
x | pointer to the beginning of the first sample window |
W | array of complex-valued samples split into subbands |
Definition at line 1175 of file aacsbr.c.
Referenced by ff_sbr_apply().
|
static |
Synthesis QMF Bank (14496-3 sp04 p206) and Downsampled Synthesis QMF Bank (14496-3 sp04 p206)
Definition at line 1197 of file aacsbr.c.
Referenced by ff_sbr_apply().
|
static |
High Frequency Generation (14496-3 sp04 p214+) and Inverse Filtering (14496-3 sp04 p214) Warning: This routine does not seem numerically stable.
Definition at line 1247 of file aacsbr.c.
Referenced by ff_sbr_apply().
|
static |
Chirp Factors (14496-3 sp04 p214)
Definition at line 1302 of file aacsbr.c.
Referenced by ff_sbr_apply().
|
static |
Generate the subband filtered lowband.
Definition at line 1323 of file aacsbr.c.
Referenced by ff_sbr_apply().
|
static |
High Frequency Generator (14496-3 sp04 p215)
Definition at line 1348 of file aacsbr.c.
Referenced by ff_sbr_apply().
|
static |
Generate the subband filtered lowband.
Definition at line 1383 of file aacsbr.c.
Referenced by ff_sbr_apply().
|
static |
High Frequency Adjustment (14496-3 sp04 p217) and Mapping (14496-3 sp04 p217)
Definition at line 1422 of file aacsbr.c.
Referenced by ff_sbr_apply().
|
static |
Estimation of current envelope (14496-3 sp04 p218)
Definition at line 1477 of file aacsbr.c.
Referenced by ff_sbr_apply().
|
static |
Calculation of levels of additional HF signal components (14496-3 sp04 p219) and Calculation of gain (14496-3 sp04 p219)
Definition at line 1523 of file aacsbr.c.
Referenced by ff_sbr_apply().
|
static |
Assembling HF Signals (14496-3 sp04 p220)
Definition at line 1579 of file aacsbr.c.
Referenced by ff_sbr_apply().
void ff_sbr_apply | ( | AACContext * | ac, |
SpectralBandReplication * | sbr, | ||
int | id_aac, | ||
float * | L, | ||
float * | R | ||
) |
Apply one SBR element to one AAC element.
Definition at line 1667 of file aacsbr.c.
Referenced by spectral_to_sample().
|
static |
Definition at line 77 of file aacsbr.c.
Referenced by read_sbr_envelope(), and read_sbr_noise().
|
static |
ceil(log2(index+1))
Definition at line 625 of file aacsbr.c.
Referenced by read_sbr_grid().