Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
7d8379f2
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,发现更多精彩内容 >>
提交
7d8379f2
编写于
2月 03, 2004
作者:
M
Mike Melanson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
added support for EA ADPCM and SMJPEG IMA ADPCM
Originally committed as revision 2744 to
svn://svn.ffmpeg.org/ffmpeg/trunk
上级
deb7a6cd
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
98 addition
and
0 deletion
+98
-0
CREDITS
CREDITS
+1
-0
doc/ffmpeg-doc.texi
doc/ffmpeg-doc.texi
+4
-0
libavcodec/adpcm.c
libavcodec/adpcm.c
+87
-0
libavcodec/allcodecs.c
libavcodec/allcodecs.c
+2
-0
libavcodec/avcodec.h
libavcodec/avcodec.h
+4
-0
未找到文件。
CREDITS
浏览文件 @
7d8379f2
...
@@ -12,6 +12,7 @@ Philip Gladstone
...
@@ -12,6 +12,7 @@ Philip Gladstone
Vladimir Gneushev
Vladimir Gneushev
Falk Hueffner
Falk Hueffner
Zdenek Kabelac
Zdenek Kabelac
Robin Kay
Nick Kurshev
Nick Kurshev
Mike Melanson
Mike Melanson
Michael Niedermayer
Michael Niedermayer
...
...
doc/ffmpeg-doc.texi
浏览文件 @
7d8379f2
...
@@ -758,9 +758,13 @@ solutions.
...
@@ -758,9 +758,13 @@ solutions.
@tab used in some Sega Saturn console games
@tab used in some Sega Saturn console games
@item Westwood Studios IMA ADPCM @tab @tab X
@item Westwood Studios IMA ADPCM @tab @tab X
@tab used in Westwood Studios games like Command and Conquer
@tab used in Westwood Studios games like Command and Conquer
@item SMJPEG IMA ADPCM @tab @tab X
@tab used in certain Loki game ports
@item CD-ROM XA ADPCM @tab @tab X
@item CD-ROM XA ADPCM @tab @tab X
@item CRI ADX ADPCM @tab X @tab X
@item CRI ADX ADPCM @tab X @tab X
@tab used in Sega Dreamcast games
@tab used in Sega Dreamcast games
@item Electronic Arts ADPCM @tab @tab X
@tab used in various EA titles
@item RA144 @tab @tab X
@item RA144 @tab @tab X
@tab Real 14400 bit/s codec
@tab Real 14400 bit/s codec
@item RA288 @tab @tab X
@item RA288 @tab @tab X
...
...
libavcodec/adpcm.c
浏览文件 @
7d8379f2
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
* Fringe ADPCM codecs (e.g., DK3, DK4, Westwood)
* Fringe ADPCM codecs (e.g., DK3, DK4, Westwood)
* by Mike Melanson (melanson@pcisys.net)
* by Mike Melanson (melanson@pcisys.net)
* CD-ROM XA ADPCM codec by BERO
* CD-ROM XA ADPCM codec by BERO
* EA ADPCM decoder by Robin Kay (komadori@myrealbox.com)
*
*
* Features and limitations:
* Features and limitations:
*
*
...
@@ -44,6 +45,13 @@
...
@@ -44,6 +45,13 @@
#define BLKSIZE 1024
#define BLKSIZE 1024
#define BE_16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1])
#define LE_16(x) ((((uint8_t*)(x))[1] << 8) | ((uint8_t*)(x))[0])
#define LE_32(x) ((((uint8_t*)(x))[3] << 24) | \
(((uint8_t*)(x))[2] << 16) | \
(((uint8_t*)(x))[1] << 8) | \
((uint8_t*)(x))[0])
#define CLAMP_TO_SHORT(value) \
#define CLAMP_TO_SHORT(value) \
if (value > 32767) \
if (value > 32767) \
value = 32767; \
value = 32767; \
...
@@ -97,6 +105,11 @@ static const int xa_adpcm_table[5][2] = {
...
@@ -97,6 +105,11 @@ static const int xa_adpcm_table[5][2] = {
{
122
,
-
60
}
{
122
,
-
60
}
};
};
static
int
ea_adpcm_table
[]
=
{
0
,
240
,
460
,
392
,
0
,
0
,
-
208
,
-
220
,
0
,
1
,
3
,
4
,
7
,
8
,
10
,
11
,
0
,
-
1
,
-
3
,
-
4
};
/* end of tables */
/* end of tables */
typedef
struct
ADPCMChannelStatus
{
typedef
struct
ADPCMChannelStatus
{
...
@@ -444,6 +457,15 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
...
@@ -444,6 +457,15 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
int
decode_top_nibble_next
=
0
;
int
decode_top_nibble_next
=
0
;
int
diff_channel
;
int
diff_channel
;
/* EA ADPCM state variables */
uint32_t
samples_in_chunk
;
int32_t
previous_left_sample
,
previous_right_sample
;
int32_t
current_left_sample
,
current_right_sample
;
int32_t
next_left_sample
,
next_right_sample
;
int32_t
coeff1l
,
coeff2l
,
coeff1r
,
coeff2r
;
uint8_t
shift_left
,
shift_right
;
int
count1
,
count2
;
if
(
!
buf_size
)
if
(
!
buf_size
)
return
0
;
return
0
;
...
@@ -715,6 +737,69 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
...
@@ -715,6 +737,69 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
buf_size
-=
128
;
buf_size
-=
128
;
}
}
break
;
break
;
case
CODEC_ID_ADPCM_EA
:
samples_in_chunk
=
LE_32
(
src
);
if
(
samples_in_chunk
>=
((
buf_size
-
12
)
*
2
))
{
src
+=
buf_size
;
break
;
}
src
+=
4
;
current_left_sample
=
(
int16_t
)
LE_16
(
src
);
src
+=
2
;
previous_left_sample
=
(
int16_t
)
LE_16
(
src
);
src
+=
2
;
current_right_sample
=
(
int16_t
)
LE_16
(
src
);
src
+=
2
;
previous_right_sample
=
(
int16_t
)
LE_16
(
src
);
src
+=
2
;
for
(
count1
=
0
;
count1
<
samples_in_chunk
/
28
;
count1
++
)
{
coeff1l
=
ea_adpcm_table
[(
*
src
>>
4
)
&
0x0F
];
coeff2l
=
ea_adpcm_table
[((
*
src
>>
4
)
&
0x0F
)
+
4
];
coeff1r
=
ea_adpcm_table
[
*
src
&
0x0F
];
coeff2r
=
ea_adpcm_table
[(
*
src
&
0x0F
)
+
4
];
src
++
;
shift_left
=
((
*
src
>>
4
)
&
0x0F
)
+
8
;
shift_right
=
(
*
src
&
0x0F
)
+
8
;
src
++
;
for
(
count2
=
0
;
count2
<
28
;
count2
++
)
{
next_left_sample
=
(((
*
src
&
0xF0
)
<<
24
)
>>
shift_left
);
next_right_sample
=
(((
*
src
&
0x0F
)
<<
28
)
>>
shift_right
);
src
++
;
next_left_sample
=
(
next_left_sample
+
(
current_left_sample
*
coeff1l
)
+
(
previous_left_sample
*
coeff2l
)
+
0x80
)
>>
8
;
next_right_sample
=
(
next_right_sample
+
(
current_right_sample
*
coeff1r
)
+
(
previous_right_sample
*
coeff2r
)
+
0x80
)
>>
8
;
CLAMP_TO_SHORT
(
next_left_sample
);
CLAMP_TO_SHORT
(
next_right_sample
);
previous_left_sample
=
current_left_sample
;
current_left_sample
=
next_left_sample
;
previous_right_sample
=
current_right_sample
;
current_right_sample
=
next_right_sample
;
*
samples
++
=
(
unsigned
short
)
current_left_sample
;
*
samples
++
=
(
unsigned
short
)
current_right_sample
;
}
}
break
;
case
CODEC_ID_ADPCM_IMA_SMJPEG
:
c
->
status
[
0
].
predictor
=
*
src
;
src
+=
2
;
c
->
status
[
0
].
step_index
=
*
src
++
;
src
++
;
/* skip another byte before getting to the meat */
while
(
src
<
buf
+
buf_size
)
{
*
samples
++
=
adpcm_ima_expand_nibble
(
&
c
->
status
[
0
],
*
src
&
0x0F
,
3
);
*
samples
++
=
adpcm_ima_expand_nibble
(
&
c
->
status
[
0
],
(
*
src
>>
4
)
&
0x0F
,
3
);
src
++
;
}
break
;
default:
default:
*
data_size
=
0
;
*
data_size
=
0
;
return
-
1
;
return
-
1
;
...
@@ -765,9 +850,11 @@ ADPCM_CODEC(CODEC_ID_ADPCM_IMA_WAV, adpcm_ima_wav);
...
@@ -765,9 +850,11 @@ ADPCM_CODEC(CODEC_ID_ADPCM_IMA_WAV, adpcm_ima_wav);
ADPCM_CODEC
(
CODEC_ID_ADPCM_IMA_DK3
,
adpcm_ima_dk3
);
ADPCM_CODEC
(
CODEC_ID_ADPCM_IMA_DK3
,
adpcm_ima_dk3
);
ADPCM_CODEC
(
CODEC_ID_ADPCM_IMA_DK4
,
adpcm_ima_dk4
);
ADPCM_CODEC
(
CODEC_ID_ADPCM_IMA_DK4
,
adpcm_ima_dk4
);
ADPCM_CODEC
(
CODEC_ID_ADPCM_IMA_WS
,
adpcm_ima_ws
);
ADPCM_CODEC
(
CODEC_ID_ADPCM_IMA_WS
,
adpcm_ima_ws
);
ADPCM_CODEC
(
CODEC_ID_ADPCM_IMA_SMJPEG
,
adpcm_ima_smjpeg
);
ADPCM_CODEC
(
CODEC_ID_ADPCM_MS
,
adpcm_ms
);
ADPCM_CODEC
(
CODEC_ID_ADPCM_MS
,
adpcm_ms
);
ADPCM_CODEC
(
CODEC_ID_ADPCM_4XM
,
adpcm_4xm
);
ADPCM_CODEC
(
CODEC_ID_ADPCM_4XM
,
adpcm_4xm
);
ADPCM_CODEC
(
CODEC_ID_ADPCM_XA
,
adpcm_xa
);
ADPCM_CODEC
(
CODEC_ID_ADPCM_XA
,
adpcm_xa
);
ADPCM_CODEC
(
CODEC_ID_ADPCM_ADX
,
adpcm_adx
);
ADPCM_CODEC
(
CODEC_ID_ADPCM_ADX
,
adpcm_adx
);
ADPCM_CODEC
(
CODEC_ID_ADPCM_EA
,
adpcm_ea
);
#undef ADPCM_CODEC
#undef ADPCM_CODEC
libavcodec/allcodecs.c
浏览文件 @
7d8379f2
...
@@ -196,10 +196,12 @@ PCM_CODEC(CODEC_ID_ADPCM_IMA_WAV, adpcm_ima_wav);
...
@@ -196,10 +196,12 @@ PCM_CODEC(CODEC_ID_ADPCM_IMA_WAV, adpcm_ima_wav);
PCM_CODEC
(
CODEC_ID_ADPCM_IMA_DK3
,
adpcm_ima_dk3
);
PCM_CODEC
(
CODEC_ID_ADPCM_IMA_DK3
,
adpcm_ima_dk3
);
PCM_CODEC
(
CODEC_ID_ADPCM_IMA_DK4
,
adpcm_ima_dk4
);
PCM_CODEC
(
CODEC_ID_ADPCM_IMA_DK4
,
adpcm_ima_dk4
);
PCM_CODEC
(
CODEC_ID_ADPCM_IMA_WS
,
adpcm_ima_ws
);
PCM_CODEC
(
CODEC_ID_ADPCM_IMA_WS
,
adpcm_ima_ws
);
PCM_CODEC
(
CODEC_ID_ADPCM_IMA_SMJPEG
,
adpcm_ima_smjpeg
);
PCM_CODEC
(
CODEC_ID_ADPCM_MS
,
adpcm_ms
);
PCM_CODEC
(
CODEC_ID_ADPCM_MS
,
adpcm_ms
);
PCM_CODEC
(
CODEC_ID_ADPCM_4XM
,
adpcm_4xm
);
PCM_CODEC
(
CODEC_ID_ADPCM_4XM
,
adpcm_4xm
);
PCM_CODEC
(
CODEC_ID_ADPCM_XA
,
adpcm_xa
);
PCM_CODEC
(
CODEC_ID_ADPCM_XA
,
adpcm_xa
);
PCM_CODEC
(
CODEC_ID_ADPCM_ADX
,
adpcm_adx
);
PCM_CODEC
(
CODEC_ID_ADPCM_ADX
,
adpcm_adx
);
PCM_CODEC
(
CODEC_ID_ADPCM_EA
,
adpcm_ea
);
#undef PCM_CODEC
#undef PCM_CODEC
...
...
libavcodec/avcodec.h
浏览文件 @
7d8379f2
...
@@ -110,10 +110,12 @@ enum CodecID {
...
@@ -110,10 +110,12 @@ enum CodecID {
CODEC_ID_ADPCM_IMA_DK3
,
CODEC_ID_ADPCM_IMA_DK3
,
CODEC_ID_ADPCM_IMA_DK4
,
CODEC_ID_ADPCM_IMA_DK4
,
CODEC_ID_ADPCM_IMA_WS
,
CODEC_ID_ADPCM_IMA_WS
,
CODEC_ID_ADPCM_IMA_SMJPEG
,
CODEC_ID_ADPCM_MS
,
CODEC_ID_ADPCM_MS
,
CODEC_ID_ADPCM_4XM
,
CODEC_ID_ADPCM_4XM
,
CODEC_ID_ADPCM_XA
,
CODEC_ID_ADPCM_XA
,
CODEC_ID_ADPCM_ADX
,
CODEC_ID_ADPCM_ADX
,
CODEC_ID_ADPCM_EA
,
/* AMR */
/* AMR */
CODEC_ID_AMR_NB
,
CODEC_ID_AMR_NB
,
...
@@ -1726,10 +1728,12 @@ PCM_CODEC(CODEC_ID_ADPCM_IMA_WAV, adpcm_ima_wav);
...
@@ -1726,10 +1728,12 @@ PCM_CODEC(CODEC_ID_ADPCM_IMA_WAV, adpcm_ima_wav);
PCM_CODEC
(
CODEC_ID_ADPCM_IMA_DK3
,
adpcm_ima_dk3
);
PCM_CODEC
(
CODEC_ID_ADPCM_IMA_DK3
,
adpcm_ima_dk3
);
PCM_CODEC
(
CODEC_ID_ADPCM_IMA_DK4
,
adpcm_ima_dk4
);
PCM_CODEC
(
CODEC_ID_ADPCM_IMA_DK4
,
adpcm_ima_dk4
);
PCM_CODEC
(
CODEC_ID_ADPCM_IMA_WS
,
adpcm_ima_ws
);
PCM_CODEC
(
CODEC_ID_ADPCM_IMA_WS
,
adpcm_ima_ws
);
PCM_CODEC
(
CODEC_ID_ADPCM_SMJPEG
,
adpcm_ima_smjpeg
);
PCM_CODEC
(
CODEC_ID_ADPCM_MS
,
adpcm_ms
);
PCM_CODEC
(
CODEC_ID_ADPCM_MS
,
adpcm_ms
);
PCM_CODEC
(
CODEC_ID_ADPCM_4XM
,
adpcm_4xm
);
PCM_CODEC
(
CODEC_ID_ADPCM_4XM
,
adpcm_4xm
);
PCM_CODEC
(
CODEC_ID_ADPCM_XA
,
adpcm_xa
);
PCM_CODEC
(
CODEC_ID_ADPCM_XA
,
adpcm_xa
);
PCM_CODEC
(
CODEC_ID_ADPCM_ADX
,
adpcm_adx
);
PCM_CODEC
(
CODEC_ID_ADPCM_ADX
,
adpcm_adx
);
PCM_CODEC
(
CODEC_ID_ADPCM_EA
,
adpcm_ea
);
#undef PCM_CODEC
#undef PCM_CODEC
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录