venc: changed CSC method in case of RGB input color
authorTaehwan Kim <t_h.kim@samsung.com>
Tue, 11 Dec 2012 09:20:31 +0000 (09:20 +0000)
committerTaehwan Kim <t_h.kim@samsung.com>
Tue, 11 Dec 2012 09:20:31 +0000 (09:20 +0000)
if USE_GSC_RGB_ENCODER is true,
CSC method is chaned to CSC_METHOD_HW from CSC_METHOD_SW
in case of RGB input color.

Change-Id: I67212bfd04a7bf8c9b5d7d65551b26a31d63c150
Signed-off-by: Taehwan Kim <t_h.kim@samsung.com>
component/video/enc/Android.mk
component/video/enc/Exynos_OMX_Venc.c

index e8f6057e526271633555b221b660335f30bfbf49..cfe4bd1e4ca21e8e916089768f5097e7376314a1 100644 (file)
@@ -46,6 +46,10 @@ ifeq ($(BOARD_USE_USERPTR_CAMERA_INPUT), true)
 LOCAL_CFLAGS += -DUSE_USERPTR_CAMERA_INPUT
 endif
 
+ifeq ($(BOARD_USE_GSC_RGB_ENCODER), true)
+LOCAL_CFLAGS += -DUSE_GSC_RGB_ENCODER
+endif
+
 LOCAL_SHARED_LIBRARIES := libcsc
 
 include $(BUILD_STATIC_LIBRARY)
index 1097f73d914353feee7cad844d1f97542ff1077f..118c51649dfe8e3c8370c9ef47dacc51ce655af6 100644 (file)
@@ -203,15 +203,6 @@ 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];
 
-#ifdef USE_DMA_BUF
-    csc_get_method(pVideoEnc->csc_handle, &csc_method);
-    if (csc_method == CSC_METHOD_HW) {
-        pDstBuf[0] = srcInputData->buffer.multiPlaneBuffer.fd[0];
-        pDstBuf[1] = srcInputData->buffer.multiPlaneBuffer.fd[1];
-        pDstBuf[2] = srcInputData->buffer.multiPlaneBuffer.fd[2];
-    }
-#endif
-
 #ifdef USE_METADATABUFFERTYPE
     OMX_PTR ppBuf[MAX_BUFFER_PLANE];
 
@@ -236,7 +227,18 @@ OMX_BOOL Exynos_CSC_InputData(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA
 
             imageSize = nFrameWidth * nFrameHeight * 3; /* RGB888 */
 
+#ifdef USE_GSC_RGB_ENCODER
+            if (pVideoEnc->csc_set_format == OMX_FALSE) {
+                cscRet = csc_set_method(pVideoEnc->csc_handle, CSC_METHOD_HW);
+                if (cscRet != CSC_ErrorNone) {
+                    ret = OMX_FALSE;
+                    goto EXIT;
+                }
+            }
+#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
@@ -249,6 +251,7 @@ 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;
@@ -274,6 +277,14 @@ OMX_BOOL Exynos_CSC_InputData(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA
         }
     }
 
+#ifdef USE_DMA_BUF
+    if (csc_method == CSC_METHOD_HW) {
+        pDstBuf[0] = srcInputData->buffer.multiPlaneBuffer.fd[0];
+        pDstBuf[1] = srcInputData->buffer.multiPlaneBuffer.fd[1];
+        pDstBuf[2] = srcInputData->buffer.multiPlaneBuffer.fd[2];
+    }
+#endif
+
     csc_set_src_format(
         pVideoEnc->csc_handle,  /* handle */
         nFrameWidth,                  /* width */