Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
8b11e437
F
Ffmpeg
项目概览
小白菜888
/
Ffmpeg
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
Ffmpeg
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8b11e437
编写于
10月 13, 2015
作者:
P
Paul B Mahol
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
avcodec: add ADPCM PSX decoder
Signed-off-by:
N
Paul B Mahol
<
onemda@gmail.com
>
上级
377883c4
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
52 addition
and
1 deletion
+52
-1
libavcodec/Makefile
libavcodec/Makefile
+1
-0
libavcodec/adpcm.c
libavcodec/adpcm.c
+40
-0
libavcodec/allcodecs.c
libavcodec/allcodecs.c
+1
-0
libavcodec/avcodec.h
libavcodec/avcodec.h
+1
-0
libavcodec/codec_desc.c
libavcodec/codec_desc.c
+7
-0
libavcodec/utils.c
libavcodec/utils.c
+1
-0
libavcodec/version.h
libavcodec/version.h
+1
-1
未找到文件。
libavcodec/Makefile
浏览文件 @
8b11e437
...
...
@@ -687,6 +687,7 @@ OBJS-$(CONFIG_ADPCM_IMA_WAV_ENCODER) += adpcmenc.o adpcm_data.o
OBJS-$(CONFIG_ADPCM_IMA_WS_DECODER)
+=
adpcm.o adpcm_data.o
OBJS-$(CONFIG_ADPCM_MS_DECODER)
+=
adpcm.o adpcm_data.o
OBJS-$(CONFIG_ADPCM_MS_ENCODER)
+=
adpcmenc.o adpcm_data.o
OBJS-$(CONFIG_ADPCM_PSX_DECODER)
+=
adpcm.o adpcm_data.o
OBJS-$(CONFIG_ADPCM_SBPRO_2_DECODER)
+=
adpcm.o adpcm_data.o
OBJS-$(CONFIG_ADPCM_SBPRO_3_DECODER)
+=
adpcm.o adpcm_data.o
OBJS-$(CONFIG_ADPCM_SBPRO_4_DECODER)
+=
adpcm.o adpcm_data.o
...
...
libavcodec/adpcm.c
浏览文件 @
8b11e437
...
...
@@ -152,6 +152,7 @@ static av_cold int adpcm_decode_init(AVCodecContext * avctx)
case
AV_CODEC_ID_ADPCM_THP_LE
:
case
AV_CODEC_ID_ADPCM_AFC
:
case
AV_CODEC_ID_ADPCM_DTK
:
case
AV_CODEC_ID_ADPCM_PSX
:
avctx
->
sample_fmt
=
AV_SAMPLE_FMT_S16P
;
break
;
case
AV_CODEC_ID_ADPCM_IMA_WS
:
...
...
@@ -665,6 +666,7 @@ static int get_nb_samples(AVCodecContext *avctx, GetByteContext *gb,
nb_samples
=
(
buf_size
/
128
)
*
224
/
ch
;
break
;
case
AV_CODEC_ID_ADPCM_DTK
:
case
AV_CODEC_ID_ADPCM_PSX
:
nb_samples
=
buf_size
/
(
16
*
ch
)
*
28
;
break
;
}
...
...
@@ -1548,6 +1550,43 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
bytestream2_seek
(
&
gb
,
0
,
SEEK_SET
);
}
break
;
case
AV_CODEC_ID_ADPCM_PSX
:
for
(
channel
=
0
;
channel
<
avctx
->
channels
;
channel
++
)
{
samples
=
samples_p
[
channel
];
/* Read in every sample for this channel. */
for
(
i
=
0
;
i
<
nb_samples
/
28
;
i
++
)
{
int
filter
,
shift
,
flag
,
byte
;
filter
=
bytestream2_get_byteu
(
&
gb
);
shift
=
filter
&
0xf
;
filter
=
filter
>>
4
;
if
(
filter
>=
FF_ARRAY_ELEMS
(
xa_adpcm_table
))
return
AVERROR_INVALIDDATA
;
flag
=
bytestream2_get_byteu
(
&
gb
);
/* Decode 28 samples. */
for
(
n
=
0
;
n
<
28
;
n
++
)
{
int
sample
=
0
,
scale
;
if
(
flag
<
0x07
)
{
if
(
n
&
1
)
{
scale
=
sign_extend
(
byte
>>
4
,
4
);
}
else
{
byte
=
bytestream2_get_byteu
(
&
gb
);
scale
=
sign_extend
(
byte
,
4
);
}
scale
=
scale
<<
12
;
sample
=
(
int
)((
scale
>>
shift
)
+
(
c
->
status
[
channel
].
sample1
*
xa_adpcm_table
[
filter
][
0
]
+
c
->
status
[
channel
].
sample2
*
xa_adpcm_table
[
filter
][
1
])
/
64
);
}
*
samples
++
=
av_clip_int16
(
sample
);
c
->
status
[
channel
].
sample2
=
c
->
status
[
channel
].
sample1
;
c
->
status
[
channel
].
sample1
=
sample
;
}
}
}
break
;
default:
return
-
1
;
...
...
@@ -1622,6 +1661,7 @@ ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_SMJPEG, sample_fmts_s16, adpcm_ima_smjpeg,
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_PSX
,
sample_fmts_s16p
,
adpcm_psx
,
"ADPCM PSX"
);
ADPCM_DECODER
(
AV_CODEC_ID_ADPCM_SBPRO_2
,
sample_fmts_s16
,
adpcm_sbpro_2
,
"ADPCM Sound Blaster Pro 2-bit"
);
ADPCM_DECODER
(
AV_CODEC_ID_ADPCM_SBPRO_3
,
sample_fmts_s16
,
adpcm_sbpro_3
,
"ADPCM Sound Blaster Pro 2.6-bit"
);
ADPCM_DECODER
(
AV_CODEC_ID_ADPCM_SBPRO_4
,
sample_fmts_s16
,
adpcm_sbpro_4
,
"ADPCM Sound Blaster Pro 4-bit"
);
...
...
libavcodec/allcodecs.c
浏览文件 @
8b11e437
...
...
@@ -509,6 +509,7 @@ void avcodec_register_all(void)
REGISTER_ENCDEC
(
ADPCM_IMA_WAV
,
adpcm_ima_wav
);
REGISTER_DECODER
(
ADPCM_IMA_WS
,
adpcm_ima_ws
);
REGISTER_ENCDEC
(
ADPCM_MS
,
adpcm_ms
);
REGISTER_DECODER
(
ADPCM_PSX
,
adpcm_psx
);
REGISTER_DECODER
(
ADPCM_SBPRO_2
,
adpcm_sbpro_2
);
REGISTER_DECODER
(
ADPCM_SBPRO_3
,
adpcm_sbpro_3
);
REGISTER_DECODER
(
ADPCM_SBPRO_4
,
adpcm_sbpro_4
);
...
...
libavcodec/avcodec.h
浏览文件 @
8b11e437
...
...
@@ -393,6 +393,7 @@ enum AVCodecID {
AV_CODEC_ID_ADPCM_IMA_RAD
,
AV_CODEC_ID_ADPCM_G726LE
,
AV_CODEC_ID_ADPCM_THP_LE
,
AV_CODEC_ID_ADPCM_PSX
,
/* AMR */
AV_CODEC_ID_AMR_NB
=
0x12000
,
...
...
libavcodec/codec_desc.c
浏览文件 @
8b11e437
...
...
@@ -1978,6 +1978,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"LucasArts VIMA audio"
),
.
props
=
AV_CODEC_PROP_LOSSY
,
},
{
.
id
=
AV_CODEC_ID_ADPCM_PSX
,
.
type
=
AVMEDIA_TYPE_AUDIO
,
.
name
=
"adpcm_psx"
,
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"ADPCM PSX"
),
.
props
=
AV_CODEC_PROP_LOSSY
,
},
/* AMR */
{
...
...
libavcodec/utils.c
浏览文件 @
8b11e437
...
...
@@ -3063,6 +3063,7 @@ int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes)
switch
(
id
)
{
case
AV_CODEC_ID_ADPCM_AFC
:
return
frame_bytes
/
(
9
*
ch
)
*
16
;
case
AV_CODEC_ID_ADPCM_PSX
:
case
AV_CODEC_ID_ADPCM_DTK
:
return
frame_bytes
/
(
16
*
ch
)
*
28
;
case
AV_CODEC_ID_ADPCM_4XM
:
...
...
libavcodec/version.h
浏览文件 @
8b11e437
...
...
@@ -29,7 +29,7 @@
#include "libavutil/version.h"
#define LIBAVCODEC_VERSION_MAJOR 57
#define LIBAVCODEC_VERSION_MINOR
6
#define LIBAVCODEC_VERSION_MINOR
7
#define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录