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
de0b586a
Commit
de0b586a
authored
Sep 08, 2011
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adpcm: simplify and speed up several ADPCM decoders.
parent
5a9ed7c1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
65 deletions
+21
-65
adpcm.c
libavcodec/adpcm.c
+21
-65
No files found.
libavcodec/adpcm.c
View file @
de0b586a
...
@@ -527,21 +527,9 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
...
@@ -527,21 +527,9 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
*
samples
++
=
c
->
status
[
1
].
predictor
;
*
samples
++
=
c
->
status
[
1
].
predictor
;
}
}
while
(
src
<
buf
+
buf_size
)
{
while
(
src
<
buf
+
buf_size
)
{
uint8_t
v
=
*
src
++
;
/* take care of the top nibble (always left or mono channel) */
*
samples
++
=
adpcm_ima_expand_nibble
(
&
c
->
status
[
0
],
v
>>
4
,
3
);
*
samples
++
=
adpcm_ima_expand_nibble
(
&
c
->
status
[
0
],
*
samples
++
=
adpcm_ima_expand_nibble
(
&
c
->
status
[
st
],
v
&
0x0F
,
3
);
src
[
0
]
>>
4
,
3
);
/* take care of the bottom nibble, which is right sample for
* stereo, or another mono sample */
if
(
st
)
*
samples
++
=
adpcm_ima_expand_nibble
(
&
c
->
status
[
1
],
src
[
0
]
&
0x0F
,
3
);
else
*
samples
++
=
adpcm_ima_expand_nibble
(
&
c
->
status
[
0
],
src
[
0
]
&
0x0F
,
3
);
src
++
;
}
}
break
;
break
;
case
CODEC_ID_ADPCM_IMA_DK3
:
case
CODEC_ID_ADPCM_IMA_DK3
:
...
@@ -600,39 +588,25 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
...
@@ -600,39 +588,25 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
}
}
while
(
src
<
buf
+
buf_size
)
{
while
(
src
<
buf
+
buf_size
)
{
uint8_t
v1
,
v2
;
uint8_t
v
=
*
src
++
;
/* nibbles are swapped for mono */
if
(
st
)
{
if
(
st
)
{
*
samples
++
=
adpcm_ima_expand_nibble
(
&
c
->
status
[
0
],
v1
=
v
>>
4
;
src
[
0
]
>>
4
,
3
);
v2
=
v
&
0x0F
;
*
samples
++
=
adpcm_ima_expand_nibble
(
&
c
->
status
[
1
],
src
[
0
]
&
0x0F
,
3
);
}
else
{
}
else
{
*
samples
++
=
adpcm_ima_expand_nibble
(
&
c
->
status
[
0
],
v2
=
v
>>
4
;
src
[
0
]
&
0x0F
,
3
);
v1
=
v
&
0x0F
;
*
samples
++
=
adpcm_ima_expand_nibble
(
&
c
->
status
[
0
],
src
[
0
]
>>
4
,
3
);
}
}
*
samples
++
=
adpcm_ima_expand_nibble
(
&
c
->
status
[
0
],
v1
,
3
);
src
++
;
*
samples
++
=
adpcm_ima_expand_nibble
(
&
c
->
status
[
st
],
v2
,
3
)
;
}
}
break
;
break
;
case
CODEC_ID_ADPCM_IMA_WS
:
case
CODEC_ID_ADPCM_IMA_WS
:
/* no per-block initialization; just start decoding the data */
while
(
src
<
buf
+
buf_size
)
{
while
(
src
<
buf
+
buf_size
)
{
uint8_t
v
=
*
src
++
;
if
(
st
)
{
*
samples
++
=
adpcm_ima_expand_nibble
(
&
c
->
status
[
0
],
v
>>
4
,
3
);
*
samples
++
=
adpcm_ima_expand_nibble
(
&
c
->
status
[
0
],
*
samples
++
=
adpcm_ima_expand_nibble
(
&
c
->
status
[
st
],
v
&
0x0F
,
3
);
src
[
0
]
>>
4
,
3
);
*
samples
++
=
adpcm_ima_expand_nibble
(
&
c
->
status
[
1
],
src
[
0
]
&
0x0F
,
3
);
}
else
{
*
samples
++
=
adpcm_ima_expand_nibble
(
&
c
->
status
[
0
],
src
[
0
]
>>
4
,
3
);
*
samples
++
=
adpcm_ima_expand_nibble
(
&
c
->
status
[
0
],
src
[
0
]
&
0x0F
,
3
);
}
src
++
;
}
}
break
;
break
;
case
CODEC_ID_ADPCM_XA
:
case
CODEC_ID_ADPCM_XA
:
...
@@ -886,18 +860,9 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
...
@@ -886,18 +860,9 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
break
;
break
;
case
CODEC_ID_ADPCM_CT
:
case
CODEC_ID_ADPCM_CT
:
while
(
src
<
buf
+
buf_size
)
{
while
(
src
<
buf
+
buf_size
)
{
if
(
st
)
{
uint8_t
v
=
*
src
++
;
*
samples
++
=
adpcm_ct_expand_nibble
(
&
c
->
status
[
0
],
*
samples
++
=
adpcm_ct_expand_nibble
(
&
c
->
status
[
0
],
v
>>
4
);
src
[
0
]
>>
4
);
*
samples
++
=
adpcm_ct_expand_nibble
(
&
c
->
status
[
st
],
v
&
0x0F
);
*
samples
++
=
adpcm_ct_expand_nibble
(
&
c
->
status
[
1
],
src
[
0
]
&
0x0F
);
}
else
{
*
samples
++
=
adpcm_ct_expand_nibble
(
&
c
->
status
[
0
],
src
[
0
]
>>
4
);
*
samples
++
=
adpcm_ct_expand_nibble
(
&
c
->
status
[
0
],
src
[
0
]
&
0x0F
);
}
src
++
;
}
}
break
;
break
;
case
CODEC_ID_ADPCM_SBPRO_4
:
case
CODEC_ID_ADPCM_SBPRO_4
:
...
@@ -1005,18 +970,9 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
...
@@ -1005,18 +970,9 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
}
}
case
CODEC_ID_ADPCM_YAMAHA
:
case
CODEC_ID_ADPCM_YAMAHA
:
while
(
src
<
buf
+
buf_size
)
{
while
(
src
<
buf
+
buf_size
)
{
if
(
st
)
{
uint8_t
v
=
*
src
++
;
*
samples
++
=
adpcm_yamaha_expand_nibble
(
&
c
->
status
[
0
],
*
samples
++
=
adpcm_yamaha_expand_nibble
(
&
c
->
status
[
0
],
v
&
0x0F
);
src
[
0
]
&
0x0F
);
*
samples
++
=
adpcm_yamaha_expand_nibble
(
&
c
->
status
[
st
],
v
>>
4
);
*
samples
++
=
adpcm_yamaha_expand_nibble
(
&
c
->
status
[
1
],
src
[
0
]
>>
4
);
}
else
{
*
samples
++
=
adpcm_yamaha_expand_nibble
(
&
c
->
status
[
0
],
src
[
0
]
&
0x0F
);
*
samples
++
=
adpcm_yamaha_expand_nibble
(
&
c
->
status
[
0
],
src
[
0
]
>>
4
);
}
src
++
;
}
}
break
;
break
;
case
CODEC_ID_ADPCM_THP
:
case
CODEC_ID_ADPCM_THP
:
...
...
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