Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
fc384777
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,发现更多精彩内容 >>
提交
fc384777
编写于
10月 15, 2003
作者:
M
Mike Melanson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
activate the XA and ADX ADPCM codecs
Originally committed as revision 2385 to
svn://svn.ffmpeg.org/ffmpeg/trunk
上级
f19af812
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
122 addition
and
4 deletion
+122
-4
libavcodec/Makefile
libavcodec/Makefile
+1
-1
libavcodec/adpcm.c
libavcodec/adpcm.c
+98
-2
libavcodec/allcodecs.c
libavcodec/allcodecs.c
+12
-0
libavcodec/avcodec.h
libavcodec/avcodec.h
+11
-1
未找到文件。
libavcodec/Makefile
浏览文件 @
fc384777
...
@@ -18,7 +18,7 @@ OBJS= common.o utils.o mem.o allcodecs.o \
...
@@ -18,7 +18,7 @@ OBJS= common.o utils.o mem.o allcodecs.o \
fft.o mdct.o mace.o huffyuv.o cyuv.o opts.o raw.o h264.o golomb.o
\
fft.o mdct.o mace.o huffyuv.o cyuv.o opts.o raw.o h264.o golomb.o
\
vp3.o asv1.o 4xm.o cabac.o ffv1.o ra144.o ra288.o vcr1.o cljr.o
\
vp3.o asv1.o 4xm.o cabac.o ffv1.o ra144.o ra288.o vcr1.o cljr.o
\
roqvideo.o dpcm.o interplayvideo.o xan.o rpza.o cinepak.o msrle.o
\
roqvideo.o dpcm.o interplayvideo.o xan.o rpza.o cinepak.o msrle.o
\
msvideo1.o vqavideo.o idcinvideo.o
msvideo1.o vqavideo.o idcinvideo.o
adx.o
ifeq
($(AMR_NB),yes)
ifeq
($(AMR_NB),yes)
ifeq
($(AMR_NB_FIXED),yes)
ifeq
($(AMR_NB_FIXED),yes)
...
...
libavcodec/adpcm.c
浏览文件 @
fc384777
...
@@ -21,9 +21,10 @@
...
@@ -21,9 +21,10 @@
/**
/**
* @file adpcm.c
* @file adpcm.c
* ADPCM codecs.
* ADPCM codecs.
* First version by Francois Revol
revol@free.fr
* First version by Francois Revol
(revol@free.fr)
* 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
*
*
* Features and limitations:
* Features and limitations:
*
*
...
@@ -34,6 +35,11 @@
...
@@ -34,6 +35,11 @@
* XAnim sources (xa_codec.c) http://www.rasnaimaging.com/people/lapus/download.html
* XAnim sources (xa_codec.c) http://www.rasnaimaging.com/people/lapus/download.html
* http://www.cs.ucla.edu/~leec/mediabench/applications.html
* http://www.cs.ucla.edu/~leec/mediabench/applications.html
* SoX source code http://home.sprynet.com/~cbagwell/sox.html
* SoX source code http://home.sprynet.com/~cbagwell/sox.html
*
* CD-ROM XA:
* http://ku-www.ss.titech.ac.jp/~yatsushi/xaadpcm.html
* vagpack & depack http://homepages.compuserve.de/bITmASTER32/psx-index.html
* readstr http://www.geocities.co.jp/Playtown/2004/
*/
*/
#define BLKSIZE 1024
#define BLKSIZE 1024
...
@@ -67,7 +73,7 @@ static const int step_table[89] = {
...
@@ -67,7 +73,7 @@ static const int step_table[89] = {
15289
,
16818
,
18500
,
20350
,
22385
,
24623
,
27086
,
29794
,
32767
15289
,
16818
,
18500
,
20350
,
22385
,
24623
,
27086
,
29794
,
32767
};
};
/* Th
o
se are for MS-ADPCM */
/* Th
e
se are for MS-ADPCM */
/* AdaptationTable[], AdaptCoeff1[], and AdaptCoeff2[] are from libsndfile */
/* AdaptationTable[], AdaptCoeff1[], and AdaptCoeff2[] are from libsndfile */
static
const
int
AdaptationTable
[]
=
{
static
const
int
AdaptationTable
[]
=
{
230
,
230
,
230
,
230
,
307
,
409
,
512
,
614
,
230
,
230
,
230
,
230
,
307
,
409
,
512
,
614
,
...
@@ -82,6 +88,15 @@ static const int AdaptCoeff2[] = {
...
@@ -82,6 +88,15 @@ static const int AdaptCoeff2[] = {
0
,
-
256
,
0
,
64
,
0
,
-
208
,
-
232
0
,
-
256
,
0
,
64
,
0
,
-
208
,
-
232
};
};
/* These are for CD-ROM XA ADPCM */
const
static
int
xa_adpcm_table
[
5
][
2
]
=
{
{
0
,
0
},
{
60
,
0
},
{
115
,
-
52
},
{
98
,
-
55
},
{
122
,
-
60
}
};
/* end of tables */
/* end of tables */
typedef
struct
ADPCMChannelStatus
{
typedef
struct
ADPCMChannelStatus
{
...
@@ -355,6 +370,74 @@ static inline short adpcm_ms_expand_nibble(ADPCMChannelStatus *c, char nibble)
...
@@ -355,6 +370,74 @@ static inline short adpcm_ms_expand_nibble(ADPCMChannelStatus *c, char nibble)
return
(
short
)
predictor
;
return
(
short
)
predictor
;
}
}
static
void
xa_decode
(
short
*
out
,
const
unsigned
char
*
in
,
ADPCMChannelStatus
*
left
,
ADPCMChannelStatus
*
right
,
int
inc
)
{
int
i
,
j
;
int
shift
,
filter
,
f0
,
f1
;
int
s_1
,
s_2
;
int
d
,
s
,
t
;
for
(
i
=
0
;
i
<
4
;
i
++
)
{
shift
=
12
-
(
in
[
4
+
i
*
2
]
&
15
);
filter
=
in
[
4
+
i
*
2
]
>>
4
;
f0
=
xa_adpcm_table
[
filter
][
0
];
f1
=
xa_adpcm_table
[
filter
][
1
];
s_1
=
left
->
sample1
;
s_2
=
left
->
sample2
;
for
(
j
=
0
;
j
<
28
;
j
++
)
{
d
=
in
[
16
+
i
+
j
*
4
];
t
=
(
signed
char
)(
d
<<
4
)
>>
4
;
s
=
(
t
<<
shift
)
+
((
s_1
*
f0
+
s_2
*
f1
+
32
)
>>
6
);
CLAMP_TO_SHORT
(
s
);
*
out
=
s
;
out
+=
inc
;
s_2
=
s_1
;
s_1
=
s
;
}
if
(
inc
==
2
)
{
/* stereo */
left
->
sample1
=
s_1
;
left
->
sample2
=
s_2
;
s_1
=
right
->
sample1
;
s_2
=
right
->
sample2
;
out
=
out
+
1
-
28
*
2
;
}
shift
=
12
-
(
in
[
5
+
i
*
2
]
&
15
);
filter
=
in
[
5
+
i
*
2
]
>>
4
;
f0
=
xa_adpcm_table
[
filter
][
0
];
f1
=
xa_adpcm_table
[
filter
][
1
];
for
(
j
=
0
;
j
<
28
;
j
++
)
{
d
=
in
[
16
+
i
+
j
*
4
];
t
=
(
signed
char
)
d
>>
4
;
s
=
(
t
<<
shift
)
+
((
s_1
*
f0
+
s_2
*
f1
+
32
)
>>
6
);
CLAMP_TO_SHORT
(
s
);
*
out
=
s
;
out
+=
inc
;
s_2
=
s_1
;
s_1
=
s
;
}
if
(
inc
==
2
)
{
/* stereo */
right
->
sample1
=
s_1
;
right
->
sample2
=
s_2
;
out
-=
1
;
}
else
{
left
->
sample1
=
s_1
;
left
->
sample2
=
s_2
;
}
}
}
/* DK3 ADPCM support macro */
/* DK3 ADPCM support macro */
#define DK3_GET_NEXT_NIBBLE() \
#define DK3_GET_NEXT_NIBBLE() \
if (decode_top_nibble_next) \
if (decode_top_nibble_next) \
...
@@ -679,6 +762,17 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
...
@@ -679,6 +762,17 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
src
++
;
src
++
;
}
}
break
;
break
;
case
CODEC_ID_ADPCM_XA
:
c
->
status
[
0
].
sample1
=
c
->
status
[
0
].
sample2
=
c
->
status
[
1
].
sample1
=
c
->
status
[
1
].
sample2
=
0
;
while
(
buf_size
>=
128
)
{
xa_decode
(
samples
,
src
,
&
c
->
status
[
0
],
&
c
->
status
[
1
],
avctx
->
channels
);
src
+=
128
;
samples
+=
28
*
8
;
buf_size
-=
128
;
}
break
;
default:
default:
*
data_size
=
0
;
*
data_size
=
0
;
return
-
1
;
return
-
1
;
...
@@ -731,5 +825,7 @@ ADPCM_CODEC(CODEC_ID_ADPCM_IMA_DK4, adpcm_ima_dk4);
...
@@ -731,5 +825,7 @@ 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_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_ADX
,
adpcm_adx
);
#undef ADPCM_CODEC
#undef ADPCM_CODEC
libavcodec/allcodecs.c
浏览文件 @
fc384777
...
@@ -146,20 +146,30 @@ void avcodec_register_all(void)
...
@@ -146,20 +146,30 @@ void avcodec_register_all(void)
#ifdef AMR_NB
#ifdef AMR_NB
register_avcodec
(
&
amr_nb_decoder
);
register_avcodec
(
&
amr_nb_decoder
);
#ifdef CONFIG_ENCODERS
register_avcodec
(
&
amr_nb_encoder
);
register_avcodec
(
&
amr_nb_encoder
);
#endif //CONFIG_ENCODERS
#endif
/* AMR_NB */
#endif
/* AMR_NB */
#ifdef AMR_WB
#ifdef AMR_WB
register_avcodec
(
&
amr_wb_decoder
);
register_avcodec
(
&
amr_wb_decoder
);
#ifdef CONFIG_ENCODERS
register_avcodec
(
&
amr_wb_encoder
);
register_avcodec
(
&
amr_wb_encoder
);
#endif //CONFIG_ENCODERS
#endif
/* AMR_WB */
#endif
/* AMR_WB */
/* pcm codecs */
/* pcm codecs */
#ifdef CONFIG_ENCODERS
#define PCM_CODEC(id, name) \
#define PCM_CODEC(id, name) \
register_avcodec(& name ## _encoder); \
register_avcodec(& name ## _encoder); \
register_avcodec(& name ## _decoder); \
register_avcodec(& name ## _decoder); \
#else
#define PCM_CODEC(id, name) \
register_avcodec(& name ## _decoder);
#endif
PCM_CODEC
(
CODEC_ID_PCM_S16LE
,
pcm_s16le
);
PCM_CODEC
(
CODEC_ID_PCM_S16LE
,
pcm_s16le
);
PCM_CODEC
(
CODEC_ID_PCM_S16BE
,
pcm_s16be
);
PCM_CODEC
(
CODEC_ID_PCM_S16BE
,
pcm_s16be
);
PCM_CODEC
(
CODEC_ID_PCM_U16LE
,
pcm_u16le
);
PCM_CODEC
(
CODEC_ID_PCM_U16LE
,
pcm_u16le
);
...
@@ -177,6 +187,8 @@ PCM_CODEC(CODEC_ID_ADPCM_IMA_DK4, adpcm_ima_dk4);
...
@@ -177,6 +187,8 @@ 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_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_ADX
,
adpcm_adx
);
#undef PCM_CODEC
#undef PCM_CODEC
}
}
...
...
libavcodec/avcodec.h
浏览文件 @
fc384777
...
@@ -101,6 +101,8 @@ enum CodecID {
...
@@ -101,6 +101,8 @@ enum CodecID {
CODEC_ID_ADPCM_IMA_WS
,
CODEC_ID_ADPCM_IMA_WS
,
CODEC_ID_ADPCM_MS
,
CODEC_ID_ADPCM_MS
,
CODEC_ID_ADPCM_4XM
,
CODEC_ID_ADPCM_4XM
,
CODEC_ID_ADPCM_XA
,
CODEC_ID_ADPCM_ADX
,
/* AMR */
/* AMR */
CODEC_ID_AMR_NB
,
CODEC_ID_AMR_NB
,
...
@@ -138,7 +140,10 @@ enum CodecType {
...
@@ -138,7 +140,10 @@ enum CodecType {
* image data is stored in AVFrame.data[0]. The palette is transported in
* image data is stored in AVFrame.data[0]. The palette is transported in
* AVFrame.data[1] and, is 1024 bytes long (256 4-byte entries) and is
* AVFrame.data[1] and, is 1024 bytes long (256 4-byte entries) and is
* formatted the same as in PIX_FMT_RGBA32 described above (i.e., it is
* formatted the same as in PIX_FMT_RGBA32 described above (i.e., it is
* also endian-specific).
* also endian-specific). Note also that the individual RGB palette
* components stored in AVFrame.data[1] should be in the range 0..255.
* This is important as many custom PAL8 video codecs that were designed
* to run on the IBM VGA graphics adapter use 6-bit palette components.
*/
*/
enum
PixelFormat
{
enum
PixelFormat
{
PIX_FMT_YUV420P
,
///< Planar YUV 4:2:0 (1 Cr & Cb sample per 2x2 Y samples)
PIX_FMT_YUV420P
,
///< Planar YUV 4:2:0 (1 Cr & Cb sample per 2x2 Y samples)
...
@@ -1488,6 +1493,8 @@ PCM_CODEC(CODEC_ID_ADPCM_IMA_DK4, adpcm_ima_dk4);
...
@@ -1488,6 +1493,8 @@ 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_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_ADX
,
adpcm_adx
);
#undef PCM_CODEC
#undef PCM_CODEC
...
@@ -1741,6 +1748,9 @@ void av_free_static(void);
...
@@ -1741,6 +1748,9 @@ void av_free_static(void);
void
*
__av_mallocz_static
(
void
**
location
,
unsigned
int
size
);
void
*
__av_mallocz_static
(
void
**
location
,
unsigned
int
size
);
#define av_mallocz_static(p, s) __av_mallocz_static((void **)(p), s)
#define av_mallocz_static(p, s) __av_mallocz_static((void **)(p), s)
/* add by bero : in adx.c */
int
is_adx
(
const
unsigned
char
*
buf
,
size_t
bufsize
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录