[vlc-devel] [PATCH 15/21] Don't trust a qcom decoder claiming to output 420 planar

Martin Storsjö martin at martin.st
Mon Sep 5 14:31:19 CEST 2011


In practice on Nexus One, it is 420 semiplanar even though the
decoder says it's planar.
---
 modules/codec/omxil/omxil.cpp |    3 +++
 modules/codec/omxil/utils.cpp |    2 +-
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/modules/codec/omxil/omxil.cpp b/modules/codec/omxil/omxil.cpp
index b37b53f..85e76b3 100644
--- a/modules/codec/omxil/omxil.cpp
+++ b/modules/codec/omxil/omxil.cpp
@@ -498,6 +498,9 @@ static OMX_ERRORTYPE GetPortDefinition(decoder_t *p_dec, OmxPort *p_port,
         p_fmt->video.i_frame_rate = p_dec->fmt_in.video.i_frame_rate;
         p_fmt->video.i_frame_rate_base = p_dec->fmt_in.video.i_frame_rate_base;
 
+        if(def->format.video.eColorFormat == OMX_COLOR_FormatYUV420Planar && !strncmp(p_sys->psz_component, "OMX.qcom.video.decoder", strlen("OMX.qcom.video.decoder")))
+            def->format.video.eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar;
+
         if(!GetVlcVideoFormat( def->format.video.eCompressionFormat,
                                &p_fmt->i_codec, 0 ) )
         {
diff --git a/modules/codec/omxil/utils.cpp b/modules/codec/omxil/utils.cpp
index 9c47637..7c36c5e 100644
--- a/modules/codec/omxil/utils.cpp
+++ b/modules/codec/omxil/utils.cpp
@@ -136,7 +136,7 @@ void CopyOmxPicture( decoder_t *p_dec, picture_t *p_pic,
     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 )
+    if( p_dec->p_sys->out.definition.format.video.eColorFormat == OMX_QCOM_COLOR_FormatYVU420SemiPlanar || p_dec->p_sys->out.definition.format.video.eColorFormat == OMX_COLOR_FormatYUV420SemiPlanar )
     {
         p_dst = p_pic->p[0].p_pixels;
         i_dst_stride = p_pic->p[0].i_pitch;
-- 
1.7.2.5




More information about the vlc-devel mailing list