diff options
Diffstat (limited to 'sec_mm/sec_omx/sec_omx_component/video/dec/mpeg4dec/SEC_OMX_Mpeg4dec.c')
-rw-r--r-- | sec_mm/sec_omx/sec_omx_component/video/dec/mpeg4dec/SEC_OMX_Mpeg4dec.c | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/sec_mm/sec_omx/sec_omx_component/video/dec/mpeg4dec/SEC_OMX_Mpeg4dec.c b/sec_mm/sec_omx/sec_omx_component/video/dec/mpeg4dec/SEC_OMX_Mpeg4dec.c index 477983c..febb453 100644 --- a/sec_mm/sec_omx/sec_omx_component/video/dec/mpeg4dec/SEC_OMX_Mpeg4dec.c +++ b/sec_mm/sec_omx/sec_omx_component/video/dec/mpeg4dec/SEC_OMX_Mpeg4dec.c @@ -1038,7 +1038,7 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4_Decode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DAT /** Update Frame Size **/ if ((pInputPort->portDefinition.format.video.nFrameWidth != imgResol.width) || - (pInputPort->portDefinition.format.video.nFrameHeight != imgResol.height)) { + (pInputPort->portDefinition.format.video.nFrameHeight != imgResol.height)) { /* change width and height information */ pInputPort->portDefinition.format.video.nFrameWidth = imgResol.width; pInputPort->portDefinition.format.video.nFrameHeight = imgResol.height; @@ -1126,21 +1126,32 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4_Decode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DAT SEC_OMX_BASEPORT *pSECOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX]; void *pOutputBuf[3]; + int actualWidth = outputInfo.img_width; + int actualHeight = outputInfo.img_height; + int actualImageSize = imageSize; + pOutputBuf[0] = (void *)pOutputData->dataBuffer; - pOutputBuf[1] = (void *)pOutputData->dataBuffer + imageSize; - pOutputBuf[2] = (void *)pOutputData->dataBuffer + ((imageSize * 5) / 4); + pOutputBuf[1] = (void *)pOutputData->dataBuffer + actualImageSize; + pOutputBuf[2] = (void *)pOutputData->dataBuffer + ((actualImageSize * 5) / 4); #ifdef USE_ANDROID_EXTENSION if (pSECOutputPort->bUseAndroidNativeBuffer == OMX_TRUE) { + OMX_U32 retANB = 0; void *pVirAddrs[2]; - getVADDRfromANB(pOutputData->dataBuffer, + actualWidth = (outputInfo.img_width + 15) & (~15); + actualImageSize = actualWidth * actualHeight; + + retANB = getVADDRfromANB(pOutputData->dataBuffer, (OMX_U32)pSECInputPort->portDefinition.format.video.nFrameWidth, (OMX_U32)pSECInputPort->portDefinition.format.video.nFrameHeight, pVirAddrs); + if (retANB != 0) { + SEC_OSAL_Log(SEC_LOG_ERROR, "Error getVADDRfromANB, Error code:%d", retANB); + ret = OMX_ErrorOverflow; + goto EXIT; + } pOutputBuf[0] = pVirAddrs[0]; pOutputBuf[1] = pVirAddrs[1]; - pOutputBuf[2] = pVirAddrs[1] + (imageSize / 4); - } #endif if ((pMpeg4Dec->hMFCMpeg4Handle.bThumbnailMode == OMX_FALSE) && @@ -1161,15 +1172,15 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4_Decode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DAT csc_tiled_to_linear( (unsigned char *)pOutputBuf[0], (unsigned char *)outputInfo.YVirAddr, - outputInfo.img_width, - outputInfo.img_height); + actualWidth, + actualHeight); csc_tiled_to_linear_deinterleave( (unsigned char *)pOutputBuf[1], (unsigned char *)pOutputBuf[2], (unsigned char *)outputInfo.CVirAddr, - outputInfo.img_width, - outputInfo.img_height >> 1); - pOutputData->dataLen = (outputInfo.img_width * outputInfo.img_height) * 3 / 2; + actualWidth, + actualHeight >> 1); + pOutputData->dataLen = actualImageSize * 3 / 2; } break; case OMX_COLOR_FormatYUV420SemiPlanar: @@ -1180,14 +1191,14 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4_Decode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DAT csc_tiled_to_linear( (unsigned char *)pOutputBuf[0], (unsigned char *)outputInfo.YVirAddr, - outputInfo.img_width, - outputInfo.img_height); + actualWidth, + actualHeight); csc_tiled_to_linear( (unsigned char *)pOutputBuf[1], (unsigned char *)outputInfo.CVirAddr, - outputInfo.img_width, - outputInfo.img_height >> 1); - pOutputData->dataLen = (outputInfo.img_width * outputInfo.img_height) * 3 / 2; + actualWidth, + actualHeight >> 1); + pOutputData->dataLen = actualImageSize * 3 / 2; } break; } |