vdec: cleaned up code
[GitHub/LineageOS/android_hardware_samsung_slsi_openmax.git] / component / video / dec / mpeg2 / Exynos_OMX_Mpeg2dec.c
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) {