[vlc-devel] [PATCH 09/21] Do manual copying of semiplanar->planar
Martin Storsjo
martin at martin.st
Sun Sep 4 14:54:14 CEST 2011
From: Martin Storsjö <martin at martin.st>
Since NV12/NV21 isn't handled in the output, covert here
(for simplicity) for now.
This is only a hack for the problems with NV12/21 in vlc-android.
---
modules/codec/omxil/utils.c | 46 +++++++++++++++++++++++++++++++++++++++++-
1 files changed, 44 insertions(+), 2 deletions(-)
diff --git a/modules/codec/omxil/utils.c b/modules/codec/omxil/utils.c
index 00b45a7..8155a6f 100644
--- a/modules/codec/omxil/utils.c
+++ b/modules/codec/omxil/utils.c
@@ -128,13 +128,55 @@ void CopyOmxPicture( decoder_t *p_dec, picture_t *p_pic,
OMX_BUFFERHEADERTYPE *p_header, int i_slice_height )
{
decoder_sys_t *p_sys = p_dec->p_sys;
- int i_src_stride, i_dst_stride;
+ int i_src_stride, i_dst_stride, i_dst_stride2;
int i_plane, i_width, i_line;
- uint8_t *p_dst, *p_src;
+ uint8_t *p_dst, *p_dst2, *p_src;
i_src_stride = p_sys->out.i_frame_stride;
p_src = p_header->pBuffer + p_header->nOffset;
+ if( p_dec->p_sys->out.definition.format.video.eColorFormat == OMX_QCOM_COLOR_FormatYVU420SemiPlanar )
+ {
+ p_dst = p_pic->p[0].p_pixels;
+ i_dst_stride = p_pic->p[0].i_pitch;
+ i_width = p_pic->p[0].i_visible_pitch;
+
+ for( i_line = 0; i_line < p_pic->p[0].i_visible_lines; i_line++ )
+ {
+ vlc_memcpy( p_dst, p_src, i_width );
+ p_src += i_src_stride;
+ p_dst += i_dst_stride;
+ }
+
+ if( i_slice_height > p_pic->p[0].i_visible_lines)
+ p_src += i_src_stride * (i_slice_height - p_pic->p[0].i_visible_lines);
+
+ i_src_stride /= p_sys->out.i_frame_stride_chroma_div;
+ p_dst = p_pic->p[1].p_pixels;
+ i_dst_stride = p_pic->p[1].i_pitch;
+ i_width = p_pic->p[1].i_visible_pitch;
+ p_dst2 = p_pic->p[2].p_pixels;
+ i_dst_stride2 = p_pic->p[2].i_pitch;
+
+ for( i_line = 0; i_line < p_pic->p[1].i_visible_lines; i_line++ )
+ {
+ uint8_t *d1 = p_dst;
+ uint8_t *d2 = p_dst2;
+ uint8_t *s = p_src;
+ int x;
+ for( x = 0; x < i_width; x++ )
+ {
+ *d2++ = *s++;
+ *d1++ = *s++;
+ }
+ p_src += i_src_stride*2;
+ p_dst += i_dst_stride;
+ p_dst2 += i_dst_stride2;
+ }
+
+ return;
+ }
+
for( i_plane = 0; i_plane < p_pic->i_planes; i_plane++ )
{
if(i_plane == 1) i_src_stride /= p_sys->out.i_frame_stride_chroma_div;
--
1.7.2.5
More information about the vlc-devel
mailing list