[Mesa-dev] [PATCH 06/04] state_trackers/vdpau: Add support for VC-1 decoding

Maarten Lankhorst m.b.lankhorst at gmail.com
Mon Oct 31 10:37:37 PDT 2011


Add a struct with all the fields.

Signed-off-by: Maarten Lankhorst <m.b.lankhorst at gmail.com>
---
Just because vdpau state tracker supports it, doesn't mean anything uses it yet.
Patience..

 src/gallium/include/pipe/p_video_state.h         |   34 +++++++++++
 src/gallium/state_trackers/vdpau/decode.c        |   65 +++++++++++++++++++++-
 src/gallium/state_trackers/vdpau/vdpau_private.h |   12 ++++
 3 files changed, 109 insertions(+), 2 deletions(-)

diff --git a/src/gallium/include/pipe/p_video_state.h b/src/gallium/include/pipe/p_video_state.h
index 0530b4a..1940bf1 100644
--- a/src/gallium/include/pipe/p_video_state.h
+++ b/src/gallium/include/pipe/p_video_state.h
@@ -212,6 +212,40 @@ struct pipe_mpeg4_quant_matrix
    const uint8_t *non_intra_matrix;
 };
 
+struct pipe_vc1_picture_desc
+{
+   struct pipe_picture_desc base;
+   uint32_t slice_count;
+   uint8_t picture_type;
+   uint8_t frame_coding_mode;
+   uint8_t postprocflag;
+   uint8_t pulldown;
+   uint8_t interlace;
+   uint8_t tfcntrflag;
+   uint8_t finterpflag;
+   uint8_t psf;
+   uint8_t dquant;
+   uint8_t panscan_flag;
+   uint8_t refdist_flag;
+   uint8_t quantizer;
+   uint8_t extended_mv;
+   uint8_t extended_dmv;
+   uint8_t overlap;
+   uint8_t vstransform;
+   uint8_t loopfilter;
+   uint8_t fastuvmc;
+   uint8_t range_mapy_flag;
+   uint8_t range_mapy;
+   uint8_t range_mapuv_flag;
+   uint8_t range_mapuv;
+   uint8_t multires;
+   uint8_t syncmarker;
+   uint8_t rangered;
+   uint8_t maxbframes;
+   uint8_t deblockEnable;
+   uint8_t pquant;
+};
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/gallium/state_trackers/vdpau/decode.c b/src/gallium/state_trackers/vdpau/decode.c
index c39c365..f135129 100644
--- a/src/gallium/state_trackers/vdpau/decode.c
+++ b/src/gallium/state_trackers/vdpau/decode.c
@@ -258,7 +258,7 @@ vlVdpDecoderRenderMpeg12(struct pipe_video_decoder *decoder,
 }
 
 /**
- * Decode a mpeg 1/2 video.
+ * Decode a mpeg 4 video.
  */
 static VdpStatus
 vlVdpDecoderRenderMpeg4(struct pipe_video_decoder *decoder,
@@ -313,6 +313,65 @@ vlVdpDecoderRenderMpeg4(struct pipe_video_decoder *decoder,
    return VDP_STATUS_OK;
 }
 
+static VdpStatus
+vlVdpDecoderRenderVC1(struct pipe_video_decoder *decoder,
+                      VdpPictureInfoVC1 *picture_info)
+{
+   struct pipe_vc1_picture_desc picture;
+   struct pipe_video_buffer *ref_frames[2] = {};
+   unsigned i;
+
+   VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Decoding VC-1\n");
+
+   /* if surfaces equals VDP_STATUS_INVALID_HANDLE, they are not used */
+   if (picture_info->forward_reference !=  VDP_INVALID_HANDLE) {
+      ref_frames[0] = ((vlVdpSurface *)vlGetDataHTAB(picture_info->forward_reference))->video_buffer;
+      if (!ref_frames[0])
+         return VDP_STATUS_INVALID_HANDLE;
+   }
+
+   if (picture_info->backward_reference !=  VDP_INVALID_HANDLE) {
+      ref_frames[1] = ((vlVdpSurface *)vlGetDataHTAB(picture_info->backward_reference))->video_buffer;
+      if (!ref_frames[1])
+         return VDP_STATUS_INVALID_HANDLE;
+   }
+   decoder->set_reference_frames(decoder, ref_frames, 2);
+
+   memset(&picture, 0, sizeof(picture));
+   picture.base.profile = decoder->profile;
+   picture.slice_count = picture_info->slice_count;
+   picture.picture_type = picture_info->picture_type;
+   picture.frame_coding_mode = picture_info->frame_coding_mode;
+   picture.postprocflag = picture_info->postprocflag;
+   picture.pulldown = picture_info->pulldown;
+   picture.interlace = picture_info->interlace;
+   picture.tfcntrflag = picture_info->tfcntrflag;
+   picture.finterpflag = picture_info->finterpflag;
+   picture.psf = picture_info->psf;
+   picture.dquant = picture_info->dquant;
+   picture.panscan_flag = picture_info->panscan_flag;
+   picture.refdist_flag = picture_info->refdist_flag;
+   picture.quantizer = picture_info->quantizer;
+   picture.extended_mv = picture_info->extended_mv;
+   picture.extended_dmv = picture_info->extended_dmv;
+   picture.overlap = picture_info->overlap;
+   picture.vstransform = picture_info->vstransform;
+   picture.loopfilter = picture_info->loopfilter;
+   picture.fastuvmc = picture_info->fastuvmc;
+   picture.range_mapy_flag = picture_info->range_mapy_flag;
+   picture.range_mapy = picture_info->range_mapy;
+   picture.range_mapuv_flag = picture_info->range_mapuv_flag;
+   picture.range_mapuv = picture_info->range_mapuv;
+   picture.multires = picture_info->multires;
+   picture.syncmarker = picture_info->syncmarker;
+   picture.rangered = picture_info->rangered;
+   picture.maxbframes = picture_info->maxbframes;
+   picture.deblockEnable = picture_info->deblockEnable;
+   picture.pquant = picture_info->pquant;
+   decoder->set_picture_parameters(decoder, &picture.base);
+   return VDP_STATUS_OK;
+}
+
 /**
  * Decode a compressed field/frame and render the result into a VdpVideoSurface.
  */
@@ -363,7 +422,9 @@ vlVdpDecoderRender(VdpDecoder decoder,
    case PIPE_VIDEO_CODEC_MPEG4:
       ret = vlVdpDecoderRenderMpeg4(dec, (VdpPictureInfoMPEG4Part2 *)picture_info);
       break;
-
+   case PIPE_VIDEO_CODEC_VC1:
+      ret = vlVdpDecoderRenderVC1(dec, (VdpPictureInfoVC1 *)picture_info);
+      break;
    default:
       return VDP_STATUS_INVALID_DECODER_PROFILE;
    }
diff --git a/src/gallium/state_trackers/vdpau/vdpau_private.h b/src/gallium/state_trackers/vdpau/vdpau_private.h
index 04699a3..aae6f78 100644
--- a/src/gallium/state_trackers/vdpau/vdpau_private.h
+++ b/src/gallium/state_trackers/vdpau/vdpau_private.h
@@ -224,6 +224,12 @@ ProfileToPipe(VdpDecoderProfile vdpau_profile)
          return PIPE_VIDEO_PROFILE_MPEG4_SIMPLE;
       case VDP_DECODER_PROFILE_MPEG4_PART2_ASP:
          return PIPE_VIDEO_PROFILE_MPEG4_ADVANCED_SIMPLE;
+      case VDP_DECODER_PROFILE_VC1_SIMPLE:
+         return PIPE_VIDEO_PROFILE_VC1_SIMPLE;
+      case VDP_DECODER_PROFILE_VC1_MAIN:
+         return PIPE_VIDEO_PROFILE_VC1_MAIN;
+      case VDP_DECODER_PROFILE_VC1_ADVANCED:
+         return PIPE_VIDEO_PROFILE_VC1_ADVANCED;
       default:
          return PIPE_VIDEO_PROFILE_UNKNOWN;
    }
@@ -249,6 +255,12 @@ PipeToProfile(enum pipe_video_profile p_profile)
          return VDP_DECODER_PROFILE_MPEG4_PART2_SP;
       case PIPE_VIDEO_PROFILE_MPEG4_ADVANCED_SIMPLE:
          return VDP_DECODER_PROFILE_MPEG4_PART2_ASP;
+      case PIPE_VIDEO_PROFILE_VC1_SIMPLE:
+         return VDP_DECODER_PROFILE_VC1_SIMPLE;
+      case PIPE_VIDEO_PROFILE_VC1_MAIN:
+         return VDP_DECODER_PROFILE_VC1_MAIN;
+      case PIPE_VIDEO_PROFILE_VC1_ADVANCED:
+         return VDP_DECODER_PROFILE_VC1_ADVANCED;
       default:
          assert(0);
          return -1;
-- 
1.7.6.4




More information about the mesa-dev mailing list