From f1485e155a985df3100708f4bfb1a9d7c72217f4 Mon Sep 17 00:00:00 2001 From: Christian König Date: Sat, 16 Apr 2011 16:22:53 +0200 Subject: [g3dvl] make macroblock_size configurable in mc --- src/gallium/auxiliary/vl/vl_mpeg12_decoder.c | 5 ++-- src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c | 38 +++++++++++++----------- src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h | 4 ++- 3 files changed, 27 insertions(+), 20 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c index 64127cf2d69..08b740c6199 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c +++ b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c @@ -756,10 +756,11 @@ vl_create_mpeg12_decoder(struct pipe_video_context *context, } } - if (!vl_mc_init(&dec->mc_y, dec->pipe, dec->base.width, dec->base.height, mc_scale)) + if (!vl_mc_init(&dec->mc_y, dec->pipe, dec->base.width, dec->base.height, MACROBLOCK_HEIGHT, mc_scale)) goto error_mc_y; - if (!vl_mc_init(&dec->mc_c, dec->pipe, dec->base.width, dec->base.height, mc_scale)) + // TODO + if (!vl_mc_init(&dec->mc_c, dec->pipe, dec->base.width, dec->base.height, BLOCK_HEIGHT, mc_scale)) goto error_mc_c; if (!init_pipe_state(dec)) diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c index afec37e28d9..b87bd6b14c9 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c +++ b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c @@ -149,21 +149,23 @@ create_ycbcr_vert_shader(struct vl_mpeg12_mc_renderer *r) ureg_scalar(eb, TGSI_SWIZZLE_W), ureg_scalar(eb, TGSI_SWIZZLE_Z)); - ureg_IF(shader, ureg_scalar(flags, TGSI_SWIZZLE_Y), &label); - - ureg_MOV(shader, ureg_writemask(t_vtex, TGSI_WRITEMASK_X), vrect); - ureg_MUL(shader, ureg_writemask(t_vtex, TGSI_WRITEMASK_Y), vrect, ureg_imm1f(shader, 0.5f)); - ureg_ADD(shader, ureg_writemask(t_vtex, TGSI_WRITEMASK_XY), vpos, ureg_src(t_vtex)); - ureg_MUL(shader, ureg_writemask(o_vtex[0], TGSI_WRITEMASK_XY), ureg_src(t_vtex), block_scale); - ureg_ADD(shader, ureg_writemask(t_vtex, TGSI_WRITEMASK_Y), ureg_src(t_vtex), ureg_imm1f(shader, 0.5f)); - ureg_MUL(shader, ureg_writemask(o_vtex[1], TGSI_WRITEMASK_XY), ureg_src(t_vtex), block_scale); - - ureg_MUL(shader, ureg_writemask(o_line, TGSI_WRITEMASK_Y), - ureg_scalar(vrect, TGSI_SWIZZLE_Y), - ureg_imm1f(shader, MACROBLOCK_HEIGHT / 2)); - - ureg_fixup_label(shader, label, ureg_get_instruction_number(shader)); - ureg_ENDIF(shader); + if (r->macroblock_size == MACROBLOCK_HEIGHT) { //TODO + ureg_IF(shader, ureg_scalar(flags, TGSI_SWIZZLE_Y), &label); + + ureg_MOV(shader, ureg_writemask(t_vtex, TGSI_WRITEMASK_X), vrect); + ureg_MUL(shader, ureg_writemask(t_vtex, TGSI_WRITEMASK_Y), vrect, ureg_imm1f(shader, 0.5f)); + ureg_ADD(shader, ureg_writemask(t_vtex, TGSI_WRITEMASK_XY), vpos, ureg_src(t_vtex)); + ureg_MUL(shader, ureg_writemask(o_vtex[0], TGSI_WRITEMASK_XY), ureg_src(t_vtex), block_scale); + ureg_ADD(shader, ureg_writemask(t_vtex, TGSI_WRITEMASK_Y), ureg_src(t_vtex), ureg_imm1f(shader, 0.5f)); + ureg_MUL(shader, ureg_writemask(o_vtex[1], TGSI_WRITEMASK_XY), ureg_src(t_vtex), block_scale); + + ureg_MUL(shader, ureg_writemask(o_line, TGSI_WRITEMASK_Y), + ureg_scalar(vrect, TGSI_SWIZZLE_Y), + ureg_imm1f(shader, MACROBLOCK_HEIGHT / 2)); + + ureg_fixup_label(shader, label, ureg_get_instruction_number(shader)); + ureg_ENDIF(shader); + } ureg_release_temporary(shader, t_vtex); ureg_release_temporary(shader, t_vpos); @@ -211,7 +213,7 @@ create_ref_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)); + vrect, ureg_imm1f(shader, r->macroblock_size / 2)); mv_scale = ureg_imm4f(shader, 0.5f / r->buffer_width, @@ -451,7 +453,8 @@ cleanup_pipe_state(struct vl_mpeg12_mc_renderer *r) bool vl_mc_init(struct vl_mpeg12_mc_renderer *renderer, struct pipe_context *pipe, - unsigned buffer_width, unsigned buffer_height, float scale) + unsigned buffer_width, unsigned buffer_height, + unsigned macroblock_size, float scale) { assert(renderer); assert(pipe); @@ -461,6 +464,7 @@ vl_mc_init(struct vl_mpeg12_mc_renderer *renderer, struct pipe_context *pipe, renderer->pipe = pipe; renderer->buffer_width = buffer_width; renderer->buffer_height = buffer_height; + renderer->macroblock_size = macroblock_size; if (!init_pipe_state(renderer)) goto error_pipe_state; diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h index b5dd0139b02..4137ac407d2 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h +++ b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h @@ -40,6 +40,7 @@ struct vl_mpeg12_mc_renderer struct pipe_context *pipe; unsigned buffer_width; unsigned buffer_height; + unsigned macroblock_size; void *rs_state; @@ -62,7 +63,8 @@ struct vl_mpeg12_mc_buffer }; bool vl_mc_init(struct vl_mpeg12_mc_renderer *renderer, struct pipe_context *pipe, - unsigned picture_width, unsigned picture_height, float scale); + unsigned picture_width, unsigned picture_height, + unsigned macroblock_size, float scale); void vl_mc_cleanup(struct vl_mpeg12_mc_renderer *renderer); -- cgit v1.2.3