Go to the documentation of this file.
36 #define TX_TYPE AV_TX_FLOAT_MDCT
86 static inline float *
VMUL2(
float *dst,
const float *v,
unsigned idx,
90 *dst++ = v[idx & 15] *
s;
91 *dst++ = v[idx>>4 & 15] *
s;
97 static inline float *
VMUL4(
float *dst,
const float *v,
unsigned idx,
101 *dst++ = v[idx & 3] *
s;
102 *dst++ = v[idx>>2 & 3] *
s;
103 *dst++ = v[idx>>4 & 3] *
s;
104 *dst++ = v[idx>>6 & 3] *
s;
110 static inline float *
VMUL2S(
float *dst,
const float *v,
unsigned idx,
111 unsigned sign,
const float *
scale)
116 s0.i ^= sign >> 1 << 31;
119 *dst++ = v[idx & 15] *
s0.f;
120 *dst++ = v[idx>>4 & 15] *
s1.f;
127 static inline float *
VMUL4S(
float *dst,
const float *v,
unsigned idx,
128 unsigned sign,
const float *
scale)
130 unsigned nz = idx >> 12;
134 t.
i =
s.i ^ (sign & 1
U<<31);
135 *dst++ = v[idx & 3] * t.
f;
137 sign <<= nz & 1; nz >>= 1;
138 t.
i =
s.i ^ (sign & 1
U<<31);
139 *dst++ = v[idx>>2 & 3] * t.
f;
141 sign <<= nz & 1; nz >>= 1;
142 t.
i =
s.i ^ (sign & 1
U<<31);
143 *dst++ = v[idx>>4 & 3] * t.
f;
146 t.
i =
s.i ^ (sign & 1
U<<31);
147 *dst++ = v[idx>>6 & 3] * t.
f;
157 tmp.i = (
tmp.i + 0x00008000
U) & 0xFFFF0000U;
165 tmp.i = (
tmp.i + 0x00007FFF
U + (
tmp.i & 0x00010000
U >> 16)) & 0xFFFF0000
U;
173 pun.
i &= 0xFFFF0000
U;
180 const float a = 0.953125;
181 const float alpha = 0.90625;
185 float r0 = ps->
r0, r1 = ps->
r1;
186 float cor0 = ps->
cor0, cor1 = ps->
cor1;
187 float var0 = ps->
var0, var1 = ps->
var1;
219 float *dest = target->
coeffs;
221 int g,
i, group, k, idx = 0;
224 "Dependent coupling is not supported together with LTP\n");
231 for (group = 0; group < ics->
group_len[
g]; group++) {
234 dest[group * 128 + k] += gain *
src[group * 128 + k];
255 float *dest = target->
ret;
263 #define LOAS_SYNC_WORD 0x2b7
290 int sync_extension = 0;
291 int bits_consumed, esize,
i;
298 }
else if (asclen == 0) {
308 &gbc, config_start_bit,
311 if (bits_consumed < config_start_bit)
313 bits_consumed -= config_start_bit;
316 asclen = bits_consumed;
329 esize = (asclen + 7) / 8;
340 for (
i = 0;
i < esize;
i++) {
356 if (audio_mux_version)
361 if (audio_mux_version)
381 if (!audio_mux_version) {
410 if (audio_mux_version) {
434 if (
ctx->frame_length_type == 0) {
435 int mux_slot_length = 0;
440 mux_slot_length +=
tmp;
441 }
while (
tmp == 255);
442 return mux_slot_length;
443 }
else if (
ctx->frame_length_type == 1) {
444 return ctx->frame_length;
445 }
else if (
ctx->frame_length_type == 3 ||
446 ctx->frame_length_type == 5 ||
447 ctx->frame_length_type == 7) {
457 uint8_t use_same_mux =
get_bits(gb, 1);
463 "no decoder config found\n");
468 if (mux_slot_length_bytes < 0 || mux_slot_length_bytes * 8LL >
get_bits_left(gb)) {
471 }
else if (mux_slot_length_bytes * 8 + 256 <
get_bits_left(gb)) {
473 "frame length mismatch %d << %d\n",
483 int *got_frame_ptr,
AVPacket *avpkt)
498 if (muxlength > avpkt->
size)
502 return (err < 0) ? err : avpkt->
size;
522 "ADTS header detected, probably as result of configuration "
580 .
p.
name =
"aac_latm",
@ AV_SAMPLE_FMT_FLTP
float, planar
static void skip_bits_long(GetBitContext *s, int n)
Skips the specified number of bits.
int frame_length_type
0/1 variable/fixed frame length
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
static int get_bits_left(GetBitContext *gb)
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
static int decode_audio_specific_config_gb(AACDecContext *ac, AVCodecContext *avctx, MPEG4AudioConfig *m4ac, GetBitContext *gb, int get_bit_alignment, int sync_extension)
Decode audio specific configuration; reference: table 1.13.
static av_cold int aac_decode_init(AVCodecContext *avctx)
static INTFLOAT aac_kbd_short_120[120]
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
static int get_bits_count(const GetBitContext *s)
This structure describes decoded (raw) audio or video data.
@ AOT_ER_AAC_LTP
N Error Resilient Long Term Prediction.
const AVProfile ff_aac_profiles[]
static int decode_audio_specific_config(AACDecContext *ac, AVCodecContext *avctx, MPEG4AudioConfig *m4ac, const uint8_t *data, int64_t bit_size, int sync_extension)
static void apply_independent_coupling(AACDecContext *ac, SingleChannelElement *target, ChannelElement *cce, int index)
Apply independent channel coupling (applied after IMDCT).
const FFCodec ff_aac_decoder
INTFLOAT * ret
PCM output.
static int latm_decode_audio_specific_config(struct LATMContext *latmctx, GetBitContext *gb, int asclen)
SingleChannelElement ch[2]
static int push_output_configuration(AACDecContext *ac)
Save current output configuration if and only if it has been locked.
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
static void skip_bits(GetBitContext *s, int n)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
AVCodec p
The public AVCodec.
static av_cold int latm_decode_init(AVCodecContext *avctx)
static int read_audio_mux_element(struct LATMContext *latmctx, GetBitContext *gb)
static float * VMUL2(float *dst, const float *v, unsigned idx, const float *scale)
IndividualChannelStream ics
static int aac_decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)
@ AOT_ER_AAC_LC
N Error Resilient Low Complexity.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
@ ZERO_BT
Scalefactors and spectral data are all zero.
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
@ AOT_ER_AAC_LD
N Error Resilient Low Delay.
#define FF_CODEC_DECODE_CB(func)
static const AVClass aac_decoder_class
INTFLOAT coeffs[1024]
coefficients for IMDCT, maybe processed
static av_always_inline void reset_predict_state(PredictorState *ps)
static const int offsets[]
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
int frame_length
frame length for fixed frame length
const AVChannelLayout ff_aac_ch_layout[]
Individual Channel Stream.
#define CODEC_LONG_NAME(str)
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
static av_cold int aac_decode_close(AVCodecContext *avctx)
void(* flush)(AVBSFContext *ctx)
static av_always_inline float flt16_trunc(float pf)
static av_always_inline float flt16_even(float pf)
int initialized
initialized after a valid extradata was seen
static av_always_inline float flt16_round(float pf)
static void pop_output_configuration(AACDecContext *ac)
Restore the previous output configuration if and only if the current configuration is unlocked.
static float * VMUL2S(float *dst, const float *v, unsigned idx, unsigned sign, const float *scale)
#define AV_CODEC_CAP_CHANNEL_CONF
Codec should fill in channel configuration and samplerate instead of container.
static float * VMUL4(float *dst, const float *v, unsigned idx, const float *scale)
static float * VMUL4S(float *dst, const float *v, unsigned idx, unsigned sign, const float *scale)
int(* init)(AVBSFContext *ctx)
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
#define DECLARE_ALIGNED(n, t, v)
static INTFLOAT sine_120[120]
static INTFLOAT sine_960[960]
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
enum BandType band_type[128]
band types
#define AV_LOG_INFO
Standard information.
static INTFLOAT aac_kbd_long_960[960]
Single Channel Element - used for both SCE and LFE elements.
#define i(width, name, range_min, range_max)
static int aac_decode_er_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, GetBitContext *gb)
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.
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
static unsigned int show_bits(GetBitContext *s, int n)
Show 1-25 bits.
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...
@ AOT_ER_AAC_ELD
N Error Resilient Enhanced Low Delay.
static av_always_inline void predict(PredictorState *ps, float *coef, int output_enable)
AVSampleFormat
Audio sample formats.
const char * name
Name of the codec implementation.
static int latm_decode_frame(AVCodecContext *avctx, AVFrame *out, int *got_frame_ptr, AVPacket *avpkt)
OutputConfiguration oc[2]
static void apply_dependent_coupling(AACDecContext *ac, SingleChannelElement *target, ChannelElement *cce, int index)
Apply dependent channel coupling (applied before IMDCT).
#define AV_INPUT_BUFFER_PADDING_SIZE
int audio_mux_version_A
LATM syntax version.
main AAC decoding context
main external API structure.
struct AVCodecContext * avctx
const FFCodec ff_aac_latm_decoder
int sbr
-1 implicit, 1 presence
static int read_stream_mux_config(struct LATMContext *latmctx, GetBitContext *gb)
#define avpriv_request_sample(...)
#define LOAS_SYNC_WORD
11 bits LOAS sync word
static void scale(int *out, const int *in, const int w, const int h, const int shift)
static const int16_t alpha[]
This structure stores compressed data.
static uint32_t latm_get_value(GetBitContext *b)
uint8_t max_sfb
number of scalefactor bands per group
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static int read_payload_length_info(struct LATMContext *ctx, GetBitContext *gb)
static int aac_decode_frame_int(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, GetBitContext *gb, const AVPacket *avpkt)
@ AOT_AAC_LTP
Y Long Term Prediction.
AACDecContext aac_ctx
containing AACContext