From e3789105fe3a289338821a53da499857aa924637 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Christian=20K=C3=B6nig?= Date: Wed, 4 May 2011 22:05:03 +0200 Subject: [PATCH] [g3dvl] divide mpg12 width height by 16 --- .../auxiliary/vl/vl_mpeg12_bitstream.c | 19 ++++++++----------- src/gallium/auxiliary/vl/vl_mpeg12_decoder.c | 4 +++- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_bitstream.c b/src/gallium/auxiliary/vl/vl_mpeg12_bitstream.c index da00f3730a1..142bcaba080 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_bitstream.c +++ b/src/gallium/auxiliary/vl/vl_mpeg12_bitstream.c @@ -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; diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c index b78844b9cfd..4ac3b90ad78 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c +++ b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c @@ -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; -- 2.30.2