From: Jinsung Yang Date: Fri, 1 Feb 2013 07:09:41 +0000 (+0900) Subject: vdec: added OMX_IndexParamSetDTSMode support X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=c70316c713142376555517369ae6c6ca7d06c3d1;p=GitHub%2FLineageOS%2Fandroid_hardware_samsung_slsi_openmax.git vdec: added OMX_IndexParamSetDTSMode support typedef struct _EXYNOS_OMX_VIDEO_PARAM_DTSMODE { OMX_U32 nSize; OMX_VERSIONTYPE nVersion; OMX_BOOL bDTSMode; } EXYNOS_OMX_VIDEO_PARAM_DTSMODE; - bDTSMode true : DTS(Decorder Time Stamp) false : PTS(Presentation Time Stamp) Change-Id: I9a7591ff8ebd9eb4fb3a2dbdd1dba7f6d2f549e8 Signed-off-by: Jinsung Yang --- diff --git a/component/video/dec/Exynos_OMX_Vdec.c b/component/video/dec/Exynos_OMX_Vdec.c index 1c1f6b2..5e58096 100644 --- a/component/video/dec/Exynos_OMX_Vdec.c +++ b/component/video/dec/Exynos_OMX_Vdec.c @@ -1179,6 +1179,7 @@ OMX_ERRORTYPE Exynos_OMX_VideoDecodeComponentInit(OMX_IN OMX_HANDLETYPE hCompone Exynos_OSAL_Memset(pVideoDec, 0, sizeof(EXYNOS_OMX_VIDEODEC_COMPONENT)); pVideoDec->bReconfigDPB = OMX_FALSE; pVideoDec->nSavedDPBCnt = 0; + pVideoDec->bDTSMode = OMX_FALSE; pExynosComponent->hComponentHandle = (OMX_HANDLETYPE)pVideoDec; pExynosComponent->bSaveFlagEOS = OMX_FALSE; diff --git a/component/video/dec/Exynos_OMX_Vdec.h b/component/video/dec/Exynos_OMX_Vdec.h index 1639366..48497e6 100644 --- a/component/video/dec/Exynos_OMX_Vdec.h +++ b/component/video/dec/Exynos_OMX_Vdec.h @@ -85,6 +85,7 @@ typedef struct _EXYNOS_OMX_VIDEODEC_COMPONENT { OMX_HANDLETYPE hCodecHandle; OMX_BOOL bThumbnailMode; + OMX_BOOL bDTSMode; /* true:Decoding Time Stamp, false:Presentation Time Stamp */ OMX_BOOL bFirstFrame; CODEC_DEC_BUFFER *pMFCDecInputBuffer[MFC_INPUT_BUFFER_NUM_MAX]; CODEC_DEC_BUFFER *pMFCDecOutputBuffer[MFC_OUTPUT_BUFFER_NUM_MAX]; diff --git a/component/video/dec/Exynos_OMX_VdecControl.c b/component/video/dec/Exynos_OMX_VdecControl.c index 87b8dd3..e99134f 100644 --- a/component/video/dec/Exynos_OMX_VdecControl.c +++ b/component/video/dec/Exynos_OMX_VdecControl.c @@ -1278,6 +1278,18 @@ OMX_ERRORTYPE Exynos_OMX_VideoDecodeSetParameter( pExynosPort->bNeedContigMem = pPortMemType->bNeedContigMem; } break; + case OMX_IndexVendorSetDTSMode: + { + EXYNOS_OMX_VIDEODEC_COMPONENT *pVideoDec = (EXYNOS_OMX_VIDEODEC_COMPONENT *)pExynosComponent->hComponentHandle; + EXYNOS_OMX_VIDEO_PARAM_DTSMODE *pDTSParam = (EXYNOS_OMX_VIDEO_PARAM_DTSMODE *)ComponentParameterStructure; + + ret = Exynos_OMX_Check_SizeVersion(pDTSParam, sizeof(EXYNOS_OMX_VIDEO_PARAM_DTSMODE)); + if (ret != OMX_ErrorNone) + goto EXIT; + + pVideoDec->bDTSMode = pDTSParam->bDTSMode; + } + break; default: { ret = Exynos_OMX_SetParameter(hComponent, nIndex, ComponentParameterStructure); @@ -1447,6 +1459,10 @@ OMX_ERRORTYPE Exynos_OMX_VideoDecodeGetExtensionIndex( *pIndexType = (OMX_INDEXTYPE) OMX_IndexVendorGetBufferFD; ret = OMX_ErrorNone; goto EXIT; + } else if (Exynos_OSAL_Strcmp(cParameterName, EXYNOS_INDEX_PARAM_SET_DTS_MODE) == 0) { + *pIndexType = (OMX_INDEXTYPE) OMX_IndexVendorSetDTSMode; + ret = OMX_ErrorNone; + goto EXIT; } #ifdef USE_ANB diff --git a/component/video/dec/h264/Exynos_OMX_H264dec.c b/component/video/dec/h264/Exynos_OMX_H264dec.c index 636192d..f2c5af0 100644 --- a/component/video/dec/h264/Exynos_OMX_H264dec.c +++ b/component/video/dec/h264/Exynos_OMX_H264dec.c @@ -912,6 +912,10 @@ OMX_ERRORTYPE H264CodecSrcSetup(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DAT if (pVideoDec->bThumbnailMode == OMX_TRUE) pDecOps->Set_DisplayDelay(hMFCHandle, 0); + if ((pDecOps->Enable_DTSMode != NULL) && + (pVideoDec->bDTSMode == OMX_TRUE)) + pDecOps->Enable_DTSMode(hMFCHandle); + /* input buffer info */ Exynos_OSAL_Memset(&bufferConf, 0, sizeof(bufferConf)); bufferConf.eCompressionFormat = VIDEO_CODING_AVC; @@ -2093,19 +2097,18 @@ OMX_ERRORTYPE Exynos_H264Dec_DstOut(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX } else { /* For timestamp correction. if mfc support frametype detect */ Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "disp_pic_frame_type: %d", pVideoBuffer->frameType); -#ifdef NEED_TIMESTAMP_REORDER - if ((pVideoBuffer->frameType == VIDEO_FRAME_I)) { - pDstOutputData->timeStamp = pExynosComponent->timeStamp[indexTimestamp]; - pDstOutputData->nFlags = pExynosComponent->nFlags[indexTimestamp]; - pH264Dec->hMFCH264Handle.outputIndexTimestamp = indexTimestamp; - } else { - pDstOutputData->timeStamp = pExynosComponent->timeStamp[pH264Dec->hMFCH264Handle.outputIndexTimestamp]; - pDstOutputData->nFlags = pExynosComponent->nFlags[pH264Dec->hMFCH264Handle.outputIndexTimestamp]; + + /* NEED TIMESTAMP REORDER */ + if (pVideoDec->bDTSMode == OMX_TRUE) { + if (pVideoBuffer->frameType == VIDEO_FRAME_I) + pH264Dec->hMFCH264Handle.outputIndexTimestamp = indexTimestamp; + else + indexTimestamp = pH264Dec->hMFCH264Handle.outputIndexTimestamp; } -#else + pDstOutputData->timeStamp = pExynosComponent->timeStamp[indexTimestamp]; pDstOutputData->nFlags = pExynosComponent->nFlags[indexTimestamp]; -#endif + Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "timestamp %lld us (%.2f secs), indexTimestamp: %d, nFlags: 0x%x", pDstOutputData->timeStamp, pDstOutputData->timeStamp / 1E6, indexTimestamp, pDstOutputData->nFlags); } diff --git a/component/video/dec/mpeg2/Exynos_OMX_Mpeg2dec.c b/component/video/dec/mpeg2/Exynos_OMX_Mpeg2dec.c index 5270245..947c684 100644 --- a/component/video/dec/mpeg2/Exynos_OMX_Mpeg2dec.c +++ b/component/video/dec/mpeg2/Exynos_OMX_Mpeg2dec.c @@ -573,6 +573,10 @@ OMX_ERRORTYPE Mpeg2CodecSrcSetup(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DA if (pVideoDec->bThumbnailMode == OMX_TRUE) pDecOps->Set_DisplayDelay(hMFCHandle, 0); + if ((pDecOps->Enable_DTSMode != NULL) && + (pVideoDec->bDTSMode == OMX_TRUE)) + pDecOps->Enable_DTSMode(hMFCHandle); + /* input buffer info */ Exynos_OSAL_Memset(&bufferConf, 0, sizeof(bufferConf)); bufferConf.eCompressionFormat = VIDEO_CODING_MPEG2; @@ -1682,19 +1686,18 @@ OMX_ERRORTYPE Exynos_Mpeg2Dec_DstOut(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OM } else { /* For timestamp correction. if mfc support frametype detect */ Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "disp_pic_frame_type: %d", pVideoBuffer->frameType); -#ifdef NEED_TIMESTAMP_REORDER - if ((pVideoBuffer->frameType == VIDEO_FRAME_I)) { - pDstOutputData->timeStamp = pExynosComponent->timeStamp[indexTimestamp]; - pDstOutputData->nFlags = pExynosComponent->nFlags[indexTimestamp]; - pMpeg2Dec->hMFCMpeg2Handle.outputIndexTimestamp = indexTimestamp; - } else { - pDstOutputData->timeStamp = pExynosComponent->timeStamp[pMpeg2Dec->hMFCMpeg2Handle.outputIndexTimestamp]; - pDstOutputData->nFlags = pExynosComponent->nFlags[pMpeg2Dec->hMFCMpeg2Handle.outputIndexTimestamp]; + + /* NEED TIMESTAMP REORDER */ + if (pVideoDec->bDTSMode == OMX_TRUE) { + if (pVideoBuffer->frameType == VIDEO_FRAME_I) + pMpeg2Dec->hMFCMpeg2Handle.outputIndexTimestamp = indexTimestamp; + else + indexTimestamp = pMpeg2Dec->hMFCMpeg2Handle.outputIndexTimestamp; } -#else + pDstOutputData->timeStamp = pExynosComponent->timeStamp[indexTimestamp]; pDstOutputData->nFlags = pExynosComponent->nFlags[indexTimestamp]; -#endif + Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "timestamp %lld us (%.2f secs), indexTimestamp: %d, nFlags: 0x%x", pDstOutputData->timeStamp, pDstOutputData->timeStamp / 1E6, indexTimestamp, pDstOutputData->nFlags); } diff --git a/component/video/dec/mpeg4/Exynos_OMX_Mpeg4dec.c b/component/video/dec/mpeg4/Exynos_OMX_Mpeg4dec.c index 6c99559..400f307 100644 --- a/component/video/dec/mpeg4/Exynos_OMX_Mpeg4dec.c +++ b/component/video/dec/mpeg4/Exynos_OMX_Mpeg4dec.c @@ -790,6 +790,10 @@ OMX_ERRORTYPE Mpeg4CodecSrcSetup(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DA if (pVideoDec->bThumbnailMode == OMX_TRUE) pDecOps->Set_DisplayDelay(hMFCHandle, 0); + if ((pDecOps->Enable_DTSMode != NULL) && + (pVideoDec->bDTSMode == OMX_TRUE)) + pDecOps->Enable_DTSMode(hMFCHandle); + /* input buffer info */ Exynos_OSAL_Memset(&bufferConf, 0, sizeof(bufferConf)); if (pMpeg4Dec->hMFCMpeg4Handle.codecType == CODEC_TYPE_MPEG4) @@ -2035,19 +2039,18 @@ OMX_ERRORTYPE Exynos_Mpeg4Dec_DstOut(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OM } else { /* For timestamp correction. if mfc support frametype detect */ Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "disp_pic_frame_type: %d", pVideoBuffer->frameType); -#ifdef NEED_TIMESTAMP_REORDER - if ((pVideoBuffer->frameType == VIDEO_FRAME_I)) { - pDstOutputData->timeStamp = pExynosComponent->timeStamp[indexTimestamp]; - pDstOutputData->nFlags = pExynosComponent->nFlags[indexTimestamp]; - pMpeg4Dec->hMFCMpeg4Handle.outputIndexTimestamp = indexTimestamp; - } else { - pDstOutputData->timeStamp = pExynosComponent->timeStamp[pMpeg4Dec->hMFCMpeg4Handle.outputIndexTimestamp]; - pDstOutputData->nFlags = pExynosComponent->nFlags[pMpeg4Dec->hMFCMpeg4Handle.outputIndexTimestamp]; + + /* NEED TIMESTAMP REORDER */ + if (pVideoDec->bDTSMode == OMX_TRUE) { + if (pVideoBuffer->frameType == VIDEO_FRAME_I) + pMpeg4Dec->hMFCMpeg4Handle.outputIndexTimestamp = indexTimestamp; + else + indexTimestamp = pMpeg4Dec->hMFCMpeg4Handle.outputIndexTimestamp; } -#else + pDstOutputData->timeStamp = pExynosComponent->timeStamp[indexTimestamp]; pDstOutputData->nFlags = pExynosComponent->nFlags[indexTimestamp]; -#endif + Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "timestamp %lld us (%.2f secs), indexTimestamp: %d, nFlags: 0x%x", pDstOutputData->timeStamp, pDstOutputData->timeStamp / 1E6, indexTimestamp, pDstOutputData->nFlags); } diff --git a/component/video/dec/vc1/Exynos_OMX_Wmvdec.c b/component/video/dec/vc1/Exynos_OMX_Wmvdec.c index 851f3ad..b588ffa 100644 --- a/component/video/dec/vc1/Exynos_OMX_Wmvdec.c +++ b/component/video/dec/vc1/Exynos_OMX_Wmvdec.c @@ -808,6 +808,10 @@ OMX_ERRORTYPE WmvCodecSrcSetup(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA if (pVideoDec->bThumbnailMode == OMX_TRUE) pDecOps->Set_DisplayDelay(hMFCHandle, 0); + if ((pDecOps->Enable_DTSMode != NULL) && + (pVideoDec->bDTSMode == OMX_TRUE)) + pDecOps->Enable_DTSMode(hMFCHandle); + if (pSrcInputData->nFlags & OMX_BUFFERFLAG_CODECCONFIG) { BitmapInfoHhr *pBitmapInfoHeader; pBitmapInfoHeader = (BitmapInfoHhr *)pSrcInputData->buffer.singlePlaneBuffer.dataBuffer; @@ -1914,21 +1918,20 @@ OMX_ERRORTYPE Exynos_WmvDec_DstOut(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_ } else { /* For timestamp correction. if mfc support frametype detect */ Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "disp_pic_frame_type: %d", pVideoBuffer->frameType); -#ifdef NEED_TIMESTAMP_REORDER - if ((pVideoBuffer->frameType == VIDEO_FRAME_I) || - ((pVideoBuffer->frameType == VIDEO_FRAME_OTHERS) && - ((pExynosComponent->nFlags[indexTimestamp] & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS))) { - pDstOutputData->timeStamp = pExynosComponent->timeStamp[indexTimestamp]; - pDstOutputData->nFlags = pExynosComponent->nFlags[indexTimestamp]; - pWmvDec->hMFCWmvHandle.outputIndexTimestamp = indexTimestamp; - } else { - pDstOutputData->timeStamp = pExynosComponent->timeStamp[pWmvDec->hMFCWmvHandle.outputIndexTimestamp]; - pDstOutputData->nFlags = pExynosComponent->nFlags[pWmvDec->hMFCWmvHandle.outputIndexTimestamp]; + + /* NEED TIMESTAMP REORDER */ + if (pVideoDec->bDTSMode == OMX_TRUE) { + if ((pVideoBuffer->frameType == VIDEO_FRAME_I) || + ((pVideoBuffer->frameType == VIDEO_FRAME_OTHERS) && + ((pExynosComponent->nFlags[indexTimestamp] & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS))) + pWmvDec->hMFCWmvHandle.outputIndexTimestamp = indexTimestamp; + else + indexTimestamp = pWmvDec->hMFCWmvHandle.outputIndexTimestamp; } -#else + pDstOutputData->timeStamp = pExynosComponent->timeStamp[indexTimestamp]; pDstOutputData->nFlags = pExynosComponent->nFlags[indexTimestamp]; -#endif + Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "timestamp %lld us (%.2f secs), indexTimestamp: %d, nFlags: 0x%x", pDstOutputData->timeStamp, pDstOutputData->timeStamp / 1E6, indexTimestamp, pDstOutputData->nFlags); } diff --git a/component/video/dec/vp8/Exynos_OMX_Vp8dec.c b/component/video/dec/vp8/Exynos_OMX_Vp8dec.c index cbd832a..e1c9b6f 100644 --- a/component/video/dec/vp8/Exynos_OMX_Vp8dec.c +++ b/component/video/dec/vp8/Exynos_OMX_Vp8dec.c @@ -605,6 +605,10 @@ OMX_ERRORTYPE VP8CodecSrcSetup(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA if (pVideoDec->bThumbnailMode == OMX_TRUE) pDecOps->Set_DisplayDelay(hMFCHandle, 0); + if ((pDecOps->Enable_DTSMode != NULL) && + (pVideoDec->bDTSMode == OMX_TRUE)) + pDecOps->Enable_DTSMode(hMFCHandle); + /* input buffer info */ Exynos_OSAL_Memset(&bufferConf, 0, sizeof(bufferConf)); bufferConf.eCompressionFormat = VIDEO_CODING_VP8; @@ -1626,19 +1630,18 @@ OMX_ERRORTYPE Exynos_VP8Dec_DstOut(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_ } else { /* For timestamp correction. if mfc support frametype detect */ Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "disp_pic_frame_type: %d", pVideoBuffer->frameType); -#ifdef NEED_TIMESTAMP_REORDER - if ((pVideoBuffer->frameType == VIDEO_FRAME_I)) { - pDstOutputData->timeStamp = pExynosComponent->timeStamp[indexTimestamp]; - pDstOutputData->nFlags = pExynosComponent->nFlags[indexTimestamp]; - pVp8Dec->hMFCVp8Handle.outputIndexTimestamp = indexTimestamp; - } else { - pDstOutputData->timeStamp = pExynosComponent->timeStamp[pVp8Dec->hMFCVp8Handle.outputIndexTimestamp]; - pDstOutputData->nFlags = pExynosComponent->nFlags[pVp8Dec->hMFCVp8Handle.outputIndexTimestamp]; + + /* NEED TIMESTAMP REORDER */ + if (pVideoDec->bDTSMode == OMX_TRUE) { + if (pVideoBuffer->frameType == VIDEO_FRAME_I) + pVp8Dec->hMFCVp8Handle.outputIndexTimestamp = indexTimestamp; + else + indexTimestamp = pVp8Dec->hMFCVp8Handle.outputIndexTimestamp; } -#else + pDstOutputData->timeStamp = pExynosComponent->timeStamp[indexTimestamp]; pDstOutputData->nFlags = pExynosComponent->nFlags[indexTimestamp]; -#endif + Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "timestamp %lld us (%.2f secs), indexTimestamp: %d, nFlags: 0x%x", pDstOutputData->timeStamp, pDstOutputData->timeStamp / 1E6, indexTimestamp, pDstOutputData->nFlags); } diff --git a/include/exynos/Exynos_OMX_Def.h b/include/exynos/Exynos_OMX_Def.h index eacb8a5..a7c61ab 100644 --- a/include/exynos/Exynos_OMX_Def.h +++ b/include/exynos/Exynos_OMX_Def.h @@ -73,6 +73,12 @@ typedef struct _EXYNOS_OMX_VIDEO_PARAM_PORTMEMTYPE { OMX_BOOL bNeedContigMem; } EXYNOS_OMX_VIDEO_PARAM_PORTMEMTYPE; +typedef struct _EXYNOS_OMX_VIDEO_PARAM_DTSMODE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_BOOL bDTSMode; +} EXYNOS_OMX_VIDEO_PARAM_DTSMODE; + typedef struct _EXYNOS_OMX_VIDEO_CONFIG_BUFFERINFO { OMX_U32 nSize; OMX_VERSIONTYPE nVersion; @@ -94,6 +100,8 @@ typedef enum _EXYNOS_OMX_INDEXTYPE OMX_IndexVendorNeedContigMemory = 0x7F000004, #define EXYNOS_INDEX_CONFIG_GET_BUFFER_FD "OMX.SEC.index.GetBufferFD" OMX_IndexVendorGetBufferFD = 0x7F000005, +#define EXYNOS_INDEX_PARAM_SET_DTS_MODE "OMX.SEC.index.SetDTSMode" + OMX_IndexVendorSetDTSMode = 0x7F000006, /* for Android Native Window */ #define EXYNOS_INDEX_PARAM_ENABLE_ANB "OMX.google.android.index.enableAndroidNativeBuffers"