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
8d359bba
Commit
8d359bba
authored
Mar 02, 2006
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup IMA-ADPCM WAV decoder
Originally committed as revision 5095 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
6a8eb0f4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
22 deletions
+21
-22
adpcm.c
libavcodec/adpcm.c
+21
-22
No files found.
libavcodec/adpcm.c
View file @
8d359bba
...
...
@@ -694,8 +694,10 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
cs
->
step_index
=
(
*
src
++
)
&
0x7F
;
if
(
cs
->
step_index
>
88
)
av_log
(
avctx
,
AV_LOG_ERROR
,
"ERROR: step_index = %i
\n
"
,
cs
->
step_index
);
if
(
cs
->
step_index
>
88
)
cs
->
step_index
=
88
;
if
(
cs
->
step_index
>
88
){
av_log
(
avctx
,
AV_LOG_ERROR
,
"ERROR: step_index = %i
\n
"
,
cs
->
step_index
);
cs
->
step_index
=
88
;
}
cs
->
step
=
step_table
[
cs
->
step_index
];
...
...
@@ -721,35 +723,32 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
if
(
avctx
->
block_align
!=
0
&&
buf_size
>
avctx
->
block_align
)
buf_size
=
avctx
->
block_align
;
// samples_per_block= (block_align-4*chanels)*8 / (bits_per_sample * chanels) + 1;
for
(
i
=
0
;
i
<
avctx
->
channels
;
i
++
){
cs
=
&
(
c
->
status
[
i
]);
cs
->
predictor
=
*
src
++
;
cs
->
predictor
|=
(
*
src
++
)
<<
8
;
if
(
cs
->
predictor
&
0x8000
)
cs
->
predictor
-=
0x10000
;
CLAMP_TO_SHORT
(
cs
->
predictor
);
cs
->
predictor
=
(
int16_t
)(
src
[
0
]
+
(
src
[
1
]
<<
8
));
src
+=
2
;
// XXX: is this correct ??: *samples++ = cs->predictor;
cs
->
step_index
=
*
src
++
;
if
(
cs
->
step_index
<
0
)
cs
->
step_index
=
0
;
if
(
cs
->
step_index
>
88
)
cs
->
step_index
=
88
;
if
(
*
src
++
)
av_log
(
avctx
,
AV_LOG_ERROR
,
"unused byte should be null !!
\n
"
);
/* unused */
if
(
cs
->
step_index
>
88
){
av_log
(
avctx
,
AV_LOG_ERROR
,
"ERROR: step_index = %i
\n
"
,
cs
->
step_index
);
cs
->
step_index
=
88
;
}
if
(
*
src
++
)
av_log
(
avctx
,
AV_LOG_ERROR
,
"unused byte should be null but is %d!!
\n
"
,
src
[
-
1
]);
/* unused */
}
for
(
m
=
4
;
src
<
(
buf
+
buf_size
);)
{
*
samples
++
=
adpcm_ima_expand_nibble
(
&
c
->
status
[
0
],
src
[
0
]
&
0x0F
,
3
);
if
(
st
)
*
samples
++
=
adpcm_ima_expand_nibble
(
&
c
->
status
[
1
],
src
[
4
]
&
0x0F
,
3
);
*
samples
++
=
adpcm_ima_expand_nibble
(
&
c
->
status
[
0
],
(
src
[
0
]
>>
4
)
&
0x0F
,
3
);
if
(
st
)
{
*
samples
++
=
adpcm_ima_expand_nibble
(
&
c
->
status
[
1
],
(
src
[
4
]
>>
4
)
&
0x0F
,
3
);
if
(
!--
m
)
{
m
=
4
;
src
+=
4
;
}
while
(
src
<
buf
+
buf_size
){
for
(
m
=
0
;
m
<
4
;
m
++
){
for
(
i
=
0
;
i
<=
st
;
i
++
)
*
samples
++
=
adpcm_ima_expand_nibble
(
&
c
->
status
[
i
],
src
[
4
*
i
]
&
0x0F
,
3
);
for
(
i
=
0
;
i
<=
st
;
i
++
)
*
samples
++
=
adpcm_ima_expand_nibble
(
&
c
->
status
[
i
],
src
[
4
*
i
]
>>
4
,
3
);
src
++
;
}
src
++
;
src
+=
4
*
st
;
}
break
;
case
CODEC_ID_ADPCM_4XM
:
...
...
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