vdec: changed buffer count related with MAX DPB
authorTaehwan Kim <t_h.kim@samsung.com>
Fri, 1 Feb 2013 01:21:48 +0000 (01:21 +0000)
committerTaehwan Kim <t_h.kim@samsung.com>
Fri, 1 Feb 2013 01:53:47 +0000 (01:53 +0000)
number of buffer is modified
to nBufferCountActual from maxDPBNum
in share mode case.

Change-Id: I07e5267ab80bf7b32442b8a4ebfba39cfe52131c
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 b168b33befa5c3cbd07587eba0ff1f67a9f6f90a..4e085ec80b729cc7bad9441e917f5e25ea34c318 100644 (file)
@@ -1024,9 +1024,6 @@ OMX_ERRORTYPE H264CodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent)
 
     FunctionIn();
 
-    /* get dpb count */
-    nOutbufs = pH264Dec->hMFCH264Handle.maxDPBNum;
-
     if (pExynosOutputPort->bufferProcessType & BUFFER_COPY) {
         /* should be done before prepare output buffer */
         if (pOutbufOps->Enable_Cacheable(hMFCHandle) != VIDEO_ERROR_NONE) {
@@ -1036,11 +1033,6 @@ OMX_ERRORTYPE H264CodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent)
     }
 
     pOutbufOps->Set_Shareable(hMFCHandle);
-    if (pOutbufOps->Setup(hMFCHandle, nOutbufs) != VIDEO_ERROR_NONE) {
-        Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Failed to setup output buffer");
-        ret = OMX_ErrorInsufficientResources;
-        goto EXIT;
-    }
 
     ExynosVideoPlane planes[MFC_OUTPUT_BUFFER_PLANE];
     OMX_U32 nAllocLen[MFC_OUTPUT_BUFFER_PLANE] = {0, 0};
@@ -1051,6 +1043,14 @@ OMX_ERRORTYPE H264CodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent)
     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) {
+            Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Failed to setup output buffer");
+            ret = OMX_ErrorInsufficientResources;
+            goto EXIT;
+        }
+
         ret = Exynos_Allocate_CodecBuffers(pOMXComponent, OUTPUT_PORT_INDEX, nOutbufs, nAllocLen);
         if (ret != OMX_ErrorNone)
             goto EXIT;
@@ -1065,6 +1065,14 @@ OMX_ERRORTYPE H264CodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent)
                             (unsigned int *)dataLen, MFC_OUTPUT_BUFFER_PLANE, NULL);
         }
     } else if (pExynosOutputPort->bufferProcessType & BUFFER_SHARE) {
+        /* get dpb count */
+        nOutbufs = pExynosOutputPort->portDefinition.nBufferCountActual;
+        if (pOutbufOps->Setup(hMFCHandle, nOutbufs) != VIDEO_ERROR_NONE) {
+            Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Failed to setup output buffer");
+            ret = OMX_ErrorInsufficientResources;
+            goto EXIT;
+        }
+
         /* Register output buffer */
         /*************/
         /*    TBD    */
index 05db3a0f0ae73da865e69908cfd75b1501fd3138..8f5bf067e910b53b745827225c705724b0e23656 100644 (file)
@@ -742,9 +742,6 @@ OMX_ERRORTYPE Mpeg2CodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent)
 
     FunctionIn();
 
-    /* get dpb count */
-    nOutbufs = pMpeg2Dec->hMFCMpeg2Handle.maxDPBNum;
-
     if (pExynosOutputPort->bufferProcessType & BUFFER_COPY) {
         /* should be done before prepare output buffer */
         if (pOutbufOps->Enable_Cacheable(hMFCHandle) != VIDEO_ERROR_NONE) {
@@ -754,11 +751,6 @@ OMX_ERRORTYPE Mpeg2CodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent)
     }
 
     pOutbufOps->Set_Shareable(hMFCHandle);
-    if (pOutbufOps->Setup(hMFCHandle, nOutbufs) != VIDEO_ERROR_NONE) {
-        Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Failed to setup output buffer");
-        ret = OMX_ErrorInsufficientResources;
-        goto EXIT;
-    }
 
     ExynosVideoPlane planes[MFC_OUTPUT_BUFFER_PLANE];
     OMX_U32 nAllocLen[MFC_OUTPUT_BUFFER_PLANE] = {0, 0};
@@ -769,6 +761,14 @@ OMX_ERRORTYPE Mpeg2CodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent)
     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) {
+            Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Failed to setup output buffer");
+            ret = OMX_ErrorInsufficientResources;
+            goto EXIT;
+        }
+
         ret = Exynos_Allocate_CodecBuffers(pOMXComponent, OUTPUT_PORT_INDEX, nOutbufs, nAllocLen);
         if (ret != OMX_ErrorNone)
             goto EXIT;
@@ -783,6 +783,14 @@ OMX_ERRORTYPE Mpeg2CodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent)
                             (unsigned int *)dataLen, MFC_OUTPUT_BUFFER_PLANE, NULL);
         }
     } else if (pExynosOutputPort->bufferProcessType & BUFFER_SHARE) {
+        /* get dpb count */
+        nOutbufs = pExynosOutputPort->portDefinition.nBufferCountActual;
+        if (pOutbufOps->Setup(hMFCHandle, nOutbufs) != VIDEO_ERROR_NONE) {
+            Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Failed to setup output buffer");
+            ret = OMX_ErrorInsufficientResources;
+            goto EXIT;
+        }
+
         /* Register output buffer */
         /*************/
         /*    TBD    */
index b2cdfdf5e8be94bc84ae58711e4511b70ad892d4..3cfc13c89327b08cdfb594a9b9433e01168592d8 100644 (file)
@@ -963,9 +963,6 @@ OMX_ERRORTYPE Mpeg4CodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent)
 
     FunctionIn();
 
-    /* get dpb count */
-    nOutbufs = pMpeg4Dec->hMFCMpeg4Handle.maxDPBNum;
-
     if (pExynosOutputPort->bufferProcessType & BUFFER_COPY) {
         /* should be done before prepare output buffer */
         if (pOutbufOps->Enable_Cacheable(hMFCHandle) != VIDEO_ERROR_NONE) {
@@ -974,11 +971,6 @@ OMX_ERRORTYPE Mpeg4CodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent)
         }
     }
     pOutbufOps->Set_Shareable(hMFCHandle);
-    if (pOutbufOps->Setup(hMFCHandle, nOutbufs) != VIDEO_ERROR_NONE) {
-        Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Failed to setup output buffer");
-        ret = OMX_ErrorInsufficientResources;
-        goto EXIT;
-    }
 
     ExynosVideoPlane planes[MFC_OUTPUT_BUFFER_PLANE];
     OMX_U32 nAllocLen[MFC_OUTPUT_BUFFER_PLANE] = {0, 0};
@@ -989,6 +981,14 @@ OMX_ERRORTYPE Mpeg4CodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent)
     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) {
+            Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Failed to setup output buffer");
+            ret = OMX_ErrorInsufficientResources;
+            goto EXIT;
+        }
+
         ret = Exynos_Allocate_CodecBuffers(pOMXComponent, OUTPUT_PORT_INDEX, nOutbufs, nAllocLen);
         if (ret != OMX_ErrorNone)
             goto EXIT;
@@ -1003,6 +1003,14 @@ OMX_ERRORTYPE Mpeg4CodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent)
                             (unsigned int *)dataLen, MFC_OUTPUT_BUFFER_PLANE, NULL);
         }
     } else if (pExynosOutputPort->bufferProcessType & BUFFER_SHARE) {
+        /* get dpb count */
+        nOutbufs = pExynosOutputPort->portDefinition.nBufferCountActual;
+        if (pOutbufOps->Setup(hMFCHandle, nOutbufs) != VIDEO_ERROR_NONE) {
+            Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Failed to setup output buffer");
+            ret = OMX_ErrorInsufficientResources;
+            goto EXIT;
+        }
+
         /* Register output buffer */
         /*************/
         /*    TBD    */
index 2a3c158d54c487561c60b564aadcbc214fd2ecbb..3491a8d8fff4ac5b314a875ee9823fbf22676517 100644 (file)
@@ -1006,9 +1006,6 @@ OMX_ERRORTYPE WmvCodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent)
 
     FunctionIn();
 
-    /* get dpb count */
-    nOutbufs = pWmvDec->hMFCWmvHandle.maxDPBNum;
-
     if (pExynosOutputPort->bufferProcessType & BUFFER_COPY) {
         /* should be done before prepare output buffer */
         if (pOutbufOps->Enable_Cacheable(hMFCHandle) != VIDEO_ERROR_NONE) {
@@ -1018,11 +1015,6 @@ OMX_ERRORTYPE WmvCodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent)
     }
 
     pOutbufOps->Set_Shareable(hMFCHandle);
-    if (pOutbufOps->Setup(hMFCHandle, nOutbufs) != VIDEO_ERROR_NONE) {
-        Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Failed to setup output buffer");
-        ret = OMX_ErrorInsufficientResources;
-        goto EXIT;
-    }
 
     ExynosVideoPlane planes[MFC_OUTPUT_BUFFER_PLANE];
     OMX_U32 nAllocLen[MFC_OUTPUT_BUFFER_PLANE] = {0, 0};
@@ -1033,6 +1025,14 @@ OMX_ERRORTYPE WmvCodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent)
     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) {
+            Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Failed to setup output buffer");
+            ret = OMX_ErrorInsufficientResources;
+            goto EXIT;
+        }
+
         ret = Exynos_Allocate_CodecBuffers(pOMXComponent, OUTPUT_PORT_INDEX, nOutbufs, nAllocLen);
         if (ret != OMX_ErrorNone)
             goto EXIT;
@@ -1047,6 +1047,14 @@ OMX_ERRORTYPE WmvCodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent)
                             (unsigned int *)dataLen, MFC_OUTPUT_BUFFER_PLANE, NULL);
         }
     } else if (pExynosOutputPort->bufferProcessType & BUFFER_SHARE) {
+        /* get dpb count */
+        nOutbufs = pExynosOutputPort->portDefinition.nBufferCountActual;
+        if (pOutbufOps->Setup(hMFCHandle, nOutbufs) != VIDEO_ERROR_NONE) {
+            Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Failed to setup output buffer");
+            ret = OMX_ErrorInsufficientResources;
+            goto EXIT;
+        }
+
         /* Register output buffer */
         /*************/
         /*    TBD    */
index 75e491dea124dafe40271b1626deeba75d07f178..e0dfd904aaf501f24018b0f50a108e385ebd092c 100644 (file)
@@ -774,9 +774,6 @@ OMX_ERRORTYPE VP8CodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent)
 
     FunctionIn();
 
-    /* get dpb count */
-    nOutbufs = pVp8Dec->hMFCVp8Handle.maxDPBNum;
-
     if (pExynosOutputPort->bufferProcessType & BUFFER_COPY) {
         /* should be done before prepare output buffer */
         if (pOutbufOps->Enable_Cacheable(hMFCHandle) != VIDEO_ERROR_NONE) {
@@ -786,11 +783,6 @@ OMX_ERRORTYPE VP8CodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent)
     }
 
     pOutbufOps->Set_Shareable(hMFCHandle);
-    if (pOutbufOps->Setup(hMFCHandle, nOutbufs) != VIDEO_ERROR_NONE) {
-        Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Failed to setup output buffer");
-        ret = OMX_ErrorInsufficientResources;
-        goto EXIT;
-    }
 
     ExynosVideoPlane planes[MFC_OUTPUT_BUFFER_PLANE];
     OMX_U32 nAllocLen[MFC_OUTPUT_BUFFER_PLANE] = {0, 0};
@@ -801,6 +793,14 @@ OMX_ERRORTYPE VP8CodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent)
     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) {
+            Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Failed to setup output buffer");
+            ret = OMX_ErrorInsufficientResources;
+            goto EXIT;
+        }
+
         ret = Exynos_Allocate_CodecBuffers(pOMXComponent, OUTPUT_PORT_INDEX, nOutbufs, nAllocLen);
         if (ret != OMX_ErrorNone)
             goto EXIT;
@@ -815,6 +815,14 @@ OMX_ERRORTYPE VP8CodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent)
                             (unsigned int *)dataLen, MFC_OUTPUT_BUFFER_PLANE, NULL);
         }
     } else if (pExynosOutputPort->bufferProcessType & BUFFER_SHARE) {
+        /* get dpb count */
+        nOutbufs = pExynosOutputPort->portDefinition.nBufferCountActual;
+        if (pOutbufOps->Setup(hMFCHandle, nOutbufs) != VIDEO_ERROR_NONE) {
+            Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Failed to setup output buffer");
+            ret = OMX_ErrorInsufficientResources;
+            goto EXIT;
+        }
+
         /* Register output buffer */
         /*************/
         /*    TBD    */