Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
aeefe898
Commit
aeefe898
authored
Dec 20, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
araw: make float/double decoder/encoder conform to C type aliasing rules
parent
af423775
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
18 deletions
+63
-18
modules/codec/araw.c
modules/codec/araw.c
+63
-18
No files found.
modules/codec/araw.c
View file @
aeefe898
...
...
@@ -95,8 +95,9 @@ static void S24B32Decode( void *, const uint8_t *, unsigned );
static
void
S24L32Decode
(
void
*
,
const
uint8_t
*
,
unsigned
);
static
void
U32BDecode
(
void
*
,
const
uint8_t
*
,
unsigned
);
static
void
U32LDecode
(
void
*
,
const
uint8_t
*
,
unsigned
);
static
void
Swap32Decode
(
void
*
,
const
uint8_t
*
,
unsigned
);
static
void
Swap64Decode
(
void
*
,
const
uint8_t
*
,
unsigned
);
static
void
S32IDecode
(
void
*
,
const
uint8_t
*
,
unsigned
);
static
void
F32IDecode
(
void
*
,
const
uint8_t
*
,
unsigned
);
static
void
F64IDecode
(
void
*
,
const
uint8_t
*
,
unsigned
);
static
void
DAT12Decode
(
void
*
,
const
uint8_t
*
,
unsigned
);
/*****************************************************************************
...
...
@@ -138,7 +139,7 @@ static int DecoderOpen( vlc_object_t *p_this )
case
VLC_CODEC_F64B
:
#endif
format
=
VLC_CODEC_FL64
;
decode
=
Swap64
Decode
;
decode
=
F64I
Decode
;
case
VLC_CODEC_FL64
:
bits
=
64
;
break
;
...
...
@@ -148,7 +149,7 @@ static int DecoderOpen( vlc_object_t *p_this )
case
VLC_CODEC_F32B
:
#endif
format
=
VLC_CODEC_FL32
;
decode
=
Swap32
Decode
;
decode
=
F32I
Decode
;
case
VLC_CODEC_FL32
:
bits
=
32
;
break
;
...
...
@@ -164,7 +165,7 @@ static int DecoderOpen( vlc_object_t *p_this )
break
;
case
VLC_CODEC_S32I
:
format
=
VLC_CODEC_S32N
;
decode
=
S
wap32
Decode
;
decode
=
S
32I
Decode
;
case
VLC_CODEC_S32N
:
bits
=
32
;
break
;
...
...
@@ -497,7 +498,7 @@ static void U32LDecode( void *outp, const uint8_t *in, unsigned samples )
}
}
static
void
S
wap32
Decode
(
void
*
outp
,
const
uint8_t
*
in
,
unsigned
samples
)
static
void
S
32I
Decode
(
void
*
outp
,
const
uint8_t
*
in
,
unsigned
samples
)
{
int32_t
*
out
=
outp
;
...
...
@@ -512,17 +513,38 @@ static void Swap32Decode( void *outp, const uint8_t *in, unsigned samples )
}
}
static
void
Swap64
Decode
(
void
*
outp
,
const
uint8_t
*
in
,
unsigned
samples
)
static
void
F32I
Decode
(
void
*
outp
,
const
uint8_t
*
in
,
unsigned
samples
)
{
int64_
t
*
out
=
outp
;
floa
t
*
out
=
outp
;
for
(
size_t
i
=
0
;
i
<
samples
;
i
++
)
{
union
{
float
f
;
uint32_t
u
;
}
s
;
#ifdef WORDS_BIGENDIAN
s
.
u
=
GetDWLE
(
in
);
#else
s
.
u
=
GetDWBE
(
in
);
#endif
*
(
out
++
)
=
s
.
f
;
in
+=
4
;
}
}
static
void
F64IDecode
(
void
*
outp
,
const
uint8_t
*
in
,
unsigned
samples
)
{
double
*
out
=
outp
;
for
(
size_t
i
=
0
;
i
<
samples
;
i
++
)
{
union
{
double
d
;
uint64_t
u
;
}
s
;
#ifdef WORDS_BIGENDIAN
*
(
out
++
)
=
GetQWLE
(
in
);
s
.
u
=
GetQWLE
(
in
);
#else
*
(
out
++
)
=
GetQWBE
(
in
);
s
.
u
=
GetQWBE
(
in
);
#endif
*
(
out
++
)
=
s
.
d
;
in
+=
8
;
}
}
...
...
@@ -662,7 +684,7 @@ static void U32NEncode( void *outp, const uint8_t *inp, unsigned samples )
*
(
out
++
)
=
*
(
in
++
)
+
0x80000000
;
}
static
void
S
wap32
Encode
(
void
*
outp
,
const
uint8_t
*
inp
,
unsigned
samples
)
static
void
S
32I
Encode
(
void
*
outp
,
const
uint8_t
*
inp
,
unsigned
samples
)
{
const
int32_t
*
in
=
(
const
int32_t
*
)
inp
;
int32_t
*
out
=
outp
;
...
...
@@ -671,13 +693,36 @@ static void Swap32Encode( void *outp, const uint8_t *inp, unsigned samples )
*
(
out
++
)
=
bswap32
(
*
(
in
++
)
);
}
static
void
Swap64
Encode
(
void
*
outp
,
const
uint8_t
*
inp
,
unsigned
samples
)
static
void
F32I
Encode
(
void
*
outp
,
const
uint8_t
*
inp
,
unsigned
samples
)
{
const
int64_t
*
in
=
(
const
int64_
t
*
)
inp
;
int64
_t
*
out
=
outp
;
const
float
*
in
=
(
const
floa
t
*
)
inp
;
uint8
_t
*
out
=
outp
;
for
(
size_t
i
=
0
;
i
<
samples
;
i
++
)
*
(
out
++
)
=
bswap64
(
*
(
in
++
)
);
{
union
{
float
f
;
uint32_t
u
;
char
b
[
4
];
}
s
;
s
.
f
=
*
(
in
++
);
s
.
u
=
bswap32
(
s
.
u
);
memcpy
(
out
,
s
.
b
,
4
);
out
+=
4
;
}
}
static
void
F64IEncode
(
void
*
outp
,
const
uint8_t
*
inp
,
unsigned
samples
)
{
const
double
*
in
=
(
const
double
*
)
inp
;
uint8_t
*
out
=
outp
;
for
(
size_t
i
=
0
;
i
<
samples
;
i
++
)
{
union
{
double
d
;
uint64_t
u
;
char
b
[
8
];
}
s
;
s
.
d
=
*
(
in
++
);
s
.
u
=
bswap64
(
s
.
u
);
memcpy
(
out
,
s
.
b
,
8
);
out
+=
8
;
}
}
static
block_t
*
Encode
(
encoder_t
*
enc
,
block_t
*
in
)
...
...
@@ -769,7 +814,7 @@ static int EncoderOpen( vlc_object_t *p_this )
p_enc
->
fmt_out
.
audio
.
i_bitspersample
=
32
;
break
;
case
VLC_CODEC_S32I
:
encode
=
S
wap32
Encode
;
encode
=
S
32I
Encode
;
case
VLC_CODEC_S32N
:
p_enc
->
fmt_in
.
i_codec
=
VLC_CODEC_S32N
;
p_enc
->
fmt_out
.
audio
.
i_bitspersample
=
32
;
...
...
@@ -779,7 +824,7 @@ static int EncoderOpen( vlc_object_t *p_this )
#else
case
VLC_CODEC_F32B
:
#endif
encode
=
Swap32
Encode
;
encode
=
F32I
Encode
;
case
VLC_CODEC_FL32
:
p_enc
->
fmt_in
.
i_codec
=
VLC_CODEC_FL32
;
p_enc
->
fmt_out
.
audio
.
i_bitspersample
=
32
;
...
...
@@ -789,7 +834,7 @@ static int EncoderOpen( vlc_object_t *p_this )
#else
case
VLC_CODEC_F64B
:
#endif
encode
=
Swap64
Encode
;
encode
=
F64I
Encode
;
case
VLC_CODEC_FL64
:
p_enc
->
fmt_in
.
i_codec
=
VLC_CODEC_FL64
;
p_enc
->
fmt_out
.
audio
.
i_bitspersample
=
64
;
...
...
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