diff options
author | SeungBeom Kim <sbcrux.kim@samsung.com> | 2011-12-08 12:20:03 +0900 |
---|---|---|
committer | James Dong <jdong@google.com> | 2011-12-07 20:34:04 -0800 |
commit | b9e186067caad92c3f50c4abe87b55965a88ea6f (patch) | |
tree | a07e2adf8dc6ed77517b2cfee151cbe2cf5c403a /sec_mm | |
parent | e13c61aaca8da78ab2e9460d3d03bdbff0e46fc4 (diff) | |
download | device_samsung_crespo-b9e186067caad92c3f50c4abe87b55965a88ea6f.zip device_samsung_crespo-b9e186067caad92c3f50c4abe87b55965a88ea6f.tar.gz device_samsung_crespo-b9e186067caad92c3f50c4abe87b55965a88ea6f.tar.bz2 |
Fix SEC-OMX Video Encode for get out encode last frame.
Change-Id: Ic03bc07a2299f63156e3a8fb56c4fe2d894a9164
Signed-off-by: SeungBeom Kim <sbcrux.kim@samsung.com>
related-to-bug: 5720764, 5679361
Diffstat (limited to 'sec_mm')
3 files changed, 56 insertions, 2 deletions
diff --git a/sec_mm/sec_omx/sec_omx_component/video/enc/SEC_OMX_Venc.c b/sec_mm/sec_omx/sec_omx_component/video/enc/SEC_OMX_Venc.c index 310064b..19e33de 100644 --- a/sec_mm/sec_omx/sec_omx_component/video/enc/SEC_OMX_Venc.c +++ b/sec_mm/sec_omx/sec_omx_component/video/enc/SEC_OMX_Venc.c @@ -688,6 +688,14 @@ OMX_BOOL SEC_Preprocessor_InputData(OMX_COMPONENTTYPE *pOMXComponent) if (pSECComponent->bUseFlagEOF == OMX_TRUE) { flagEOF = OMX_TRUE; checkedSize = checkInputStreamLen; + if (checkedSize == 0) { + SEC_OMX_BASEPORT *pSECPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX]; + int width = pSECPort->portDefinition.format.video.nFrameWidth; + int height = pSECPort->portDefinition.format.video.nFrameHeight; + inputUseBuffer->remainDataLen = inputUseBuffer->dataLen = (width * height * 3) / 2; + checkedSize = checkInputStreamLen = inputUseBuffer->remainDataLen; + inputUseBuffer->nFlags |= OMX_BUFFERFLAG_EOS; + } if (inputUseBuffer->nFlags & OMX_BUFFERFLAG_EOS) { flagEOS = OMX_TRUE; } diff --git a/sec_mm/sec_omx/sec_omx_component/video/enc/h264enc/SEC_OMX_H264enc.c b/sec_mm/sec_omx/sec_omx_component/video/enc/h264enc/SEC_OMX_H264enc.c index a7f7ad5..24bbc7a 100644 --- a/sec_mm/sec_omx/sec_omx_component/video/enc/h264enc/SEC_OMX_H264enc.c +++ b/sec_mm/sec_omx/sec_omx_component/video/enc/h264enc/SEC_OMX_H264enc.c @@ -974,7 +974,14 @@ OMX_ERRORTYPE SEC_MFC_H264_Encode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DATA } pSECPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX]; - if (pSECPort->portDefinition.format.video.eColorFormat == OMX_SEC_COLOR_FormatNV12TPhysicalAddress) { + if (((pInputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) || + (pSECComponent->getAllDelayBuffer == OMX_TRUE)){ + /* Dummy input data for get out encoded last frame */ + pInputInfo->YPhyAddr = pH264Enc->MFCEncInputBuffer[pH264Enc->indexInputBuffer].YPhyAddr; + pInputInfo->CPhyAddr = pH264Enc->MFCEncInputBuffer[pH264Enc->indexInputBuffer].CPhyAddr; + pInputInfo->YVirAddr = pH264Enc->MFCEncInputBuffer[pH264Enc->indexInputBuffer].YVirAddr; + pInputInfo->CVirAddr = pH264Enc->MFCEncInputBuffer[pH264Enc->indexInputBuffer].CVirAddr; + } else if (pSECPort->portDefinition.format.video.eColorFormat == OMX_SEC_COLOR_FormatNV12TPhysicalAddress) { SEC_OSAL_Memcpy(&addrInfo.pAddrY, pInputData->dataBuffer, sizeof(addrInfo.pAddrY)); SEC_OSAL_Memcpy(&addrInfo.pAddrC, pInputData->dataBuffer + sizeof(addrInfo.pAddrY), sizeof(addrInfo.pAddrC)); pInputInfo->YPhyAddr = addrInfo.pAddrY; @@ -1033,6 +1040,22 @@ OMX_ERRORTYPE SEC_MFC_H264_Encode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DATA ret = OMX_ErrorUndefined; goto EXIT; } + + if (pSECComponent->getAllDelayBuffer == OMX_TRUE) { + ret = OMX_ErrorInputDataEncodeYet; + } + if ((pInputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) { + pInputData->nFlags = (pOutputData->nFlags & (~OMX_BUFFERFLAG_EOS)); + pSECComponent->getAllDelayBuffer = OMX_TRUE; + ret = OMX_ErrorInputDataEncodeYet; + } + if ((pOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) { + pSECComponent->getAllDelayBuffer = OMX_FALSE; + pOutputData->dataLen = 0; + pOutputData->usedDataLen = 0; + SEC_OSAL_Log(SEC_LOG_TRACE, "OMX_BUFFERFLAG_EOS!!!"); + ret = OMX_ErrorNone; + } } if (pH264Enc->hMFCH264Handle.returnCodec != MFC_RET_OK) { SEC_OSAL_Log(SEC_LOG_ERROR, "In %s : SsbSipMfcEncExe Failed!!!\n", __func__); diff --git a/sec_mm/sec_omx/sec_omx_component/video/enc/mpeg4enc/SEC_OMX_Mpeg4enc.c b/sec_mm/sec_omx/sec_omx_component/video/enc/mpeg4enc/SEC_OMX_Mpeg4enc.c index 8fdd41e..5213522 100644 --- a/sec_mm/sec_omx/sec_omx_component/video/enc/mpeg4enc/SEC_OMX_Mpeg4enc.c +++ b/sec_mm/sec_omx/sec_omx_component/video/enc/mpeg4enc/SEC_OMX_Mpeg4enc.c @@ -1144,7 +1144,14 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4_Encode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DAT } pSECPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX]; - if (pSECPort->portDefinition.format.video.eColorFormat == OMX_SEC_COLOR_FormatNV12TPhysicalAddress) { + if (((pInputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) || + (pSECComponent->getAllDelayBuffer == OMX_TRUE)){ + /* Dummy input data for get out encoded last frame */ + pInputInfo->YPhyAddr = pMpeg4Enc->MFCEncInputBuffer[pMpeg4Enc->indexInputBuffer].YPhyAddr; + pInputInfo->CPhyAddr = pMpeg4Enc->MFCEncInputBuffer[pMpeg4Enc->indexInputBuffer].CPhyAddr; + pInputInfo->YVirAddr = pMpeg4Enc->MFCEncInputBuffer[pMpeg4Enc->indexInputBuffer].YVirAddr; + pInputInfo->CVirAddr = pMpeg4Enc->MFCEncInputBuffer[pMpeg4Enc->indexInputBuffer].CVirAddr; + } else if (pSECPort->portDefinition.format.video.eColorFormat == OMX_SEC_COLOR_FormatNV12TPhysicalAddress) { SEC_OSAL_Memcpy(&addrInfo.pAddrY, pInputData->dataBuffer, sizeof(addrInfo.pAddrY)); SEC_OSAL_Memcpy(&addrInfo.pAddrC, pInputData->dataBuffer + sizeof(addrInfo.pAddrY), sizeof(addrInfo.pAddrC)); pInputInfo->YPhyAddr = addrInfo.pAddrY; @@ -1201,6 +1208,22 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4_Encode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DAT ret = OMX_ErrorUndefined; goto EXIT; } + + if (pSECComponent->getAllDelayBuffer == OMX_TRUE) { + ret = OMX_ErrorInputDataEncodeYet; + } + if ((pInputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) { + pInputData->nFlags = (pOutputData->nFlags & (~OMX_BUFFERFLAG_EOS)); + pSECComponent->getAllDelayBuffer = OMX_TRUE; + ret = OMX_ErrorInputDataEncodeYet; + } + if ((pOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) { + pSECComponent->getAllDelayBuffer = OMX_FALSE; + pOutputData->dataLen = 0; + pOutputData->usedDataLen = 0; + SEC_OSAL_Log(SEC_LOG_TRACE, "OMX_BUFFERFLAG_EOS!!!"); + ret = OMX_ErrorNone; + } } if (pMpeg4Enc->hMFCMpeg4Handle.returnCodec != MFC_RET_OK) { SEC_OSAL_Log(SEC_LOG_ERROR, "%s: SsbSipMfcEncExe failed, ret:%d", __FUNCTION__, pMpeg4Enc->hMFCMpeg4Handle.returnCodec); |