fixed overflow issue that can have out of range as conditional expression
[platform/adaptation/ap_samsung/libomxil-e3250-v4l2.git] / openmax / component / video / dec / h264 / Exynos_OMX_H264dec.c
index 5211a6f..406b677 100755 (executable)
@@ -1028,7 +1028,7 @@ OMX_ERRORTYPE H264CodecSrcSetup(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DAT
 
     /* set output geometry */
     Exynos_OSAL_Memset(&bufferConf, 0, sizeof(bufferConf));
-    pH264Dec->hMFCH264Handle.MFCOutputColorType = bufferConf.eColorFormat = VIDEO_COLORFORMAT_NV12_TILED;
+    pH264Dec->hMFCH264Handle.MFCOutputColorType = bufferConf.eColorFormat = VIDEO_COLORFORMAT_NV12;
     if (pOutbufOps->Set_Geometry(hMFCHandle, &bufferConf) != VIDEO_ERROR_NONE) {
         Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Failed to set geometry for output buffer");
         ret = OMX_ErrorInsufficientResources;
@@ -1161,6 +1161,7 @@ OMX_ERRORTYPE H264CodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent)
                 for (plane = 0; plane < MFC_OUTPUT_BUFFER_PLANE; plane++) {
                     planes[plane].fd = pExynosOutputPort->extendBufferHeader[i].buf_fd[plane];
                     planes[plane].addr = pExynosOutputPort->extendBufferHeader[i].pYUVBuf[plane];
+                    planes[plane].tbm_bo = pExynosOutputPort->extendBufferHeader[i].tbm_bo[plane];
                     planes[plane].allocSize = nAllocLen[plane];
                 }
 
@@ -1616,7 +1617,8 @@ OMX_ERRORTYPE Exynos_H264Dec_SetParameter(
             case OMX_COLOR_FormatYUV420SemiPlanar:
                 pExynosOutputPort->portDefinition.nBufferSize = (width * height * 3) / 2;
                 break;
-#ifdef SLP_PLATFORM /* NV12T fd */
+#ifdef SLP_PLATFORM /* NV12 fd */
+            case OMX_SEC_COLOR_FormatNV12L_DmaBuf_Fd:
             case OMX_SEC_COLOR_FormatNV12T_DmaBuf_Fd:
                 pExynosOutputPort->portDefinition.nBufferSize = sizeof(MMVideoBuffer);
                 break;
@@ -2234,12 +2236,12 @@ OMX_ERRORTYPE Exynos_H264Dec_SrcOut(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX
         if (pExynosInputPort->bufferProcessType & BUFFER_COPY) {
             int i = 0;
             while (pSrcOutputData->buffer.singlePlaneBuffer.dataBuffer != pVideoDec->pMFCDecInputBuffer[i]->pVirAddr[0]) {
+                i++;
                 if (i >= MFC_INPUT_BUFFER_NUM_MAX) {
                     Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Can not find buffer");
                     ret = (OMX_ERRORTYPE)OMX_ErrorCodecDecode;
                     goto EXIT;
                 }
-                i++;
             }
             pVideoDec->pMFCDecInputBuffer[i]->dataSize = 0;
             pSrcOutputData->pPrivate = pVideoDec->pMFCDecInputBuffer[i];
@@ -2384,6 +2386,7 @@ OMX_ERRORTYPE Exynos_H264Dec_DstOut(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX
     for (plane = 0; plane < MFC_OUTPUT_BUFFER_PLANE; plane++) {
         pDstOutputData->buffer.multiPlaneBuffer.dataBuffer[plane] = pVideoBuffer->planes[plane].addr;
         pDstOutputData->buffer.multiPlaneBuffer.fd[plane] = pVideoBuffer->planes[plane].fd;
+        pDstOutputData->buffer.multiPlaneBuffer.tbm_bo[plane] = pVideoBuffer->planes[plane].tbm_bo;
         pDstOutputData->allocSize += pVideoBuffer->planes[plane].allocSize;
         pDstOutputData->dataLen +=  pVideoBuffer->planes[plane].dataSize;
     }
@@ -2398,8 +2401,8 @@ OMX_ERRORTYPE Exynos_H264Dec_DstOut(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX
     pBufferInfo->imageHeight = bufferGeometry->nFrameHeight;
     switch (bufferGeometry->eColorFormat) {
     case VIDEO_COLORFORMAT_NV12:
-#ifdef SLP_PLATFORM /* NV12T fd */
-        pBufferInfo->ColorFormat = OMX_SEC_COLOR_FormatNV12T_DmaBuf_Fd;
+#ifdef SLP_PLATFORM /* NV12 fd */
+        pBufferInfo->ColorFormat = OMX_SEC_COLOR_FormatNV12L_DmaBuf_Fd;
 #else
         pBufferInfo->ColorFormat = OMX_COLOR_FormatYUV420SemiPlanar;
 #endif
@@ -2738,7 +2741,7 @@ OSCL_EXPORT_REF OMX_ERRORTYPE Exynos_OMX_ComponentInit(OMX_HANDLETYPE hComponent
     pExynosPort->portDefinition.format.video.pNativeRender = 0;
     pExynosPort->portDefinition.format.video.bFlagErrorConcealment = OMX_FALSE;
 #ifdef SLP_PLATFORM
-    pExynosPort->portDefinition.format.video.eColorFormat = OMX_SEC_COLOR_FormatNV12T_DmaBuf_Fd;
+    pExynosPort->portDefinition.format.video.eColorFormat = OMX_SEC_COLOR_FormatNV12L_DmaBuf_Fd;
 #else
     pExynosPort->portDefinition.format.video.eColorFormat = OMX_COLOR_FormatYUV420Planar;
 #endif