[g3dvl] make macroblock_size configurable in mc
authorChristian König <deathsimple@vodafone.de>
Sat, 16 Apr 2011 14:22:53 +0000 (16:22 +0200)
committerChristian König <deathsimple@vodafone.de>
Sat, 16 Apr 2011 14:22:53 +0000 (16:22 +0200)
src/gallium/auxiliary/vl/vl_mpeg12_decoder.c
src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c
src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h

index 64127cf2d697c9a73b6a82a720199fafb6dbf915..08b740c619911e3bf1d3ac57f8838b0467ce4750 100644 (file)
@@ -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))
index afec37e28d9e2f15dfa586f24b8fe8f4e95bbeca..b87bd6b14c9cda2728bc84c6ac9ffc96ef85db06 100644 (file)
@@ -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;
index b5dd0139b0239b3997a0d936a02e72c38f7842b4..4137ac407d26b6560058be3f9cc27209d6a6d50b 100644 (file)
@@ -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);