exynos_omx: multi_thread: Add OMX_IndexParamVideoIntraRefresh support.
authorSeungBeom Kim <sbcrux.kim@samsung.com>
Fri, 16 Nov 2012 04:03:45 +0000 (13:03 +0900)
committerJames Dong <jdong@google.com>
Wed, 28 Nov 2012 18:22:23 +0000 (10:22 -0800)
Add OMX_IndexParamVideoIntraRefresh support, with "Cyclic intra marcoblock refresh" mode support only.
Don't support "Adaptive intra-refresh".

o related-to-bug: 7524845

Change-Id: Id47c0cd3831db6fdb4e46ccece8f8d6f955d777a
Signed-off-by: SeungBeom Kim <sbcrux.kim@samsung.com>
exynos_omx/openmax/exynos_omx/component/video/enc/Exynos_OMX_Venc.h
exynos_omx/openmax/exynos_omx/component/video/enc/Exynos_OMX_VencControl.c
exynos_omx/openmax/exynos_omx/component/video/enc/h264/Exynos_OMX_H264enc.c
exynos_omx/openmax/exynos_omx/component/video/enc/mpeg4/Exynos_OMX_Mpeg4enc.c

index cb5f11005361e19d73282e95208a651afc5ece5f..072c2b44e6444dca84ce05a534cfe5497e4d6c16 100644 (file)
@@ -99,6 +99,7 @@ typedef struct _EXYNOS_OMX_VIDEOENC_COMPONENT
     OMX_BOOL IntraRefreshVOP;
     OMX_VIDEO_CONTROLRATETYPE eControlRate[ALL_PORT_NUM];
     OMX_VIDEO_PARAM_QUANTIZATIONTYPE quantization;
+    OMX_VIDEO_PARAM_INTRAREFRESHTYPE intraRefresh;
 
     OMX_BOOL bFirstInput;
     OMX_BOOL bFirstOutput;
index e8c8647a71fc58d37923aca4491386614c4be986..42bcc3872a4f986e23ada0e672ab9873ad6e81e2 100644 (file)
@@ -1194,6 +1194,25 @@ OMX_ERRORTYPE Exynos_OMX_VideoEncodeGetParameter(
             portDefinition->nBufferSize = MAX_INPUT_METADATA_BUFFER_SIZE;
         }
 #endif
+    }
+        break;
+    case OMX_IndexParamVideoIntraRefresh:
+    {
+        OMX_VIDEO_PARAM_INTRAREFRESHTYPE *pIntraRefresh = (OMX_VIDEO_PARAM_INTRAREFRESHTYPE *)ComponentParameterStructure;
+        OMX_U32                           portIndex = pIntraRefresh->nPortIndex;
+        EXYNOS_OMX_VIDEOENC_COMPONENT    *pVideoEnc = NULL;
+
+        if (portIndex != OUTPUT_PORT_INDEX) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        } else {
+            pVideoEnc = (EXYNOS_OMX_VIDEOENC_COMPONENT *)pExynosComponent->hComponentHandle;
+            pIntraRefresh->eRefreshMode = pVideoEnc->intraRefresh.eRefreshMode;
+            pIntraRefresh->nAirMBs = pVideoEnc->intraRefresh.nAirMBs;
+            pIntraRefresh->nAirRef = pVideoEnc->intraRefresh.nAirRef;
+            pIntraRefresh->nCirMBs = pVideoEnc->intraRefresh.nCirMBs;
+        }
+        ret = OMX_ErrorNone;
     }
         break;
     default:
@@ -1358,6 +1377,30 @@ OMX_ERRORTYPE Exynos_OMX_VideoEncodeSetParameter(
         ret = OMX_ErrorNone;
     }
         break;
+    case OMX_IndexParamVideoIntraRefresh:
+    {
+        OMX_VIDEO_PARAM_INTRAREFRESHTYPE *pIntraRefresh = (OMX_VIDEO_PARAM_INTRAREFRESHTYPE *)ComponentParameterStructure;
+        OMX_U32                           portIndex = pIntraRefresh->nPortIndex;
+        EXYNOS_OMX_VIDEOENC_COMPONENT    *pVideoEnc = NULL;
+
+        if (portIndex != OUTPUT_PORT_INDEX) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        } else {
+            pVideoEnc = (EXYNOS_OMX_VIDEOENC_COMPONENT *)pExynosComponent->hComponentHandle;
+            if (pIntraRefresh->eRefreshMode == OMX_VIDEO_IntraRefreshCyclic) {
+                pVideoEnc->intraRefresh.eRefreshMode = pIntraRefresh->eRefreshMode;
+                pVideoEnc->intraRefresh.nCirMBs = pIntraRefresh->nCirMBs;
+                Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "OMX_VIDEO_IntraRefreshCyclic Enable, nCirMBs: %d",
+                                pVideoEnc->intraRefresh.nCirMBs);
+            } else {
+                ret = OMX_ErrorUnsupportedSetting;
+                goto EXIT;
+            }
+        }
+        ret = OMX_ErrorNone;
+    }
+        break;
 #ifdef USE_STOREMETADATA
     case OMX_IndexParamStoreMetaDataBuffer:
     {
index 0f8a27578b4b1accae6c44ebfcc7710020525b0c..d25503d4fc79d3cc17cf5d97b6deb0277e7f9c83 100644 (file)
@@ -241,7 +241,6 @@ static void Set_H264Enc_Param(EXYNOS_OMX_BASECOMPONENT *pExynosComponent)
     pCommonParam->SourceHeight = pExynosOutputPort->portDefinition.format.video.nFrameHeight;
     pCommonParam->IDRPeriod    = pH264Enc->AVCComponent[OUTPUT_PORT_INDEX].nPFrames + 1;
     pCommonParam->SliceMode    = 0;
-    pCommonParam->RandomIntraMBRefresh = 0;
     pCommonParam->Bitrate      = pExynosOutputPort->portDefinition.format.video.nBitrate;
     pCommonParam->FrameQp      = pVideoEnc->quantization.nQpI;
     pCommonParam->FrameQp_P    = pVideoEnc->quantization.nQpP;
@@ -252,6 +251,15 @@ static void Set_H264Enc_Param(EXYNOS_OMX_BASECOMPONENT *pExynosComponent)
     pCommonParam->CbPadVal     = 0;
     pCommonParam->CrPadVal     = 0;
 
+    if (pVideoEnc->intraRefresh.eRefreshMode == OMX_VIDEO_IntraRefreshCyclic) {
+        /* Cyclic Mode */
+        pCommonParam->RandomIntraMBRefresh = pVideoEnc->intraRefresh.nCirMBs;
+        Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "RandomIntraMBRefresh: %d", pCommonParam->RandomIntraMBRefresh);
+    } else {
+        /* Don't support "Adaptive" and "Cyclic + Adaptive" */
+        pCommonParam->RandomIntraMBRefresh = 0;
+    }
+
     if (pExynosInputPort->bufferProcessType == BUFFER_SHARE) {
         if (pVideoEnc->ANBColorFormat == OMX_COLOR_FormatYUV420SemiPlanar)
             pCommonParam->FrameMap = VIDEO_COLORFORMAT_NV12;
index 4884a8140fb740c3034df742f0dc41cd3c35813f..f58ee45d59743737049e22c223e5e2d56be59f54 100644 (file)
@@ -232,7 +232,6 @@ static void Set_Mpeg4Enc_Param(EXYNOS_OMX_BASECOMPONENT *pExynosComponent)
     pCommonParam->SourceHeight = pExynosOutputPort->portDefinition.format.video.nFrameHeight;
     pCommonParam->IDRPeriod    = pMpeg4Enc->mpeg4Component[OUTPUT_PORT_INDEX].nPFrames + 1;
     pCommonParam->SliceMode    = 0;
-    pCommonParam->RandomIntraMBRefresh = 0;
     pCommonParam->Bitrate      = pExynosOutputPort->portDefinition.format.video.nBitrate;
     pCommonParam->FrameQp      = pVideoEnc->quantization.nQpI;
     pCommonParam->FrameQp_P    = pVideoEnc->quantization.nQpP;
@@ -243,6 +242,14 @@ static void Set_Mpeg4Enc_Param(EXYNOS_OMX_BASECOMPONENT *pExynosComponent)
     pCommonParam->CbPadVal     = 0;
     pCommonParam->CrPadVal     = 0;
 
+    if (pVideoEnc->intraRefresh.eRefreshMode == OMX_VIDEO_IntraRefreshCyclic) {
+        /* Cyclic Mode */
+        pCommonParam->RandomIntraMBRefresh = pVideoEnc->intraRefresh.nCirMBs;
+    } else {
+        /* Don't support "Adaptive" and "Cyclic + Adaptive" */
+        pCommonParam->RandomIntraMBRefresh = 0;
+    }
+
     if (pExynosInputPort->bufferProcessType == BUFFER_SHARE) {
         if (pVideoEnc->ANBColorFormat == OMX_SEC_COLOR_FormatNV21Linear)
             pCommonParam->FrameMap = VIDEO_COLORFORMAT_NV12;
@@ -333,7 +340,6 @@ static void Set_H263Enc_Param(EXYNOS_OMX_BASECOMPONENT *pExynosComponent)
     pCommonParam->SourceHeight = pExynosOutputPort->portDefinition.format.video.nFrameHeight;
     pCommonParam->IDRPeriod    = pMpeg4Enc->h263Component[OUTPUT_PORT_INDEX].nPFrames + 1;
     pCommonParam->SliceMode    = 0;
-    pCommonParam->RandomIntraMBRefresh = 0;
     pCommonParam->Bitrate      = pExynosOutputPort->portDefinition.format.video.nBitrate;
     pCommonParam->FrameQp      = pVideoEnc->quantization.nQpI;
     pCommonParam->FrameQp_P    = pVideoEnc->quantization.nQpP;
@@ -344,6 +350,14 @@ static void Set_H263Enc_Param(EXYNOS_OMX_BASECOMPONENT *pExynosComponent)
     pCommonParam->CbPadVal     = 0;
     pCommonParam->CrPadVal     = 0;
 
+    if (pVideoEnc->intraRefresh.eRefreshMode == OMX_VIDEO_IntraRefreshCyclic) {
+        /* Cyclic Mode */
+        pCommonParam->RandomIntraMBRefresh = pVideoEnc->intraRefresh.nCirMBs;
+    } else {
+        /* Don't support "Adaptive" and "Cyclic + Adaptive" */
+        pCommonParam->RandomIntraMBRefresh = 0;
+    }
+
     if (pExynosInputPort->bufferProcessType == BUFFER_SHARE) {
         if (pVideoEnc->ANBColorFormat == OMX_SEC_COLOR_FormatNV21Linear)
             pCommonParam->FrameMap = VIDEO_COLORFORMAT_NV12;