[vlc-devel] [PATCH 1/2] omxil: Make CopyOmxPicture not use the omxil decoder's internals

Martin Storsjö martin at martin.st
Mon Sep 24 19:17:06 CEST 2012


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).
---
Changed to replace the old function completely, as suggested by
j-b.
---
 modules/codec/omxil/omxil.c       |    6 +++++-
 modules/codec/omxil/omxil_utils.h |    5 ++++-
 modules/codec/omxil/utils.c       |   18 +++++++-----------
 3 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/modules/codec/omxil/omxil.c b/modules/codec/omxil/omxil.c
index 002adc2..e33ab36 100644
--- a/modules/codec/omxil/omxil.c
+++ b/modules/codec/omxil/omxil.c
@@ -1290,7 +1290,11 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
                 p_pic = decoder_NewPicture( p_dec );
 
                 if (p_pic)
-                    CopyOmxPicture(p_dec, p_pic, p_header, p_sys->out.definition.format.video.nSliceHeight);
+                    CopyOmxPicture(p_sys->out.definition.format.video.eColorFormat,
+                                   p_pic, p_sys->out.definition.format.video.nSliceHeight,
+                                   p_sys->out.i_frame_stride,
+                                   p_header->pBuffer + p_header->nOffset,
+                                   p_sys->out.i_frame_stride_chroma_div);
             }
 
             if (p_pic)
diff --git a/modules/codec/omxil/omxil_utils.h b/modules/codec/omxil/omxil_utils.h
index 635951c..e5e29cd 100644
--- a/modules/codec/omxil/omxil_utils.h
+++ b/modules/codec/omxil/omxil_utils.h
@@ -131,7 +131,10 @@ OMX_ERRORTYPE WaitForSpecificOmxEvent(decoder_t *p_dec,
 /*****************************************************************************
  * Picture utility functions
  *****************************************************************************/
-void CopyOmxPicture( decoder_t *, picture_t *, OMX_BUFFERHEADERTYPE *, int );
+void CopyOmxPicture( 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..9aa5337 100644
--- a/modules/codec/omxil/utils.c
+++ b/modules/codec/omxil/utils.c
@@ -119,18 +119,14 @@ OMX_ERRORTYPE WaitForSpecificOmxEvent(decoder_t *p_dec,
 /*****************************************************************************
  * Picture utility functions
  *****************************************************************************/
-void CopyOmxPicture( decoder_t *p_dec, picture_t *p_pic,
-                     OMX_BUFFERHEADERTYPE *p_header, int i_slice_height )
+void CopyOmxPicture( int i_color_format, picture_t *p_pic,
+                     int i_slice_height,
+                     int i_src_stride, uint8_t *p_src, int i_chroma_div )
 {
-    decoder_sys_t *p_sys = p_dec->p_sys;
-    int i_src_stride, i_dst_stride;
+    uint8_t *p_dst;
+    int 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;
-
-    if( p_dec->p_sys->out.definition.format.video.eColorFormat == QOMX_COLOR_FormatYUV420PackedSemiPlanar64x32Tile2m8ka )
+    if( i_color_format == QOMX_COLOR_FormatYUV420PackedSemiPlanar64x32Tile2m8ka )
     {
         qcom_convert(p_src, p_pic);
         return;
@@ -138,7 +134,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