Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
316a2ec8
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,发现更多精彩内容 >>
提交
316a2ec8
编写于
12月 23, 2005
作者:
M
Michael Niedermayer
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
bidir refine support
Originally committed as revision 4768 to
svn://svn.ffmpeg.org/ffmpeg/trunk
上级
377798d6
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
71 addition
and
3 deletion
+71
-3
libavcodec/avcodec.h
libavcodec/avcodec.h
+7
-0
libavcodec/motion_est.c
libavcodec/motion_est.c
+63
-3
libavcodec/utils.c
libavcodec/utils.c
+1
-0
未找到文件。
libavcodec/avcodec.h
浏览文件 @
316a2ec8
...
...
@@ -1862,6 +1862,13 @@ typedef struct AVCodecContext {
* - decoding: set by user.
*/
enum
AVDiscard
skip_frame
;
/**
*
* - encoding: set by user.
* - decoding: unused
*/
int
bidir_refine
;
}
AVCodecContext
;
/**
...
...
libavcodec/motion_est.c
浏览文件 @
316a2ec8
...
...
@@ -1617,6 +1617,7 @@ static inline int check_bidir_mv(MpegEncContext * s,
/* refine the bidir vectors in hq mode and return the score in both lq & hq mode*/
static
inline
int
bidir_refine
(
MpegEncContext
*
s
,
int
mb_x
,
int
mb_y
)
{
MotionEstContext
*
const
c
=
&
s
->
me
;
const
int
mot_stride
=
s
->
mb_stride
;
const
int
xy
=
mb_y
*
mot_stride
+
mb_x
;
int
fbmin
;
...
...
@@ -1628,8 +1629,13 @@ static inline int bidir_refine(MpegEncContext * s, int mb_x, int mb_y)
int
motion_fy
=
s
->
b_bidir_forw_mv_table
[
xy
][
1
]
=
s
->
b_forw_mv_table
[
xy
][
1
];
int
motion_bx
=
s
->
b_bidir_back_mv_table
[
xy
][
0
]
=
s
->
b_back_mv_table
[
xy
][
0
];
int
motion_by
=
s
->
b_bidir_back_mv_table
[
xy
][
1
]
=
s
->
b_back_mv_table
[
xy
][
1
];
//FIXME do refinement and add flag
const
int
flags
=
c
->
sub_flags
;
const
int
qpel
=
flags
&
FLAG_QPEL
;
const
int
shift
=
1
+
qpel
;
const
int
xmin
=
c
->
xmin
<<
shift
;
const
int
ymin
=
c
->
ymin
<<
shift
;
const
int
xmax
=
c
->
xmax
<<
shift
;
const
int
ymax
=
c
->
ymax
<<
shift
;
fbmin
=
check_bidir_mv
(
s
,
motion_fx
,
motion_fy
,
motion_bx
,
motion_by
,
...
...
@@ -1637,7 +1643,61 @@ static inline int bidir_refine(MpegEncContext * s, int mb_x, int mb_y)
pred_bx
,
pred_by
,
0
,
16
);
return
fbmin
;
if
(
s
->
avctx
->
bidir_refine
){
int
score
,
end
;
#define CHECK_BIDIR(fx,fy,bx,by)\
score= check_bidir_mv(s, motion_fx+fx, motion_fy+fy, motion_bx+bx, motion_by+by, pred_fx, pred_fy, pred_bx, pred_by, 0, 16);\
if(score < fbmin){\
fbmin= score;\
motion_fx+=fx;\
motion_fy+=fy;\
motion_bx+=bx;\
motion_by+=by;\
end=0;\
}
#define CHECK_BIDIR2(a,b,c,d)\
CHECK_BIDIR(a,b,c,d)\
CHECK_BIDIR(-a,-b,-c,-d)
#define CHECK_BIDIRR(a,b,c,d)\
CHECK_BIDIR2(a,b,c,d)\
CHECK_BIDIR2(b,c,d,a)\
CHECK_BIDIR2(c,d,a,b)\
CHECK_BIDIR2(d,a,b,c)
do
{
end
=
1
;
if
(
motion_fx
>=
xmax
||
motion_bx
>=
xmax
||
motion_fx
<=
xmin
||
motion_bx
<=
xmin
||
motion_fy
>=
ymax
||
motion_by
>=
ymax
||
motion_fy
<=
ymin
||
motion_by
<=
ymin
)
break
;
CHECK_BIDIRR
(
0
,
0
,
0
,
1
)
if
(
s
->
avctx
->
bidir_refine
>
1
){
CHECK_BIDIRR
(
0
,
0
,
1
,
1
)
CHECK_BIDIR2
(
0
,
1
,
0
,
1
)
CHECK_BIDIR2
(
1
,
0
,
1
,
0
)
CHECK_BIDIRR
(
0
,
0
,
-
1
,
1
)
CHECK_BIDIR2
(
0
,
-
1
,
0
,
1
)
CHECK_BIDIR2
(
-
1
,
0
,
1
,
0
)
if
(
s
->
avctx
->
bidir_refine
>
2
){
CHECK_BIDIRR
(
0
,
1
,
1
,
1
)
CHECK_BIDIRR
(
0
,
-
1
,
1
,
1
)
CHECK_BIDIRR
(
0
,
1
,
-
1
,
1
)
CHECK_BIDIRR
(
0
,
1
,
1
,
-
1
)
if
(
s
->
avctx
->
bidir_refine
>
3
){
CHECK_BIDIR2
(
1
,
1
,
1
,
1
)
CHECK_BIDIRR
(
1
,
1
,
1
,
-
1
)
CHECK_BIDIR2
(
1
,
1
,
-
1
,
-
1
)
CHECK_BIDIR2
(
1
,
-
1
,
-
1
,
1
)
CHECK_BIDIR2
(
1
,
-
1
,
1
,
-
1
)
}
}
}
}
while
(
!
end
);
}
return
fbmin
;
}
static
inline
int
direct_search
(
MpegEncContext
*
s
,
int
mb_x
,
int
mb_y
)
...
...
libavcodec/utils.c
浏览文件 @
316a2ec8
...
...
@@ -707,6 +707,7 @@ static AVOption options[]={
{
"mb_lmin"
,
NULL
,
OFFSET
(
mb_lmin
),
FF_OPT_TYPE_INT
,
DEFAULT
,
INT_MIN
,
INT_MAX
,
V
|
E
},
{
"mb_lmax"
,
NULL
,
OFFSET
(
mb_lmax
),
FF_OPT_TYPE_INT
,
DEFAULT
,
INT_MIN
,
INT_MAX
,
V
|
E
},
{
"me_penalty_compensation"
,
NULL
,
OFFSET
(
me_penalty_compensation
),
FF_OPT_TYPE_INT
,
DEFAULT
,
INT_MIN
,
INT_MAX
,
V
|
E
},
{
"bidir_refine"
,
NULL
,
OFFSET
(
bidir_refine
),
FF_OPT_TYPE_INT
,
DEFAULT
,
0
,
4
,
V
|
E
},
{
NULL
},
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录