exynos: multimedia: add support for OMX_IndexParamVideoIntraRefresh parameter
filiprrs: This fixes miracast, and possibly resolves issues with features
like chromecast, screen recording, wifi display etc.
Change-Id: I35f789a9ae29df0198b21c98dc866d8886799893
diff --git a/exynos/multimedia/openmax/component/video/enc/SEC_OMX_Venc.c b/exynos/multimedia/openmax/component/video/enc/SEC_OMX_Venc.c
index 94ba5a4..cbc3858 100644
--- a/exynos/multimedia/openmax/component/video/enc/SEC_OMX_Venc.c
+++ b/exynos/multimedia/openmax/component/video/enc/SEC_OMX_Venc.c
@@ -1245,6 +1245,30 @@
#endif
}
break;
+ case OMX_IndexParamVideoIntraRefresh:
+ {
+ OMX_VIDEO_PARAM_INTRAREFRESHTYPE *pIntraRefresh = (OMX_VIDEO_PARAM_INTRAREFRESHTYPE *)ComponentParameterStructure;
+ OMX_U32 nPortIndex = pIntraRefresh->nPortIndex;
+ SEC_OMX_VIDEOENC_COMPONENT *pVideoEnc = NULL;
+
+ ret = SEC_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 = (SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->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 = SEC_OMX_GetParameter(hComponent, nParamIndex, ComponentParameterStructure);
@@ -1414,6 +1438,35 @@
}
break;
#endif
+ case OMX_IndexParamVideoIntraRefresh:
+ {
+ OMX_VIDEO_PARAM_INTRAREFRESHTYPE *pIntraRefresh = (OMX_VIDEO_PARAM_INTRAREFRESHTYPE *)ComponentParameterStructure;
+ OMX_U32 nPortIndex = pIntraRefresh->nPortIndex;
+ SEC_OMX_VIDEOENC_COMPONENT *pVideoEnc = NULL;
+
+ ret = SEC_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 = (SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle;
+ if (pIntraRefresh->eRefreshMode == OMX_VIDEO_IntraRefreshCyclic) {
+ pVideoEnc->intraRefresh.eRefreshMode = pIntraRefresh->eRefreshMode;
+ pVideoEnc->intraRefresh.nCirMBs = pIntraRefresh->nCirMBs;
+ SEC_OSAL_Log(SEC_LOG_TRACE, "OMX_VIDEO_IntraRefreshCyclic Enable, nCirMBs: %d",
+ pVideoEnc->intraRefresh.nCirMBs);
+ } else {
+ ret = OMX_ErrorUnsupportedSetting;
+ goto EXIT;
+ }
+
+ ret = OMX_ErrorNone;
+ }
+ break;
default:
{
ret = SEC_OMX_SetParameter(hComponent, nIndex, ComponentParameterStructure);
diff --git a/exynos/multimedia/openmax/component/video/enc/SEC_OMX_Venc.h b/exynos/multimedia/openmax/component/video/enc/SEC_OMX_Venc.h
index 7403544..40ded5b 100644
--- a/exynos/multimedia/openmax/component/video/enc/SEC_OMX_Venc.h
+++ b/exynos/multimedia/openmax/component/video/enc/SEC_OMX_Venc.h
@@ -92,6 +92,7 @@
OMX_BOOL IntraRefreshVOP;
OMX_VIDEO_CONTROLRATETYPE eControlRate[ALL_PORT_NUM];
OMX_VIDEO_PARAM_QUANTIZATIONTYPE quantization;
+ OMX_VIDEO_PARAM_INTRAREFRESHTYPE intraRefresh;
OMX_BOOL bFirstFrame;
MFC_ENC_INPUT_BUFFER MFCEncInputBuffer[MFC_INPUT_BUFFER_NUM_MAX];
OMX_U32 indexInputBuffer;
diff --git a/exynos/multimedia/openmax/component/video/enc/h264/SEC_OMX_H264enc.c b/exynos/multimedia/openmax/component/video/enc/h264/SEC_OMX_H264enc.c
index f8b4585..a7e6e7e 100644
--- a/exynos/multimedia/openmax/component/video/enc/h264/SEC_OMX_H264enc.c
+++ b/exynos/multimedia/openmax/component/video/enc/h264/SEC_OMX_H264enc.c
@@ -205,7 +205,6 @@
pH264Arg->SourceHeight = pSECOutputPort->portDefinition.format.video.nFrameHeight;
pH264Arg->IDRPeriod = pH264Enc->AVCComponent[OUTPUT_PORT_INDEX].nPFrames + 1;
pH264Arg->SliceMode = 0;
- pH264Arg->RandomIntraMBRefresh = 0;
pH264Arg->Bitrate = pSECOutputPort->portDefinition.format.video.nBitrate;
pH264Arg->QSCodeMax = 51;
pH264Arg->QSCodeMin = 10;
@@ -259,6 +258,15 @@
break;
}
+ if (pVideoEnc->intraRefresh.eRefreshMode == OMX_VIDEO_IntraRefreshCyclic) {
+ /* Cyclic Mode */
+ pH264Arg->RandomIntraMBRefresh = pVideoEnc->intraRefresh.nCirMBs;
+ SEC_OSAL_Log(SEC_LOG_TRACE, "RandomIntraMBRefresh: %d", pH264Arg->RandomIntraMBRefresh);
+ } else {
+ /* Don't support "Adaptive" and "Cyclic + Adaptive" */
+ pH264Arg->RandomIntraMBRefresh = 0;
+ }
+
switch ((SEC_OMX_COLOR_FORMATTYPE)pSECInputPort->portDefinition.format.video.eColorFormat) {
case OMX_SEC_COLOR_FormatNV12LPhysicalAddress:
case OMX_SEC_COLOR_FormatNV12LVirtualAddress:
diff --git a/exynos/multimedia/openmax/component/video/enc/mpeg4/SEC_OMX_Mpeg4enc.c b/exynos/multimedia/openmax/component/video/enc/mpeg4/SEC_OMX_Mpeg4enc.c
index ebfbe6e..760fc37 100644
--- a/exynos/multimedia/openmax/component/video/enc/mpeg4/SEC_OMX_Mpeg4enc.c
+++ b/exynos/multimedia/openmax/component/video/enc/mpeg4/SEC_OMX_Mpeg4enc.c
@@ -201,7 +201,6 @@
pMpeg4Param->SourceHeight = pSECOutputPort->portDefinition.format.video.nFrameHeight;
pMpeg4Param->IDRPeriod = pMpeg4Enc->mpeg4Component[OUTPUT_PORT_INDEX].nPFrames + 1;
pMpeg4Param->SliceMode = 0;
- pMpeg4Param->RandomIntraMBRefresh = 0;
pMpeg4Param->Bitrate = pSECOutputPort->portDefinition.format.video.nBitrate;
pMpeg4Param->QSCodeMax = 30;
pMpeg4Param->QSCodeMin = 10;
@@ -242,6 +241,15 @@
break;
}
+ if (pVideoEnc->intraRefresh.eRefreshMode == OMX_VIDEO_IntraRefreshCyclic) {
+ /* Cyclic Mode */
+ pMpeg4Param->RandomIntraMBRefresh = pVideoEnc->intraRefresh.nCirMBs;
+ SEC_OSAL_Log(SEC_LOG_TRACE, "RandomIntraMBRefresh: %d", pMpeg4Param->RandomIntraMBRefresh);
+ } else {
+ /* Don't support "Adaptive" and "Cyclic + Adaptive" */
+ pMpeg4Param->RandomIntraMBRefresh = 0;
+ }
+
switch ((SEC_OMX_COLOR_FORMATTYPE)pSECInputPort->portDefinition.format.video.eColorFormat) {
case OMX_SEC_COLOR_FormatNV12LPhysicalAddress:
case OMX_SEC_COLOR_FormatNV12LVirtualAddress:
@@ -322,7 +330,6 @@
pH263Param->SourceHeight = pSECOutputPort->portDefinition.format.video.nFrameHeight;
pH263Param->IDRPeriod = pMpeg4Enc->h263Component[OUTPUT_PORT_INDEX].nPFrames + 1;
pH263Param->SliceMode = 0;
- pH263Param->RandomIntraMBRefresh = 0;
pH263Param->Bitrate = pSECOutputPort->portDefinition.format.video.nBitrate;
pH263Param->QSCodeMax = 30;
pH263Param->QSCodeMin = 10;
@@ -356,6 +363,15 @@
break;
}
+ if (pVideoEnc->intraRefresh.eRefreshMode == OMX_VIDEO_IntraRefreshCyclic) {
+ /* Cyclic Mode */
+ pH263Param->RandomIntraMBRefresh = pVideoEnc->intraRefresh.nCirMBs;
+ SEC_OSAL_Log(SEC_LOG_TRACE, "RandomIntraMBRefresh: %d", pH263Param->RandomIntraMBRefresh);
+ } else {
+ /* Don't support "Adaptive" and "Cyclic + Adaptive" */
+ pH263Param->RandomIntraMBRefresh = 0;
+ }
+
switch ((SEC_OMX_COLOR_FORMATTYPE)pSECInputPort->portDefinition.format.video.eColorFormat) {
case OMX_SEC_COLOR_FormatNV12LPhysicalAddress:
case OMX_SEC_COLOR_FormatNV12LVirtualAddress: