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
8e7a06aa
Commit
8e7a06aa
authored
Jun 20, 2015
by
Rodger Combs
Committed by
Michael Niedermayer
Jun 20, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavc/adpcm: THP: handle packets with sample counts not divisible by 14
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
7e7256c3
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
adpcm.c
libavcodec/adpcm.c
+10
-4
No files found.
libavcodec/adpcm.c
View file @
8e7a06aa
...
...
@@ -648,8 +648,14 @@ static int get_nb_samples(AVCodecContext *avctx, GetByteContext *gb,
*
coded_samples
=
(
avctx
->
codec
->
id
==
AV_CODEC_ID_ADPCM_THP_LE
)
?
bytestream2_get_le32
(
gb
)
:
bytestream2_get_be32
(
gb
);
*
coded_samples
-=
*
coded_samples
%
14
;
nb_samples
=
(
buf_size
-
(
8
+
36
*
ch
))
/
(
8
*
ch
)
*
14
;
buf_size
-=
8
+
36
*
ch
;
buf_size
/=
ch
;
nb_samples
=
buf_size
/
8
*
14
;
if
(
buf_size
%
8
>
1
)
{
nb_samples
+=
(
buf_size
%
8
-
1
)
*
2
;
if
(
*
coded_samples
&
1
)
nb_samples
-=
1
;
}
break
;
case
AV_CODEC_ID_ADPCM_AFC
:
nb_samples
=
buf_size
/
(
9
*
ch
)
*
16
;
...
...
@@ -1458,7 +1464,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
samples
=
samples_p
[
ch
];
/* Read in every sample for this channel. */
for
(
i
=
0
;
i
<
nb_samples
/
14
;
i
++
)
{
for
(
i
=
0
;
i
<
(
nb_samples
+
13
)
/
14
;
i
++
)
{
int
byte
=
bytestream2_get_byteu
(
&
gb
);
int
index
=
(
byte
>>
4
)
&
7
;
unsigned
int
exp
=
byte
&
0x0F
;
...
...
@@ -1466,7 +1472,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
int
factor2
=
table
[
ch
][
index
*
2
+
1
];
/* Decode 14 samples. */
for
(
n
=
0
;
n
<
14
;
n
++
)
{
for
(
n
=
0
;
n
<
14
&&
(
i
*
14
+
n
<
nb_samples
)
;
n
++
)
{
int32_t
sampledat
;
if
(
n
&
1
)
{
...
...
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