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
954d94dd
Commit
954d94dd
authored
Nov 20, 2011
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adx: use 12-bit coefficients instead of 14-bit to avoid integer overflow
parent
c52ddc60
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
5 deletions
+5
-5
adx.h
libavcodec/adx.h
+3
-3
adxdec.c
libavcodec/adxdec.c
+1
-1
adxenc.c
libavcodec/adxenc.c
+1
-1
No files found.
libavcodec/adx.h
View file @
954d94dd
...
...
@@ -43,8 +43,8 @@ typedef struct {
int
in_temp
;
}
ADXContext
;
#define
BASEVOL 0x4000
#define
SCALE1 0x7298
#define
SCALE2 0x3350
#define
COEFF_BITS 12
#define
COEFF1 0x1CA6
#define
COEFF2 0x0CD4
#endif
/* AVCODEC_ADX_H */
libavcodec/adxdec.c
View file @
954d94dd
...
...
@@ -59,7 +59,7 @@ static void adx_decode(ADXContext *c, int16_t *out, const uint8_t *in, int ch)
s2
=
prev
->
s2
;
for
(
i
=
0
;
i
<
32
;
i
++
)
{
d
=
get_sbits
(
&
gb
,
4
);
s0
=
(
BASEVOL
*
d
*
scale
+
SCALE1
*
s1
-
SCALE2
*
s2
)
>>
14
;
s0
=
(
(
d
<<
COEFF_BITS
)
*
scale
+
COEFF1
*
s1
-
COEFF2
*
s2
)
>>
COEFF_BITS
;
s2
=
s1
;
s1
=
av_clip_int16
(
s0
);
*
out
=
s1
;
...
...
libavcodec/adxenc.c
View file @
954d94dd
...
...
@@ -48,7 +48,7 @@ static void adx_encode(unsigned char *adx,const short *wav,
s2
=
prev
->
s2
;
for
(
i
=
0
;
i
<
32
;
i
++
)
{
s0
=
wav
[
i
];
d
=
((
s0
<<
14
)
-
SCALE1
*
s1
+
SCALE2
*
s2
)
/
BASEVOL
;
d
=
((
s0
<<
COEFF_BITS
)
-
COEFF1
*
s1
+
COEFF2
*
s2
)
>>
COEFF_BITS
;
data
[
i
]
=
d
;
if
(
max
<
d
)
max
=
d
;
if
(
min
>
d
)
min
=
d
;
...
...
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