Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
6b232cec
Commit
6b232cec
authored
Dec 19, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
araw: add non-native float encoding and decode float to native
parent
fda4b655
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
5 deletions
+56
-5
modules/codec/araw.c
modules/codec/araw.c
+56
-5
No files found.
modules/codec/araw.c
View file @
6b232cec
...
...
@@ -89,7 +89,8 @@ static void S16IDecode( void *, const uint8_t *, unsigned );
static
void
S20BDecode
(
void
*
,
const
uint8_t
*
,
unsigned
);
static
void
U32BDecode
(
void
*
,
const
uint8_t
*
,
unsigned
);
static
void
U32LDecode
(
void
*
,
const
uint8_t
*
,
unsigned
);
static
void
S32IDecode
(
void
*
,
const
uint8_t
*
,
unsigned
);
static
void
Swap32Decode
(
void
*
,
const
uint8_t
*
,
unsigned
);
static
void
Swap64Decode
(
void
*
,
const
uint8_t
*
,
unsigned
);
static
void
DAT12Decode
(
void
*
,
const
uint8_t
*
,
unsigned
);
/*****************************************************************************
...
...
@@ -125,12 +126,24 @@ static int DecoderOpen( vlc_object_t *p_this )
switch
(
format
)
{
#ifdef WORDS_BIGENDIAN
case
VLC_CODEC_F64L
:
#else
case
VLC_CODEC_F64B
:
#endif
format
=
VLC_CODEC_FL64
;
decode
=
Swap64Decode
;
case
VLC_CODEC_FL64
:
bits
=
64
;
break
;
#ifdef WORDS_BIGENDIAN
case
VLC_CODEC_F32L
:
#else
case
VLC_CODEC_F32B
:
#endif
format
=
VLC_CODEC_FL32
;
decode
=
Swap32Decode
;
case
VLC_CODEC_FL32
:
bits
=
32
;
break
;
case
VLC_CODEC_U32B
:
...
...
@@ -145,7 +158,7 @@ static int DecoderOpen( vlc_object_t *p_this )
break
;
case
VLC_CODEC_S32I
:
format
=
VLC_CODEC_S32N
;
decode
=
S
32I
Decode
;
decode
=
S
wap32
Decode
;
case
VLC_CODEC_S32N
:
bits
=
32
;
break
;
...
...
@@ -382,7 +395,7 @@ static void U32LDecode( void *outp, const uint8_t *in, unsigned samples )
}
}
static
void
S
32I
Decode
(
void
*
outp
,
const
uint8_t
*
in
,
unsigned
samples
)
static
void
S
wap32
Decode
(
void
*
outp
,
const
uint8_t
*
in
,
unsigned
samples
)
{
int32_t
*
out
=
outp
;
...
...
@@ -397,6 +410,21 @@ static void S32IDecode( void *outp, const uint8_t *in, unsigned samples )
}
}
static
void
Swap64Decode
(
void
*
outp
,
const
uint8_t
*
in
,
unsigned
samples
)
{
int64_t
*
out
=
outp
;
for
(
size_t
i
=
0
;
i
<
samples
;
i
++
)
{
#ifdef WORDS_BIGENDIAN
*
(
out
++
)
=
GetQWLE
(
in
);
#else
*
(
out
++
)
=
GetQWBE
(
in
);
#endif
in
+=
8
;
}
}
static
int16_t
dat12tos16
(
uint16_t
y
)
{
static
const
uint16_t
diff
[
16
]
=
{
...
...
@@ -476,7 +504,7 @@ static void U32NEncode( void *outp, const uint8_t *inp, unsigned samples )
*
(
out
++
)
=
*
(
in
++
)
+
0x80000000
;
}
static
void
S
32I
Encode
(
void
*
outp
,
const
uint8_t
*
inp
,
unsigned
samples
)
static
void
S
wap32
Encode
(
void
*
outp
,
const
uint8_t
*
inp
,
unsigned
samples
)
{
const
int32_t
*
in
=
(
const
int32_t
*
)
inp
;
int32_t
*
out
=
outp
;
...
...
@@ -485,6 +513,15 @@ static void S32IEncode( void *outp, const uint8_t *inp, unsigned samples )
*
(
out
++
)
=
bswap32
(
*
(
in
++
)
);
}
static
void
Swap64Encode
(
void
*
outp
,
const
uint8_t
*
inp
,
unsigned
samples
)
{
const
int64_t
*
in
=
(
const
int64_t
*
)
inp
;
int64_t
*
out
=
outp
;
for
(
size_t
i
=
0
;
i
<
samples
;
i
++
)
*
(
out
++
)
=
bswap64
(
*
(
in
++
)
);
}
static
block_t
*
Encode
(
encoder_t
*
enc
,
block_t
*
in
)
{
if
(
in
==
NULL
)
...
...
@@ -560,15 +597,29 @@ static int EncoderOpen( vlc_object_t *p_this )
p_enc
->
fmt_out
.
audio
.
i_bitspersample
=
32
;
break
;
case
VLC_CODEC_S32I
:
encode
=
S
32I
Encode
;
encode
=
S
wap32
Encode
;
case
VLC_CODEC_S32N
:
p_enc
->
fmt_in
.
i_codec
=
VLC_CODEC_S32N
;
p_enc
->
fmt_out
.
audio
.
i_bitspersample
=
32
;
break
;
#ifdef WORDS_BIGENDIAN
case
VLC_CODEC_F32L
:
#else
case
VLC_CODEC_F32B
:
#endif
encode
=
Swap32Encode
;
case
VLC_CODEC_FL32
:
p_enc
->
fmt_in
.
i_codec
=
VLC_CODEC_FL32
;
p_enc
->
fmt_out
.
audio
.
i_bitspersample
=
32
;
break
;
#ifdef WORDS_BIGENDIAN
case
VLC_CODEC_F64L
:
#else
case
VLC_CODEC_F64B
:
#endif
encode
=
Swap64Encode
;
case
VLC_CODEC_FL64
:
p_enc
->
fmt_in
.
i_codec
=
VLC_CODEC_FL64
;
p_enc
->
fmt_out
.
audio
.
i_bitspersample
=
64
;
break
;
default:
...
...
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