amcvideodec: Port tiled NV12 conversion to 1.0
authorSebastian Dröge <slomo@circular-chaos.org>
Tue, 3 Sep 2013 09:05:02 +0000 (11:05 +0200)
committerSebastian Dröge <slomo@circular-chaos.org>
Tue, 3 Sep 2013 09:06:00 +0000 (11:06 +0200)
sys/androidmedia/gstamcvideodec.c

index cfdbb5a6dccdcd2a70b8789a2e0d58bebdfa5313..8abfe5558060b48473684e6d11d130ea9bd83159 100644 (file)
@@ -1004,26 +1004,25 @@ gst_amc_video_dec_fill_buffer (GstAmcVideoDec * self, gint idx,
     }
       /* FIXME: This should be in libgstvideo as MT12 or similar, see v4l2 */
     case COLOR_QCOM_FormatYUV420PackedSemiPlanar64x32Tile2m8ka:{
+      GstVideoFrame vframe;
       gint width = self->width;
       gint height = self->height;
-      gint src_stride = self->stride;
-      gint dest_luma_stride = GST_VIDEO_INFO_COMP_STRIDE (info, 0);
-      gint dest_chroma_stride = GST_VIDEO_INFO_COMP_STRIDE (info, 1);
+      gint dest_luma_stride, dest_chroma_stride;
       guint8 *src = buf->data + buffer_info->offset;
-      guint8 *dest_luma =
-          GST_BUFFER_DATA (outbuf) + GST_VIDEO_INFO_COMP_OFFSET (info, 0);
-      guint8 *dest_chroma =
-          GST_BUFFER_DATA (outbuf) + GST_VIDEO_INFO_COMP_OFFSET (info, 1);
+      guint8 *dest_luma, *dest_chroma;
       gint y;
-
       const size_t tile_w = (width - 1) / TILE_WIDTH + 1;
       const size_t tile_w_align = (tile_w + 1) & ~1;
-
       const size_t tile_h_luma = (height - 1) / TILE_HEIGHT + 1;
       const size_t tile_h_chroma = (height / 2 - 1) / TILE_HEIGHT + 1;
-
       size_t luma_size = tile_w_align * tile_h_luma * TILE_SIZE;
 
+      gst_video_frame_map (&vframe, info, outbuf, GST_MAP_WRITE);
+      dest_luma = GST_VIDEO_FRAME_PLANE_DATA (&vframe, 0);
+      dest_chroma = GST_VIDEO_FRAME_PLANE_DATA (&vframe, 1);
+      dest_luma_stride = GST_VIDEO_FRAME_COMP_STRIDE (&vframe, 0);
+      dest_chroma_stride = GST_VIDEO_FRAME_COMP_STRIDE (&vframe, 1);
+
       if ((luma_size % TILE_GROUP_SIZE) != 0)
         luma_size = (((luma_size - 1) / TILE_GROUP_SIZE) + 1) * TILE_GROUP_SIZE;
 
@@ -1080,6 +1079,7 @@ gst_amc_video_dec_fill_buffer (GstAmcVideoDec * self, gint idx,
         }
         height -= TILE_HEIGHT;
       }
+      gst_video_frame_unmap (&vframe);
       ret = TRUE;
       break;