Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
93fbdb5a
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,发现更多精彩内容 >>
提交
93fbdb5a
编写于
8月 02, 2004
作者:
M
Michael Niedermayer
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
lossless support
Originally committed as revision 3374 to
svn://svn.ffmpeg.org/ffmpeg/trunk
上级
3bb9f096
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
37 addition
and
7 deletion
+37
-7
libavcodec/snow.c
libavcodec/snow.c
+37
-7
未找到文件。
libavcodec/snow.c
浏览文件 @
93fbdb5a
...
...
@@ -30,6 +30,7 @@
#define MAX_PLANES 4
#define DWTELEM int
#define QROOT 8
#define LOSSLESS_QLOG -128
static
const
int8_t
quant3
[
256
]
=
{
0
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
...
...
@@ -2246,6 +2247,8 @@ static void quantize(SnowContext *s, SubBand *b, DWTELEM *src, int stride, int b
assert
(
QROOT
==
8
);
if
(
s
->
qlog
==
LOSSLESS_QLOG
)
return
;
bias
=
bias
?
0
:
(
3
*
qmul
)
>>
3
;
thres1
=
((
qmul
-
bias
)
>>
QEXPSHIFT
)
-
1
;
thres2
=
2
*
thres1
;
...
...
@@ -2305,6 +2308,8 @@ static void dequantize(SnowContext *s, SubBand *b, DWTELEM *src, int stride){
const
int
qadd
=
(
s
->
qbias
*
qmul
)
>>
QBIAS_SHIFT
;
int
x
,
y
;
if
(
s
->
qlog
==
LOSSLESS_QLOG
)
return
;
assert
(
QROOT
==
8
);
for
(
y
=
0
;
y
<
h
;
y
++
){
...
...
@@ -2673,9 +2678,13 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size,
s
->
keyframe
=
avctx
->
gop_size
==
0
||
avctx
->
frame_number
%
avctx
->
gop_size
==
0
;
pict
->
pict_type
=
s
->
keyframe
?
FF_I_TYPE
:
FF_P_TYPE
;
s
->
qlog
=
rint
(
QROOT
*
log
(
pict
->
quality
/
(
float
)
FF_QP2LAMBDA
)
/
log
(
2
));
//<64 >60
s
->
qlog
+=
61
;
if
(
pict
->
quality
){
s
->
qlog
=
rint
(
QROOT
*
log
(
pict
->
quality
/
(
float
)
FF_QP2LAMBDA
)
/
log
(
2
));
//<64 >60
s
->
qlog
+=
61
;
}
else
{
s
->
qlog
=
LOSSLESS_QLOG
;
}
for
(
i
=
0
;
i
<
s
->
mb_band
.
stride
*
s
->
mb_band
.
height
;
i
++
){
s
->
mb_band
.
buf
[
i
]
=
s
->
keyframe
;
...
...
@@ -2877,8 +2886,16 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size,
}
}
predict_plane
(
s
,
s
->
spatial_dwt_buffer
,
plane_index
,
0
);
spatial_dwt
(
s
,
s
->
spatial_dwt_buffer
,
w
,
h
,
w
);
if
(
s
->
qlog
==
LOSSLESS_QLOG
){
for
(
y
=
0
;
y
<
h
;
y
++
){
for
(
x
=
0
;
x
<
w
;
x
++
){
s
->
spatial_dwt_buffer
[
y
*
w
+
x
]
=
(
s
->
spatial_dwt_buffer
[
y
*
w
+
x
]
+
127
)
>>
8
;
}
}
}
spatial_dwt
(
s
,
s
->
spatial_dwt_buffer
,
w
,
h
,
w
);
for
(
level
=
0
;
level
<
s
->
spatial_decomposition_count
;
level
++
){
for
(
orientation
=
level
?
1
:
0
;
orientation
<
4
;
orientation
++
){
SubBand
*
b
=
&
p
->
band
[
level
][
orientation
];
...
...
@@ -2901,8 +2918,15 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size,
dequantize
(
s
,
b
,
b
->
buf
,
b
->
stride
);
}
}
spatial_idwt
(
s
,
s
->
spatial_dwt_buffer
,
w
,
h
,
w
);
if
(
s
->
qlog
==
LOSSLESS_QLOG
){
for
(
y
=
0
;
y
<
h
;
y
++
){
for
(
x
=
0
;
x
<
w
;
x
++
){
s
->
spatial_dwt_buffer
[
y
*
w
+
x
]
<<=
8
;
}
}
}
predict_plane
(
s
,
s
->
spatial_dwt_buffer
,
plane_index
,
1
);
//FIXME optimize
for
(
y
=
0
;
y
<
h
;
y
++
){
...
...
@@ -2918,11 +2942,10 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size,
if
(
pict
->
data
[
plane_index
])
//FIXME gray hack
for
(
y
=
0
;
y
<
h
;
y
++
){
for
(
x
=
0
;
x
<
w
;
x
++
){
int
d
=
s
->
spatial_dwt_buffer
[
y
*
w
+
x
]
-
pict
->
data
[
plane_index
][
y
*
pict
->
linesize
[
plane_index
]
+
x
]
*
256
;
int
d
=
s
->
current_picture
.
data
[
plane_index
][
y
*
s
->
current_picture
.
linesize
[
plane_index
]
+
x
]
-
pict
->
data
[
plane_index
][
y
*
pict
->
linesize
[
plane_index
]
+
x
]
;
error
+=
d
*
d
;
}
}
error
=
(
error
+
128
*
256
)
>>
16
;
s
->
avctx
->
error
[
plane_index
]
+=
error
;
s
->
avctx
->
error
[
3
]
+=
error
;
}
...
...
@@ -3041,6 +3064,13 @@ if(!(s->avctx->debug&1024))
}
spatial_idwt
(
s
,
s
->
spatial_dwt_buffer
,
w
,
h
,
w
);
if
(
s
->
qlog
==
LOSSLESS_QLOG
){
for
(
y
=
0
;
y
<
h
;
y
++
){
for
(
x
=
0
;
x
<
w
;
x
++
){
s
->
spatial_dwt_buffer
[
y
*
w
+
x
]
<<=
8
;
}
}
}
predict_plane
(
s
,
s
->
spatial_dwt_buffer
,
plane_index
,
1
);
//FIXME optimize
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录