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
5e4e58d2
Commit
5e4e58d2
authored
Dec 19, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
araw: decode/encode U16 and S16I to/from S16N
parent
141c6716
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
77 additions
and
5 deletions
+77
-5
modules/codec/araw.c
modules/codec/araw.c
+77
-5
No files found.
modules/codec/araw.c
View file @
5e4e58d2
...
...
@@ -83,6 +83,9 @@ static const uint16_t pi_channels_maps[] =
};
static
void
S8Decode
(
void
*
,
const
uint8_t
*
,
unsigned
);
static
void
U16BDecode
(
void
*
,
const
uint8_t
*
,
unsigned
);
static
void
U16LDecode
(
void
*
,
const
uint8_t
*
,
unsigned
);
static
void
S16IDecode
(
void
*
,
const
uint8_t
*
,
unsigned
);
static
void
S20BDecode
(
void
*
,
const
uint8_t
*
,
unsigned
);
static
void
DAT12Decode
(
void
*
,
const
uint8_t
*
,
unsigned
);
...
...
@@ -138,8 +141,20 @@ static int DecoderOpen( vlc_object_t *p_this )
decode
=
S20BDecode
;
bits
=
20
;
break
;
case
VLC_CODEC_S16L
:
case
VLC_CODEC_S16B
:
case
VLC_CODEC_U16B
:
format
=
VLC_CODEC_S16N
;
decode
=
U16BDecode
;
bits
=
16
;
break
;
case
VLC_CODEC_U16L
:
format
=
VLC_CODEC_S16N
;
decode
=
U16LDecode
;
bits
=
16
;
break
;
case
VLC_CODEC_S16I
:
format
=
VLC_CODEC_S16N
;
decode
=
S16IDecode
;
case
VLC_CODEC_S16N
:
bits
=
16
;
break
;
case
VLC_CODEC_DAT12
:
...
...
@@ -282,6 +297,33 @@ static void S8Decode( void *outp, const uint8_t *in, unsigned samples )
out
[
i
]
=
in
[
i
]
^
0x80
;
}
static
void
U16BDecode
(
void
*
outp
,
const
uint8_t
*
in
,
unsigned
samples
)
{
uint16_t
*
out
=
outp
;
for
(
size_t
i
=
0
;
i
<
samples
;
i
++
)
{
*
(
out
++
)
=
GetWBE
(
in
)
-
0x8000
;
in
+=
2
;
}
}
static
void
U16LDecode
(
void
*
outp
,
const
uint8_t
*
in
,
unsigned
samples
)
{
uint16_t
*
out
=
outp
;
for
(
size_t
i
=
0
;
i
<
samples
;
i
++
)
{
*
(
out
++
)
=
GetWLE
(
in
)
-
0x8000
;
in
+=
2
;
}
}
static
void
S16IDecode
(
void
*
out
,
const
uint8_t
*
in
,
unsigned
samples
)
{
swab
(
in
,
out
,
samples
*
2
);
}
static
void
S20BDecode
(
void
*
outp
,
const
uint8_t
*
in
,
unsigned
samples
)
{
int32_t
*
out
=
outp
;
...
...
@@ -340,6 +382,24 @@ static void DecoderClose( vlc_object_t *p_this )
}
#ifdef ENABLE_SOUT
static
void
U16IEncode
(
void
*
outp
,
const
uint8_t
*
inp
,
unsigned
samples
)
{
const
uint16_t
*
in
=
(
const
uint16_t
*
)
inp
;
uint16_t
*
out
=
outp
;
for
(
size_t
i
=
0
;
i
<
samples
;
i
++
)
*
(
out
++
)
=
bswap16
(
*
(
in
++
)
+
0x8000
);
}
static
void
U16NEncode
(
void
*
outp
,
const
uint8_t
*
inp
,
unsigned
samples
)
{
const
uint16_t
*
in
=
(
const
uint16_t
*
)
inp
;
uint16_t
*
out
=
outp
;
for
(
size_t
i
=
0
;
i
<
samples
;
i
++
)
*
(
out
++
)
=
*
(
in
++
)
+
0x8000
;
}
static
block_t
*
Encode
(
encoder_t
*
enc
,
block_t
*
in
)
{
if
(
in
==
NULL
)
...
...
@@ -382,10 +442,22 @@ static int EncoderOpen( vlc_object_t *p_this )
case
VLC_CODEC_U8
:
p_enc
->
fmt_out
.
audio
.
i_bitspersample
=
8
;
break
;
case
VLC_CODEC_U16L
:
case
VLC_CODEC_U16B
:
case
VLC_CODEC_U16I
:
encode
=
U16IEncode
;
p_enc
->
fmt_in
.
i_codec
=
VLC_CODEC_S16N
;
p_enc
->
fmt_out
.
audio
.
i_bitspersample
=
16
;
break
;
case
VLC_CODEC_U16N
:
encode
=
U16NEncode
;
p_enc
->
fmt_in
.
i_codec
=
VLC_CODEC_S16N
;
p_enc
->
fmt_out
.
audio
.
i_bitspersample
=
16
;
break
;
case
VLC_CODEC_S16I
:
encode
=
S16IDecode
;
p_enc
->
fmt_in
.
i_codec
=
VLC_CODEC_S16N
;
p_enc
->
fmt_out
.
audio
.
i_bitspersample
=
16
;
break
;
case
VLC_CODEC_S16L
:
case
VLC_CODEC_S16B
:
p_enc
->
fmt_out
.
audio
.
i_bitspersample
=
16
;
break
;
case
VLC_CODEC_U24L
:
...
...
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