venc: added OMX_IndexParamVideoIntraRefresh support
authorTaehwan Kim <t_h.kim@samsung.com>
Thu, 17 Jan 2013 02:08:56 +0000 (02:08 +0000)
committerHuisung Kang <hs1218.kang@samsung.com>
Thu, 7 Feb 2013 00:24:42 +0000 (09:24 +0900)
support "Cyclic intra-refresh" only.
doesn't support "Adaptive intra-refresh".

Change-Id: I50722f5bfe8729243395123f998025e6c655b7bd
Signed-off-by: Taehwan Kim <t_h.kim@samsung.com>
component/video/enc/Exynos_OMX_Venc.h
component/video/enc/Exynos_OMX_VencControl.c
component/video/enc/h264/Exynos_OMX_H264enc.c
component/video/enc/mpeg4/Exynos_OMX_Mpeg4enc.c

index 15c6566d0b90dddceee208e6e6d94879a2d2d1f2..d0d35f7e90bcb95f2db66aaf49d7a7cd4dc05580 100644 (file)
@@ -101,6 +101,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 36fd7664879a26d7f3203c10a5d7e25ca6581d07..6d7bdb5b89e5048df6ab36650b34ae04aba269b1 100644 (file)
@@ -1443,6 +1443,30 @@ OMX_ERRORTYPE Exynos_OMX_VideoEncodeGetParameter(
         pPortMemType->bNeedContigMem = pExynosPort->bNeedContigMem;
     }
         break;
+    case OMX_IndexParamVideoIntraRefresh:
+    {
+        OMX_VIDEO_PARAM_INTRAREFRESHTYPE    *pIntraRefresh  = (OMX_VIDEO_PARAM_INTRAREFRESHTYPE *)pComponentParameterStructure;
+        OMX_U32                              nPortIndex     = pIntraRefresh->nPortIndex;
+        EXYNOS_OMX_VIDEOENC_COMPONENT       *pVideoEnc      = NULL;
+
+        ret = Exynos_OMX_Check_SizeVersion(pIntraRefresh, sizeof(OMX_VIDEO_PARAM_INTRAREFRESHTYPE));
+        if (ret != OMX_ErrorNone)
+            goto EXIT;
+
+        if (nPortIndex != OUTPUT_PORT_INDEX) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        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:
     {
         ret = Exynos_OMX_GetParameter(hComponent, nParamIndex, pComponentParameterStructure);
@@ -1655,6 +1679,35 @@ OMX_ERRORTYPE Exynos_OMX_VideoEncodeSetParameter(
         pExynosPort->bNeedContigMem = pPortMemType->bNeedContigMem;
     }
         break;
+    case OMX_IndexParamVideoIntraRefresh:
+    {
+        OMX_VIDEO_PARAM_INTRAREFRESHTYPE    *pIntraRefresh  = (OMX_VIDEO_PARAM_INTRAREFRESHTYPE *)pComponentParameterStructure;
+        OMX_U32                              nPortIndex     = pIntraRefresh->nPortIndex;
+        EXYNOS_OMX_VIDEOENC_COMPONENT       *pVideoEnc      = NULL;
+
+        ret = Exynos_OMX_Check_SizeVersion(pIntraRefresh, sizeof(OMX_VIDEO_PARAM_INTRAREFRESHTYPE));
+        if (ret != OMX_ErrorNone)
+            goto EXIT;
+
+        if (nPortIndex != OUTPUT_PORT_INDEX) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        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;
     default:
     {
         ret = Exynos_OMX_SetParameter(hComponent, nParamIndex, pComponentParameterStructure);
index 84230aef7f078f77488e64b6bd6dd7868c6206e5..32b06b68bd594f03bffeeaf977c76bdc10bb0967 100644 (file)
@@ -240,7 +240,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;
@@ -251,6 +250,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 0dd2d2a4933fa76946f4e9aa1fb420513965e722..ccbb485f177f6ef6f3547a61c5de5737d27f3805 100644 (file)
@@ -231,7 +231,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;
@@ -242,6 +241,15 @@ 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;
+        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_SEC_COLOR_FormatNV21Linear)
             pCommonParam->FrameMap = VIDEO_COLORFORMAT_NV12;
@@ -332,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;
@@ -343,6 +350,15 @@ 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;
+        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_SEC_COLOR_FormatNV21Linear)
             pCommonParam->FrameMap = VIDEO_COLORFORMAT_NV12;