From f2c6affa365eee55d2e5a18f889691900711583e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6nig?= Date: Sun, 20 Mar 2011 22:14:49 +0100 Subject: [g3dvl] simplify motion vector calculation --- src/gallium/auxiliary/vl/vl_vertex_buffers.c | 70 ++++++++++------------------ 1 file changed, 25 insertions(+), 45 deletions(-) (limited to 'src/gallium/auxiliary/vl/vl_vertex_buffers.c') 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; } } -- cgit v1.1