vdec: added OMX_IndexParamSetDTSMode support
authorJinsung Yang <jsgood.yang@samsung.com>
Fri, 1 Feb 2013 07:09:41 +0000 (16:09 +0900)
committerHuisung Kang <hs1218.kang@samsung.com>
Thu, 7 Feb 2013 00:31:56 +0000 (09:31 +0900)
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 <jsgood.yang@samsung.com>
component/video/dec/Exynos_OMX_Vdec.c
component/video/dec/Exynos_OMX_Vdec.h
component/video/dec/Exynos_OMX_VdecControl.c
component/video/dec/h264/Exynos_OMX_H264dec.c
component/video/dec/mpeg2/Exynos_OMX_Mpeg2dec.c
component/video/dec/mpeg4/Exynos_OMX_Mpeg4dec.c
component/video/dec/vc1/Exynos_OMX_Wmvdec.c
component/video/dec/vp8/Exynos_OMX_Vp8dec.c
include/exynos/Exynos_OMX_Def.h

index 1c1f6b2b2d8df491b1be8214e18abe1f32d690f0..5e58096e7addad1ae937d4db78ee45f1101f295b 100644 (file)
@@ -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;
index 1639366cd7f02b62d2f42a05cb592f12cd7c8a8d..48497e6dcaef50387cb08fc6f17e038f8481117e 100644 (file)
@@ -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];
index 87b8dd358ca7c30a9373da0ed079e0733add9964..e99134f119a9feee755d240ae9883977543c9fe1 100644 (file)
@@ -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
index 636192d68be4fd550b7cb29fb2da3da3b447fe9e..f2c5af05b497f7830dbd09ebcb6b1ce9b928db39 100644 (file)
@@ -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);
     }
 
index 52702457aa474098ef42d61026de4e01cc4a544f..947c684f5083652ed79aa009f3ff8cd9e94d08f8 100644 (file)
@@ -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);
     }
 
index 6c9955946de89443036c5568f43a211588c892b7..400f307293d6eef87ffb1cfcc364ebd124d14077 100644 (file)
@@ -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);
     }
 
index 851f3ad93a40c484dd754ef204db84c7dfcbafab..b588ffa57351702c4db9518fc8184a0dc4101ae5 100644 (file)
@@ -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);
     }
 
index cbd832a48487635a24d04fdb86863d8c51d81247..e1c9b6fbedd1ed7dccd65510264ccbfae0d7facd 100644 (file)
@@ -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);
     }
 
index eacb8a59b72a9241e531871fd35e82c320cf2f1b..a7c61abdd349f33a488d40311e8c54521cd377ff 100644 (file)
@@ -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"