summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/vl/vl_vertex_buffers.c
diff options
context:
space:
mode:
authorChristian König <deathsimple@vodafone.de>2011-03-20 22:14:49 +0100
committerChristian König <deathsimple@vodafone.de>2011-03-20 22:14:49 +0100
commitf2c6affa365eee55d2e5a18f889691900711583e (patch)
tree1a941349ef5d47f04ac999f71b154022ce676ac6 /src/gallium/auxiliary/vl/vl_vertex_buffers.c
parentbac8760f7f3523e9b6d5b2fd7cd46091d4883f5e (diff)
downloadexternal_mesa3d-f2c6affa365eee55d2e5a18f889691900711583e.zip
external_mesa3d-f2c6affa365eee55d2e5a18f889691900711583e.tar.gz
external_mesa3d-f2c6affa365eee55d2e5a18f889691900711583e.tar.bz2
[g3dvl] simplify motion vector calculation
Diffstat (limited to 'src/gallium/auxiliary/vl/vl_vertex_buffers.c')
-rw-r--r--src/gallium/auxiliary/vl/vl_vertex_buffers.c70
1 files changed, 25 insertions, 45 deletions
diff --git a/src/gallium/auxiliary/vl/vl_vertex_buffers.c b/src/gallium/auxiliary/vl/vl_vertex_buffers.c
index 928910f..f791d4e 100644
--- a/src/gallium/auxiliary/vl/vl_vertex_buffers.c
+++ b/src/gallium/auxiliary/vl/vl_vertex_buffers.c
@@ -208,62 +208,42 @@ vl_vb_map(struct vl_vertex_buffer *buffer, struct pipe_context *pipe)
static void
get_motion_vectors(struct pipe_mpeg12_macroblock *mb, struct vertex2s mv[4])
{
- switch (mb->mb_type) {
- case PIPE_MPEG12_MACROBLOCK_TYPE_BI:
- {
- if (mb->mo_type == PIPE_MPEG12_MOTION_TYPE_FRAME) {
- mv[2].x = mb->mv[1].top.x;
- mv[2].y = mb->mv[1].top.y;
+ if (mb->mb_type == PIPE_MPEG12_MACROBLOCK_TYPE_BI ||
+ mb->mb_type == PIPE_MPEG12_MACROBLOCK_TYPE_FWD) {
- } else {
- mv[2].x = mb->mv[1].top.x;
- mv[2].y = mb->mv[1].top.y - (mb->mv[1].top.y % 4);
+ if (mb->mo_type == PIPE_MPEG12_MOTION_TYPE_FRAME) {
+ mv[0].x = mb->mv[0].top.x;
+ mv[0].y = mb->mv[0].top.y;
- mv[3].x = mb->mv[1].bottom.x;
- mv[3].y = mb->mv[1].bottom.y - (mb->mv[1].bottom.y % 4);
+ } else {
+ mv[0].x = mb->mv[0].top.x;
+ mv[0].y = mb->mv[0].top.y - (mb->mv[0].top.y % 4);
- if (mb->mv[1].top.field_select) mv[2].y += 2;
- if (!mb->mv[1].bottom.field_select) mv[3].y -= 2;
- }
+ mv[1].x = mb->mv[0].bottom.x;
+ mv[1].y = mb->mv[0].bottom.y - (mb->mv[0].bottom.y % 4);
- /* fall-through */
+ if (mb->mv[0].top.field_select) mv[0].y += 2;
+ if (!mb->mv[0].bottom.field_select) mv[1].y -= 2;
}
- case PIPE_MPEG12_MACROBLOCK_TYPE_FWD:
- {
- if (mb->mo_type == PIPE_MPEG12_MOTION_TYPE_FRAME) {
- mv[0].x = mb->mv[0].top.x;
- mv[0].y = mb->mv[0].top.y;
+ }
- } else {
- mv[0].x = mb->mv[0].top.x;
- mv[0].y = mb->mv[0].top.y - (mb->mv[0].top.y % 4);
+ if (mb->mb_type == PIPE_MPEG12_MACROBLOCK_TYPE_BI ||
+ mb->mb_type == PIPE_MPEG12_MACROBLOCK_TYPE_BKWD) {
- mv[1].x = mb->mv[0].bottom.x;
- mv[1].y = mb->mv[0].bottom.y - (mb->mv[0].bottom.y % 4);
+ if (mb->mo_type == PIPE_MPEG12_MOTION_TYPE_FRAME) {
+ mv[2].x = mb->mv[1].top.x;
+ mv[2].y = mb->mv[1].top.y;
- if (mb->mv[0].top.field_select) mv[0].y += 2;
- if (!mb->mv[0].bottom.field_select) mv[1].y -= 2;
- }
- break;
+ } else {
+ mv[2].x = mb->mv[1].top.x;
+ mv[2].y = mb->mv[1].top.y - (mb->mv[1].top.y % 4);
- case PIPE_MPEG12_MACROBLOCK_TYPE_BKWD:
- if (mb->mo_type == PIPE_MPEG12_MOTION_TYPE_FRAME) {
- mv[0].x = mb->mv[1].top.x;
- mv[0].y = mb->mv[1].top.y;
-
- } else {
- mv[0].x = mb->mv[1].top.x;
- mv[0].y = mb->mv[1].top.y - (mb->mv[1].top.y % 4);
-
- mv[1].x = mb->mv[1].bottom.x;
- mv[1].y = mb->mv[1].bottom.y - (mb->mv[1].bottom.y % 4);
+ mv[3].x = mb->mv[1].bottom.x;
+ mv[3].y = mb->mv[1].bottom.y - (mb->mv[1].bottom.y % 4);
- if (mb->mv[1].top.field_select) mv[0].y += 2;
- if (!mb->mv[1].bottom.field_select) mv[1].y -= 2;
- }
+ if (mb->mv[1].top.field_select) mv[2].y += 2;
+ if (!mb->mv[1].bottom.field_select) mv[3].y -= 2;
}
- default:
- break;
}
}