[Mesa-dev] [PATCH 13/15] st/va: handle VAPictureParameterBufferMPEG2

Christian König deathsimple at vodafone.de
Tue Jun 18 02:27:43 PDT 2013


From: Christian König <christian.koenig at amd.com>

Signed-off-by: Christian König <christian.koenig at amd.com>
---
 src/gallium/state_trackers/va/picture.c |   51 ++++++++++++++++++++++++++++++-
 1 file changed, 50 insertions(+), 1 deletion(-)

diff --git a/src/gallium/state_trackers/va/picture.c b/src/gallium/state_trackers/va/picture.c
index 66cd6ca..f7d32c6 100644
--- a/src/gallium/state_trackers/va/picture.c
+++ b/src/gallium/state_trackers/va/picture.c
@@ -62,6 +62,55 @@ vlVaBeginPicture(VADriverContextP ctx, VAContextID context_id, VASurfaceID rende
 }
 
 static void
+getReferenceFrame(vlVaDriver *drv, VASurfaceID surface_id,
+                  struct pipe_video_buffer **ref_frame)
+{
+   vlVaSurface *surf = handle_table_get(drv->htab, surface_id);
+   if (surf)
+      *ref_frame = surf->buffer;
+   else
+      *ref_frame = NULL;
+}
+
+static void
+handlePictureParameterBuffer(vlVaDriver *drv, vlVaContext *context, vlVaBuffer *buf)
+{
+   VAPictureParameterBufferMPEG2 *mpeg2;
+
+   switch (u_reduce_video_profile(context->decoder->profile)) {
+   case PIPE_VIDEO_CODEC_MPEG12:
+      assert(buf->size >= sizeof(VAPictureParameterBufferMPEG2) && buf->num_elements == 1);
+      mpeg2 = buf->data;
+
+      /*horizontal_size;*/
+      /*vertical_size;*/
+      getReferenceFrame(drv, mpeg2->forward_reference_picture, &context->desc.mpeg12.ref[0]);
+      getReferenceFrame(drv, mpeg2->backward_reference_picture, &context->desc.mpeg12.ref[1]);
+      context->desc.mpeg12.picture_coding_type = mpeg2->picture_coding_type;
+      context->desc.mpeg12.f_code[0][0] = ((mpeg2->f_code >> 12) & 0xf) - 1;
+      context->desc.mpeg12.f_code[0][1] = ((mpeg2->f_code >> 8) & 0xf) - 1;
+      context->desc.mpeg12.f_code[1][0] = ((mpeg2->f_code >> 4) & 0xf) - 1;
+      context->desc.mpeg12.f_code[1][1] = (mpeg2->f_code & 0xf) - 1;
+      context->desc.mpeg12.intra_dc_precision = mpeg2->picture_coding_extension.bits.intra_dc_precision;
+      context->desc.mpeg12.picture_structure = mpeg2->picture_coding_extension.bits.picture_structure;
+      context->desc.mpeg12.top_field_first = mpeg2->picture_coding_extension.bits.top_field_first;
+      context->desc.mpeg12.frame_pred_frame_dct = mpeg2->picture_coding_extension.bits.frame_pred_frame_dct;
+      context->desc.mpeg12.concealment_motion_vectors = mpeg2->picture_coding_extension.bits.concealment_motion_vectors;
+      context->desc.mpeg12.q_scale_type = mpeg2->picture_coding_extension.bits.q_scale_type;
+      context->desc.mpeg12.intra_vlc_format = mpeg2->picture_coding_extension.bits.intra_vlc_format;
+      context->desc.mpeg12.alternate_scan = mpeg2->picture_coding_extension.bits.alternate_scan;
+      /*repeat_first_field*/
+      /*progressive_frame*/
+      /*is_first_field*/
+
+      break;
+
+   default:
+      break;
+   }
+}
+
+static void
 handleIQMatrixBuffer(vlVaContext *context, vlVaBuffer *buf)
 {
    VAIQMatrixBufferMPEG2 *mpeg2;
@@ -113,7 +162,7 @@ vlVaRenderPicture(VADriverContextP ctx, VAContextID context_id, VABufferID *buff
 
       switch (buf->type) {
       case VAPictureParameterBufferType:
-         // TODO
+         handlePictureParameterBuffer(drv, context, buf);
          break;
 
       case VAIQMatrixBufferType:
-- 
1.7.9.5



More information about the mesa-dev mailing list