[vlc-devel] [PATCH 1/2] omxil: Split CopyOmxPicture into a smaller helper function
Martin Storsjö
martin at martin.st
Mon Sep 24 15:44:32 CEST 2012
This smaller function doesn't use the omxil decoder's internal
structures.
This allows using this function for copying data in a given
OMX pixel format, to be used by the MediaCodec decoder (that
uses OMX pixel format definitions).
---
modules/codec/omxil/omxil_utils.h | 4 ++++
modules/codec/omxil/utils.c | 18 +++++++++++-------
2 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/modules/codec/omxil/omxil_utils.h b/modules/codec/omxil/omxil_utils.h
index 635951c..d51c16a 100644
--- a/modules/codec/omxil/omxil_utils.h
+++ b/modules/codec/omxil/omxil_utils.h
@@ -132,6 +132,10 @@ OMX_ERRORTYPE WaitForSpecificOmxEvent(decoder_t *p_dec,
* Picture utility functions
*****************************************************************************/
void CopyOmxPicture( decoder_t *, picture_t *, OMX_BUFFERHEADERTYPE *, int );
+void CopyOmxPictureInternal( int i_color_format, picture_t *p_pic,
+ int i_slice_height,
+ int i_src_stride, uint8_t *p_src, int i_chroma_div );
+
void CopyVlcPicture( decoder_t *, OMX_BUFFERHEADERTYPE *, picture_t * );
/*****************************************************************************
diff --git a/modules/codec/omxil/utils.c b/modules/codec/omxil/utils.c
index c1e5fba..d652859 100644
--- a/modules/codec/omxil/utils.c
+++ b/modules/codec/omxil/utils.c
@@ -123,14 +123,18 @@ 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_plane, i_width, i_line;
- uint8_t *p_dst, *p_src;
- i_src_stride = p_sys->out.i_frame_stride;
- p_src = p_header->pBuffer + p_header->nOffset;
+ CopyOmxPictureInternal(p_dec->p_sys->out.definition.format.video.eColorFormat, p_pic, i_slice_height, p_sys->out.i_frame_stride, p_header->pBuffer + p_header->nOffset, p_sys->out.i_frame_stride_chroma_div);
+}
- if( p_dec->p_sys->out.definition.format.video.eColorFormat == QOMX_COLOR_FormatYUV420PackedSemiPlanar64x32Tile2m8ka )
+void CopyOmxPictureInternal( int i_color_format, picture_t *p_pic,
+ int i_slice_height,
+ int i_src_stride, uint8_t *p_src, int i_chroma_div )
+{
+ uint8_t *p_dst;
+ int i_dst_stride;
+ int i_plane, i_width, i_line;
+ if( i_color_format == QOMX_COLOR_FormatYUV420PackedSemiPlanar64x32Tile2m8ka )
{
qcom_convert(p_src, p_pic);
return;
@@ -138,7 +142,7 @@ void CopyOmxPicture( decoder_t *p_dec, picture_t *p_pic,
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;
+ if(i_plane == 1) i_src_stride /= i_chroma_div;
p_dst = p_pic->p[i_plane].p_pixels;
i_dst_stride = p_pic->p[i_plane].i_pitch;
i_width = p_pic->p[i_plane].i_visible_pitch;
--
1.7.10
More information about the vlc-devel
mailing list