summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian König <[email protected]>2011-03-20 22:14:49 +0100
committerChristian König <[email protected]>2011-03-20 22:14:49 +0100
commitf2c6affa365eee55d2e5a18f889691900711583e (patch)
tree1a941349ef5d47f04ac999f71b154022ce676ac6
parentbac8760f7f3523e9b6d5b2fd7cd46091d4883f5e (diff)
[g3dvl] simplify motion vector calculation
-rw-r--r--src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c8
-rw-r--r--src/gallium/auxiliary/vl/vl_vertex_buffers.c70
2 files changed, 29 insertions, 49 deletions
diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c
index d45b0642e3c..4f0b9ada73a 100644
--- a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c
+++ b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c
@@ -314,6 +314,9 @@ fetch_ref(struct ureg_program *shader, struct ureg_dst field)
ureg_CMP(shader, ureg_writemask(ref[0], TGSI_WRITEMASK_XY),
ureg_negate(ureg_scalar(ureg_src(field), TGSI_SWIZZLE_Y)),
tc[1], tc[0]);
+ ureg_CMP(shader, ureg_writemask(ref[1], TGSI_WRITEMASK_XY),
+ ureg_negate(ureg_scalar(ureg_src(field), TGSI_SWIZZLE_Y)),
+ tc[3], tc[2]);
ureg_IF(shader, ureg_scalar(info, TGSI_SWIZZLE_X), &bi_label);
@@ -321,7 +324,7 @@ fetch_ref(struct ureg_program *shader, struct ureg_dst field)
* result = tex(field.z ? tc[1] : tc[0], sampler[bkwd_pred ? 1 : 0])
*/
ureg_IF(shader, ureg_scalar(info, TGSI_SWIZZLE_Z), &label);
- ureg_TEX(shader, result, TGSI_TEXTURE_2D, ureg_src(ref[0]), sampler[1]);
+ ureg_TEX(shader, result, TGSI_TEXTURE_2D, ureg_src(ref[1]), sampler[1]);
ureg_fixup_label(shader, label, ureg_get_instruction_number(shader));
ureg_ELSE(shader, &label);
ureg_TEX(shader, result, TGSI_TEXTURE_2D, ureg_src(ref[0]), sampler[0]);
@@ -337,9 +340,6 @@ fetch_ref(struct ureg_program *shader, struct ureg_dst field)
* else
* ref[0..1] = tex(tc[2..3], sampler[0..1])
*/
- ureg_CMP(shader, ureg_writemask(ref[1], TGSI_WRITEMASK_XY),
- ureg_negate(ureg_scalar(ureg_src(field), TGSI_SWIZZLE_Y)),
- tc[3], tc[2]);
ureg_TEX(shader, ref[0], TGSI_TEXTURE_2D, ureg_src(ref[0]), sampler[0]);
ureg_TEX(shader, ref[1], TGSI_TEXTURE_2D, ureg_src(ref[1]), sampler[1]);
diff --git a/src/gallium/auxiliary/vl/vl_vertex_buffers.c b/src/gallium/auxiliary/vl/vl_vertex_buffers.c
index 928910f572e..f791d4eca8d 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;
}
}