OSDN Git Service

[g3dvl] divide mpg12 width height by 16
authorChristian König <deathsimple@vodafone.de>
Wed, 4 May 2011 20:05:03 +0000 (22:05 +0200)
committerChristian König <deathsimple@vodafone.de>
Wed, 4 May 2011 20:05:03 +0000 (22:05 +0200)
src/gallium/auxiliary/vl/vl_mpeg12_bitstream.c
src/gallium/auxiliary/vl/vl_mpeg12_decoder.c

index da00f37..142bcab 100644 (file)
@@ -1592,12 +1592,12 @@ do {                                                    \
 
 #define NEXT_MACROBLOCK                                \
 do {                                           \
-   bs->mv_stream[0][x+y*bs->width/16] = mv_fwd; \
-   bs->mv_stream[1][x+y*bs->width/16] = mv_bwd; \
+   bs->mv_stream[0][x+y*bs->width] = mv_fwd;    \
+   bs->mv_stream[1][x+y*bs->width] = mv_bwd;    \
    ++x;                                                \
-   if (x == bs->width/16) {                    \
+   if (x == bs->width) {                       \
       ++y;                                      \
-      if (y >= bs->height/16)                   \
+      if (y >= bs->height)                      \
          return false;                          \
       x = 0;                                    \
    }                                            \
@@ -1613,7 +1613,7 @@ slice_init(struct vl_mpg12_bs *bs, struct pipe_mpeg12_picture_desc * picture, in
       if(!vl_vlc_getbyte(&bs->vlc))
          return false;
    }
-   *y = ((bs->vlc.buf & 0xFF) - 1) * 16;
+   *y = (bs->vlc.buf & 0xFF) - 1;
    vl_vlc_restart(&bs->vlc);
 
    //TODO conversion to signed format signed format
@@ -1652,11 +1652,11 @@ slice_init(struct vl_mpg12_bs *bs, struct pipe_mpeg12_picture_desc * picture, in
       }
    }
    vl_vlc_dumpbits(&bs->vlc, mba->len + 1);
-   *x = (*x + mba->mba) << 4;
+   *x += mba->mba;
 
    while (*x >= bs->width) {
       *x -= bs->width;
-      *y += 16;
+      (*y)++;
    }
    if (*y > bs->height)
       return false;
@@ -1680,9 +1680,6 @@ decode_slice(struct vl_mpg12_bs *bs, struct pipe_mpeg12_picture_desc *picture)
    mv_bwd.top.x = mv_bwd.top.y = mv_bwd.bottom.x = mv_bwd.bottom.y = 0;
    mv_bwd.top.field_select = mv_bwd.bottom.field_select = PIPE_VIDEO_FRAME;
 
-   x /= 16;
-   y /= 16;
-
    while (1) {
       int macroblock_modes;
       int mba_inc;
@@ -1897,7 +1894,7 @@ vl_mpg12_bs_set_buffers(struct vl_mpg12_bs *bs, struct pipe_ycbcr_block *ycbcr_s
       bs->mv_stream[i] = mv_stream[i];
 
    // TODO
-   for (i = 0; i < bs->width/16*bs->height/16; ++i) {
+   for (i = 0; i < bs->width*bs->height; ++i) {
       bs->mv_stream[0][i].top.x = bs->mv_stream[0][i].top.y = 0;
       bs->mv_stream[0][i].top.field_select = PIPE_VIDEO_FRAME;
       bs->mv_stream[0][i].top.weight = PIPE_VIDEO_MV_WEIGHT_MAX;
index b78844b..4ac3b90 100644 (file)
@@ -505,7 +505,9 @@ vl_mpeg12_create_buffer(struct pipe_video_decoder *decoder)
       goto error_zscan;
 
    if (dec->base.entrypoint == PIPE_VIDEO_ENTRYPOINT_BITSTREAM)
-      vl_mpg12_bs_init(&buffer->bs, dec->base.width, dec->base.height);
+      vl_mpg12_bs_init(&buffer->bs,
+                       dec->base.width / MACROBLOCK_WIDTH,
+                       dec->base.height / MACROBLOCK_HEIGHT);
 
    return &buffer->base;