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
e60d0991
Commit
e60d0991
authored
Mar 17, 2012
by
Ronald S. Bultje
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adpcm: convert ea_maxis_xa to bytestream2.
parent
4a876eba
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
+10
-8
adpcm.c
libavcodec/adpcm.c
+10
-8
No files found.
libavcodec/adpcm.c
View file @
e60d0991
...
...
@@ -413,7 +413,7 @@ static int get_nb_samples(AVCodecContext *avctx, const uint8_t *buf,
nb_samples
=
(
buf_size
-
(
4
+
8
*
ch
))
*
2
/
ch
;
break
;
case
CODEC_ID_ADPCM_EA_MAXIS_XA
:
nb_samples
=
(
(
buf_size
-
ch
)
/
(
2
*
ch
))
*
2
*
ch
;
nb_samples
=
(
buf_size
-
ch
)
/
ch
*
2
;
break
;
case
CODEC_ID_ADPCM_EA_R1
:
case
CODEC_ID_ADPCM_EA_R2
:
...
...
@@ -921,15 +921,19 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
int
coeff
[
2
][
2
],
shift
[
2
];
for
(
channel
=
0
;
channel
<
avctx
->
channels
;
channel
++
)
{
int
byte
=
bytestream2_get_byteu
(
&
gb
);
for
(
i
=
0
;
i
<
2
;
i
++
)
coeff
[
channel
][
i
]
=
ea_adpcm_table
[(
*
src
>>
4
)
+
4
*
i
];
shift
[
channel
]
=
20
-
(
*
src
&
0x0F
);
src
++
;
coeff
[
channel
][
i
]
=
ea_adpcm_table
[(
byte
>>
4
)
+
4
*
i
];
shift
[
channel
]
=
20
-
(
byte
&
0x0F
);
}
for
(
count1
=
0
;
count1
<
nb_samples
/
2
;
count1
++
)
{
int
byte
[
2
];
byte
[
0
]
=
bytestream2_get_byteu
(
&
gb
);
if
(
st
)
byte
[
1
]
=
bytestream2_get_byteu
(
&
gb
);
for
(
i
=
4
;
i
>=
0
;
i
-=
4
)
{
/* Pairwise samples LL RR (st) or LL LL (mono) */
for
(
channel
=
0
;
channel
<
avctx
->
channels
;
channel
++
)
{
int
32_t
sample
=
sign_extend
(
src
[
channel
]
>>
i
,
4
)
<<
shift
[
channel
];
int
sample
=
sign_extend
(
byte
[
channel
]
>>
i
,
4
)
<<
shift
[
channel
];
sample
=
(
sample
+
c
->
status
[
channel
].
sample1
*
coeff
[
channel
][
0
]
+
c
->
status
[
channel
].
sample2
*
coeff
[
channel
][
1
]
+
0x80
)
>>
8
;
...
...
@@ -938,10 +942,8 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
*
samples
++
=
c
->
status
[
channel
].
sample1
;
}
}
src
+=
avctx
->
channels
;
}
/* consume whole packet */
src
=
buf
+
buf_size
;
bytestream2_seek
(
&
gb
,
0
,
SEEK_END
);
break
;
}
case
CODEC_ID_ADPCM_EA_R1
:
...
...
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