[prev in list] [next in list] [prev in thread] [next in thread] 

List:       helix-video-cvs
Subject:    [Video-cvs] sitelib/platform/unix/android/4.0 miniandroidsurf_qc8x60.cpp, 1.1.2.3, 1.1.2.3.2.1
From:       shuohuang () helixcommunity ! org
Date:       2012-03-09 7:26:39
[Download RAW message or body]

Update of /cvsroot/video/sitelib/platform/unix/android/4.0
In directory cvs01.internal.helixcommunity.org:/tmp/cvs-serv32589/video/sitelib/platform/unix/android/4.0


Modified Files:
      Tag: hxclient_3_6_1_krill
	miniandroidsurf_qc8x60.cpp 
Log Message:
commit all local patch files to krill branch.

Index: miniandroidsurf_qc8x60.cpp
===================================================================
RCS file: /cvsroot/video/sitelib/platform/unix/android/4.0/Attic/miniandroidsurf_qc8x60.cpp,v
 retrieving revision 1.1.2.3
retrieving revision 1.1.2.3.2.1
diff -u -d -r1.1.2.3 -r1.1.2.3.2.1
--- miniandroidsurf_qc8x60.cpp	22 Feb 2012 05:21:57 -0000	1.1.2.3
+++ miniandroidsurf_qc8x60.cpp	9 Mar 2012 07:26:35 -0000	1.1.2.3.2.1
@@ -55,12 +55,14 @@
 
 #include "miniandroidsurf_qc8x60.h"
 #include "miniandroidsite.h"
-
+#include "utils/Log.h"
 #include "cutils/properties.h"
 #include "CFrameObj.h"
 #include "BufferMeta.h"
 
 #include <media/stagefright/openmax/OMX_IVCommon.h>
+#define LOG_TAG "MiniAndroidSurface"
+
 //use double buffer
 #define BUFFERCOUNT 2
 
@@ -74,7 +76,7 @@
 static UINT32 t_start = 0;
 static UINT32 t_count = 0;
 #endif
-
+static int m_originalWidth=0;
 CMiniAndroidSurface::CMiniAndroidSurface(IUnknown* pContext, CMiniBaseSite* pSite)
     : CMiniBaseSurface(pContext, pSite)
     , m_cidIn(0)
@@ -145,6 +147,7 @@
               return OMX_COLOR_Format16bitRGB565;
               break;
        case CID_I420:
+       case CID_XING:
               return OMX_COLOR_FormatYUV420Planar;
               break;
     }
@@ -173,6 +176,13 @@
     m_cidIn = cidIn;
     m_cidOut = GetDstCID(m_cidIn);
 
+    m_originalWidth = nWidth;
+    //LOGD("--------------------width %d height %d\n", nWidth, nHeight);
+    if (cidIn != CID_OMXV && (nWidth & 0x1fU)) {
+      nWidth = ((nWidth + 31) >> 5) << 5;
+    }
+    //LOGD("--------------------width %d height %d\n", nWidth, nHeight);
+
     HXxSize size;
     size.cx = nWidth; size.cy = nHeight;
     m_pSite->SetSize(size);
@@ -193,6 +203,11 @@
     m_nCompositionPitch = m_pImageHelper->GetBitmapPitch(&bmiTemp);
     m_ulFrameSize = bmiTemp.bmiHeader.biSizeImage;
 
+    //hmm, what happens if BitCount is not on byte boundary? Assert for now.
+    //this is not a problem for RGB565 cause we know BitCount=16
+    HX_ASSERT((bmiTemp.bmiHeader.biBitCount % 8) == 0);
+    int nStride = m_nCompositionPitch / (bmiTemp.bmiHeader.biBitCount/8);
+
     m_nWidth = nWidth;
     m_nHeight = nHeight;
     m_ifmt = CID2PixelFormat(cidIn);
@@ -226,10 +241,128 @@
                                                       LONG32   nDstPitch)
 {
     MediaBuffer* pBuf = NULL;
-    if (m_cidIn == CID_I420 | m_cidIn == CID_RGB32)
+    if (m_cidIn == CID_I420 || m_cidIn == CID_RGB32)
     {
         // SW playback
+        if (m_nWidth == m_originalWidth)
         pBuf = new MediaBuffer(pSrcBuffer, m_ulFrameSize);
+        else {
+          pBuf = new MediaBuffer(m_ulFrameSize);
+          unsigned char * pDst = (unsigned char *)pBuf->data() + \
pBuf->range_offset(); +          unsigned char * pDstY = pDst;
+          unsigned char * pDstU = pDstY + m_nWidth * m_nHeight;
+          unsigned char * pDstV = pDstU + m_nWidth * m_nHeight / 4;
+          unsigned char * pSrcY = pSrcBuffer;
+          unsigned char * pSrcU = pSrcY + m_originalWidth * m_nHeight;
+          unsigned char * pSrcV = pSrcU + m_originalWidth * m_nHeight / 4;
+          int nPadYSize = (m_nWidth - m_originalWidth) / 2;
+          for (int i = 0; i < m_nHeight/2; ++i) {
+            memset(pDstY, 0, nPadYSize);
+            memcpy(pDstY + nPadYSize, pSrcY, m_originalWidth);
+            memset(pDstY + nPadYSize + m_originalWidth, 0, nPadYSize);
+            pDstY += m_nWidth;  
+            pSrcY += m_originalWidth;
+            memset(pDstY, 0, nPadYSize);
+            memcpy(pDstY + nPadYSize, pSrcY, m_originalWidth);
+            memset(pDstY + nPadYSize + m_originalWidth, 0, nPadYSize);
+            pDstY += m_nWidth;
+            pSrcY += m_originalWidth;
+            memset(pDstU, 128, nPadYSize / 2);
+            memcpy(pDstU + nPadYSize / 2, pSrcU, m_originalWidth / 2);
+            memset(pDstU + nPadYSize / 2 + m_originalWidth / 2, 128, nPadYSize / 2);
+            memset(pDstV, 128, nPadYSize / 2);
+            memcpy(pDstV + nPadYSize / 2, pSrcV, m_originalWidth / 2);
+            memset(pDstV + nPadYSize / 2 + m_originalWidth / 2, 128, nPadYSize / 2);
+            pDstU += m_nWidth / 2;
+            pDstV += m_nWidth / 2;
+            pSrcU += m_originalWidth / 2;
+            pSrcV += m_originalWidth / 2;
+          }
+
+        }
+    }
+    else if (m_cidIn == CID_XING)
+    {
+        //LOGD("%s %s %d ------------------- dst pitch %d", __FILE__, __FUNCTION__, \
__LINE__, nDstPitch); +        int nOrigSize = m_originalWidth*m_nHeight*3/2;
+        //LOGD("orig size %d m_ulFramesize %d\n", nOrigSize, m_ulFrameSize);
+        pBuf = new MediaBuffer(m_ulFrameSize);
+        int nSrcPitch = 0;
+        m_fpColorConverter = GetColorConverter(CID_XING, CID_I420, pBitmapInfo, \
nSrcPitch); +        //LOGD("src w %d h %d s %d : (%d, %d) (%d, %d)", \
pBitmapInfo->biWidth, pBitmapInfo->biHeight, nSrcPitch); +        //LOGD("src stride \
%d", nSrcPitch); +        if (1) {
+          unsigned nPadYSize = (m_nWidth - m_originalWidth) / 2;
+          unsigned char * pDstY = (unsigned char *)pBuf->data() + \
pBuf->range_offset(); +          unsigned char * pDstU = pDstY + m_nWidth * \
m_nHeight; +          unsigned char * pDstV = pDstU + m_nWidth * m_nHeight / 4;
+          unsigned char * pSrcY = pSrcBuffer;
+          unsigned nAlignedHeight = ((m_nHeight + 15) >> 4) << 4;
+          unsigned char * pSrcU = pSrcY + nSrcPitch * nAlignedHeight;
+          unsigned char * pSrcV = pSrcU + nSrcPitch / 2;
+          for (int i = 0; i < m_nHeight/2; ++i) {
+            memset(pDstY, 0, nPadYSize);
+            memcpy(pDstY + nPadYSize, pSrcY, m_originalWidth);
+            memset(pDstY + nPadYSize + m_originalWidth, 0, nPadYSize);
+            pDstY += m_nWidth;
+            pSrcY += nSrcPitch;
+            memset(pDstY, 0, nPadYSize);
+            memcpy(pDstY + nPadYSize, pSrcY, m_originalWidth);
+            memset(pDstY + nPadYSize + m_originalWidth, 0, nPadYSize);
+            pDstY += m_nWidth;
+            pSrcY += nSrcPitch;
+            memset(pDstU, 128, nPadYSize / 2);
+            memcpy(pDstU + nPadYSize / 2, pSrcU, m_originalWidth / 2);
+            memset(pDstU + nPadYSize / 2 + m_originalWidth / 2, 128, nPadYSize / 2);
+            memset(pDstV, 128, nPadYSize / 2);
+            memcpy(pDstV + nPadYSize / 2, pSrcV, m_originalWidth / 2);
+            memset(pDstV + nPadYSize / 2 + m_originalWidth / 2, 128, nPadYSize / 2);
+            pDstU += m_nWidth / 2;
+            pDstV += m_nWidth / 2;
+            pSrcU += nSrcPitch;
+            pSrcV += nSrcPitch;
+          }
+        }
+        else {
+        XINGtoI420((unsigned char *)pBuf->data() + pBuf->range_offset(), \
m_originalWidth, m_nHeight, m_originalWidth, 0, 0, m_originalWidth, m_nHeight, \
pSrcBuffer, m_originalWidth, m_nHeight, nSrcPitch, 0, 0, m_originalWidth, m_nHeight); \
+        MediaBuffer * pBuf2 = NULL; +        if(nOrigSize != m_ulFrameSize) {
+          pBuf2 = new MediaBuffer(m_ulFrameSize);
+          unsigned char * pDst = (unsigned char *)pBuf2->data() + \
pBuf2->range_offset(); +          unsigned char * pDstY = pDst;
+          unsigned char * pDstU = pDstY + m_nWidth * m_nHeight;
+          unsigned char * pDstV = pDstU + m_nWidth * m_nHeight / 4;
+          unsigned char * pSrcY = (unsigned char *)pBuf->data() + \
pBuf->range_offset(); +          unsigned char * pSrcU = pSrcY + m_originalWidth * \
m_nHeight; +          unsigned char * pSrcV = pSrcU + m_originalWidth * m_nHeight / \
4; +          int nPadYSize = (m_nWidth - m_originalWidth) / 2;
+          for (int i = 0; i < m_nHeight/2; ++i) {
+            memset(pDstY, 0, nPadYSize);
+            memcpy(pDstY + nPadYSize, pSrcY, m_originalWidth);
+            memset(pDstY + nPadYSize + m_originalWidth, 0, nPadYSize);
+            pDstY += m_nWidth;
+            pSrcY += m_originalWidth;
+            memset(pDstY, 0, nPadYSize);
+            memcpy(pDstY + nPadYSize, pSrcY, m_originalWidth);
+            memset(pDstY + nPadYSize + m_originalWidth, 0, nPadYSize);
+            pDstY += m_nWidth;
+            pSrcY += m_originalWidth;
+            memset(pDstU, 128, nPadYSize / 2);
+            memcpy(pDstU + nPadYSize / 2, pSrcU, m_originalWidth / 2);
+            memset(pDstU + nPadYSize / 2 + m_originalWidth / 2, 128, nPadYSize / 2);
+            memset(pDstV, 128, nPadYSize / 2);
+            memcpy(pDstV + nPadYSize / 2, pSrcV, m_originalWidth / 2);
+            memset(pDstV + nPadYSize / 2 + m_originalWidth / 2, 128, nPadYSize / 2);
+            pDstU += m_nWidth / 2;
+            pDstV += m_nWidth / 2;
+            pSrcU += m_originalWidth / 2;
+            pSrcV += m_originalWidth / 2;
+          }
+          pBuf->release();
+          pBuf = pBuf2; 
+        }
+        }
+		
     }
     else if (m_cidIn == CID_OMXV)
     {
@@ -252,7 +385,7 @@
         pFrame->SetOMXBufferHold(TRUE);
         OMX_BUFFERHEADERTYPE* pOMXBuffer = pFrame->GetOMXBuffer();
         pBuf = new MediaBuffer(((BufferMeta*)(pOMXBuffer->pAppPrivate))->mGraphicBuffer);
                
-        // LOGD("_TransferToDestBuffer graphicBuf[%p]", \
((BufferMeta*)(pOMXBuffer->pAppPrivate))->mGraphicBuffer.get()); +        
     }
 
     if (pBuf)


_______________________________________________
Video-cvs mailing list
Video-cvs@helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/video-cvs


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic