mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 06:16:36 +00:00
Really implement stride conversion for NV12 too
This commit is contained in:
parent
266bc5bf69
commit
3acc776dd6
1 changed files with 38 additions and 1 deletions
|
@ -701,6 +701,7 @@ gst_amc_video_dec_fill_buffer (GstAmcVideoDec * self, gint idx,
|
||||||
if (buffer_info->size == GST_BUFFER_SIZE (outbuf)) {
|
if (buffer_info->size == GST_BUFFER_SIZE (outbuf)) {
|
||||||
memcpy (GST_BUFFER_DATA (outbuf), buf->data + buffer_info->offset,
|
memcpy (GST_BUFFER_DATA (outbuf), buf->data + buffer_info->offset,
|
||||||
buffer_info->size);
|
buffer_info->size);
|
||||||
|
ret = TRUE;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -749,8 +750,44 @@ gst_amc_video_dec_fill_buffer (GstAmcVideoDec * self, gint idx,
|
||||||
case COLOR_FormatYUV420SemiPlanar:
|
case COLOR_FormatYUV420SemiPlanar:
|
||||||
case COLOR_TI_FormatYUV420PackedSemiPlanar:
|
case COLOR_TI_FormatYUV420PackedSemiPlanar:
|
||||||
case COLOR_TI_FormatYUV420PackedSemiPlanarInterlaced:
|
case COLOR_TI_FormatYUV420PackedSemiPlanarInterlaced:
|
||||||
case COLOR_QCOM_FormatYUV420SemiPlanar:
|
case COLOR_QCOM_FormatYUV420SemiPlanar:{
|
||||||
|
gint i, j, height;
|
||||||
|
guint8 *src, *dest;
|
||||||
|
gint src_stride, dest_stride;
|
||||||
|
|
||||||
|
for (i = 0; i < 2; i++) {
|
||||||
|
if (i == 0) {
|
||||||
|
src_stride = self->stride;
|
||||||
|
dest_stride = GST_VIDEO_INFO_COMP_STRIDE (info, i);
|
||||||
|
|
||||||
|
/* XXX: Try this if no stride was set */
|
||||||
|
if (src_stride == 0)
|
||||||
|
src_stride = dest_stride;
|
||||||
|
} else {
|
||||||
|
src_stride = self->stride / 2;
|
||||||
|
dest_stride = GST_VIDEO_INFO_COMP_STRIDE (info, i);
|
||||||
|
|
||||||
|
/* XXX: Try this if no stride was set */
|
||||||
|
if (src_stride == 0)
|
||||||
|
src_stride = dest_stride;
|
||||||
|
}
|
||||||
|
|
||||||
|
src = buf->data + buffer_info->offset;
|
||||||
|
if (i == 1)
|
||||||
|
src += self->slice_height * self->stride;
|
||||||
|
|
||||||
|
dest = GST_BUFFER_DATA (outbuf) + GST_VIDEO_INFO_COMP_OFFSET (info, i);
|
||||||
|
height = GST_VIDEO_INFO_COMP_HEIGHT (info, i);
|
||||||
|
|
||||||
|
for (j = 0; j < height; j++) {
|
||||||
|
memcpy (dest, src, MIN (src_stride, dest_stride));
|
||||||
|
src += src_stride;
|
||||||
|
dest += dest_stride;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ret = TRUE;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
GST_ERROR_OBJECT (self, "Unsupported color format %d",
|
GST_ERROR_OBJECT (self, "Unsupported color format %d",
|
||||||
self->color_format);
|
self->color_format);
|
||||||
|
|
Loading…
Reference in a new issue