venc: fixed a FrameMap problem in kMetadataBufferTypeCameraSource case.
authorTaehwan Kim <t_h.kim@samsung.com>
Mon, 4 Mar 2013 05:17:18 +0000 (05:17 +0000)
committerHuisung Kang <hs1218.kang@samsung.com>
Mon, 4 Mar 2013 23:44:24 +0000 (08:44 +0900)
in case of kMetadataBufferTypeCameraSource,
ANBColorFormat is not set.
so, It is possible to use an uninitialized value.

modified a handling to decide a value of FrameMap.

Change-Id: I5221f48902724b47d68a1e6170c34695a60fad36
Signed-off-by: Taehwan Kim <t_h.kim@samsung.com>
component/video/enc/h264/Exynos_OMX_H264enc.c
component/video/enc/mpeg4/Exynos_OMX_Mpeg4enc.c

index fe43839d32badc6b464e774aa95ee0f688539104..d3f323dd43188dbb1869ab9a2314b0e08c29fbea 100644 (file)
@@ -259,28 +259,37 @@ static void Set_H264Enc_Param(EXYNOS_OMX_BASECOMPONENT *pExynosComponent)
         pCommonParam->RandomIntraMBRefresh = 0;
     }
 
-    if (pExynosInputPort->bufferProcessType == BUFFER_SHARE) {
-        if (pVideoEnc->ANBColorFormat == OMX_COLOR_FormatYUV420SemiPlanar)
-            pCommonParam->FrameMap = VIDEO_COLORFORMAT_NV12;
-        if (pVideoEnc->ANBColorFormat == OMX_SEC_COLOR_FormatNV12Tiled)
-            pCommonParam->FrameMap = VIDEO_COLORFORMAT_NV12_TILED;
-    } else {
-        switch ((EXYNOS_OMX_COLOR_FORMATTYPE)pExynosInputPort->portDefinition.format.video.eColorFormat) {
-        case OMX_COLOR_FormatYUV420SemiPlanar:
-        case OMX_COLOR_FormatYUV420Planar: /* Converted to NV12 in Exynos_CSC_InputData */
+    switch ((EXYNOS_OMX_COLOR_FORMATTYPE)pExynosInputPort->portDefinition.format.video.eColorFormat) {
+    case OMX_COLOR_FormatYUV420SemiPlanar:
+    case OMX_COLOR_FormatYUV420Planar: /* Converted to NV12 in Exynos_CSC_InputData */
+        pCommonParam->FrameMap = VIDEO_COLORFORMAT_NV12;
+        break;
 #ifdef USE_METADATABUFFERTYPE
-        case OMX_COLOR_FormatAndroidOpaque:
-#endif
+    case OMX_COLOR_FormatAndroidOpaque:
+        if (pExynosInputPort->bufferProcessType == BUFFER_SHARE) {
+            switch (pVideoEnc->ANBColorFormat) {
+            case OMX_COLOR_FormatYUV420SemiPlanar:
+                pCommonParam->FrameMap = VIDEO_COLORFORMAT_NV12;
+                break;
+            case OMX_SEC_COLOR_FormatNV12Tiled:
+                pCommonParam->FrameMap = VIDEO_COLORFORMAT_NV12_TILED;
+                break;
+            default:
+                pCommonParam->FrameMap = VIDEO_COLORFORMAT_NV12;
+                break;
+            }
+        } else {
             pCommonParam->FrameMap = VIDEO_COLORFORMAT_NV12;
-            break;
-        case OMX_SEC_COLOR_FormatNV21Linear:
-            pCommonParam->FrameMap = VIDEO_COLORFORMAT_NV21;
-            break;
-        case OMX_SEC_COLOR_FormatNV12Tiled:
-        default:
-            pCommonParam->FrameMap = VIDEO_COLORFORMAT_NV12_TILED;
-            break;
         }
+        break;
+#endif
+    case OMX_SEC_COLOR_FormatNV21Linear:
+        pCommonParam->FrameMap = VIDEO_COLORFORMAT_NV21;
+        break;
+    case OMX_SEC_COLOR_FormatNV12Tiled:
+    default:
+        pCommonParam->FrameMap = VIDEO_COLORFORMAT_NV12_TILED;
+        break;
     }
 
     /* H.264 specific parameters */
index 962002c10a8b0ec6ff826cce703d73cac731212e..801f720f41c8155fe487c0ff92696bc57ee42831 100644 (file)
@@ -250,28 +250,37 @@ static void Set_Mpeg4Enc_Param(EXYNOS_OMX_BASECOMPONENT *pExynosComponent)
         pCommonParam->RandomIntraMBRefresh = 0;
     }
 
-    if (pExynosInputPort->bufferProcessType == BUFFER_SHARE) {
-        if (pVideoEnc->ANBColorFormat == OMX_SEC_COLOR_FormatNV21Linear)
-            pCommonParam->FrameMap = VIDEO_COLORFORMAT_NV12;
-        if (pVideoEnc->ANBColorFormat == OMX_SEC_COLOR_FormatNV12Tiled)
-            pCommonParam->FrameMap = VIDEO_COLORFORMAT_NV12_TILED;
-    } else {
-        switch ((EXYNOS_OMX_COLOR_FORMATTYPE)pExynosInputPort->portDefinition.format.video.eColorFormat) {
-        case OMX_COLOR_FormatYUV420SemiPlanar:
-        case OMX_COLOR_FormatYUV420Planar: /* Converted to NV12 in Exynos_CSC_InputData */
+    switch ((EXYNOS_OMX_COLOR_FORMATTYPE)pExynosInputPort->portDefinition.format.video.eColorFormat) {
+    case OMX_COLOR_FormatYUV420SemiPlanar:
+    case OMX_COLOR_FormatYUV420Planar: /* Converted to NV12 in Exynos_CSC_InputData */
+        pCommonParam->FrameMap = VIDEO_COLORFORMAT_NV12;
+        break;
 #ifdef USE_METADATABUFFERTYPE
-        case OMX_COLOR_FormatAndroidOpaque:
-#endif
+    case OMX_COLOR_FormatAndroidOpaque:
+        if (pExynosInputPort->bufferProcessType == BUFFER_SHARE) {
+            switch (pVideoEnc->ANBColorFormat) {
+            case OMX_COLOR_FormatYUV420SemiPlanar:
+                pCommonParam->FrameMap = VIDEO_COLORFORMAT_NV12;
+                break;
+            case OMX_SEC_COLOR_FormatNV12Tiled:
+                pCommonParam->FrameMap = VIDEO_COLORFORMAT_NV12_TILED;
+                break;
+            default:
+                pCommonParam->FrameMap = VIDEO_COLORFORMAT_NV12;
+                break;
+            }
+        } else {
             pCommonParam->FrameMap = VIDEO_COLORFORMAT_NV12;
-            break;
-        case OMX_SEC_COLOR_FormatNV21Linear:
-            pCommonParam->FrameMap = VIDEO_COLORFORMAT_NV21;
-            break;
-        case OMX_SEC_COLOR_FormatNV12Tiled:
-        default:
-            pCommonParam->FrameMap = VIDEO_COLORFORMAT_NV12_TILED;
-            break;
         }
+        break;
+#endif
+    case OMX_SEC_COLOR_FormatNV21Linear:
+        pCommonParam->FrameMap = VIDEO_COLORFORMAT_NV21;
+        break;
+    case OMX_SEC_COLOR_FormatNV12Tiled:
+    default:
+        pCommonParam->FrameMap = VIDEO_COLORFORMAT_NV12_TILED;
+        break;
     }
 
     /* Mpeg4 specific parameters */
@@ -359,28 +368,37 @@ static void Set_H263Enc_Param(EXYNOS_OMX_BASECOMPONENT *pExynosComponent)
         pCommonParam->RandomIntraMBRefresh = 0;
     }
 
-    if (pExynosInputPort->bufferProcessType == BUFFER_SHARE) {
-        if (pVideoEnc->ANBColorFormat == OMX_SEC_COLOR_FormatNV21Linear)
-            pCommonParam->FrameMap = VIDEO_COLORFORMAT_NV12;
-        if (pVideoEnc->ANBColorFormat == OMX_SEC_COLOR_FormatNV12Tiled)
-            pCommonParam->FrameMap = VIDEO_COLORFORMAT_NV12_TILED;
-    } else {
-        switch ((EXYNOS_OMX_COLOR_FORMATTYPE)pExynosInputPort->portDefinition.format.video.eColorFormat) {
-        case OMX_COLOR_FormatYUV420SemiPlanar:
-        case OMX_COLOR_FormatYUV420Planar: /* Converted to NV12 in Exynos_CSC_InputData */
+    switch ((EXYNOS_OMX_COLOR_FORMATTYPE)pExynosInputPort->portDefinition.format.video.eColorFormat) {
+    case OMX_COLOR_FormatYUV420SemiPlanar:
+    case OMX_COLOR_FormatYUV420Planar: /* Converted to NV12 in Exynos_CSC_InputData */
+        pCommonParam->FrameMap = VIDEO_COLORFORMAT_NV12;
+        break;
 #ifdef USE_METADATABUFFERTYPE
-        case OMX_COLOR_FormatAndroidOpaque:
-#endif
+    case OMX_COLOR_FormatAndroidOpaque:
+        if (pExynosInputPort->bufferProcessType == BUFFER_SHARE) {
+            switch (pVideoEnc->ANBColorFormat) {
+            case OMX_COLOR_FormatYUV420SemiPlanar:
+                pCommonParam->FrameMap = VIDEO_COLORFORMAT_NV12;
+                break;
+            case OMX_SEC_COLOR_FormatNV12Tiled:
+                pCommonParam->FrameMap = VIDEO_COLORFORMAT_NV12_TILED;
+                break;
+            default:
+                pCommonParam->FrameMap = VIDEO_COLORFORMAT_NV12;
+                break;
+            }
+        } else {
             pCommonParam->FrameMap = VIDEO_COLORFORMAT_NV12;
-            break;
-        case OMX_SEC_COLOR_FormatNV21Linear:
-            pCommonParam->FrameMap = VIDEO_COLORFORMAT_NV21;
-            break;
-        case OMX_SEC_COLOR_FormatNV12Tiled:
-        default:
-            pCommonParam->FrameMap = VIDEO_COLORFORMAT_NV12_TILED;
-            break;
         }
+        break;
+#endif
+    case OMX_SEC_COLOR_FormatNV21Linear:
+        pCommonParam->FrameMap = VIDEO_COLORFORMAT_NV21;
+        break;
+    case OMX_SEC_COLOR_FormatNV12Tiled:
+    default:
+        pCommonParam->FrameMap = VIDEO_COLORFORMAT_NV12_TILED;
+        break;
     }
 
     /* H263 specific parameters */