From a38b059717ffa142bf573c3220efaece8af863b4 Mon Sep 17 00:00:00 2001 From: Taehwan Kim Date: Fri, 1 Feb 2013 01:21:48 +0000 Subject: [PATCH] vdec: changed buffer count related with MAX DPB number of buffer is modified to nBufferCountActual from maxDPBNum in share mode case. Change-Id: I07e5267ab80bf7b32442b8a4ebfba39cfe52131c Signed-off-by: Taehwan Kim --- component/video/dec/h264/Exynos_OMX_H264dec.c | 24 ++++++++++++------- .../video/dec/mpeg2/Exynos_OMX_Mpeg2dec.c | 24 ++++++++++++------- .../video/dec/mpeg4/Exynos_OMX_Mpeg4dec.c | 24 ++++++++++++------- component/video/dec/vc1/Exynos_OMX_Wmvdec.c | 24 ++++++++++++------- component/video/dec/vp8/Exynos_OMX_Vp8dec.c | 24 ++++++++++++------- 5 files changed, 80 insertions(+), 40 deletions(-) diff --git a/component/video/dec/h264/Exynos_OMX_H264dec.c b/component/video/dec/h264/Exynos_OMX_H264dec.c index b168b33..4e085ec 100644 --- a/component/video/dec/h264/Exynos_OMX_H264dec.c +++ b/component/video/dec/h264/Exynos_OMX_H264dec.c @@ -1024,9 +1024,6 @@ OMX_ERRORTYPE H264CodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent) FunctionIn(); - /* get dpb count */ - nOutbufs = pH264Dec->hMFCH264Handle.maxDPBNum; - if (pExynosOutputPort->bufferProcessType & BUFFER_COPY) { /* should be done before prepare output buffer */ if (pOutbufOps->Enable_Cacheable(hMFCHandle) != VIDEO_ERROR_NONE) { @@ -1036,11 +1033,6 @@ OMX_ERRORTYPE H264CodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent) } pOutbufOps->Set_Shareable(hMFCHandle); - if (pOutbufOps->Setup(hMFCHandle, nOutbufs) != VIDEO_ERROR_NONE) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Failed to setup output buffer"); - ret = OMX_ErrorInsufficientResources; - goto EXIT; - } ExynosVideoPlane planes[MFC_OUTPUT_BUFFER_PLANE]; OMX_U32 nAllocLen[MFC_OUTPUT_BUFFER_PLANE] = {0, 0}; @@ -1051,6 +1043,14 @@ OMX_ERRORTYPE H264CodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent) nAllocLen[1] = pH264Dec->hMFCH264Handle.codecOutbufConf.nAlignPlaneSize[1]; if (pExynosOutputPort->bufferProcessType & BUFFER_COPY) { + /* get dpb count */ + nOutbufs = pH264Dec->hMFCH264Handle.maxDPBNum; + if (pOutbufOps->Setup(hMFCHandle, nOutbufs) != VIDEO_ERROR_NONE) { + Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Failed to setup output buffer"); + ret = OMX_ErrorInsufficientResources; + goto EXIT; + } + ret = Exynos_Allocate_CodecBuffers(pOMXComponent, OUTPUT_PORT_INDEX, nOutbufs, nAllocLen); if (ret != OMX_ErrorNone) goto EXIT; @@ -1065,6 +1065,14 @@ OMX_ERRORTYPE H264CodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent) (unsigned int *)dataLen, MFC_OUTPUT_BUFFER_PLANE, NULL); } } else if (pExynosOutputPort->bufferProcessType & BUFFER_SHARE) { + /* get dpb count */ + nOutbufs = pExynosOutputPort->portDefinition.nBufferCountActual; + if (pOutbufOps->Setup(hMFCHandle, nOutbufs) != VIDEO_ERROR_NONE) { + Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Failed to setup output buffer"); + ret = OMX_ErrorInsufficientResources; + goto EXIT; + } + /* Register output buffer */ /*************/ /* TBD */ diff --git a/component/video/dec/mpeg2/Exynos_OMX_Mpeg2dec.c b/component/video/dec/mpeg2/Exynos_OMX_Mpeg2dec.c index 05db3a0..8f5bf06 100644 --- a/component/video/dec/mpeg2/Exynos_OMX_Mpeg2dec.c +++ b/component/video/dec/mpeg2/Exynos_OMX_Mpeg2dec.c @@ -742,9 +742,6 @@ OMX_ERRORTYPE Mpeg2CodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent) FunctionIn(); - /* get dpb count */ - nOutbufs = pMpeg2Dec->hMFCMpeg2Handle.maxDPBNum; - if (pExynosOutputPort->bufferProcessType & BUFFER_COPY) { /* should be done before prepare output buffer */ if (pOutbufOps->Enable_Cacheable(hMFCHandle) != VIDEO_ERROR_NONE) { @@ -754,11 +751,6 @@ OMX_ERRORTYPE Mpeg2CodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent) } pOutbufOps->Set_Shareable(hMFCHandle); - if (pOutbufOps->Setup(hMFCHandle, nOutbufs) != VIDEO_ERROR_NONE) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Failed to setup output buffer"); - ret = OMX_ErrorInsufficientResources; - goto EXIT; - } ExynosVideoPlane planes[MFC_OUTPUT_BUFFER_PLANE]; OMX_U32 nAllocLen[MFC_OUTPUT_BUFFER_PLANE] = {0, 0}; @@ -769,6 +761,14 @@ OMX_ERRORTYPE Mpeg2CodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent) nAllocLen[1] = pMpeg2Dec->hMFCMpeg2Handle.codecOutbufConf.nAlignPlaneSize[1]; if (pExynosOutputPort->bufferProcessType & BUFFER_COPY) { + /* get dpb count */ + nOutbufs = pMpeg2Dec->hMFCMpeg2Handle.maxDPBNum; + if (pOutbufOps->Setup(hMFCHandle, nOutbufs) != VIDEO_ERROR_NONE) { + Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Failed to setup output buffer"); + ret = OMX_ErrorInsufficientResources; + goto EXIT; + } + ret = Exynos_Allocate_CodecBuffers(pOMXComponent, OUTPUT_PORT_INDEX, nOutbufs, nAllocLen); if (ret != OMX_ErrorNone) goto EXIT; @@ -783,6 +783,14 @@ OMX_ERRORTYPE Mpeg2CodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent) (unsigned int *)dataLen, MFC_OUTPUT_BUFFER_PLANE, NULL); } } else if (pExynosOutputPort->bufferProcessType & BUFFER_SHARE) { + /* get dpb count */ + nOutbufs = pExynosOutputPort->portDefinition.nBufferCountActual; + if (pOutbufOps->Setup(hMFCHandle, nOutbufs) != VIDEO_ERROR_NONE) { + Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Failed to setup output buffer"); + ret = OMX_ErrorInsufficientResources; + goto EXIT; + } + /* Register output buffer */ /*************/ /* TBD */ diff --git a/component/video/dec/mpeg4/Exynos_OMX_Mpeg4dec.c b/component/video/dec/mpeg4/Exynos_OMX_Mpeg4dec.c index b2cdfdf..3cfc13c 100644 --- a/component/video/dec/mpeg4/Exynos_OMX_Mpeg4dec.c +++ b/component/video/dec/mpeg4/Exynos_OMX_Mpeg4dec.c @@ -963,9 +963,6 @@ OMX_ERRORTYPE Mpeg4CodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent) FunctionIn(); - /* get dpb count */ - nOutbufs = pMpeg4Dec->hMFCMpeg4Handle.maxDPBNum; - if (pExynosOutputPort->bufferProcessType & BUFFER_COPY) { /* should be done before prepare output buffer */ if (pOutbufOps->Enable_Cacheable(hMFCHandle) != VIDEO_ERROR_NONE) { @@ -974,11 +971,6 @@ OMX_ERRORTYPE Mpeg4CodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent) } } pOutbufOps->Set_Shareable(hMFCHandle); - if (pOutbufOps->Setup(hMFCHandle, nOutbufs) != VIDEO_ERROR_NONE) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Failed to setup output buffer"); - ret = OMX_ErrorInsufficientResources; - goto EXIT; - } ExynosVideoPlane planes[MFC_OUTPUT_BUFFER_PLANE]; OMX_U32 nAllocLen[MFC_OUTPUT_BUFFER_PLANE] = {0, 0}; @@ -989,6 +981,14 @@ OMX_ERRORTYPE Mpeg4CodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent) nAllocLen[1] = pMpeg4Dec->hMFCMpeg4Handle.codecOutbufConf.nAlignPlaneSize[1]; if (pExynosOutputPort->bufferProcessType & BUFFER_COPY) { + /* get dpb count */ + nOutbufs = pMpeg4Dec->hMFCMpeg4Handle.maxDPBNum; + if (pOutbufOps->Setup(hMFCHandle, nOutbufs) != VIDEO_ERROR_NONE) { + Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Failed to setup output buffer"); + ret = OMX_ErrorInsufficientResources; + goto EXIT; + } + ret = Exynos_Allocate_CodecBuffers(pOMXComponent, OUTPUT_PORT_INDEX, nOutbufs, nAllocLen); if (ret != OMX_ErrorNone) goto EXIT; @@ -1003,6 +1003,14 @@ OMX_ERRORTYPE Mpeg4CodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent) (unsigned int *)dataLen, MFC_OUTPUT_BUFFER_PLANE, NULL); } } else if (pExynosOutputPort->bufferProcessType & BUFFER_SHARE) { + /* get dpb count */ + nOutbufs = pExynosOutputPort->portDefinition.nBufferCountActual; + if (pOutbufOps->Setup(hMFCHandle, nOutbufs) != VIDEO_ERROR_NONE) { + Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Failed to setup output buffer"); + ret = OMX_ErrorInsufficientResources; + goto EXIT; + } + /* Register output buffer */ /*************/ /* TBD */ diff --git a/component/video/dec/vc1/Exynos_OMX_Wmvdec.c b/component/video/dec/vc1/Exynos_OMX_Wmvdec.c index 2a3c158..3491a8d 100644 --- a/component/video/dec/vc1/Exynos_OMX_Wmvdec.c +++ b/component/video/dec/vc1/Exynos_OMX_Wmvdec.c @@ -1006,9 +1006,6 @@ OMX_ERRORTYPE WmvCodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent) FunctionIn(); - /* get dpb count */ - nOutbufs = pWmvDec->hMFCWmvHandle.maxDPBNum; - if (pExynosOutputPort->bufferProcessType & BUFFER_COPY) { /* should be done before prepare output buffer */ if (pOutbufOps->Enable_Cacheable(hMFCHandle) != VIDEO_ERROR_NONE) { @@ -1018,11 +1015,6 @@ OMX_ERRORTYPE WmvCodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent) } pOutbufOps->Set_Shareable(hMFCHandle); - if (pOutbufOps->Setup(hMFCHandle, nOutbufs) != VIDEO_ERROR_NONE) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Failed to setup output buffer"); - ret = OMX_ErrorInsufficientResources; - goto EXIT; - } ExynosVideoPlane planes[MFC_OUTPUT_BUFFER_PLANE]; OMX_U32 nAllocLen[MFC_OUTPUT_BUFFER_PLANE] = {0, 0}; @@ -1033,6 +1025,14 @@ OMX_ERRORTYPE WmvCodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent) nAllocLen[1] = pWmvDec->hMFCWmvHandle.codecOutbufConf.nAlignPlaneSize[1]; if (pExynosOutputPort->bufferProcessType & BUFFER_COPY) { + /* get dpb count */ + nOutbufs = pWmvDec->hMFCWmvHandle.maxDPBNum; + if (pOutbufOps->Setup(hMFCHandle, nOutbufs) != VIDEO_ERROR_NONE) { + Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Failed to setup output buffer"); + ret = OMX_ErrorInsufficientResources; + goto EXIT; + } + ret = Exynos_Allocate_CodecBuffers(pOMXComponent, OUTPUT_PORT_INDEX, nOutbufs, nAllocLen); if (ret != OMX_ErrorNone) goto EXIT; @@ -1047,6 +1047,14 @@ OMX_ERRORTYPE WmvCodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent) (unsigned int *)dataLen, MFC_OUTPUT_BUFFER_PLANE, NULL); } } else if (pExynosOutputPort->bufferProcessType & BUFFER_SHARE) { + /* get dpb count */ + nOutbufs = pExynosOutputPort->portDefinition.nBufferCountActual; + if (pOutbufOps->Setup(hMFCHandle, nOutbufs) != VIDEO_ERROR_NONE) { + Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Failed to setup output buffer"); + ret = OMX_ErrorInsufficientResources; + goto EXIT; + } + /* Register output buffer */ /*************/ /* TBD */ diff --git a/component/video/dec/vp8/Exynos_OMX_Vp8dec.c b/component/video/dec/vp8/Exynos_OMX_Vp8dec.c index 75e491d..e0dfd90 100644 --- a/component/video/dec/vp8/Exynos_OMX_Vp8dec.c +++ b/component/video/dec/vp8/Exynos_OMX_Vp8dec.c @@ -774,9 +774,6 @@ OMX_ERRORTYPE VP8CodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent) FunctionIn(); - /* get dpb count */ - nOutbufs = pVp8Dec->hMFCVp8Handle.maxDPBNum; - if (pExynosOutputPort->bufferProcessType & BUFFER_COPY) { /* should be done before prepare output buffer */ if (pOutbufOps->Enable_Cacheable(hMFCHandle) != VIDEO_ERROR_NONE) { @@ -786,11 +783,6 @@ OMX_ERRORTYPE VP8CodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent) } pOutbufOps->Set_Shareable(hMFCHandle); - if (pOutbufOps->Setup(hMFCHandle, nOutbufs) != VIDEO_ERROR_NONE) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Failed to setup output buffer"); - ret = OMX_ErrorInsufficientResources; - goto EXIT; - } ExynosVideoPlane planes[MFC_OUTPUT_BUFFER_PLANE]; OMX_U32 nAllocLen[MFC_OUTPUT_BUFFER_PLANE] = {0, 0}; @@ -801,6 +793,14 @@ OMX_ERRORTYPE VP8CodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent) nAllocLen[1] = pVp8Dec->hMFCVp8Handle.codecOutbufConf.nAlignPlaneSize[1]; if (pExynosOutputPort->bufferProcessType & BUFFER_COPY) { + /* get dpb count */ + nOutbufs = pVp8Dec->hMFCVp8Handle.maxDPBNum; + if (pOutbufOps->Setup(hMFCHandle, nOutbufs) != VIDEO_ERROR_NONE) { + Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Failed to setup output buffer"); + ret = OMX_ErrorInsufficientResources; + goto EXIT; + } + ret = Exynos_Allocate_CodecBuffers(pOMXComponent, OUTPUT_PORT_INDEX, nOutbufs, nAllocLen); if (ret != OMX_ErrorNone) goto EXIT; @@ -815,6 +815,14 @@ OMX_ERRORTYPE VP8CodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent) (unsigned int *)dataLen, MFC_OUTPUT_BUFFER_PLANE, NULL); } } else if (pExynosOutputPort->bufferProcessType & BUFFER_SHARE) { + /* get dpb count */ + nOutbufs = pExynosOutputPort->portDefinition.nBufferCountActual; + if (pOutbufOps->Setup(hMFCHandle, nOutbufs) != VIDEO_ERROR_NONE) { + Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Failed to setup output buffer"); + ret = OMX_ErrorInsufficientResources; + goto EXIT; + } + /* Register output buffer */ /*************/ /* TBD */ -- 2.20.1