OSDN Git Service

RIO-7648: Improve OMX Dec BufferSize Negotiation during PortReConfig for non-multiple...
authorPacketVideo CM <engbuild@pv.com>
Thu, 8 Oct 2009 05:45:39 +0000 (22:45 -0700)
committerPacketVideo CM <engbuild@pv.com>
Thu, 8 Oct 2009 05:45:39 +0000 (22:45 -0700)
codecs_v2/omx/omx_baseclass/include/pv_omxcomponent.h
codecs_v2/omx/omx_baseclass/src/pv_omxcomponent.cpp
codecs_v2/utilities/pv_config_parser/src/pv_video_config_parser.cpp
engines/2way/src/pv_2way_sdkinfo.h
engines/author/src/pv_author_sdkinfo.h
engines/player/src/pv_player_sdkinfo.h

index b7c6f55..ec55baf 100644 (file)
@@ -549,6 +549,7 @@ class OmxComponentBase : public OsclActiveObject
 
         OSCL_IMPORT_REF void Run();
 
+
         OMX_CALLBACKTYPE*   ipCallbacks;
         OMX_PTR             iCallbackData;
         OMX_STATETYPE       iState;
@@ -673,7 +674,7 @@ class OmxComponentVideo : public OmxComponentBase
             OMX_IN  OMX_INDEXTYPE nParamIndex,
             OMX_IN  OMX_PTR ComponentParameterStructure);
 
-
+        OSCL_IMPORT_REF virtual void CalculateBufferParameters(OMX_U32 PortIndex);
 };
 
 
index 2ca72e2..d5a0502 100644 (file)
@@ -4516,53 +4516,8 @@ OSCL_EXPORT_REF OMX_ERRORTYPE OmxComponentVideo::SetParameter(
             OMX_VIDEO_PORTDEFINITIONTYPE *videoformat = &(ipPorts[PortIndex]->PortParam.format.video);
             if (videoformat->eCompressionFormat == OMX_VIDEO_CodingUnused)
             {
-                // check if stride needs to be adjusted - stride should be at least the 16 byte aligned width
-                // WMV is special case that requires 4 bytes alignment
-
-                OMX_U32 min_stride = ((videoformat->nFrameWidth + 15) & (~15));
-                OMX_U32 min_sliceheight = ((videoformat->nFrameHeight + 15) & (~15));
-
-                if (oscl_strcmp("video/wmv", videoformat->cMIMEType) == 0)
-                {
-                    min_stride = ((videoformat->nFrameWidth + 3) & (~3));
-                    min_sliceheight = ((videoformat->nFrameHeight + 1) & (~1));
-                }
-
-
-                videoformat->nStride = min_stride;
-                videoformat->nSliceHeight = min_sliceheight;
-
-
-                // finally, compute the new minimum buffer size.
-
-                // Encoder components can have different formats - (rely on the client to provide the correct size)
-                if (OMX_PORT_OUTPUTPORT_INDEX == PortIndex)
-                {
-                    // Decoder components always output YUV420 format
-                    ipPorts[PortIndex]->PortParam.nBufferSize = (videoformat->nSliceHeight * videoformat->nStride * 3) >> 1;
-
-                }
-
-                if (OMX_PORT_INPUTPORT_INDEX == PortIndex)
-                {
-                    // Encoder components may have different formats
-                    if (videoformat->eColorFormat == OMX_COLOR_Format24bitRGB888)
-                    {
-                        ipPorts[PortIndex]->PortParam.nBufferSize = videoformat->nSliceHeight * videoformat->nStride * 3;
-                    }
-                    else if (videoformat->eColorFormat == OMX_COLOR_Format12bitRGB444)
-                    {
-                        ipPorts[PortIndex]->PortParam.nBufferSize = videoformat->nSliceHeight * videoformat->nStride * 2;
-
-                    }
-                    else if (videoformat->eColorFormat == OMX_COLOR_FormatYUV420Planar)
-                    {
-                        ipPorts[PortIndex]->PortParam.nBufferSize = (videoformat->nSliceHeight * videoformat->nStride * 3) >> 1;
-
-                    }
-
-                }
-
+                // call components to calculate nStride, nSliceHeight and nBufferSize  of videoformat.
+                CalculateBufferParameters(PortIndex);
             }
 
         }
@@ -4737,6 +4692,55 @@ OSCL_EXPORT_REF OMX_ERRORTYPE OmxComponentVideo::SetParameter(
     return ErrorType;
 
 }
+
+// This virtual function can be overwritten by component according to the buffer requirement.
+
+OSCL_EXPORT_REF void OmxComponentVideo::CalculateBufferParameters(OMX_U32 PortIndex)
+{
+    OMX_VIDEO_PORTDEFINITIONTYPE *videoformat = &(ipPorts[PortIndex]->PortParam.format.video);
+
+    // check if stride needs to be adjusted - stride should be at least the 16 byte aligned width
+    OMX_U32 min_stride = ((videoformat->nFrameWidth + 15) & (~15));
+    OMX_U32 min_sliceheight = ((videoformat->nFrameHeight + 15) & (~15));
+
+
+    videoformat->nStride = min_stride;
+    videoformat->nSliceHeight = min_sliceheight;
+
+
+    // finally, compute the new minimum buffer size.
+
+    // Encoder components can have different formats - (rely on the client to provide the correct size)
+    if (OMX_PORT_OUTPUTPORT_INDEX == PortIndex)
+    {
+        // Decoder components always output YUV420 format
+        ipPorts[PortIndex]->PortParam.nBufferSize = (videoformat->nSliceHeight * videoformat->nStride * 3) >> 1;
+
+    }
+
+    if (OMX_PORT_INPUTPORT_INDEX == PortIndex)
+    {
+        // Encoder components may have different formats
+        if (videoformat->eColorFormat == OMX_COLOR_Format24bitRGB888)
+        {
+            ipPorts[PortIndex]->PortParam.nBufferSize = videoformat->nSliceHeight * videoformat->nStride * 3;
+        }
+        else if (videoformat->eColorFormat == OMX_COLOR_Format12bitRGB444)
+        {
+            ipPorts[PortIndex]->PortParam.nBufferSize = videoformat->nSliceHeight * videoformat->nStride * 2;
+
+        }
+        else if (videoformat->eColorFormat == OMX_COLOR_FormatYUV420Planar)
+        {
+            ipPorts[PortIndex]->PortParam.nBufferSize = (videoformat->nSliceHeight * videoformat->nStride * 3) >> 1;
+
+        }
+
+    }
+
+    return ;
+}
+
 #if PROXY_INTERFACE
 
 /** Component entry points declarations with proxy interface*/
index aa261c9..077ced5 100644 (file)
@@ -70,21 +70,7 @@ enum { NOT_WMV3 = -1, WMV3_SIMPLE_PROFILE, WMV3_MAIN_PROFILE, WMV3_PC_PROFILE, W
 #define SC_SEQ          0x0F
 #define SC_ENTRY        0x0E
 
-//For Real Video Decoder
 
-#define GetUnalignedWordRv( pb, w ) \
-            (w) = ((uint16) *(pb) << 8) + *(pb+1);
-
-#define GetUnalignedDwordRv( pb, dw ) \
-            (dw) = ((uint32) *(pb + 3)) + \
-                   ((uint32) *(pb + 2) << 8) + \
-                   ((uint32) *(pb + 1) << 16) + ((uint32) (*pb) << 24);
-
-#define GetUnalignedWordExRv( pb, w )     GetUnalignedWordRv( pb, w ); (pb) += sizeof(uint16);
-#define GetUnalignedDwordExRv( pb, dw )   GetUnalignedDwordRv( pb, dw ); (pb) += sizeof(uint32);
-
-#define LoadWORDRv( w, p )    GetUnalignedWordExRv( p, w )
-#define LoadDWORDRv( dw, p )  GetUnalignedDwordExRv( p, dw )
 
 OSCL_DLL_ENTRY_POINT_DEFAULT()
 
@@ -371,23 +357,9 @@ OSCL_EXPORT_REF int16 pv_video_config_parser(pvVideoConfigParserInputs *aInputs,
     }
     else if (aInputs->iMimeType == PVMF_MIME_REAL_VIDEO) //rv
     {
-        uint32 dwdat;
-        uint16 wdat;
-
-        uint8 *pData = aInputs->inPtr;
-
-        // Init frame contains: HX_FORMAT_VIDEO + extra_data= 26  bytes + 4(SPO) + 4(stream_version) + RPRsizeinfo (variable)
-
-        // HX_FORMAT_VIDEO
-        LoadDWORDRv(dwdat, pData);
-        LoadDWORDRv(dwdat, pData);
-        LoadDWORDRv(dwdat, pData);
-        LoadWORDRv(wdat, pData);
-        aOutputs->width = (int32) wdat; // size of data below
-
-        LoadWORDRv(wdat, pData);
-        aOutputs->height = (int32) wdat;
-
+        // use this as default value, let decoder discover the actual size and perform port reconfig
+        aOutputs->width = 128;
+        aOutputs->height = 96;
         aOutputs->profile = 0;
         aOutputs->level = 0;
     }
index 1d58458..d3b753c 100644 (file)
@@ -21,7 +21,7 @@
 // This header file is automatically generated at build-time
 // *** OFFICIAL RELEASE INFO -- Will not auto update
 
-#define PV2WAY_ENGINE_SDKINFO_LABEL "997505"
+#define PV2WAY_ENGINE_SDKINFO_LABEL "997976"
 #define PV2WAY_ENGINE_SDKINFO_DATE 0x20091002
 
 #endif //PV_2WAY_SDKINFO_H_INCLUDED
index d1ffbc3..1ab22af 100644 (file)
@@ -21,7 +21,7 @@
 // This header file is automatically generated at build-time
 // *** OFFICIAL RELEASE INFO -- Will not auto update
 
-#define PVAUTHOR_ENGINE_SDKINFO_LABEL "997505"
+#define PVAUTHOR_ENGINE_SDKINFO_LABEL "997976"
 #define PVAUTHOR_ENGINE_SDKINFO_DATE 0x20091002
 
 #endif //PV_AUTHOR_SDKINFO_H_INCLUDED
index 0c8894b..b5226da 100644 (file)
@@ -21,7 +21,7 @@
 // This header file is automatically generated at build-time
 // *** OFFICIAL RELEASE INFO -- Will not auto update
 
-#define PVPLAYER_ENGINE_SDKINFO_LABEL "997505"
+#define PVPLAYER_ENGINE_SDKINFO_LABEL "997976"
 #define PVPLAYER_ENGINE_SDKINFO_DATE 0x20091002
 
 #endif //PV_PLAYER_SDKINFO_H_INCLUDED