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
f7987340
Commit
f7987340
authored
Jul 25, 2019
by
Paul B Mahol
Committed by
Kieran Kunhya
Jul 26, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/adpcm: add support for 5.1 ADPCM MS
parent
052d4137
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
1 deletion
+32
-1
adpcm.c
libavcodec/adpcm.c
+30
-1
wavdec.c
libavformat/wavdec.c
+2
-0
No files found.
libavcodec/adpcm.c
View file @
f7987340
...
...
@@ -105,6 +105,7 @@ static av_cold int adpcm_decode_init(AVCodecContext * avctx)
case
AV_CODEC_ID_ADPCM_EA_R2
:
case
AV_CODEC_ID_ADPCM_EA_R3
:
case
AV_CODEC_ID_ADPCM_EA_XAS
:
case
AV_CODEC_ID_ADPCM_MS
:
max_channels
=
6
;
break
;
case
AV_CODEC_ID_ADPCM_MTAF
:
...
...
@@ -170,6 +171,10 @@ static av_cold int adpcm_decode_init(AVCodecContext * avctx)
avctx
->
sample_fmt
=
c
->
vqa_version
==
3
?
AV_SAMPLE_FMT_S16P
:
AV_SAMPLE_FMT_S16
;
break
;
case
AV_CODEC_ID_ADPCM_MS
:
avctx
->
sample_fmt
=
avctx
->
channels
>
2
?
AV_SAMPLE_FMT_S16P
:
AV_SAMPLE_FMT_S16
;
break
;
default:
avctx
->
sample_fmt
=
AV_SAMPLE_FMT_S16
;
}
...
...
@@ -924,6 +929,29 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
{
int
block_predictor
;
if
(
avctx
->
channels
>
2
)
{
for
(
channel
=
0
;
channel
<
avctx
->
channels
;
channel
++
)
{
samples
=
samples_p
[
channel
];
block_predictor
=
bytestream2_get_byteu
(
&
gb
);
if
(
block_predictor
>
6
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"ERROR: block_predictor[%d] = %d
\n
"
,
channel
,
block_predictor
);
return
AVERROR_INVALIDDATA
;
}
c
->
status
[
channel
].
coeff1
=
ff_adpcm_AdaptCoeff1
[
block_predictor
];
c
->
status
[
channel
].
coeff2
=
ff_adpcm_AdaptCoeff2
[
block_predictor
];
c
->
status
[
channel
].
idelta
=
sign_extend
(
bytestream2_get_le16u
(
&
gb
),
16
);
c
->
status
[
channel
].
sample1
=
sign_extend
(
bytestream2_get_le16u
(
&
gb
),
16
);
c
->
status
[
channel
].
sample2
=
sign_extend
(
bytestream2_get_le16u
(
&
gb
),
16
);
*
samples
++
=
c
->
status
[
channel
].
sample2
;
*
samples
++
=
c
->
status
[
channel
].
sample1
;
for
(
n
=
(
nb_samples
-
2
)
>>
1
;
n
>
0
;
n
--
)
{
int
byte
=
bytestream2_get_byteu
(
&
gb
);
*
samples
++
=
adpcm_ms_expand_nibble
(
&
c
->
status
[
channel
],
byte
>>
4
);
*
samples
++
=
adpcm_ms_expand_nibble
(
&
c
->
status
[
channel
],
byte
&
0x0F
);
}
}
}
else
{
block_predictor
=
bytestream2_get_byteu
(
&
gb
);
if
(
block_predictor
>
6
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"ERROR: block_predictor[0] = %d
\n
"
,
...
...
@@ -961,6 +989,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
*
samples
++
=
adpcm_ms_expand_nibble
(
&
c
->
status
[
0
],
byte
>>
4
);
*
samples
++
=
adpcm_ms_expand_nibble
(
&
c
->
status
[
st
],
byte
&
0x0F
);
}
}
break
;
}
case
AV_CODEC_ID_ADPCM_MTAF
:
...
...
@@ -1810,7 +1839,7 @@ ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_RAD, sample_fmts_s16, adpcm_ima_rad,
ADPCM_DECODER
(
AV_CODEC_ID_ADPCM_IMA_SMJPEG
,
sample_fmts_s16
,
adpcm_ima_smjpeg
,
"ADPCM IMA Loki SDL MJPEG"
);
ADPCM_DECODER
(
AV_CODEC_ID_ADPCM_IMA_WAV
,
sample_fmts_s16p
,
adpcm_ima_wav
,
"ADPCM IMA WAV"
);
ADPCM_DECODER
(
AV_CODEC_ID_ADPCM_IMA_WS
,
sample_fmts_both
,
adpcm_ima_ws
,
"ADPCM IMA Westwood"
);
ADPCM_DECODER
(
AV_CODEC_ID_ADPCM_MS
,
sample_fmts_
s16
,
adpcm_ms
,
"ADPCM Microsoft"
);
ADPCM_DECODER
(
AV_CODEC_ID_ADPCM_MS
,
sample_fmts_
both
,
adpcm_ms
,
"ADPCM Microsoft"
);
ADPCM_DECODER
(
AV_CODEC_ID_ADPCM_MTAF
,
sample_fmts_s16p
,
adpcm_mtaf
,
"ADPCM MTAF"
);
ADPCM_DECODER
(
AV_CODEC_ID_ADPCM_PSX
,
sample_fmts_s16p
,
adpcm_psx
,
"ADPCM Playstation"
);
ADPCM_DECODER
(
AV_CODEC_ID_ADPCM_SBPRO_2
,
sample_fmts_s16
,
adpcm_sbpro_2
,
"ADPCM Sound Blaster Pro 2-bit"
);
...
...
libavformat/wavdec.c
View file @
f7987340
...
...
@@ -590,6 +590,8 @@ break_loop:
}
else
if
(
st
->
codecpar
->
codec_id
==
AV_CODEC_ID_XMA1
||
st
->
codecpar
->
codec_id
==
AV_CODEC_ID_XMA2
)
{
st
->
codecpar
->
block_align
=
2048
;
}
else
if
(
st
->
codecpar
->
codec_id
==
AV_CODEC_ID_ADPCM_MS
&&
st
->
codecpar
->
channels
>
2
)
{
st
->
codecpar
->
block_align
*=
st
->
codecpar
->
channels
;
}
ff_metadata_conv_ctx
(
s
,
NULL
,
wav_metadata_conv
);
...
...
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