Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
TrueDei
FFmpeg
提交
b304244b
F
FFmpeg
项目概览
TrueDei
/
FFmpeg
通知
1
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,发现更多精彩内容 >>
提交
b304244b
编写于
9月 07, 2011
作者:
B
Baptiste Coudurier
提交者:
Justin Ruggles
9月 23, 2011
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
adpcmenc: fix QT IMA ADPCM encoder
Signed-off-by:
N
Michael Niedermayer
<
michaelni@gmx.at
>
上级
bf334535
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
38 addition
and
7 deletion
+38
-7
libavcodec/adpcmenc.c
libavcodec/adpcmenc.c
+35
-4
tests/ref/acodec/adpcm_ima_qt
tests/ref/acodec/adpcm_ima_qt
+3
-3
未找到文件。
libavcodec/adpcmenc.c
浏览文件 @
b304244b
...
...
@@ -164,6 +164,39 @@ static inline unsigned char adpcm_ima_compress_sample(ADPCMChannelStatus *c, sho
return
nibble
;
}
static
inline
unsigned
char
adpcm_ima_qt_compress_sample
(
ADPCMChannelStatus
*
c
,
short
sample
)
{
int
delta
=
sample
-
c
->
prev_sample
;
int
mask
,
step
=
ff_adpcm_step_table
[
c
->
step_index
];
int
diff
=
step
>>
3
;
int
nibble
=
0
;
if
(
delta
<
0
)
{
nibble
=
8
;
delta
=
-
delta
;
}
for
(
mask
=
4
;
mask
;)
{
if
(
delta
>=
step
)
{
nibble
|=
mask
;
delta
-=
step
;
diff
+=
step
;
}
step
>>=
1
;
mask
>>=
1
;
}
if
(
nibble
&
8
)
c
->
prev_sample
-=
diff
;
else
c
->
prev_sample
+=
diff
;
c
->
prev_sample
=
av_clip_int16
(
c
->
prev_sample
);
c
->
step_index
=
av_clip
(
c
->
step_index
+
ff_adpcm_index_table
[
nibble
],
0
,
88
);
return
nibble
;
}
static
inline
unsigned
char
adpcm_ms_compress_sample
(
ADPCMChannelStatus
*
c
,
short
sample
)
{
int
predictor
,
nibble
,
bias
;
...
...
@@ -497,16 +530,14 @@ static int adpcm_encode_frame(AVCodecContext *avctx,
adpcm_compress_trellis
(
avctx
,
samples
+
ch
,
buf
,
&
c
->
status
[
ch
],
64
);
for
(
i
=
0
;
i
<
64
;
i
++
)
put_bits
(
&
pb
,
4
,
buf
[
i
^
1
]);
c
->
status
[
ch
].
prev_sample
=
c
->
status
[
ch
].
predictor
&
~
0x7F
;
}
else
{
for
(
i
=
0
;
i
<
64
;
i
+=
2
){
int
t1
,
t2
;
t1
=
adpcm_ima_compress_sample
(
&
c
->
status
[
ch
],
samples
[
avctx
->
channels
*
(
i
+
0
)
+
ch
]);
t2
=
adpcm_ima_compress_sample
(
&
c
->
status
[
ch
],
samples
[
avctx
->
channels
*
(
i
+
1
)
+
ch
]);
t1
=
adpcm_ima_
qt_
compress_sample
(
&
c
->
status
[
ch
],
samples
[
avctx
->
channels
*
(
i
+
0
)
+
ch
]);
t2
=
adpcm_ima_
qt_
compress_sample
(
&
c
->
status
[
ch
],
samples
[
avctx
->
channels
*
(
i
+
1
)
+
ch
]);
put_bits
(
&
pb
,
4
,
t2
);
put_bits
(
&
pb
,
4
,
t1
);
}
c
->
status
[
ch
].
prev_sample
&=
~
0x7F
;
}
}
...
...
tests/ref/acodec/adpcm_ima_qt
浏览文件 @
b304244b
0
19564da45949d0b5278bd75ee9a4ac2
*./tests/data/acodec/adpcm_qt.aiff
0
57d27978b35888776512e4e9669a63b
*./tests/data/acodec/adpcm_qt.aiff
281252 ./tests/data/acodec/adpcm_qt.aiff
a7fb054f7bd82270c8fd476eb9f5677c
*./tests/data/adpcm_ima_qt.acodec.out.wav
stddev: 9
20.19 PSNR: 37.05
MAXDIFF:34029 bytes: 1058560/ 1058400
3890343c0c20934e014d7ac93f5d65bd
*./tests/data/adpcm_ima_qt.acodec.out.wav
stddev: 9
18.61 PSNR: 37.07
MAXDIFF:34029 bytes: 1058560/ 1058400
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录