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
1db6437f
Commit
1db6437f
authored
Sep 24, 2011
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wmapro: fix strict-aliasing violations by using av_alias32
Also fix some undefined unsigned/signed conversions.
parent
b8b4c9c3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
wmaprodec.c
libavcodec/wmaprodec.c
+8
-7
No files found.
libavcodec/wmaprodec.c
View file @
1db6437f
...
@@ -86,6 +86,7 @@
...
@@ -86,6 +86,7 @@
* subframe in order to reconstruct the output samples.
* subframe in order to reconstruct the output samples.
*/
*/
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
#include "avcodec.h"
#include "internal.h"
#include "internal.h"
#include "get_bits.h"
#include "get_bits.h"
...
@@ -770,7 +771,7 @@ static int decode_coeffs(WMAProDecodeCtx *s, int c)
...
@@ -770,7 +771,7 @@ static int decode_coeffs(WMAProDecodeCtx *s, int c)
/* Integers 0..15 as single-precision floats. The table saves a
/* Integers 0..15 as single-precision floats. The table saves a
costly int to float conversion, and storing the values as
costly int to float conversion, and storing the values as
integers allows fast sign-flipping. */
integers allows fast sign-flipping. */
static
const
in
t
fval_tab
[
16
]
=
{
static
const
uint32_
t
fval_tab
[
16
]
=
{
0x00000000
,
0x3f800000
,
0x40000000
,
0x40400000
,
0x00000000
,
0x3f800000
,
0x40000000
,
0x40400000
,
0x40800000
,
0x40a00000
,
0x40c00000
,
0x40e00000
,
0x40800000
,
0x40a00000
,
0x40c00000
,
0x40e00000
,
0x41000000
,
0x41100000
,
0x41200000
,
0x41300000
,
0x41000000
,
0x41100000
,
0x41200000
,
0x41300000
,
...
@@ -802,7 +803,7 @@ static int decode_coeffs(WMAProDecodeCtx *s, int c)
...
@@ -802,7 +803,7 @@ static int decode_coeffs(WMAProDecodeCtx *s, int c)
4 vector coded large values) */
4 vector coded large values) */
while
((
s
->
transmit_num_vec_coeffs
||
!
rl_mode
)
&&
while
((
s
->
transmit_num_vec_coeffs
||
!
rl_mode
)
&&
(
cur_coeff
+
3
<
ci
->
num_vec_coeffs
))
{
(
cur_coeff
+
3
<
ci
->
num_vec_coeffs
))
{
in
t
vals
[
4
];
uint32_
t
vals
[
4
];
int
i
;
int
i
;
unsigned
int
idx
;
unsigned
int
idx
;
...
@@ -812,15 +813,15 @@ static int decode_coeffs(WMAProDecodeCtx *s, int c)
...
@@ -812,15 +813,15 @@ static int decode_coeffs(WMAProDecodeCtx *s, int c)
for
(
i
=
0
;
i
<
4
;
i
+=
2
)
{
for
(
i
=
0
;
i
<
4
;
i
+=
2
)
{
idx
=
get_vlc2
(
&
s
->
gb
,
vec2_vlc
.
table
,
VLCBITS
,
VEC2MAXDEPTH
);
idx
=
get_vlc2
(
&
s
->
gb
,
vec2_vlc
.
table
,
VLCBITS
,
VEC2MAXDEPTH
);
if
(
idx
==
HUFF_VEC2_SIZE
-
1
)
{
if
(
idx
==
HUFF_VEC2_SIZE
-
1
)
{
in
t
v0
,
v1
;
uint32_
t
v0
,
v1
;
v0
=
get_vlc2
(
&
s
->
gb
,
vec1_vlc
.
table
,
VLCBITS
,
VEC1MAXDEPTH
);
v0
=
get_vlc2
(
&
s
->
gb
,
vec1_vlc
.
table
,
VLCBITS
,
VEC1MAXDEPTH
);
if
(
v0
==
HUFF_VEC1_SIZE
-
1
)
if
(
v0
==
HUFF_VEC1_SIZE
-
1
)
v0
+=
ff_wma_get_large_val
(
&
s
->
gb
);
v0
+=
ff_wma_get_large_val
(
&
s
->
gb
);
v1
=
get_vlc2
(
&
s
->
gb
,
vec1_vlc
.
table
,
VLCBITS
,
VEC1MAXDEPTH
);
v1
=
get_vlc2
(
&
s
->
gb
,
vec1_vlc
.
table
,
VLCBITS
,
VEC1MAXDEPTH
);
if
(
v1
==
HUFF_VEC1_SIZE
-
1
)
if
(
v1
==
HUFF_VEC1_SIZE
-
1
)
v1
+=
ff_wma_get_large_val
(
&
s
->
gb
);
v1
+=
ff_wma_get_large_val
(
&
s
->
gb
);
((
float
*
)
vals
)[
i
]
=
v0
;
vals
[
i
]
=
((
av_alias32
){
.
f32
=
v0
}).
u32
;
((
float
*
)
vals
)[
i
+
1
]
=
v1
;
vals
[
i
+
1
]
=
((
av_alias32
){
.
f32
=
v1
}).
u32
;
}
else
{
}
else
{
vals
[
i
]
=
fval_tab
[
symbol_to_vec2
[
idx
]
>>
4
];
vals
[
i
]
=
fval_tab
[
symbol_to_vec2
[
idx
]
>>
4
];
vals
[
i
+
1
]
=
fval_tab
[
symbol_to_vec2
[
idx
]
&
0xF
];
vals
[
i
+
1
]
=
fval_tab
[
symbol_to_vec2
[
idx
]
&
0xF
];
...
@@ -836,8 +837,8 @@ static int decode_coeffs(WMAProDecodeCtx *s, int c)
...
@@ -836,8 +837,8 @@ static int decode_coeffs(WMAProDecodeCtx *s, int c)
/** decode sign */
/** decode sign */
for
(
i
=
0
;
i
<
4
;
i
++
)
{
for
(
i
=
0
;
i
<
4
;
i
++
)
{
if
(
vals
[
i
])
{
if
(
vals
[
i
])
{
in
t
sign
=
get_bits1
(
&
s
->
gb
)
-
1
;
uint32_
t
sign
=
get_bits1
(
&
s
->
gb
)
-
1
;
*
(
uint32_t
*
)
&
ci
->
coeffs
[
cur_coeff
]
=
vals
[
i
]
^
sign
<<
31
;
AV_WN32A
(
&
ci
->
coeffs
[
cur_coeff
],
vals
[
i
]
^
sign
<<
31
)
;
num_zeros
=
0
;
num_zeros
=
0
;
}
else
{
}
else
{
ci
->
coeffs
[
cur_coeff
]
=
0
;
ci
->
coeffs
[
cur_coeff
]
=
0
;
...
...
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