From: SeungBeom Kim Date: Mon, 30 Mar 2015 16:36:13 +0000 (+0200) Subject: video_dec: Set crop only if frame dimensions change X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=3c74bcd3979f3b9cfc69b5fa489bf25d5a54309b;p=GitHub%2FLineageOS%2Fandroid_hardware_samsung_slsi_openmax.git video_dec: Set crop only if frame dimensions change Backported-from: hardware/samsung_slsi/exynos5 Change-Id: Ic8c8a59f799334210a7c51bfaceb272b94ba7602 Signed-off-by: Andreas Schneider --- diff --git a/component/video/dec/Exynos_OMX_VdecControl.c b/component/video/dec/Exynos_OMX_VdecControl.c index 5863ab9..5011363 100644 --- a/component/video/dec/Exynos_OMX_VdecControl.c +++ b/component/video/dec/Exynos_OMX_VdecControl.c @@ -1255,6 +1255,7 @@ OMX_ERRORTYPE Exynos_OMX_VideoDecodeSetParameter( EXYNOS_OMX_BASEPORT *pExynosPort; OMX_U32 width, height, size; OMX_U32 realWidth, realHeight; + OMX_U32 originalWidth, originalHeight; if (portIndex >= pExynosComponent->portParam.nPorts) { ret = OMX_ErrorBadPortIndex; @@ -1280,6 +1281,8 @@ OMX_ERRORTYPE Exynos_OMX_VideoDecodeSetParameter( goto EXIT; } + originalWidth = pExynosPort->portDefinition.format.video.nFrameWidth; + originalHeight = pExynosPort->portDefinition.format.video.nFrameHeight; Exynos_OSAL_Memcpy(&pExynosPort->portDefinition, pPortDefinition, pPortDefinition->nSize); #ifdef USE_ANB // Modified by Google engineer @@ -1300,10 +1303,12 @@ OMX_ERRORTYPE Exynos_OMX_VideoDecodeSetParameter( pExynosPort->portDefinition.format.video.nSliceHeight = height; pExynosPort->portDefinition.nBufferSize = (size > pExynosPort->portDefinition.nBufferSize) ? size : pExynosPort->portDefinition.nBufferSize; - pExynosPort->cropRectangle.nTop = 0; - pExynosPort->cropRectangle.nLeft = 0; - pExynosPort->cropRectangle.nWidth = realWidth; - pExynosPort->cropRectangle.nHeight = realHeight; + if (realWidth != originalWidth || realHeight != originalHeight) { + pExynosPort->cropRectangle.nTop = 0; + pExynosPort->cropRectangle.nLeft = 0; + pExynosPort->cropRectangle.nWidth = realWidth; + pExynosPort->cropRectangle.nHeight = realHeight; + } if (portIndex == INPUT_PORT_INDEX) { EXYNOS_OMX_BASEPORT *pExynosOutputPort = &pExynosComponent->pExynosPort[OUTPUT_PORT_INDEX]; @@ -1311,6 +1316,15 @@ OMX_ERRORTYPE Exynos_OMX_VideoDecodeSetParameter( pExynosOutputPort->portDefinition.format.video.nFrameHeight = pExynosPort->portDefinition.format.video.nFrameHeight; pExynosOutputPort->portDefinition.format.video.nStride = width; pExynosOutputPort->portDefinition.format.video.nSliceHeight = height; + // if resetting the output port size, also reset the crop size for the output port; + // otherwise, output crop will not be updated when setting up the output port because + // the output size would not have changed after we updated it here + if (realWidth != originalWidth || realHeight != originalHeight) { + pExynosOutputPort->cropRectangle.nTop = 0; + pExynosOutputPort->cropRectangle.nLeft = 0; + pExynosOutputPort->cropRectangle.nWidth = realWidth; + pExynosOutputPort->cropRectangle.nHeight = realHeight; + } switch (pExynosOutputPort->portDefinition.format.video.eColorFormat) { case OMX_COLOR_FormatYUV420Planar: