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
ba7cec94
Commit
ba7cec94
authored
Jun 09, 2014
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adpcm: clean up and optimize
parent
7e968781
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
26 deletions
+17
-26
modules/codec/adpcm.c
modules/codec/adpcm.c
+17
-26
No files found.
modules/codec/adpcm.c
View file @
ba7cec94
...
@@ -729,45 +729,37 @@ static void DecodeAdpcmDk3( decoder_t *p_dec, int16_t *p_sample,
...
@@ -729,45 +729,37 @@ static void DecodeAdpcmDk3( decoder_t *p_dec, int16_t *p_sample,
static
void
DecodeAdpcmEA
(
decoder_t
*
p_dec
,
int16_t
*
p_sample
,
static
void
DecodeAdpcmEA
(
decoder_t
*
p_dec
,
int16_t
*
p_sample
,
uint8_t
*
p_buffer
)
uint8_t
*
p_buffer
)
{
{
static
const
uint32
_t
EATable
[]
=
static
const
int16
_t
EATable
[]
=
{
{
0x00000000
,
0x000000F0
,
0x000001CC
,
0x00000188
,
0x0000
,
0x00F0
,
0x01CC
,
0x0188
,
0x0000
,
0x0000
,
0xFF30
,
0xFF24
,
0x00000000
,
0x00000000
,
0xFFFFFF30
,
0xFFFFFF24
,
0x0000
,
0x0001
,
0x0003
,
0x0004
,
0x0007
,
0x0008
,
0x000A
,
0x000B
,
0x00000000
,
0x00000001
,
0x00000003
,
0x00000004
,
0x0000
,
0xFFFF
,
0xFFFD
,
0xFFFC
,
0x00000007
,
0x00000008
,
0x0000000A
,
0x0000000B
,
0x00000000
,
0xFFFFFFFF
,
0xFFFFFFFD
,
0xFFFFFFFC
};
};
decoder_sys_t
*
p_sys
=
p_dec
->
p_sys
;
decoder_sys_t
*
p_sys
=
p_dec
->
p_sys
;
uint8_t
*
p_end
;
int_fast32_t
c1
[
MAX_CHAN
],
c2
[
MAX_CHAN
];
unsigned
i_channels
,
c
;
int_fast8_t
d
[
MAX_CHAN
];
int16_t
*
prev
,
*
cur
;
int32_t
c1
[
MAX_CHAN
],
c2
[
MAX_CHAN
];
int8_t
d
[
MAX_CHAN
];
i_channels
=
p_dec
->
fmt_in
.
audio
.
i_channels
;
unsigned
chans
=
p_dec
->
fmt_in
.
audio
.
i_channels
;
p_end
=
&
p_buffer
[
p_sys
->
i_block
];
const
uint8_t
*
p_end
=
&
p_buffer
[
p_sys
->
i_block
];
int16_t
*
prev
=
(
int16_t
*
)
p_dec
->
fmt_in
.
p_extra
;
int16_t
*
cur
=
prev
+
chans
;
prev
=
(
int16_t
*
)
p_dec
->
fmt_in
.
p_extra
;
for
(
unsigned
c
=
0
;
c
<
chans
;
c
++
)
cur
=
prev
+
i_channels
;
for
(
c
=
0
;
c
<
i_channels
;
c
++
)
{
{
uint8_t
input
;
uint8_t
input
=
p_buffer
[
c
]
;
input
=
p_buffer
[
c
];
c1
[
c
]
=
EATable
[
input
>>
4
];
c1
[
c
]
=
EATable
[
input
>>
4
];
c2
[
c
]
=
EATable
[(
input
>>
4
)
+
4
];
c2
[
c
]
=
EATable
[(
input
>>
4
)
+
4
];
d
[
c
]
=
(
input
&
0xf
)
+
8
;
d
[
c
]
=
(
input
&
0xf
)
+
8
;
}
}
for
(
p_buffer
+=
i_channels
;
p_buffer
<
p_end
;
p_buffer
+=
i_channel
s
)
for
(
p_buffer
+=
chans
;
p_buffer
<
p_end
;
p_buffer
+=
chan
s
)
{
{
for
(
c
=
0
;
c
<
i_channel
s
;
c
++
)
for
(
unsigned
c
=
0
;
c
<
chan
s
;
c
++
)
{
{
int32_t
spl
;
int32_t
spl
;
spl
=
(
p_buffer
[
c
]
>>
4
)
&
0xf
;
spl
=
((
p_buffer
[
c
]
&
0xf0
)
<<
0x18u
)
>>
d
[
c
];
spl
=
(
spl
<<
0x1c
)
>>
d
[
c
];
spl
=
(
spl
+
cur
[
c
]
*
c1
[
c
]
+
prev
[
c
]
*
c2
[
c
]
+
0x80
)
>>
8
;
spl
=
(
spl
+
cur
[
c
]
*
c1
[
c
]
+
prev
[
c
]
*
c2
[
c
]
+
0x80
)
>>
8
;
CLAMP
(
spl
,
-
32768
,
32767
);
CLAMP
(
spl
,
-
32768
,
32767
);
prev
[
c
]
=
cur
[
c
];
prev
[
c
]
=
cur
[
c
];
...
@@ -776,12 +768,11 @@ static void DecodeAdpcmEA( decoder_t *p_dec, int16_t *p_sample,
...
@@ -776,12 +768,11 @@ static void DecodeAdpcmEA( decoder_t *p_dec, int16_t *p_sample,
*
(
p_sample
++
)
=
spl
;
*
(
p_sample
++
)
=
spl
;
}
}
for
(
c
=
0
;
c
<
i_channel
s
;
c
++
)
for
(
unsigned
c
=
0
;
c
<
chan
s
;
c
++
)
{
{
int32_t
spl
;
int32_t
spl
;
spl
=
p_buffer
[
c
]
&
0xf
;
spl
=
((
p_buffer
[
c
]
&
0x0f
)
<<
0x1cu
)
>>
d
[
c
];
spl
=
(
spl
<<
0x1c
)
>>
d
[
c
];
spl
=
(
spl
+
cur
[
c
]
*
c1
[
c
]
+
prev
[
c
]
*
c2
[
c
]
+
0x80
)
>>
8
;
spl
=
(
spl
+
cur
[
c
]
*
c1
[
c
]
+
prev
[
c
]
*
c2
[
c
]
+
0x80
)
>>
8
;
CLAMP
(
spl
,
-
32768
,
32767
);
CLAMP
(
spl
,
-
32768
,
32767
);
prev
[
c
]
=
cur
[
c
];
prev
[
c
]
=
cur
[
c
];
...
...
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