Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
d70fa4c4
Commit
d70fa4c4
authored
Apr 26, 2011
by
Alex Converse
Committed by
Justin Ruggles
Apr 27, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Define POW_SF2_ZERO in aac.h and use for ff_aac_pow2sf_tabp[] offsets instead
of hardcoding 200 everywhere.
parent
e4744b59
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
8 deletions
+10
-8
aac.h
libavcodec/aac.h
+1
-0
aac_tablegen.h
libavcodec/aac_tablegen.h
+2
-1
aaccoder.c
libavcodec/aaccoder.c
+4
-4
aacdec.c
libavcodec/aacdec.c
+3
-3
No files found.
libavcodec/aac.h
View file @
d70fa4c4
...
...
@@ -130,6 +130,7 @@ typedef struct {
#define SCALE_MAX_POS 255 ///< scalefactor index maximum value
#define SCALE_MAX_DIFF 60 ///< maximum scalefactor difference allowed by standard
#define SCALE_DIFF_ZERO 60 ///< codebook index corresponding to zero scalefactor indices difference
#define POW_SF2_ZERO 200 ///< ff_aac_pow2sf_tab index corresponding to pow(2, 0);
/**
* Long Term Prediction
...
...
libavcodec/aac_tablegen.h
View file @
d70fa4c4
...
...
@@ -29,13 +29,14 @@
#include "libavcodec/aac_tables.h"
#else
#include "libavutil/mathematics.h"
#include "libavcodec/aac.h"
float
ff_aac_pow2sf_tab
[
428
];
void
ff_aac_tableinit
(
void
)
{
int
i
;
for
(
i
=
0
;
i
<
428
;
i
++
)
ff_aac_pow2sf_tab
[
i
]
=
pow
(
2
,
(
i
-
200
)
/
4
.);
ff_aac_pow2sf_tab
[
i
]
=
pow
(
2
,
(
i
-
POW_SF2_ZERO
)
/
4
.);
}
#endif
/* CONFIG_HARDCODED_TABLES */
...
...
libavcodec/aaccoder.c
View file @
d70fa4c4
...
...
@@ -108,8 +108,8 @@ static av_always_inline float quantize_and_encode_band_cost_template(
int
*
bits
,
int
BT_ZERO
,
int
BT_UNSIGNED
,
int
BT_PAIR
,
int
BT_ESC
)
{
const
float
IQ
=
ff_aac_pow2sf_tab
[
200
+
scale_idx
-
SCALE_ONE_POS
+
SCALE_DIV_512
];
const
float
Q
=
ff_aac_pow2sf_tab
[
200
-
scale_idx
+
SCALE_ONE_POS
-
SCALE_DIV_512
];
const
float
IQ
=
ff_aac_pow2sf_tab
[
POW_SF2_ZERO
+
scale_idx
-
SCALE_ONE_POS
+
SCALE_DIV_512
];
const
float
Q
=
ff_aac_pow2sf_tab
[
POW_SF2_ZERO
-
scale_idx
+
SCALE_ONE_POS
-
SCALE_DIV_512
];
const
float
CLIPPED_ESCAPE
=
165140
.
0
f
*
IQ
;
int
i
,
j
;
float
cost
=
0
;
...
...
@@ -280,7 +280,7 @@ static float find_max_val(int group_len, int swb_size, const float *scaled) {
}
static
int
find_min_book
(
float
maxval
,
int
sf
)
{
float
Q
=
ff_aac_pow2sf_tab
[
200
-
sf
+
SCALE_ONE_POS
-
SCALE_DIV_512
];
float
Q
=
ff_aac_pow2sf_tab
[
POW_SF2_ZERO
-
sf
+
SCALE_ONE_POS
-
SCALE_DIV_512
];
float
Q34
=
sqrtf
(
Q
*
sqrtf
(
Q
));
int
qmaxval
,
cb
;
qmaxval
=
maxval
*
Q34
+
0
.
4054
f
;
...
...
@@ -955,7 +955,7 @@ static void search_for_quantizers_faac(AVCodecContext *avctx, AACEncContext *s,
dist
-=
b
;
}
dist
*=
1
.
0
f
/
512
.
0
f
/
lambda
;
quant_max
=
quant
(
maxq
[
w
*
16
+
g
],
ff_aac_pow2sf_tab
[
200
-
scf
+
SCALE_ONE_POS
-
SCALE_DIV_512
]);
quant_max
=
quant
(
maxq
[
w
*
16
+
g
],
ff_aac_pow2sf_tab
[
POW_SF2_ZERO
-
scf
+
SCALE_ONE_POS
-
SCALE_DIV_512
]);
if
(
quant_max
>=
8191
)
{
// too much, return to the previous quantizer
sce
->
sf_idx
[
w
*
16
+
g
]
=
prev_scf
;
break
;
...
...
libavcodec/aacdec.c
View file @
d70fa4c4
...
...
@@ -811,7 +811,7 @@ static int decode_scalefactors(AACContext *ac, float sf[120], GetBitContext *gb,
"audible artifact, there may be a bug in the "
"decoder. "
,
offset
[
2
],
clipped_offset
);
}
sf
[
idx
]
=
ff_aac_pow2sf_tab
[
-
clipped_offset
+
200
];
sf
[
idx
]
=
ff_aac_pow2sf_tab
[
-
clipped_offset
+
POW_SF2_ZERO
];
}
}
else
if
(
band_type
[
idx
]
==
NOISE_BT
)
{
for
(;
i
<
run_end
;
i
++
,
idx
++
)
{
...
...
@@ -826,7 +826,7 @@ static int decode_scalefactors(AACContext *ac, float sf[120], GetBitContext *gb,
"artifact, there may be a bug in the decoder. "
,
offset
[
1
],
clipped_offset
);
}
sf
[
idx
]
=
-
ff_aac_pow2sf_tab
[
clipped_offset
+
sf_offset
+
100
];
sf
[
idx
]
=
-
ff_aac_pow2sf_tab
[
clipped_offset
+
sf_offset
-
100
+
POW_SF2_ZERO
];
}
}
else
{
for
(;
i
<
run_end
;
i
++
,
idx
++
)
{
...
...
@@ -836,7 +836,7 @@ static int decode_scalefactors(AACContext *ac, float sf[120], GetBitContext *gb,
"%s (%d) out of range.
\n
"
,
sf_str
[
0
],
offset
[
0
]);
return
-
1
;
}
sf
[
idx
]
=
-
ff_aac_pow2sf_tab
[
offset
[
0
]
+
sf_offset
];
sf
[
idx
]
=
-
ff_aac_pow2sf_tab
[
offset
[
0
]
+
sf_offset
-
200
+
POW_SF2_ZERO
];
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment