41 union {
unsigned u;
int s; } v = { previous_val * 1664525u + 1013904223 };
63 INTFLOAT *coef = sce->AAC_RENAME(coeffs);
67 const INTFLOAT *sf = sce->AAC_RENAME(sf);
68 const enum BandType *band_type = sce->band_type;
79 const unsigned cbt_m1 = band_type[idx] - 1;
85 for (group = 0; group < (
AAC_SIGNE)g_len; group++, cfo+=128) {
86 memset(cfo, 0, off_len *
sizeof(*cfo));
89 for (group = 0; group < (
AAC_SIGNE)g_len; group++, cfo+=128) {
92 for (k = 0; k < off_len; k++) {
93 ac->random_state =
lcg_random(ac->random_state);
94 cfo[k] = ac->random_state >> 3;
97 band_energy = ac->fdsp->scalarproduct_fixed(cfo, cfo, off_len);
103 for (k = 0; k < off_len; k++) {
104 ac->random_state =
lcg_random(ac->random_state);
105 cfo[k] = ac->random_state;
108 band_energy = ac->fdsp->scalarproduct_float(cfo, cfo, off_len);
110 ac->fdsp->vector_fmul_scalar(cfo, cfo,
scale, off_len);
120 switch (cbt_m1 >> 1) {
122 for (group = 0; group < (
AAC_SIGNE)g_len; group++, cfo+=128) {
136 cf =
VMUL4(cf, vq, cb_idx, sf + idx);
143 for (group = 0; group < (
AAC_SIGNE)g_len; group++, cfo+=128) {
156 nnz = cb_idx >> 8 & 15;
169 for (group = 0; group < (
AAC_SIGNE)g_len; group++, cfo+=128) {
183 cf =
VMUL2(cf, vq, cb_idx, sf + idx);
191 for (group = 0; group < (
AAC_SIGNE)g_len; group++, cfo+=128) {
204 nnz = cb_idx >> 8 & 15;
205 sign = nnz ?
SHOW_UBITS(re, gb, nnz) << (cb_idx >> 12) : 0;
210 cf =
VMUL2S(cf, vq, cb_idx, sign, sf + idx);
217 for (group = 0; group < (
AAC_SIGNE)g_len; group++, cfo+=128) {
223 uint32_t *icf = (uint32_t *) cf;
238 if (cb_idx == 0x0000) {
249 for (j = 0; j < 2; j++) {
284 unsigned v = ((
const uint32_t*)vq)[cb_idx & 15];
285 *icf++ = (
bits & 1U<<31) | v;
293 ac->fdsp->vector_fmul_scalar(cfo, cfo, sf[idx], off_len);
306 for (
i = 0;
i < pulse->num_pulse;
i++) {
307 INTFLOAT co = coef_base[ pulse->pos[
i] ];
308 while (
offsets[idx + 1] <= pulse->pos[
i])
310 if (band_type[idx] !=
NOISE_BT && sf[idx]) {
314 ico = co + (co > 0 ? -ico : ico);
316 coef_base[ pulse->pos[
i] ] = ico;
322 coef_base[ pulse->pos[
i] ] =
cbrtf(
fabsf(ico)) * ico * sf[idx];
334 const unsigned cbt_m1 = band_type[idx] - 1;
340 for (group = 0; group < (int)g_len; group++, cfo+=128) {
391 for (
c = 0;
c < num_gain;
c++) {
401 if ((
abs(gain_cache)-1024) >> 3 > 30)
406 coup->gain[
c][0] = gain_cache;
409 for (sfb = 0; sfb < sce->
ics.
max_sfb; sfb++, idx++) {
422 if ((
abs(gain_cache)-1024) >> 3 > 30)
427 coup->gain[
c][idx] = gain_cache;
438#define SET(member) aac_proc->member = AAC_RENAME(member)
442#define SET(member) aac_proc->member = AV_JOIN(ff_aac_, AAC_RENAME(member));
443 SET(sbr_ctx_alloc_init);
444 SET(sbr_decode_extension);
@ ZERO_BT
Scalefactors and spectral data are all zero.
@ INTENSITY_BT2
Scalefactor data are intensity stereo positions (out of phase).
@ NOISE_BT
Spectral data are scaled white noise not coded in the bitstream.
static void subband_scale(int *dst, int *src, int scale, int offset, int len, void *log_context)
static int * DEC_UPAIR(int *dst, unsigned idx, unsigned sign)
static int * DEC_SPAIR(int *dst, unsigned idx)
static int * DEC_SQUAD(int *dst, unsigned idx)
static void vector_pow43(int *coefs, int len)
static void noise_scale(int *coefs, int scale, int band_energy, int len)
static int * DEC_UQUAD(int *dst, unsigned idx, unsigned sign)
static float * VMUL4S(float *dst, const float *v, unsigned idx, unsigned sign, const float *scale)
static float * VMUL2S(float *dst, const float *v, unsigned idx, unsigned sign, const float *scale)
static float * VMUL2(float *dst, const float *v, unsigned idx, const float *scale)
Dequantization-related.
static float * VMUL4(float *dst, const float *v, unsigned idx, const float *scale)
static const float cce_scale[]
static int AAC_RENAME decode_cce(AACDecContext *ac, GetBitContext *gb, ChannelElement *che)
Decode coupling_channel_element; reference: table 4.8.
static av_cold void AAC_RENAME aac_proc_init(AACDecProc *aac_proc)
static int AAC_RENAME decode_spectrum_and_dequant(AACDecContext *ac, GetBitContext *gb, const Pulse *pulse, SingleChannelElement *sce)
Decode spectral data; reference: table 4.50.
static av_always_inline int lcg_random(unsigned previous_val)
linear congruential pseudorandom number generator
const VLCElem * ff_vlc_spectral[11]
VLCElem ff_vlc_scalefactors[352]
const float *const ff_aac_codebook_vector_vals[]
const uint32_t ff_cbrt_tab[LUT_SIZE]
#define i(width, name, range_min, range_max)
static __device__ float sqrtf(float a)
static __device__ float fabsf(float a)
static const uint8_t bits[8]
static av_always_inline int fixed_sqrt(int x, int bits)
Calculate the square root.
#define GET_VLC(code, name, gb, table, bits, max_depth)
If the vlc code is invalid and max_depth=1, then no bits will be removed.
#define GET_CACHE(name, gb)
static av_always_inline int get_vlc2(GetBitContext *s, const VLCElem *table, int bits, int max_depth)
Parse a vlc code.
#define CLOSE_READER(name, gb)
#define SHOW_UBITS(name, gb, num)
static unsigned int get_bits1(GetBitContext *s)
#define OPEN_READER(name, gb)
#define SKIP_BITS(name, gb, num)
#define UPDATE_CACHE(name, gb)
#define LAST_SKIP_BITS(name, gb, num)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static const int offsets[]
static void scale(int *out, const int *in, const int w, const int h, const int shift)
int ff_aac_decode_ics(AACDecContext *ac, SingleChannelElement *sce, GetBitContext *gb, int common_window, int scale_flag)
Decode an individual_channel_stream payload; reference: table 4.44.
#define u(width, name, range_min, range_max)
static av_always_inline float cbrtf(float x)
main AAC decoding context
Decode-specific primitives.
int id_select[8]
element id
enum CouplingPoint coupling_point
The point during decoding at which coupling is applied.
int num_coupled
number of target elements
int ch_select[8]
[0] shared list of gains; [1] list of gains for right channel; [2] list of gains for left channel; [3...
enum RawDataBlockType type[8]
Type of channel element to be coupled - SCE or CPE.
channel element - generic struct for SCE/CPE/CCE/LFE
Individual Channel Stream.
uint8_t max_sfb
number of scalefactor bands per group
const uint16_t * swb_offset
table of offsets to the lowest spectral coefficient of a scalefactor band, sfb, for a particular wind...
Single Channel Element - used for both SCE and LFE elements.
enum BandType band_type[128]
band types
IndividualChannelStream ics