Go to the documentation of this file.
31 }
else if (
state->last_len !=
N) {
34 memcpy(last,
state->last,
sizeof(last));
37 for (
i = 0;
i <
N/2;
i++) {
38 int k = (int)(
i * ratio);
54 return state->last[0] << 12;
78 while ((i_max - i_min) > 1) {
79 i = i_min + ((i_max - i_min) / 2);
83 else if (
c > (j >> 8))
92 uint16_t
a, uint16_t
b)
106 ac->
high = UINT16_MAX;
111 const uint16_t *cdf, uint16_t cdf_len)
118 int rng =
high - low + 1;
119 int c = ((((int)(
val - low + 1)) << 14) - ((int)1));
121 const uint16_t *p = cdf - 1;
126 if ((p[1] * rng) >
c)
130 if ((p[2] * rng) >
c)
132 if ((p[1] * rng) >
c)
137 if ((p[1] * rng) <=
c)
140 for (
int i = 8;
i >= 1;
i >>= 1)
141 if ((p[
i] * rng) >
c)
145 if ((p[16] * rng) >
c)
147 if ((p[8] * rng) >
c)
149 if (p != (cdf - 1 + 24))
150 if ((p[4] * rng) >
c)
152 if ((p[2] * rng) >
c)
155 if (p != (cdf - 1 + 24 + 2))
156 if ((p[1] * rng) >
c)
164 sym = (int)((ptrdiff_t)(p - cdf)) + 1;
166 high = low + ((rng * cdf[sym - 1]) >> 14) - 1;
167 low += (rng * cdf[sym]) >> 14;
173 }
else if (low >= 32768) {
177 }
else if (low >= 16384 &&
high < 49152) {
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static double val(void *priv, double ch)
const uint32_t ff_aac_ac_hash_m[742]
#define FF_ARRAY_ELEMS(a)
void ff_aac_ac_finish(AACArithState *state, int offset, int N)
void ff_aac_ac_init(AACArith *ac, GetBitContext *gb)
static unsigned int get_bits1(GetBitContext *s)
uint16_t ff_aac_ac_decode(AACArith *ac, GetBitContext *gb, const uint16_t *cdf, uint16_t cdf_len)
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
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
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
uint32_t ff_aac_ac_get_context(AACArithState *state, uint32_t c, int i, int N)
uint32_t ff_aac_ac_get_pk(uint32_t c)
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
#define i(width, name, range_min, range_max)
void ff_aac_ac_update_context(AACArithState *state, int idx, uint16_t a, uint16_t b)
uint32_t ff_aac_ac_map_process(AACArithState *state, int reset, int N)
const uint8_t ff_aac_ac_lookup_m[742]