vdec: cleaned up code
authorTaehwan Kim <t_h.kim@samsung.com>
Fri, 1 Feb 2013 04:47:16 +0000 (04:47 +0000)
committerTaehwan Kim <t_h.kim@samsung.com>
Fri, 1 Feb 2013 04:47:16 +0000 (04:47 +0000)
Change-Id: I59f523993ed9638b9640d6fc9877f662c057f639
Signed-off-by: Taehwan Kim <t_h.kim@samsung.com>
component/video/dec/h264/Exynos_OMX_H264dec.c
component/video/dec/mpeg2/Exynos_OMX_Mpeg2dec.c
component/video/dec/mpeg4/Exynos_OMX_Mpeg4dec.c
component/video/dec/vc1/Exynos_OMX_Wmvdec.c
component/video/dec/vp8/Exynos_OMX_Vp8dec.c

index 4e085ec80b729cc7bad9441e917f5e25ea34c318..636192d68be4fd550b7cb29fb2da3da3b447fe9e 100644 (file)
@@ -1022,27 +1022,23 @@ OMX_ERRORTYPE H264CodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent)
 
     int i, nOutbufs;
 
+    OMX_U32 nAllocLen[MFC_OUTPUT_BUFFER_PLANE] = {0, 0};
+    OMX_U32 dataLen[MFC_OUTPUT_BUFFER_PLANE]   = {0, 0};
+
     FunctionIn();
 
+    nAllocLen[0] = pH264Dec->hMFCH264Handle.codecOutbufConf.nAlignPlaneSize[0];
+    nAllocLen[1] = pH264Dec->hMFCH264Handle.codecOutbufConf.nAlignPlaneSize[1];
+
+    pOutbufOps->Set_Shareable(hMFCHandle);
+
     if (pExynosOutputPort->bufferProcessType & BUFFER_COPY) {
         /* should be done before prepare output buffer */
         if (pOutbufOps->Enable_Cacheable(hMFCHandle) != VIDEO_ERROR_NONE) {
             ret = OMX_ErrorInsufficientResources;
             goto EXIT;
         }
-    }
-
-    pOutbufOps->Set_Shareable(hMFCHandle);
 
-    ExynosVideoPlane planes[MFC_OUTPUT_BUFFER_PLANE];
-    OMX_U32 nAllocLen[MFC_OUTPUT_BUFFER_PLANE] = {0, 0};
-    OMX_U32 dataLen[MFC_OUTPUT_BUFFER_PLANE] = {0, 0};
-    int plane;
-
-    nAllocLen[0] = pH264Dec->hMFCH264Handle.codecOutbufConf.nAlignPlaneSize[0];
-    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) {
@@ -1065,6 +1061,9 @@ OMX_ERRORTYPE H264CodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent)
                             (unsigned int *)dataLen, MFC_OUTPUT_BUFFER_PLANE, NULL);
         }
     } else if (pExynosOutputPort->bufferProcessType & BUFFER_SHARE) {
+        ExynosVideoPlane planes[MFC_OUTPUT_BUFFER_PLANE];
+        int plane;
+
         /* get dpb count */
         nOutbufs = pExynosOutputPort->portDefinition.nBufferCountActual;
         if (pOutbufOps->Setup(hMFCHandle, nOutbufs) != VIDEO_ERROR_NONE) {
index 8f5bf067e910b53b745827225c705724b0e23656..52702457aa474098ef42d61026de4e01cc4a544f 100644 (file)
@@ -740,27 +740,23 @@ OMX_ERRORTYPE Mpeg2CodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent)
 
     int i, nOutbufs;
 
+    OMX_U32 nAllocLen[MFC_OUTPUT_BUFFER_PLANE] = {0, 0};
+    OMX_U32 dataLen[MFC_OUTPUT_BUFFER_PLANE]   = {0, 0};
+
     FunctionIn();
 
+    nAllocLen[0] = pMpeg2Dec->hMFCMpeg2Handle.codecOutbufConf.nAlignPlaneSize[0];
+    nAllocLen[1] = pMpeg2Dec->hMFCMpeg2Handle.codecOutbufConf.nAlignPlaneSize[1];
+
+    pOutbufOps->Set_Shareable(hMFCHandle);
+
     if (pExynosOutputPort->bufferProcessType & BUFFER_COPY) {
         /* should be done before prepare output buffer */
         if (pOutbufOps->Enable_Cacheable(hMFCHandle) != VIDEO_ERROR_NONE) {
             ret = OMX_ErrorInsufficientResources;
             goto EXIT;
         }
-    }
-
-    pOutbufOps->Set_Shareable(hMFCHandle);
 
-    ExynosVideoPlane planes[MFC_OUTPUT_BUFFER_PLANE];
-    OMX_U32 nAllocLen[MFC_OUTPUT_BUFFER_PLANE] = {0, 0};
-    OMX_U32 dataLen[MFC_OUTPUT_BUFFER_PLANE] = {0, 0};
-    int plane;
-
-    nAllocLen[0] = pMpeg2Dec->hMFCMpeg2Handle.codecOutbufConf.nAlignPlaneSize[0];
-    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) {
@@ -783,6 +779,9 @@ OMX_ERRORTYPE Mpeg2CodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent)
                             (unsigned int *)dataLen, MFC_OUTPUT_BUFFER_PLANE, NULL);
         }
     } else if (pExynosOutputPort->bufferProcessType & BUFFER_SHARE) {
+        ExynosVideoPlane planes[MFC_OUTPUT_BUFFER_PLANE];
+        int plane;
+
         /* get dpb count */
         nOutbufs = pExynosOutputPort->portDefinition.nBufferCountActual;
         if (pOutbufOps->Setup(hMFCHandle, nOutbufs) != VIDEO_ERROR_NONE) {
index 3cfc13c89327b08cdfb594a9b9433e01168592d8..6c9955946de89443036c5568f43a211588c892b7 100644 (file)
@@ -961,26 +961,23 @@ OMX_ERRORTYPE Mpeg4CodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent)
 
     int i, nOutbufs;
 
+    OMX_U32 nAllocLen[MFC_OUTPUT_BUFFER_PLANE] = {0, 0};
+    OMX_U32 dataLen[MFC_OUTPUT_BUFFER_PLANE]   = {0, 0};
+
     FunctionIn();
 
+    nAllocLen[0] = pMpeg4Dec->hMFCMpeg4Handle.codecOutbufConf.nAlignPlaneSize[0];
+    nAllocLen[1] = pMpeg4Dec->hMFCMpeg4Handle.codecOutbufConf.nAlignPlaneSize[1];
+
+    pOutbufOps->Set_Shareable(hMFCHandle);
+
     if (pExynosOutputPort->bufferProcessType & BUFFER_COPY) {
         /* should be done before prepare output buffer */
         if (pOutbufOps->Enable_Cacheable(hMFCHandle) != VIDEO_ERROR_NONE) {
             ret = OMX_ErrorInsufficientResources;
             goto EXIT;
         }
-    }
-    pOutbufOps->Set_Shareable(hMFCHandle);
 
-    ExynosVideoPlane planes[MFC_OUTPUT_BUFFER_PLANE];
-    OMX_U32 nAllocLen[MFC_OUTPUT_BUFFER_PLANE] = {0, 0};
-    OMX_U32 dataLen[MFC_OUTPUT_BUFFER_PLANE] = {0, 0};
-    int plane;
-
-    nAllocLen[0] = pMpeg4Dec->hMFCMpeg4Handle.codecOutbufConf.nAlignPlaneSize[0];
-    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) {
@@ -1003,6 +1000,9 @@ OMX_ERRORTYPE Mpeg4CodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent)
                             (unsigned int *)dataLen, MFC_OUTPUT_BUFFER_PLANE, NULL);
         }
     } else if (pExynosOutputPort->bufferProcessType & BUFFER_SHARE) {
+        ExynosVideoPlane planes[MFC_OUTPUT_BUFFER_PLANE];
+        int plane;
+
         /* get dpb count */
         nOutbufs = pExynosOutputPort->portDefinition.nBufferCountActual;
         if (pOutbufOps->Setup(hMFCHandle, nOutbufs) != VIDEO_ERROR_NONE) {
index 3491a8d8fff4ac5b314a875ee9823fbf22676517..851f3ad93a40c484dd754ef204db84c7dfcbafab 100644 (file)
@@ -1004,27 +1004,23 @@ OMX_ERRORTYPE WmvCodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent)
 
     int i, nOutbufs;
 
+    OMX_U32 nAllocLen[MFC_OUTPUT_BUFFER_PLANE] = {0, 0};
+    OMX_U32 dataLen[MFC_OUTPUT_BUFFER_PLANE]   = {0, 0};
+
     FunctionIn();
 
+    nAllocLen[0] = pWmvDec->hMFCWmvHandle.codecOutbufConf.nAlignPlaneSize[0];
+    nAllocLen[1] = pWmvDec->hMFCWmvHandle.codecOutbufConf.nAlignPlaneSize[1];
+
+    pOutbufOps->Set_Shareable(hMFCHandle);
+
     if (pExynosOutputPort->bufferProcessType & BUFFER_COPY) {
         /* should be done before prepare output buffer */
         if (pOutbufOps->Enable_Cacheable(hMFCHandle) != VIDEO_ERROR_NONE) {
             ret = OMX_ErrorInsufficientResources;
             goto EXIT;
         }
-    }
-
-    pOutbufOps->Set_Shareable(hMFCHandle);
 
-    ExynosVideoPlane planes[MFC_OUTPUT_BUFFER_PLANE];
-    OMX_U32 nAllocLen[MFC_OUTPUT_BUFFER_PLANE] = {0, 0};
-    OMX_U32 dataLen[MFC_OUTPUT_BUFFER_PLANE] = {0, 0};
-    int plane;
-
-    nAllocLen[0] = pWmvDec->hMFCWmvHandle.codecOutbufConf.nAlignPlaneSize[0];
-    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) {
@@ -1047,6 +1043,9 @@ OMX_ERRORTYPE WmvCodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent)
                             (unsigned int *)dataLen, MFC_OUTPUT_BUFFER_PLANE, NULL);
         }
     } else if (pExynosOutputPort->bufferProcessType & BUFFER_SHARE) {
+        ExynosVideoPlane planes[MFC_OUTPUT_BUFFER_PLANE];
+        int plane;
+
         /* get dpb count */
         nOutbufs = pExynosOutputPort->portDefinition.nBufferCountActual;
         if (pOutbufOps->Setup(hMFCHandle, nOutbufs) != VIDEO_ERROR_NONE) {
index e0dfd904aaf501f24018b0f50a108e385ebd092c..cbd832a48487635a24d04fdb86863d8c51d81247 100644 (file)
@@ -772,27 +772,23 @@ OMX_ERRORTYPE VP8CodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent)
 
     int i, nOutbufs;
 
+    OMX_U32 nAllocLen[MFC_OUTPUT_BUFFER_PLANE] = {0, 0};
+    OMX_U32 dataLen[MFC_OUTPUT_BUFFER_PLANE]   = {0, 0};
+
     FunctionIn();
 
+    nAllocLen[0] = pVp8Dec->hMFCVp8Handle.codecOutbufConf.nAlignPlaneSize[0];
+    nAllocLen[1] = pVp8Dec->hMFCVp8Handle.codecOutbufConf.nAlignPlaneSize[1];
+
+    pOutbufOps->Set_Shareable(hMFCHandle);
+
     if (pExynosOutputPort->bufferProcessType & BUFFER_COPY) {
         /* should be done before prepare output buffer */
         if (pOutbufOps->Enable_Cacheable(hMFCHandle) != VIDEO_ERROR_NONE) {
             ret = OMX_ErrorInsufficientResources;
             goto EXIT;
         }
-    }
-
-    pOutbufOps->Set_Shareable(hMFCHandle);
 
-    ExynosVideoPlane planes[MFC_OUTPUT_BUFFER_PLANE];
-    OMX_U32 nAllocLen[MFC_OUTPUT_BUFFER_PLANE] = {0, 0};
-    OMX_U32 dataLen[MFC_OUTPUT_BUFFER_PLANE] = {0, 0};
-    int plane;
-
-    nAllocLen[0] = pVp8Dec->hMFCVp8Handle.codecOutbufConf.nAlignPlaneSize[0];
-    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) {
@@ -815,6 +811,9 @@ OMX_ERRORTYPE VP8CodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent)
                             (unsigned int *)dataLen, MFC_OUTPUT_BUFFER_PLANE, NULL);
         }
     } else if (pExynosOutputPort->bufferProcessType & BUFFER_SHARE) {
+        ExynosVideoPlane planes[MFC_OUTPUT_BUFFER_PLANE];
+        int plane;
+
         /* get dpb count */
         nOutbufs = pExynosOutputPort->portDefinition.nBufferCountActual;
         if (pOutbufOps->Setup(hMFCHandle, nOutbufs) != VIDEO_ERROR_NONE) {