Go to the documentation of this file.
62 #define TX_TYPE AV_TX_INT32_MDCT
96 Q30(0.570829),
Q30(0.696616),
Q30(0.813004),
Q30(0.911304),
97 Q30(0.984900),
Q30(1.067894),
Q30(1.194601),
Q30(1.369533),
107 Q31(0.00000000),
Q31(-0.43388373),
Q31(0.64278758),
Q31(0.34202015),
111 Q31(0.00000000),
Q31(-0.43388373),
Q31(-0.78183150),
Q31(-0.97492790),
112 Q31(0.98480773),
Q31( 0.86602539),
Q31( 0.64278758),
Q31( 0.34202015),
116 Q31(0.00000000),
Q31(-0.20791170),
Q31(-0.40673664),
Q31(-0.58778524),
117 Q31(0.67369562),
Q31( 0.52643216),
Q31( 0.36124167),
Q31( 0.18374951),
121 Q31( 0.00000000),
Q31(-0.20791170),
Q31(-0.40673664),
Q31(-0.58778524),
122 Q31(-0.74314481),
Q31(-0.86602539),
Q31(-0.95105654),
Q31(-0.99452192),
123 Q31( 0.99573416),
Q31( 0.96182561),
Q31( 0.89516330),
Q31( 0.79801720),
124 Q31( 0.67369562),
Q31( 0.52643216),
Q31( 0.36124167),
Q31( 0.18374951),
145 ps->
var0.mant = 0x20000000;
147 ps->
var1.mant = 0x20000000;
151 static const int exp2tab[4] = {
Q31(1.0000000000/2),
Q31(1.1892071150/2),
Q31(1.4142135624/2),
Q31(1.6817928305/2) };
155 dst[0] = (idx & 15) - 4;
156 dst[1] = (idx >> 4 & 15) - 4;
163 dst[0] = (idx & 3) - 1;
164 dst[1] = (idx >> 2 & 3) - 1;
165 dst[2] = (idx >> 4 & 3) - 1;
166 dst[3] = (idx >> 6 & 3) - 1;
171 static inline int *
DEC_UPAIR(
int *dst,
unsigned idx,
unsigned sign)
173 dst[0] = (idx & 15) * (1 - (sign & 0xFFFFFFFE));
174 dst[1] = (idx >> 4 & 15) * (1 - ((sign & 1) * 2));
179 static inline int *
DEC_UQUAD(
int *dst,
unsigned idx,
unsigned sign)
181 unsigned nz = idx >> 12;
183 dst[0] = (idx & 3) * (1 + (((
int)sign >> 31) * 2));
186 dst[1] = (idx >> 2 & 3) * (1 + (((
int)sign >> 31) * 2));
189 dst[2] = (idx >> 4 & 3) * (1 + (((
int)sign >> 31) * 2));
192 dst[3] = (idx >> 6 & 3) * (1 + (((
int)sign >> 31) * 2));
213 int ssign =
scale < 0 ? -1 : 1;
230 }
else if (
s > -32) {
235 dst[
i] =
out * (unsigned)ssign;
250 while (band_energy > 0x7fff) {
255 s = 21 + nlz - (
s >> 2);
291 tmp.mant = (
tmp.mant + 0x00200000
U) & 0xFFC00000U;
305 tmp.mant = (
tmp.mant + 0x001FFFFF
U + (
tmp.mant & 0x00400000
U >> 16)) & 0xFFC00000
U;
338 if (var0.
exp > 1 || (var0.
exp == 1 && var0.
mant > 0x20000000)) {
346 if (var1.exp > 1 || (var1.exp == 1 && var1.mant > 0x20000000)) {
361 *coef += (unsigned)((
pv.mant + (1 << (
shift - 1))) >>
shift);
363 *coef += (unsigned)
pv.mant << -
shift;
406 int *dest = target->
coeffs;
408 int g,
i, group, k, idx = 0;
411 "Dependent coupling is not supported together with LTP\n");
422 shift = (-gain-1024) >> 3;
426 shift = (gain-1024) >> 3;
431 }
else if (
shift < 0) {
435 for (group = 0; group < ics->
group_len[
g]; group++) {
444 for (group = 0; group < ics->
group_len[
g]; group++) {
448 dest[group * 128 + k] +=
tmp * (1
U <<
shift);
471 unsigned int *dest = target->
ret;
475 shift = (gain-1024) >> 3;
478 }
else if (
shift < 0) {
482 for (
i = 0;
i <
len;
i++) {
488 for (
i = 0;
i <
len;
i++) {
498 .
p.
name =
"aac_fixed",
static void vector_pow43(int *coefs, int len)
static av_always_inline SoftFloat flt16_even(SoftFloat pf)
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
static av_cold int aac_decode_init(AVCodecContext *avctx)
static INTFLOAT aac_kbd_short_120[120]
static av_const SoftFloat av_sub_sf(SoftFloat a, SoftFloat b)
@ AV_SAMPLE_FMT_S32P
signed 32 bits, planar
static const int tns_tmp2_map_0_3[8]
const AVProfile ff_aac_profiles[]
static int * DEC_SQUAD(int *dst, unsigned idx)
INTFLOAT * ret
PCM output.
SingleChannelElement ch[2]
static void apply_independent_coupling_fixed(AACDecContext *ac, SingleChannelElement *target, ChannelElement *cce, int index)
Apply independent channel coupling (applied after IMDCT).
AVCodec p
The public AVCodec.
static av_const SoftFloat av_div_sf(SoftFloat a, SoftFloat b)
b has to be normalized and not zero.
static const int *const tns_tmp2_map_fixed[4]
IndividualChannelStream ics
static int aac_decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
@ ZERO_BT
Scalefactors and spectral data are all zero.
uint32_t ff_cbrt_tab_fixed[1<< 13]
#define FF_CODEC_DECODE_CB(func)
static const AVClass aac_decoder_class
INTFLOAT coeffs[1024]
coefficients for IMDCT, maybe processed
static const int offsets[]
#define av_assert0(cond)
assert() equivalent, that is always enabled.
static av_always_inline void predict(PredictorState *ps, int *coef, int output_enable)
const AVChannelLayout ff_aac_ch_layout[]
Individual Channel Stream.
#define CODEC_LONG_NAME(str)
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
static void apply_dependent_coupling_fixed(AACDecContext *ac, SingleChannelElement *target, ChannelElement *cce, int index)
Apply dependent channel coupling (applied before IMDCT).
static av_cold int aac_decode_close(AVCodecContext *avctx)
void(* flush)(AVBSFContext *ctx)
static const int tns_tmp2_map_1_4[8]
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
#define AV_CODEC_CAP_CHANNEL_CONF
Codec should fill in channel configuration and samplerate instead of container.
static const int tns_tmp2_map_0_4[16]
int(* init)(AVBSFContext *ctx)
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
static void scale(int *out, const int *in, const int w, const int h, const int shift)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static av_always_inline void reset_predict_state(PredictorState *ps)
static const int tns_tmp2_map_1_3[4]
#define DECLARE_ALIGNED(n, t, v)
static int shift(int a, int b)
static void noise_scale(int *coefs, int scale, int band_energy, int len)
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
static const int ltp_coef_fixed[8]
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
enum BandType band_type[128]
band types
static INTFLOAT aac_kbd_long_960[960]
static const int cce_scale_fixed[8]
Single Channel Element - used for both SCE and LFE elements.
#define i(width, name, range_min, range_max)
static av_always_inline av_const double round(double x)
channel element - generic struct for SCE/CPE/CCE/LFE
const uint16_t * swb_offset
table of offsets to the lowest spectral coefficient of a scalefactor band, sfb, for a particular wind...
AVSampleFormat
Audio sample formats.
static av_const SoftFloat av_int2sf(int v, int frac_bits)
Converts a mantisse and exponent to a SoftFloat.
const char * name
Name of the codec implementation.
OutputConfiguration oc[2]
const FFCodec ff_aac_fixed_decoder
static void subband_scale(int *dst, int *src, int scale, int offset, int len, void *log_context)
static const int exp2tab[4]
main AAC decoding context
struct AVCodecContext * avctx
static av_const SoftFloat av_add_sf(SoftFloat a, SoftFloat b)
int sbr
-1 implicit, 1 presence
static int * DEC_UQUAD(int *dst, unsigned idx, unsigned sign)
static const int16_t alpha[]
uint8_t max_sfb
number of scalefactor bands per group
static av_always_inline SoftFloat flt16_round(SoftFloat pf)
static int * DEC_UPAIR(int *dst, unsigned idx, unsigned sign)
static int * DEC_SPAIR(int *dst, unsigned idx)
static av_const SoftFloat av_mul_sf(SoftFloat a, SoftFloat b)
static av_always_inline SoftFloat flt16_trunc(SoftFloat pf)
@ AOT_AAC_LTP
Y Long Term Prediction.