[g3dvl] remove dc_dct_pred from picture structure
authorChristian König <deathsimple@vodafone.de>
Wed, 4 May 2011 20:16:03 +0000 (22:16 +0200)
committerChristian König <deathsimple@vodafone.de>
Wed, 4 May 2011 20:16:03 +0000 (22:16 +0200)
src/gallium/auxiliary/vl/vl_mpeg12_bitstream.c
src/gallium/include/pipe/p_video_state.h

index 142bcaba08015961569780b41408c467d51ad1c6..221ebdd391ebbb42d07f14f570be3c1f40317c3e 100644 (file)
@@ -1313,7 +1313,7 @@ get_mpeg1_non_intra_block(struct vl_mpg12_bs *bs, struct pipe_mpeg12_picture_des
 
 static inline void
 slice_intra_DCT(struct vl_mpg12_bs *bs, struct pipe_mpeg12_picture_desc * picture, int cc,
-                unsigned x, unsigned y, enum pipe_mpeg12_dct_type coding)
+                unsigned x, unsigned y, enum pipe_mpeg12_dct_type coding, int dc_dct_pred[3])
 {
    short *dest = bs->ycbcr_buffer[cc];
 
@@ -1326,12 +1326,12 @@ slice_intra_DCT(struct vl_mpg12_bs *bs, struct pipe_mpeg12_picture_desc * pictur
 
    /* Get the intra DC coefficient and inverse quantize it */
    if (cc == 0)
-      picture->dc_dct_pred[0] += get_luma_dc_dct_diff(bs);
+      dc_dct_pred[0] += get_luma_dc_dct_diff(bs);
    else
-      picture->dc_dct_pred[cc] += get_chroma_dc_dct_diff(bs);
+      dc_dct_pred[cc] += get_chroma_dc_dct_diff(bs);
 
    memset(dest, 0, sizeof(int16_t) * 64);
-   dest[0] = picture->dc_dct_pred[cc] << (3 - picture->intra_dc_precision);
+   dest[0] = dc_dct_pred[cc] << (3 - picture->intra_dc_precision);
    if (picture->mpeg1) {
       if (picture->picture_coding_type != D_TYPE)
           get_mpeg1_intra_block(bs, picture, dest);
@@ -1616,9 +1616,6 @@ slice_init(struct vl_mpg12_bs *bs, struct pipe_mpeg12_picture_desc * picture, in
    *y = (bs->vlc.buf & 0xFF) - 1;
    vl_vlc_restart(&bs->vlc);
 
-   //TODO conversion to signed format signed format
-   picture->dc_dct_pred[0] = picture->dc_dct_pred[1] = picture->dc_dct_pred[2] = 0;
-
    picture->quantizer_scale = get_quantizer_scale(bs, picture);
 
    /* ignore intra_slice and all the extra data */
@@ -1669,6 +1666,10 @@ decode_slice(struct vl_mpg12_bs *bs, struct pipe_mpeg12_picture_desc *picture)
 {
    struct pipe_motionvector mv_fwd, mv_bwd;
    enum pipe_mpeg12_dct_type dct_type;
+
+   /* predictor for DC coefficients in intra blocks */
+   int dc_dct_pred[3] = { 0, 0, 0 };
+
    int x, y;
 
    if (!slice_init(bs, picture, &x, &y))
@@ -1729,12 +1730,12 @@ decode_slice(struct vl_mpg12_bs *bs, struct pipe_mpeg12_picture_desc *picture)
          mv_bwd.top.weight = mv_bwd.bottom.weight = PIPE_VIDEO_MV_WEIGHT_MIN;
 
          // unravaled loop of 6 block(i) calls in macroblock()
-         slice_intra_DCT(bs, picture, 0, x*2+0, y*2+0, dct_type);
-         slice_intra_DCT(bs, picture, 0, x*2+1, y*2+0, dct_type);
-         slice_intra_DCT(bs, picture, 0, x*2+0, y*2+1, dct_type);
-         slice_intra_DCT(bs, picture, 0, x*2+1, y*2+1, dct_type);
-         slice_intra_DCT(bs, picture, 1, x, y, dct_type);
-         slice_intra_DCT(bs, picture, 2, x, y, dct_type);
+         slice_intra_DCT(bs, picture, 0, x*2+0, y*2+0, dct_type, dc_dct_pred);
+         slice_intra_DCT(bs, picture, 0, x*2+1, y*2+0, dct_type, dc_dct_pred);
+         slice_intra_DCT(bs, picture, 0, x*2+0, y*2+1, dct_type, dc_dct_pred);
+         slice_intra_DCT(bs, picture, 0, x*2+1, y*2+1, dct_type, dc_dct_pred);
+         slice_intra_DCT(bs, picture, 1, x, y, dct_type, dc_dct_pred);
+         slice_intra_DCT(bs, picture, 2, x, y, dct_type, dc_dct_pred);
 
          if (picture->picture_coding_type == D_TYPE) {
             vl_vlc_needbits(&bs->vlc);
@@ -1805,7 +1806,7 @@ decode_slice(struct vl_mpg12_bs *bs, struct pipe_mpeg12_picture_desc *picture)
                slice_non_intra_DCT(bs, picture, 2, x, y, dct_type); // cc2 croma
          }
 
-         picture->dc_dct_pred[0] = picture->dc_dct_pred[1] = picture->dc_dct_pred[2] = 0;
+         dc_dct_pred[0] = dc_dct_pred[1] = dc_dct_pred[2] = 0;
       }
 
       NEXT_MACROBLOCK;
@@ -1835,7 +1836,7 @@ decode_slice(struct vl_mpg12_bs *bs, struct pipe_mpeg12_picture_desc *picture)
       mba_inc += mba->mba;
       if (mba_inc) {
          //TODO  conversion to signed format signed format
-         picture->dc_dct_pred[0] = picture->dc_dct_pred[1] = picture->dc_dct_pred[2] = 0;
+         dc_dct_pred[0] = dc_dct_pred[1] = dc_dct_pred[2] = 0;
 
          switch(picture->picture_structure) {
          case FRAME_PICTURE:
index 54fb1b7a5950b3f8a7ec6ae3e7ae28878f2a6274..828bebb56ecd79cb748fd8c69d713c2cc00279d9 100644 (file)
@@ -122,9 +122,6 @@ struct pipe_mpeg12_picture_desc
    uint8_t *intra_quantizer_matrix;
    uint8_t *non_intra_quantizer_matrix;
 
-   /* predictor for DC coefficients in intra blocks */
-   int16_t dc_dct_pred[3];
-
    int quantizer_scale;
 
 #if 0