Mesa (pipe-video): [g3dvl] fix field selection of mb without mc

Christian König deathsimple at kemper.freedesktop.org
Sun May 15 17:24:32 UTC 2011


Module: Mesa
Branch: pipe-video
Commit: 3b773d06d2edd39ce6e6ab6e306e3cca121dddfc
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=3b773d06d2edd39ce6e6ab6e306e3cca121dddfc

Author: Christian König <deathsimple at vodafone.de>
Date:   Sun May  8 13:39:56 2011 +0200

[g3dvl] fix field selection of mb without mc

---

 src/gallium/auxiliary/vl/vl_mpeg12_bitstream.c |   41 +++++++++++++----------
 1 files changed, 23 insertions(+), 18 deletions(-)

diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_bitstream.c b/src/gallium/auxiliary/vl/vl_mpeg12_bitstream.c
index 9401081..02bf903 100644
--- a/src/gallium/auxiliary/vl/vl_mpeg12_bitstream.c
+++ b/src/gallium/auxiliary/vl/vl_mpeg12_bitstream.c
@@ -1612,6 +1612,7 @@ slice_init(struct vl_mpg12_bs *bs, struct pipe_mpeg12_picture_desc * picture,
 static inline bool
 decode_slice(struct vl_mpg12_bs *bs, struct pipe_mpeg12_picture_desc *picture, const int scan[64])
 {
+   enum pipe_video_field_select default_field_select;
    struct pipe_motionvector mv_fwd, mv_bwd;
    enum pipe_mpeg12_dct_type dct_type;
 
@@ -1621,14 +1622,28 @@ decode_slice(struct vl_mpg12_bs *bs, struct pipe_mpeg12_picture_desc *picture, c
 
    int x, y;
 
+   switch(picture->picture_structure) {
+   case TOP_FIELD:
+      default_field_select = PIPE_VIDEO_TOP_FIELD;
+      break;
+
+   case BOTTOM_FIELD:
+      default_field_select = PIPE_VIDEO_BOTTOM_FIELD;
+      break;
+
+   default:
+      default_field_select = PIPE_VIDEO_FRAME;
+      break;
+   }
+
    if (!slice_init(bs, picture, &quantizer_scale, &x, &y))
       return false;
 
    mv_fwd.top.x = mv_fwd.top.y = mv_fwd.bottom.x = mv_fwd.bottom.y = 0;
-   mv_fwd.top.field_select = mv_fwd.bottom.field_select = PIPE_VIDEO_FRAME;
+   mv_fwd.top.field_select = mv_fwd.bottom.field_select = default_field_select;
 
    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;
+   mv_bwd.top.field_select = mv_bwd.bottom.field_select = default_field_select;
 
    while (1) {
       int macroblock_modes;
@@ -1648,6 +1663,10 @@ decode_slice(struct vl_mpg12_bs *bs, struct pipe_mpeg12_picture_desc *picture, c
          break;
 
       default:
+         mv_fwd.top.field_select = mv_fwd.bottom.field_select = default_field_select;
+         mv_bwd.top.field_select = mv_bwd.bottom.field_select = default_field_select;
+
+         /* fall through */
       case MACROBLOCK_MOTION_FORWARD:
          mv_fwd.top.weight = mv_fwd.bottom.weight = PIPE_VIDEO_MV_WEIGHT_MAX;
          mv_bwd.top.weight = mv_bwd.bottom.weight = PIPE_VIDEO_MV_WEIGHT_MIN;
@@ -1787,22 +1806,8 @@ decode_slice(struct vl_mpg12_bs *bs, struct pipe_mpeg12_picture_desc *picture, c
          //TODO  conversion to signed format signed format
          dc_dct_pred[0] = dc_dct_pred[1] = dc_dct_pred[2] = 0;
 
-         switch(picture->picture_structure) {
-         case FRAME_PICTURE:
-            mv_fwd.top.field_select = mv_fwd.bottom.field_select = PIPE_VIDEO_FRAME;
-            mv_bwd.top.field_select = mv_bwd.bottom.field_select = PIPE_VIDEO_FRAME;
-            break;
-
-         case TOP_FIELD:
-            mv_fwd.top.field_select = mv_fwd.bottom.field_select = PIPE_VIDEO_TOP_FIELD;
-            mv_bwd.top.field_select = mv_bwd.bottom.field_select = PIPE_VIDEO_TOP_FIELD;
-            break;
-
-         case BOTTOM_FIELD:
-            mv_fwd.top.field_select = mv_fwd.bottom.field_select = PIPE_VIDEO_BOTTOM_FIELD;
-            mv_bwd.top.field_select = mv_bwd.bottom.field_select = PIPE_VIDEO_BOTTOM_FIELD;
-            break;
-         }
+         mv_fwd.top.field_select = mv_fwd.bottom.field_select = default_field_select;
+         mv_bwd.top.field_select = mv_bwd.bottom.field_select = default_field_select;
 
          if (picture->picture_coding_type == P_TYPE) {
             mv_fwd.top.x = mv_fwd.top.y = mv_fwd.bottom.x = mv_fwd.bottom.y = 0;




More information about the mesa-commit mailing list