From a80c3bc59aabff8dc572d5f63231ddf4554a90c9 Mon Sep 17 00:00:00 2001 From: Taehwan Kim Date: Fri, 28 Dec 2012 02:26:22 +0000 Subject: [PATCH] video: added USE_CSC_HW macro Change-Id: I64609678de85d69b108c2c32158901f7ca00c327 Signed-off-by: Taehwan Kim --- component/video/dec/Exynos_OMX_Vdec.c | 11 +++++++---- component/video/dec/h264/Android.mk | 4 ++++ component/video/dec/h264/Exynos_OMX_H264dec.c | 4 ++-- component/video/dec/mpeg2/Android.mk | 4 ++++ component/video/dec/mpeg2/Exynos_OMX_Mpeg2dec.c | 4 ++-- component/video/dec/mpeg4/Android.mk | 4 ++++ component/video/dec/mpeg4/Exynos_OMX_Mpeg4dec.c | 4 ++-- component/video/dec/vc1/Android.mk | 4 ++++ component/video/dec/vc1/Exynos_OMX_Wmvdec.c | 4 ++-- component/video/dec/vp8/Android.mk | 4 ++++ component/video/dec/vp8/Exynos_OMX_Vp8dec.c | 4 ++-- component/video/enc/Exynos_OMX_Venc.c | 12 +++++++----- component/video/enc/h264/Android.mk | 4 ++++ component/video/enc/h264/Exynos_OMX_H264enc.c | 4 ++-- component/video/enc/mpeg4/Android.mk | 4 ++++ component/video/enc/mpeg4/Exynos_OMX_Mpeg4enc.c | 4 ++-- 16 files changed, 56 insertions(+), 23 deletions(-) diff --git a/component/video/dec/Exynos_OMX_Vdec.c b/component/video/dec/Exynos_OMX_Vdec.c index 3ff4df8..145c210 100644 --- a/component/video/dec/Exynos_OMX_Vdec.c +++ b/component/video/dec/Exynos_OMX_Vdec.c @@ -327,7 +327,7 @@ OMX_BOOL Exynos_CSC_OutputData(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA CSC_ERRORCODE cscRet = CSC_ErrorNone; CSC_METHOD csc_method = CSC_METHOD_SW; - unsigned int cacheable = 1; + unsigned int srcCacheable = 1, dstCacheable = 1; pBufferInfo = (DECODE_CODEC_EXTRA_BUFFERINFO *)dstOutputData->extInfo; @@ -344,8 +344,11 @@ OMX_BOOL Exynos_CSC_OutputData(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA pYUVBuf[1] = (unsigned char *)pOutputBuf + imageSize; pYUVBuf[2] = (unsigned char *)pOutputBuf + imageSize + imageSize / 4; -#ifdef USE_DMA_BUF csc_get_method(pVideoDec->csc_handle, &csc_method); + if (csc_method == CSC_METHOD_HW) + srcCacheable = 0; + +#ifdef USE_DMA_BUF if (csc_method == CSC_METHOD_HW) { pSrcBuf[0] = dstOutputData->buffer.multiPlaneBuffer.fd[0]; pSrcBuf[1] = dstOutputData->buffer.multiPlaneBuffer.fd[1]; @@ -392,7 +395,7 @@ OMX_BOOL Exynos_CSC_OutputData(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA width, /* crop_width */ height, /* crop_height */ omx_2_hal_pixel_format(colorFormat), /* color_format */ - cacheable); /* cacheable */ + srcCacheable); /* cacheable */ csc_set_dst_format( pVideoDec->csc_handle, /* handle */ width, /* width */ @@ -402,7 +405,7 @@ OMX_BOOL Exynos_CSC_OutputData(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA width, /* crop_width */ height, /* crop_height */ omx_2_hal_pixel_format(exynosOutputPort->portDefinition.format.video.eColorFormat), /* color_format */ - cacheable); /* cacheable */ + dstCacheable); /* cacheable */ pVideoDec->csc_set_format = OMX_TRUE; } csc_set_src_buffer( diff --git a/component/video/dec/h264/Android.mk b/component/video/dec/h264/Android.mk index f07f477..7b25889 100644 --- a/component/video/dec/h264/Android.mk +++ b/component/video/dec/h264/Android.mk @@ -25,6 +25,10 @@ ifeq ($(BOARD_USE_S3D_SUPPORT), true) LOCAL_CFLAGS += -DUSE_S3D_SUPPORT endif +ifeq ($(BOARD_USE_CSC_HW), true) +LOCAL_CFLAGS += -DUSE_CSC_HW +endif + LOCAL_ARM_MODE := arm LOCAL_STATIC_LIBRARIES := libExynosOMX_Vdec libExynosOMX_OSAL libExynosOMX_Basecomponent \ diff --git a/component/video/dec/h264/Exynos_OMX_H264dec.c b/component/video/dec/h264/Exynos_OMX_H264dec.c index 371d0b5..5253f74 100644 --- a/component/video/dec/h264/Exynos_OMX_H264dec.c +++ b/component/video/dec/h264/Exynos_OMX_H264dec.c @@ -1694,8 +1694,8 @@ OMX_ERRORTYPE Exynos_H264Dec_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. +#ifdef USE_CSC_HW + csc_method = CSC_METHOD_HW; #endif if (pVideoDec->bDRMPlayerMode == OMX_TRUE) { pVideoDec->csc_handle = csc_init(CSC_METHOD_HW); diff --git a/component/video/dec/mpeg2/Android.mk b/component/video/dec/mpeg2/Android.mk index 2b8002a..d378baa 100644 --- a/component/video/dec/mpeg2/Android.mk +++ b/component/video/dec/mpeg2/Android.mk @@ -21,6 +21,10 @@ ifeq ($(BOARD_USE_DMA_BUF), true) LOCAL_CFLAGS += -DUSE_DMA_BUF endif +ifeq ($(BOARD_USE_CSC_HW), true) +LOCAL_CFLAGS += -DUSE_CSC_HW +endif + LOCAL_ARM_MODE := arm LOCAL_STATIC_LIBRARIES := libExynosOMX_Vdec libExynosOMX_OSAL libExynosOMX_Basecomponent \ diff --git a/component/video/dec/mpeg2/Exynos_OMX_Mpeg2dec.c b/component/video/dec/mpeg2/Exynos_OMX_Mpeg2dec.c index 5f7cab2..377d0e8 100644 --- a/component/video/dec/mpeg2/Exynos_OMX_Mpeg2dec.c +++ b/component/video/dec/mpeg2/Exynos_OMX_Mpeg2dec.c @@ -1324,8 +1324,8 @@ OMX_ERRORTYPE Exynos_Mpeg2Dec_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. +#ifdef USE_CSC_HW + csc_method = CSC_METHOD_HW; #endif pVideoDec->csc_handle = csc_init(csc_method); if (pVideoDec->csc_handle == NULL) { diff --git a/component/video/dec/mpeg4/Android.mk b/component/video/dec/mpeg4/Android.mk index bd231f2..26ab170 100644 --- a/component/video/dec/mpeg4/Android.mk +++ b/component/video/dec/mpeg4/Android.mk @@ -21,6 +21,10 @@ ifeq ($(BOARD_USE_DMA_BUF), true) LOCAL_CFLAGS += -DUSE_DMA_BUF endif +ifeq ($(BOARD_USE_CSC_HW), true) +LOCAL_CFLAGS += -DUSE_CSC_HW +endif + LOCAL_ARM_MODE := arm LOCAL_STATIC_LIBRARIES := libExynosOMX_Vdec libExynosOMX_OSAL libExynosOMX_Basecomponent \ diff --git a/component/video/dec/mpeg4/Exynos_OMX_Mpeg4dec.c b/component/video/dec/mpeg4/Exynos_OMX_Mpeg4dec.c index b57900b..b7226b6 100644 --- a/component/video/dec/mpeg4/Exynos_OMX_Mpeg4dec.c +++ b/component/video/dec/mpeg4/Exynos_OMX_Mpeg4dec.c @@ -1676,8 +1676,8 @@ OMX_ERRORTYPE Exynos_Mpeg4Dec_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. +#ifdef USE_CSC_HW + csc_method = CSC_METHOD_HW; #endif pVideoDec->csc_handle = csc_init(csc_method); if (pVideoDec->csc_handle == NULL) { diff --git a/component/video/dec/vc1/Android.mk b/component/video/dec/vc1/Android.mk index 0671578..d347c68 100644 --- a/component/video/dec/vc1/Android.mk +++ b/component/video/dec/vc1/Android.mk @@ -21,6 +21,10 @@ ifeq ($(BOARD_USE_DMA_BUF), true) LOCAL_CFLAGS += -DUSE_DMA_BUF endif +ifeq ($(BOARD_USE_CSC_HW), true) +LOCAL_CFLAGS += -DUSE_CSC_HW +endif + LOCAL_ARM_MODE := arm LOCAL_STATIC_LIBRARIES := libExynosOMX_Vdec libExynosOMX_OSAL libExynosOMX_Basecomponent \ diff --git a/component/video/dec/vc1/Exynos_OMX_Wmvdec.c b/component/video/dec/vc1/Exynos_OMX_Wmvdec.c index d469175..4a22d93 100644 --- a/component/video/dec/vc1/Exynos_OMX_Wmvdec.c +++ b/component/video/dec/vc1/Exynos_OMX_Wmvdec.c @@ -1544,8 +1544,8 @@ OMX_ERRORTYPE Exynos_WmvDec_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. +#ifdef USE_CSC_HW + csc_method = CSC_METHOD_HW; #endif pVideoDec->csc_handle = csc_init(csc_method); if (pVideoDec->csc_handle == NULL) { diff --git a/component/video/dec/vp8/Android.mk b/component/video/dec/vp8/Android.mk index 124b13a..94baa5a 100644 --- a/component/video/dec/vp8/Android.mk +++ b/component/video/dec/vp8/Android.mk @@ -21,6 +21,10 @@ ifeq ($(BOARD_USE_DMA_BUF), true) LOCAL_CFLAGS += -DUSE_DMA_BUF endif +ifeq ($(BOARD_USE_CSC_HW), true) +LOCAL_CFLAGS += -DUSE_CSC_HW +endif + LOCAL_ARM_MODE := arm LOCAL_STATIC_LIBRARIES := libExynosOMX_Vdec libExynosOMX_OSAL libExynosOMX_Basecomponent \ diff --git a/component/video/dec/vp8/Exynos_OMX_Vp8dec.c b/component/video/dec/vp8/Exynos_OMX_Vp8dec.c index 55e8dbb..b3de613 100644 --- a/component/video/dec/vp8/Exynos_OMX_Vp8dec.c +++ b/component/video/dec/vp8/Exynos_OMX_Vp8dec.c @@ -1268,8 +1268,8 @@ OMX_ERRORTYPE Exynos_VP8Dec_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. +#ifdef USE_CSC_HW + csc_method = CSC_METHOD_HW; #endif pVideoDec->csc_handle = csc_init(csc_method); if (pVideoDec->csc_handle == NULL) { diff --git a/component/video/enc/Exynos_OMX_Venc.c b/component/video/enc/Exynos_OMX_Venc.c index 919c3a1..95689c6 100644 --- a/component/video/enc/Exynos_OMX_Venc.c +++ b/component/video/enc/Exynos_OMX_Venc.c @@ -290,7 +290,7 @@ OMX_BOOL Exynos_CSC_InputData(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA unsigned int csc_src_color_format = omx_2_hal_pixel_format((unsigned int)OMX_COLOR_FormatYUV420SemiPlanar); unsigned int csc_dst_color_format = omx_2_hal_pixel_format((unsigned int)OMX_COLOR_FormatYUV420SemiPlanar); CSC_METHOD csc_method = CSC_METHOD_SW; - unsigned int cacheable = 1; + unsigned int srcCacheable = 1, dstCacheable = 1; unsigned char *pSrcBuf[3] = {NULL, }; unsigned char *pDstBuf[3] = {NULL, }; @@ -305,6 +305,10 @@ OMX_BOOL Exynos_CSC_InputData(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA pDstBuf[1] = srcInputData->buffer.multiPlaneBuffer.dataBuffer[1]; pDstBuf[2] = srcInputData->buffer.multiPlaneBuffer.dataBuffer[2]; + csc_get_method(pVideoEnc->csc_handle, &csc_method); + if (csc_method == CSC_METHOD_HW) + dstCacheable = 0; + #ifdef USE_METADATABUFFERTYPE OMX_PTR ppBuf[MAX_BUFFER_PLANE]; @@ -340,7 +344,6 @@ OMX_BOOL Exynos_CSC_InputData(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA #endif #ifdef USE_DMA_BUF - csc_get_method(pVideoEnc->csc_handle, &csc_method); if (csc_method == CSC_METHOD_HW) pSrcBuf[0] = (unsigned char *)planes[0].fd; else @@ -353,7 +356,6 @@ OMX_BOOL Exynos_CSC_InputData(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA #endif { #ifdef USE_DMA_BUF - csc_get_method(pVideoEnc->csc_handle, &csc_method); if (csc_method == CSC_METHOD_HW) { pSrcBuf[0] = Exynos_OSAL_SharedMemory_VirtToION(pVideoEnc->hSharedMemory, checkInputStream); pSrcBuf[1] = NULL; @@ -396,7 +398,7 @@ OMX_BOOL Exynos_CSC_InputData(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA nFrameWidth, /* crop_width */ nFrameHeight, /* crop_height */ csc_src_color_format, /* color_format */ - cacheable); /* cacheable */ + srcCacheable); /* cacheable */ csc_set_dst_format( pVideoEnc->csc_handle, /* handle */ nFrameWidth, /* width */ @@ -406,7 +408,7 @@ OMX_BOOL Exynos_CSC_InputData(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA nFrameWidth, /* crop_width */ nFrameHeight, /* crop_height */ csc_dst_color_format, /* color_format */ - cacheable); /* cacheable */ + dstCacheable); /* cacheable */ csc_set_src_buffer( pVideoEnc->csc_handle, /* handle */ pSrcBuf, diff --git a/component/video/enc/h264/Android.mk b/component/video/enc/h264/Android.mk index 11c6b7f..aeef1a5 100644 --- a/component/video/enc/h264/Android.mk +++ b/component/video/enc/h264/Android.mk @@ -21,6 +21,10 @@ ifeq ($(BOARD_USE_DMA_BUF), true) LOCAL_CFLAGS += -DUSE_DMA_BUF endif +ifeq ($(BOARD_USE_CSC_HW), true) +LOCAL_CFLAGS += -DUSE_CSC_HW +endif + LOCAL_ARM_MODE := arm LOCAL_STATIC_LIBRARIES := libExynosOMX_Venc libExynosOMX_OSAL libExynosOMX_Basecomponent \ diff --git a/component/video/enc/h264/Exynos_OMX_H264enc.c b/component/video/enc/h264/Exynos_OMX_H264enc.c index 8b6433e..85dbd89 100644 --- a/component/video/enc/h264/Exynos_OMX_H264enc.c +++ b/component/video/enc/h264/Exynos_OMX_H264enc.c @@ -1644,8 +1644,8 @@ 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. +#ifdef USE_CSC_HW + csc_method = CSC_METHOD_HW; #endif pVideoEnc->csc_handle = csc_init(csc_method); if (pVideoEnc->csc_handle == NULL) { diff --git a/component/video/enc/mpeg4/Android.mk b/component/video/enc/mpeg4/Android.mk index a5c0fa4..1ea4920 100644 --- a/component/video/enc/mpeg4/Android.mk +++ b/component/video/enc/mpeg4/Android.mk @@ -21,6 +21,10 @@ ifeq ($(BOARD_USE_DMA_BUF), true) LOCAL_CFLAGS += -DUSE_DMA_BUF endif +ifeq ($(BOARD_USE_CSC_HW), true) +LOCAL_CFLAGS += -DUSE_CSC_HW +endif + LOCAL_ARM_MODE := arm LOCAL_STATIC_LIBRARIES := libExynosOMX_Venc libExynosOMX_OSAL libExynosOMX_Basecomponent \ diff --git a/component/video/enc/mpeg4/Exynos_OMX_Mpeg4enc.c b/component/video/enc/mpeg4/Exynos_OMX_Mpeg4enc.c index 2344c43..1a1c4f4 100644 --- a/component/video/enc/mpeg4/Exynos_OMX_Mpeg4enc.c +++ b/component/video/enc/mpeg4/Exynos_OMX_Mpeg4enc.c @@ -1854,8 +1854,8 @@ 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. +#ifdef USE_CSC_HW + csc_method = CSC_METHOD_HW; #endif pVideoEnc->csc_handle = csc_init(csc_method); if (pVideoEnc->csc_handle == NULL) { -- 2.20.1