FFmpeg
aacdec_ac.h
Go to the documentation of this file.
1 /*
2  * AAC definitions and structures
3  * Copyright (c) 2024 Lynne
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #ifndef AVCODEC_AAC_AACDEC_AC_H
23 #define AVCODEC_AAC_AACDEC_AC_H
24 
25 #include "libavcodec/get_bits.h"
26 
27 typedef struct AACArithState {
28  uint8_t last[512 /* 2048 / 4 */ + 1];
29  int last_len;
30  uint8_t cur[4];
31  uint16_t state_pre;
33 
34 typedef struct AACArith {
35  uint16_t low;
36  uint16_t high;
37  uint16_t val;
38 } AACArith;
39 
40 #define FF_AAC_AC_ESCAPE 16
41 
42 uint32_t ff_aac_ac_map_process(AACArithState *state, int reset, int len);
43 uint32_t ff_aac_ac_get_context(AACArithState *state, uint32_t old_c, int idx, int len);
44 uint32_t ff_aac_ac_get_pk(uint32_t c);
45 
46 void ff_aac_ac_update_context(AACArithState *state, int idx, uint16_t a, uint16_t b);
48 
49 uint16_t ff_aac_ac_decode(AACArith *ac, GetBitContext *gb,
50  const uint16_t *cdf, uint16_t cdf_len);
51 
52 void ff_aac_ac_finish(AACArithState *state, int offset, int nb);
53 
54 #endif /* AVCODEC_AACDEC_AC_H */
ff_aac_ac_init
void ff_aac_ac_init(AACArith *ac, GetBitContext *gb)
Definition: aacdec_ac.c:106
ff_aac_ac_get_context
uint32_t ff_aac_ac_get_context(AACArithState *state, uint32_t old_c, int idx, int len)
Definition: aacdec_ac.c:57
b
#define b
Definition: input.c:41
AACArith
Definition: aacdec_ac.h:34
GetBitContext
Definition: get_bits.h:108
AACArithState::last_len
int last_len
Definition: aacdec_ac.h:29
get_bits.h
AACArithState::state_pre
uint16_t state_pre
Definition: aacdec_ac.h:31
c
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
Definition: undefined.txt:32
AACArithState::last
uint8_t last[512+1]
Definition: aacdec_ac.h:28
a
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
Definition: undefined.txt:41
offset
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
Definition: writing_filters.txt:86
ff_aac_ac_finish
void ff_aac_ac_finish(AACArithState *state, int offset, int nb)
Definition: aacdec_ac.c:199
AACArith::val
uint16_t val
Definition: aacdec_ac.h:37
ff_aac_ac_update_context
void ff_aac_ac_update_context(AACArithState *state, int idx, uint16_t a, uint16_t b)
Definition: aacdec_ac.c:91
state
static struct @456 state
ff_aac_ac_map_process
uint32_t ff_aac_ac_map_process(AACArithState *state, int reset, int len)
Definition: aacdec_ac.c:25
len
int len
Definition: vorbis_enc_data.h:426
ff_aac_ac_decode
uint16_t ff_aac_ac_decode(AACArith *ac, GetBitContext *gb, const uint16_t *cdf, uint16_t cdf_len)
Definition: aacdec_ac.c:113
AACArithState::cur
uint8_t cur[4]
Definition: aacdec_ac.h:30
AACArith::low
uint16_t low
Definition: aacdec_ac.h:35
AACArith::high
uint16_t high
Definition: aacdec_ac.h:36
ff_aac_ac_get_pk
uint32_t ff_aac_ac_get_pk(uint32_t c)
Definition: aacdec_ac.c:73
AACArithState
Definition: aacdec_ac.h:27