Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
ea676144
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,发现更多精彩内容 >>
提交
ea676144
编写于
2月 13, 2010
作者:
D
David Conrad
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Eliminate macroblock -> fragment mapping array
Originally committed as revision 21801 to
svn://svn.ffmpeg.org/ffmpeg/trunk
上级
19cd517d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
33 addition
and
50 deletion
+33
-50
libavcodec/vp3.c
libavcodec/vp3.c
+33
-50
未找到文件。
libavcodec/vp3.c
浏览文件 @
ea676144
...
...
@@ -206,10 +206,6 @@ typedef struct Vp3DecodeContext {
* index. */
int
*
superblock_fragments
;
/* This table contains macroblock_count * 6 entries. Each set of 6
* numbers corresponds to the fragment indexes 0..5 which comprise
* the macroblock (4 Y fragments and 2 C fragments). */
int
*
macroblock_fragments
;
/* This is an array that indicates how a particular macroblock
* is coded. */
unsigned
char
*
macroblock_coding
;
...
...
@@ -353,46 +349,34 @@ static int init_block_mapping(Vp3DecodeContext *s)
/* initialize the macroblock <-> fragment mapping */
current_fragment
=
0
;
current_macroblock
=
0
;
mapping_index
=
0
;
for
(
i
=
0
;
i
<
s
->
fragment_height
;
i
+=
2
)
{
for
(
j
=
0
;
j
<
s
->
fragment_width
;
j
+=
2
)
{
s
->
all_fragments
[
current_fragment
].
macroblock
=
current_macroblock
;
s
->
macroblock_fragments
[
mapping_index
++
]
=
current_fragment
;
if
(
j
+
1
<
s
->
fragment_width
)
{
s
->
all_fragments
[
current_fragment
+
1
].
macroblock
=
current_macroblock
;
s
->
macroblock_fragments
[
mapping_index
++
]
=
current_fragment
+
1
;
}
else
s
->
macroblock_fragments
[
mapping_index
++
]
=
-
1
;
}
if
(
i
+
1
<
s
->
fragment_height
)
{
s
->
all_fragments
[
current_fragment
+
s
->
fragment_width
].
macroblock
=
current_macroblock
;
s
->
macroblock_fragments
[
mapping_index
++
]
=
current_fragment
+
s
->
fragment_width
;
}
else
s
->
macroblock_fragments
[
mapping_index
++
]
=
-
1
;
}
if
((
j
+
1
<
s
->
fragment_width
)
&&
(
i
+
1
<
s
->
fragment_height
))
{
s
->
all_fragments
[
current_fragment
+
s
->
fragment_width
+
1
].
macroblock
=
current_macroblock
;
s
->
macroblock_fragments
[
mapping_index
++
]
=
current_fragment
+
s
->
fragment_width
+
1
;
}
else
s
->
macroblock_fragments
[
mapping_index
++
]
=
-
1
;
}
/* C planes */
c_fragment
=
s
->
fragment_start
[
1
]
+
(
i
*
s
->
fragment_width
/
4
)
+
(
j
/
2
);
s
->
all_fragments
[
c_fragment
].
macroblock
=
s
->
macroblock_count
;
s
->
macroblock_fragments
[
mapping_index
++
]
=
c_fragment
;
c_fragment
=
s
->
fragment_start
[
2
]
+
(
i
*
s
->
fragment_width
/
4
)
+
(
j
/
2
);
s
->
all_fragments
[
c_fragment
].
macroblock
=
s
->
macroblock_count
;
s
->
macroblock_fragments
[
mapping_index
++
]
=
c_fragment
;
if
(
j
+
2
<=
s
->
fragment_width
)
current_fragment
+=
2
;
...
...
@@ -742,6 +726,9 @@ static int unpack_modes(Vp3DecodeContext *s, GetBitContext *gb)
(
s
->
macroblock_coding
[
current_macroblock
]
==
MODE_COPY
))
continue
;
#define BLOCK_X (2*mb_x + (k&1))
#define BLOCK_Y (2*mb_y + (k>>1))
/* mode 7 means get 3 bits for each coding mode */
if
(
scheme
==
7
)
coding_mode
=
get_bits
(
gb
,
3
);
...
...
@@ -753,16 +740,17 @@ static int unpack_modes(Vp3DecodeContext *s, GetBitContext *gb)
[
get_vlc2
(
gb
,
s
->
mode_code_vlc
.
table
,
3
,
3
)];
s
->
macroblock_coding
[
current_macroblock
]
=
coding_mode
;
for
(
k
=
0
;
k
<
6
;
k
++
)
{
for
(
k
=
0
;
k
<
4
;
k
++
)
{
current_fragment
=
s
->
macroblock_fragments
[
current_macroblock
*
6
+
k
];
if
(
current_fragment
==
-
1
)
continue
;
if
(
current_fragment
>=
s
->
fragment_count
)
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
" vp3:unpack_modes(): bad fragment number (%d >= %d)
\n
"
,
current_fragment
,
s
->
fragment_count
);
return
1
;
}
BLOCK_Y
*
s
->
fragment_width
+
BLOCK_X
;
if
(
s
->
all_fragments
[
current_fragment
].
coding_method
!=
MODE_COPY
)
s
->
all_fragments
[
current_fragment
].
coding_method
=
coding_mode
;
}
for
(
k
=
0
;
k
<
2
;
k
++
)
{
current_fragment
=
s
->
fragment_start
[
k
+
1
]
+
mb_y
*
(
s
->
fragment_width
>>
1
)
+
mb_x
;
if
(
s
->
all_fragments
[
current_fragment
].
coding_method
!=
MODE_COPY
)
s
->
all_fragments
[
current_fragment
].
coding_method
=
...
...
@@ -816,12 +804,6 @@ static int unpack_vectors(Vp3DecodeContext *s, GetBitContext *gb)
(
s
->
macroblock_coding
[
current_macroblock
]
==
MODE_COPY
))
continue
;
current_fragment
=
s
->
macroblock_fragments
[
current_macroblock
*
6
];
if
(
current_fragment
>=
s
->
fragment_count
)
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
" vp3:unpack_vectors(): bad fragment number (%d >= %d
\n
"
,
current_fragment
,
s
->
fragment_count
);
return
1
;
}
switch
(
s
->
macroblock_coding
[
current_macroblock
])
{
case
MODE_INTER_PLUS_MV
:
...
...
@@ -854,8 +836,9 @@ static int unpack_vectors(Vp3DecodeContext *s, GetBitContext *gb)
* Y fragment, then average for the C fragment vectors */
motion_x
[
4
]
=
motion_y
[
4
]
=
0
;
for
(
k
=
0
;
k
<
4
;
k
++
)
{
current_fragment
=
BLOCK_Y
*
s
->
fragment_width
+
BLOCK_X
;
for
(
l
=
0
;
l
<
s
->
coded_fragment_list_index
;
l
++
)
if
(
s
->
coded_fragment_list
[
l
]
==
s
->
macroblock_fragments
[
6
*
current_macroblock
+
k
]
)
if
(
s
->
coded_fragment_list
[
l
]
==
current_fragment
)
break
;
if
(
l
<
s
->
coded_fragment_list_index
)
{
if
(
coding_mode
==
0
)
{
...
...
@@ -913,16 +896,9 @@ static int unpack_vectors(Vp3DecodeContext *s, GetBitContext *gb)
}
/* assign the motion vectors to the correct fragments */
for
(
k
=
0
;
k
<
6
;
k
++
)
{
for
(
k
=
0
;
k
<
4
;
k
++
)
{
current_fragment
=
s
->
macroblock_fragments
[
current_macroblock
*
6
+
k
];
if
(
current_fragment
==
-
1
)
continue
;
if
(
current_fragment
>=
s
->
fragment_count
)
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
" vp3:unpack_vectors(): bad fragment number (%d >= %d)
\n
"
,
current_fragment
,
s
->
fragment_count
);
return
1
;
}
BLOCK_Y
*
s
->
fragment_width
+
BLOCK_X
;
if
(
s
->
macroblock_coding
[
current_macroblock
]
==
MODE_INTER_FOURMV
)
{
s
->
all_fragments
[
current_fragment
].
motion_x
=
motion_x
[
k
];
s
->
all_fragments
[
current_fragment
].
motion_y
=
motion_y
[
k
];
...
...
@@ -931,6 +907,17 @@ static int unpack_vectors(Vp3DecodeContext *s, GetBitContext *gb)
s
->
all_fragments
[
current_fragment
].
motion_y
=
motion_y
[
0
];
}
}
for
(
k
=
0
;
k
<
2
;
k
++
)
{
current_fragment
=
s
->
fragment_start
[
k
+
1
]
+
mb_y
*
(
s
->
fragment_width
>>
1
)
+
mb_x
;
if
(
s
->
macroblock_coding
[
current_macroblock
]
==
MODE_INTER_FOURMV
)
{
s
->
all_fragments
[
current_fragment
].
motion_x
=
motion_x
[
k
+
4
];
s
->
all_fragments
[
current_fragment
].
motion_y
=
motion_y
[
k
+
4
];
}
else
{
s
->
all_fragments
[
current_fragment
].
motion_x
=
motion_x
[
0
];
s
->
all_fragments
[
current_fragment
].
motion_y
=
motion_y
[
0
];
}
}
}
}
}
...
...
@@ -1441,7 +1428,6 @@ static void render_slice(Vp3DecodeContext *s, int slice)
int
motion_halfpel_index
;
uint8_t
*
motion_source
;
int
plane
;
int
current_macroblock_entry
=
slice
*
s
->
macroblock_width
*
6
;
if
(
slice
>=
s
->
macroblock_height
)
return
;
...
...
@@ -1455,7 +1441,7 @@ static void render_slice(Vp3DecodeContext *s, int slice)
int
plane_height
=
s
->
height
>>
!!
plane
;
int
y
=
slice
*
FRAGMENT_PIXELS
<<
!
plane
;
int
slice_height
=
y
+
(
FRAGMENT_PIXELS
<<
!
plane
);
int
i
=
s
->
macroblock_fragments
[
current_macroblock_entry
+
plane
+
3
*!!
plane
]
;
int
i
=
s
->
fragment_start
[
plane
]
+
(
y
>>
3
)
*
(
s
->
fragment_width
>>!!
plane
)
;
if
(
!
s
->
flipped_image
)
stride
=
-
stride
;
...
...
@@ -1781,10 +1767,8 @@ static av_cold int vp3_decode_init(AVCodecContext *avctx)
/* work out the block mapping tables */
s
->
superblock_fragments
=
av_malloc
(
s
->
superblock_count
*
16
*
sizeof
(
int
));
s
->
macroblock_fragments
=
av_malloc
(
s
->
macroblock_count
*
6
*
sizeof
(
int
));
s
->
macroblock_coding
=
av_malloc
(
s
->
macroblock_count
+
1
);
if
(
!
s
->
superblock_fragments
||
!
s
->
macroblock_fragments
||
!
s
->
macroblock_coding
)
{
if
(
!
s
->
superblock_fragments
||
!
s
->
macroblock_coding
)
{
vp3_decode_end
(
avctx
);
return
-
1
;
}
...
...
@@ -1981,7 +1965,6 @@ static av_cold int vp3_decode_end(AVCodecContext *avctx)
av_free
(
s
->
coded_fragment_list
);
av_free
(
s
->
fast_fragment_list
);
av_free
(
s
->
superblock_fragments
);
av_free
(
s
->
macroblock_fragments
);
av_free
(
s
->
macroblock_coding
);
for
(
i
=
0
;
i
<
16
;
i
++
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录