36 #define FFT_FIXED_32 0
88 static inline float *
VMUL2(
float *dst,
const float *v,
unsigned idx,
92 *dst++ = v[idx & 15] *
s;
93 *dst++ = v[idx>>4 & 15] *
s;
99 static inline float *
VMUL4(
float *dst,
const float *v,
unsigned idx,
103 *dst++ = v[idx & 3] *
s;
104 *dst++ = v[idx>>2 & 3] *
s;
105 *dst++ = v[idx>>4 & 3] *
s;
106 *dst++ = v[idx>>6 & 3] *
s;
112 static inline float *
VMUL2S(
float *dst,
const float *v,
unsigned idx,
113 unsigned sign,
const float *scale)
117 s0.f =
s1.f = *scale;
118 s0.i ^= sign >> 1 << 31;
121 *dst++ = v[idx & 15] *
s0.f;
122 *dst++ = v[idx>>4 & 15] *
s1.f;
129 static inline float *
VMUL4S(
float *dst,
const float *v,
unsigned idx,
130 unsigned sign,
const float *scale)
132 unsigned nz = idx >> 12;
136 t.
i =
s.i ^ (sign & 1U<<31);
137 *dst++ = v[idx & 3] * t.
f;
139 sign <<= nz & 1; nz >>= 1;
140 t.
i =
s.i ^ (sign & 1U<<31);
141 *dst++ = v[idx>>2 & 3] * t.
f;
143 sign <<= nz & 1; nz >>= 1;
144 t.
i =
s.i ^ (sign & 1U<<31);
145 *dst++ = v[idx>>4 & 3] * t.
f;
148 t.
i =
s.i ^ (sign & 1U<<31);
149 *dst++ = v[idx>>6 & 3] * t.
f;
159 tmp.i = (
tmp.i + 0x00008000U) & 0xFFFF0000U;
167 tmp.i = (
tmp.i + 0x00007FFFU + (
tmp.i & 0x00010000U >> 16)) & 0xFFFF0000U;
175 pun.
i &= 0xFFFF0000U;
182 const float a = 0.953125;
183 const float alpha = 0.90625;
187 float r0 = ps->
r0, r1 = ps->
r1;
188 float cor0 = ps->
cor0, cor1 = ps->
cor1;
189 float var0 = ps->
var0, var1 = ps->
var1;
221 float *dest = target->
coeffs;
223 int g,
i, group, k, idx = 0;
226 "Dependent coupling is not supported together with LTP\n");
233 for (group = 0; group < ics->
group_len[
g]; group++) {
236 dest[group * 128 + k] += gain *
src[group * 128 + k];
257 float *dest = target->
ret;
265 #define LOAS_SYNC_WORD 0x2b7
292 int sync_extension = 0;
293 int bits_consumed, esize,
i;
300 }
else if (asclen == 0) {
310 &gbc, config_start_bit,
313 if (bits_consumed < config_start_bit)
315 bits_consumed -= config_start_bit;
318 asclen = bits_consumed;
331 esize = (asclen + 7) / 8;
342 for (
i = 0;
i < esize;
i++) {
355 int ret, audio_mux_version =
get_bits(gb, 1);
358 if (audio_mux_version)
363 if (audio_mux_version)
383 if (!audio_mux_version) {
412 if (audio_mux_version) {
436 if (
ctx->frame_length_type == 0) {
437 int mux_slot_length = 0;
442 mux_slot_length +=
tmp;
443 }
while (
tmp == 255);
444 return mux_slot_length;
445 }
else if (
ctx->frame_length_type == 1) {
446 return ctx->frame_length;
447 }
else if (
ctx->frame_length_type == 3 ||
448 ctx->frame_length_type == 5 ||
449 ctx->frame_length_type == 7) {
465 "no decoder config found\n");
470 if (mux_slot_length_bytes < 0 || mux_slot_length_bytes * 8LL >
get_bits_left(gb)) {
473 }
else if (mux_slot_length_bytes * 8 + 256 <
get_bits_left(gb)) {
475 "frame length mismatch %d << %d\n",
485 int *got_frame_ptr,
AVPacket *avpkt)
500 if (muxlength > avpkt->
size)
504 return (err < 0) ? err : avpkt->
size;
524 "ADTS header detected, probably as result of configuration "
@ ZERO_BT
Scalefactors and spectral data are all zero.
Reference: libavcodec/aacdec.c.
static int aac_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
static int aac_decode_er_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, GetBitContext *gb)
static int decode_audio_specific_config_gb(AACContext *ac, AVCodecContext *avctx, MPEG4AudioConfig *m4ac, GetBitContext *gb, int get_bit_alignment, int sync_extension)
Decode audio specific configuration; reference: table 1.13.
static int aac_decode_frame_int(AVCodecContext *avctx, void *data, int *got_frame_ptr, GetBitContext *gb, const AVPacket *avpkt)
static av_cold int aac_decode_close(AVCodecContext *avctx)
static av_cold int aac_decode_init(AVCodecContext *avctx)
static int decode_audio_specific_config(AACContext *ac, AVCodecContext *avctx, MPEG4AudioConfig *m4ac, const uint8_t *data, int64_t bit_size, int sync_extension)
static int push_output_configuration(AACContext *ac)
Save current output configuration if and only if it has been locked.
static void pop_output_configuration(AACContext *ac)
Restore the previous output configuration if and only if the current configuration is unlocked.
static const AVClass aac_decoder_class
static void flush(AVCodecContext *avctx)
static const uint64_t aac_channel_layout[16]
AAC Spectral Band Replication function declarations.
static enum AVSampleFormat sample_fmts[]
Libavcodec external API header.
static av_cold int init(AVCodecContext *avctx)
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
bitstream reader API header.
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
static int get_bits_left(GetBitContext *gb)
static void skip_bits_long(GetBitContext *s, int n)
Skips the specified number of bits.
static void skip_bits(GetBitContext *s, int n)
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
static int get_bits_count(const GetBitContext *s)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static unsigned int show_bits(GetBitContext *s, int n)
Show 1-25 bits.
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define AV_CODEC_CAP_CHANNEL_CONF
Codec should fill in channel configuration and samplerate instead of container.
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding.
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_LOG_INFO
Standard information.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define DECLARE_ALIGNED(n, t, v)
Declare a variable that is aligned in memory.
AVSampleFormat
Audio sample formats.
@ AV_SAMPLE_FMT_FLTP
float, planar
static const int offsets[]
static const int16_t alpha[]
static int read_audio_mux_element(struct LATMContext *latmctx, GetBitContext *gb)
static av_always_inline void reset_predict_state(PredictorState *ps)
static av_cold int latm_decode_init(AVCodecContext *avctx)
static av_always_inline float flt16_even(float pf)
static float * VMUL4S(float *dst, const float *v, unsigned idx, unsigned sign, const float *scale)
static uint32_t latm_get_value(GetBitContext *b)
#define LOAS_SYNC_WORD
11 bits LOAS sync word
static void apply_dependent_coupling(AACContext *ac, SingleChannelElement *target, ChannelElement *cce, int index)
Apply dependent channel coupling (applied before IMDCT).
static float * VMUL4(float *dst, const float *v, unsigned idx, const float *scale)
static INTFLOAT aac_kbd_short_120[120]
static av_always_inline void predict(PredictorState *ps, float *coef, int output_enable)
static int read_payload_length_info(struct LATMContext *ctx, GetBitContext *gb)
static void apply_independent_coupling(AACContext *ac, SingleChannelElement *target, ChannelElement *cce, int index)
Apply independent channel coupling (applied after IMDCT).
static int read_stream_mux_config(struct LATMContext *latmctx, GetBitContext *gb)
static int latm_decode_audio_specific_config(struct LATMContext *latmctx, GetBitContext *gb, int asclen)
static INTFLOAT aac_kbd_long_960[960]
static INTFLOAT sine_960[960]
AVCodec ff_aac_latm_decoder
static av_always_inline float flt16_round(float pf)
static INTFLOAT sine_120[120]
static float * VMUL2(float *dst, const float *v, unsigned idx, const float *scale)
static float * VMUL2S(float *dst, const float *v, unsigned idx, unsigned sign, const float *scale)
static int latm_decode_frame(AVCodecContext *avctx, void *out, int *got_frame_ptr, AVPacket *avpkt)
static av_always_inline float flt16_trunc(float pf)
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
@ AOT_AAC_LTP
Y Long Term Prediction.
@ AOT_ER_AAC_LD
N Error Resilient Low Delay.
@ AOT_ER_AAC_ELD
N Error Resilient Enhanced Low Delay.
@ AOT_ER_AAC_LC
N Error Resilient Low Complexity.
@ AOT_ER_AAC_LTP
N Error Resilient Long Term Prediction.
const AVProfile ff_aac_profiles[]
Spectral Band Replication definitions and structures.
OutputConfiguration oc[2]
main external API structure.
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
const char * name
Name of the codec implementation.
void(* vector_fmac_scalar)(float *dst, const float *src, float mul, int len)
Multiply a vector of floats by a scalar float and add to destination vector.
This structure stores compressed data.
channel element - generic struct for SCE/CPE/CCE/LFE
SingleChannelElement ch[2]
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...
int audio_mux_version_A
LATM syntax version.
AACContext aac_ctx
containing AACContext
int frame_length_type
0/1 variable/fixed frame length
int initialized
initialized after a valid extradata was seen
int frame_length
frame length for fixed frame length
int sbr
-1 implicit, 1 presence
Single Channel Element - used for both SCE and LFE elements.
INTFLOAT * ret
PCM output.
enum BandType band_type[128]
band types
INTFLOAT coeffs[1024]
coefficients for IMDCT, maybe processed
IndividualChannelStream ics
#define avpriv_request_sample(...)