From 44477ac489a34402d9d3314857fd2358a5e58e48 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Christian=20K=C3=B6nig?= Date: Sat, 9 Apr 2011 12:01:29 +0200 Subject: [PATCH] [g3dvl] give each mv an individual weight --- .../auxiliary/vl/vl_mpeg12_mc_renderer.c | 18 +++++++------ src/gallium/auxiliary/vl/vl_vertex_buffers.c | 27 ++++++++++--------- 2 files changed, 25 insertions(+), 20 deletions(-) diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c index 455aa52919e..029c85137be 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c +++ b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c @@ -136,14 +136,10 @@ create_vert_shader(struct vl_mpeg12_mc_renderer *r) ureg_MOV(shader, ureg_writemask(o_vpos, TGSI_WRITEMASK_XY), ureg_src(t_vpos)); ureg_MOV(shader, ureg_writemask(o_vpos, TGSI_WRITEMASK_ZW), vpos); - ureg_MUL(shader, ureg_writemask(t_vpos, TGSI_WRITEMASK_Z), - ureg_scalar(flags, TGSI_SWIZZLE_W), - ureg_imm1f(shader, 0.5f)); - for (i = 0; i < 2; ++i) for (j = 0; j < 2; ++j) { ureg_MAD(shader, ureg_writemask(o_vmv[i][j], TGSI_WRITEMASK_XY), mv_scale, vmv[i][j], ureg_src(t_vpos)); - ureg_MOV(shader, ureg_writemask(o_vmv[i][j], TGSI_WRITEMASK_Z), ureg_src(t_vpos)); + ureg_MOV(shader, ureg_writemask(o_vmv[i][j], TGSI_WRITEMASK_Z), ureg_scalar(flags, TGSI_SWIZZLE_Z + i)); } ureg_MOV(shader, ureg_writemask(o_vtex[0], TGSI_WRITEMASK_XY), ureg_src(t_vpos)); @@ -162,7 +158,7 @@ create_vert_shader(struct vl_mpeg12_mc_renderer *r) ureg_MUL(shader, ureg_writemask(o_line, TGSI_WRITEMASK_Y), vrect, ureg_imm1f(shader, MACROBLOCK_HEIGHT / 2)); ureg_MOV(shader, ureg_writemask(o_line, TGSI_WRITEMASK_Z), - ureg_scalar(flags, TGSI_SWIZZLE_Z)); + ureg_scalar(flags, TGSI_SWIZZLE_Y)); ureg_IF(shader, ureg_scalar(flags, TGSI_SWIZZLE_X), &label); @@ -297,9 +293,15 @@ fetch_ref(struct ureg_program *shader, struct ureg_dst field) 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]); - ureg_LRP(shader, result, + ureg_LRP(shader, ref[0], ureg_scalar(tc[0][0], TGSI_SWIZZLE_Z), - ureg_src(ref[1]), ureg_src(ref[0])); + ureg_src(ref[0]), ureg_imm1f(shader, 0.0f)); + + ureg_LRP(shader, ref[1], + ureg_scalar(tc[1][0], TGSI_SWIZZLE_Z), + ureg_src(ref[1]), ureg_imm1f(shader, 0.0f)); + + ureg_ADD(shader, result, ureg_src(ref[0]), ureg_src(ref[1])); ureg_fixup_label(shader, intra_label, ureg_get_instruction_number(shader)); ureg_ENDIF(shader); diff --git a/src/gallium/auxiliary/vl/vl_vertex_buffers.c b/src/gallium/auxiliary/vl/vl_vertex_buffers.c index 1094b76ec0d..f3e728c65a6 100644 --- a/src/gallium/auxiliary/vl/vl_vertex_buffers.c +++ b/src/gallium/auxiliary/vl/vl_vertex_buffers.c @@ -33,11 +33,10 @@ struct vl_vertex_stream { struct vertex2s pos; - int8_t eb[3][2][2]; - int8_t dct_type_field; - int8_t mo_type_frame; - int8_t mb_type_intra; - int8_t mv_wheights; + uint8_t eb[3][2][2]; + uint8_t dct_type_field; + uint8_t mb_type_intra; + uint8_t mv_wheights[2]; struct vertex2s mv[4]; }; @@ -143,11 +142,11 @@ vl_vb_get_elems_state(struct pipe_context *pipe, int component) /* empty block element of selected component */ vertex_elems[VS_I_EB].src_offset = 4 + component * 4; - vertex_elems[VS_I_EB].src_format = PIPE_FORMAT_R8G8B8A8_SSCALED; + vertex_elems[VS_I_EB].src_format = PIPE_FORMAT_R8G8B8A8_USCALED; /* flags */ vertex_elems[VS_I_FLAGS].src_offset = 16; - vertex_elems[VS_I_FLAGS].src_format = PIPE_FORMAT_R8G8B8A8_SSCALED; + vertex_elems[VS_I_FLAGS].src_format = PIPE_FORMAT_R8G8B8A8_UNORM; /* motion vector 0 TOP element */ vertex_elems[VS_I_MV0_TOP].src_format = PIPE_FORMAT_R16G16_SSCALED; @@ -280,23 +279,27 @@ vl_vb_add_block(struct vl_vertex_buffer *buffer, struct pipe_mpeg12_macroblock * stream->eb[i][j][k] = !(mb->cbp & (*empty_block_mask)[i][j][k]); stream->dct_type_field = mb->dct_type == PIPE_MPEG12_DCT_TYPE_FIELD; - stream->mo_type_frame = mb->mo_type == PIPE_MPEG12_MOTION_TYPE_FRAME; + //stream->mo_type_frame = mb->mo_type == PIPE_MPEG12_MOTION_TYPE_FRAME; stream->mb_type_intra = mb->mb_type != PIPE_MPEG12_MACROBLOCK_TYPE_INTRA; switch (mb->mb_type) { case PIPE_MPEG12_MACROBLOCK_TYPE_FWD: - stream->mv_wheights = 0; + stream->mv_wheights[0] = 255; + stream->mv_wheights[1] = 0; break; case PIPE_MPEG12_MACROBLOCK_TYPE_BI: - stream->mv_wheights = 1; + stream->mv_wheights[0] = 127; + stream->mv_wheights[1] = 127; break; case PIPE_MPEG12_MACROBLOCK_TYPE_BKWD: - stream->mv_wheights = 2; + stream->mv_wheights[0] = 0; + stream->mv_wheights[1] = 255; break; default: - stream->mv_wheights = 0; + stream->mv_wheights[0] = 0; + stream->mv_wheights[1] = 0; } get_motion_vectors(mb, stream->mv); -- 2.30.2