From cf09147955c0f14c06a548c1310c3683831c37bd Mon Sep 17 00:00:00 2001 From: Greg Hackmann Date: Tue, 8 Jan 2013 12:27:12 -0800 Subject: [PATCH] omx: move csc (de)initialization to common venc Change-Id: I495816ec592ecebdcceae760b1c1e90c26b223da Signed-off-by: Greg Hackmann --- .../component/video/enc/Exynos_OMX_Venc.c | 20 +++++++++++++++++++ .../video/enc/h264/Exynos_OMX_H264enc.c | 16 --------------- .../video/enc/mpeg4/Exynos_OMX_Mpeg4enc.c | 16 --------------- 3 files changed, 20 insertions(+), 32 deletions(-) diff --git a/exynos_omx/openmax/exynos_omx/component/video/enc/Exynos_OMX_Venc.c b/exynos_omx/openmax/exynos_omx/component/video/enc/Exynos_OMX_Venc.c index 82ef205..3537228 100644 --- a/exynos_omx/openmax/exynos_omx/component/video/enc/Exynos_OMX_Venc.c +++ b/exynos_omx/openmax/exynos_omx/component/video/enc/Exynos_OMX_Venc.c @@ -1091,6 +1091,8 @@ OMX_ERRORTYPE Exynos_OMX_VideoEncodeComponentInit(OMX_IN OMX_HANDLETYPE hCompone EXYNOS_OMX_BASEPORT *pExynosPort = NULL; EXYNOS_OMX_VIDEOENC_COMPONENT *pVideoEnc = NULL; + CSC_METHOD csc_method = CSC_METHOD_SW; + FunctionIn(); if (hComponent == NULL) { @@ -1139,6 +1141,19 @@ OMX_ERRORTYPE Exynos_OMX_VideoEncodeComponentInit(OMX_IN OMX_HANDLETYPE hCompone pVideoEnc->quantization.nQpP = 5; // P frame quantization parameter pVideoEnc->quantization.nQpB = 5; // B frame quantization parameter +#if 0//defined(USE_CSC_GSCALER) + csc_method = CSC_METHOD_HW; //in case of Use ION buffer. +#endif + pVideoEnc->csc_handle = csc_init(csc_method); + if (pVideoEnc->csc_handle == NULL) { + Exynos_OSAL_Free(pVideoEnc); + Exynos_OMX_BaseComponent_Destructor(pOMXComponent); + ret = OMX_ErrorInsufficientResources; + Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "OMX_ErrorInsufficientResources, Line:%d", __LINE__); + goto EXIT; + } + pVideoEnc->csc_set_format = OMX_FALSE; + pExynosComponent->bMultiThreadProcess = OMX_TRUE; /* Input port */ @@ -1235,6 +1250,11 @@ OMX_ERRORTYPE Exynos_OMX_VideoEncodeComponentDeinit(OMX_IN OMX_HANDLETYPE hCompo pVideoEnc = (EXYNOS_OMX_VIDEOENC_COMPONENT *)pExynosComponent->hComponentHandle; + if (pVideoEnc->csc_handle != NULL) { + csc_deinit(pVideoEnc->csc_handle); + pVideoEnc->csc_handle = NULL; + } + Exynos_OSAL_Free(pVideoEnc); pExynosComponent->hComponentHandle = pVideoEnc = NULL; diff --git a/exynos_omx/openmax/exynos_omx/component/video/enc/h264/Exynos_OMX_H264enc.c b/exynos_omx/openmax/exynos_omx/component/video/enc/h264/Exynos_OMX_H264enc.c index 6b4bc8b..0806f03 100644 --- a/exynos_omx/openmax/exynos_omx/component/video/enc/h264/Exynos_OMX_H264enc.c +++ b/exynos_omx/openmax/exynos_omx/component/video/enc/h264/Exynos_OMX_H264enc.c @@ -1533,7 +1533,6 @@ OMX_ERRORTYPE Exynos_H264Enc_Init(OMX_COMPONENTTYPE *pOMXComponent) ExynosVideoEncBufferOps *pInbufOps = NULL; ExynosVideoEncBufferOps *pOutbufOps = NULL; - CSC_METHOD csc_method = CSC_METHOD_SW; int i = 0; FunctionIn(); @@ -1632,16 +1631,6 @@ OMX_ERRORTYPE Exynos_H264Enc_Init(OMX_COMPONENTTYPE *pOMXComponent) pExynosComponent->getAllDelayBuffer = OMX_FALSE; -#if 0//defined(USE_CSC_GSCALER) - csc_method = CSC_METHOD_HW; //in case of Use ION buffer. -#endif - pVideoEnc->csc_handle = csc_init(csc_method); - if (pVideoEnc->csc_handle == NULL) { - ret = OMX_ErrorInsufficientResources; - goto EXIT; - } - pVideoEnc->csc_set_format = OMX_FALSE; - EXIT: FunctionOut(); @@ -1667,11 +1656,6 @@ OMX_ERRORTYPE Exynos_H264Enc_Terminate(OMX_COMPONENTTYPE *pOMXComponent) FunctionIn(); - if (pVideoEnc->csc_handle != NULL) { - csc_deinit(pVideoEnc->csc_handle); - pVideoEnc->csc_handle = NULL; - } - Exynos_OSAL_SignalTerminate(pH264Enc->hDestinationStartEvent); pH264Enc->hDestinationStartEvent = NULL; pH264Enc->bDestinationStart = OMX_FALSE; diff --git a/exynos_omx/openmax/exynos_omx/component/video/enc/mpeg4/Exynos_OMX_Mpeg4enc.c b/exynos_omx/openmax/exynos_omx/component/video/enc/mpeg4/Exynos_OMX_Mpeg4enc.c index b98db5b..c6bafc4 100644 --- a/exynos_omx/openmax/exynos_omx/component/video/enc/mpeg4/Exynos_OMX_Mpeg4enc.c +++ b/exynos_omx/openmax/exynos_omx/component/video/enc/mpeg4/Exynos_OMX_Mpeg4enc.c @@ -1749,7 +1749,6 @@ OMX_ERRORTYPE Exynos_Mpeg4Enc_Init(OMX_COMPONENTTYPE *pOMXComponent) ExynosVideoEncBufferOps *pInbufOps = NULL; ExynosVideoEncBufferOps *pOutbufOps = NULL; - CSC_METHOD csc_method = CSC_METHOD_SW; int i = 0; FunctionIn(); @@ -1848,16 +1847,6 @@ OMX_ERRORTYPE Exynos_Mpeg4Enc_Init(OMX_COMPONENTTYPE *pOMXComponent) pExynosComponent->getAllDelayBuffer = OMX_FALSE; -#if 0//defined(USE_CSC_GSCALER) - csc_method = CSC_METHOD_HW; //in case of Use ION buffer. -#endif - pVideoEnc->csc_handle = csc_init(csc_method); - if (pVideoEnc->csc_handle == NULL) { - ret = OMX_ErrorInsufficientResources; - goto EXIT; - } - pVideoEnc->csc_set_format = OMX_FALSE; - EXIT: FunctionOut(); @@ -1883,11 +1872,6 @@ OMX_ERRORTYPE Exynos_Mpeg4Enc_Terminate(OMX_COMPONENTTYPE *pOMXComponent) FunctionIn(); - if (pVideoEnc->csc_handle != NULL) { - csc_deinit(pVideoEnc->csc_handle); - pVideoEnc->csc_handle = NULL; - } - Exynos_OSAL_SignalTerminate(pMpeg4Enc->hDestinationStartEvent); pMpeg4Enc->hDestinationStartEvent = NULL; pMpeg4Enc->bDestinationStart = OMX_FALSE; -- 2.20.1