MBOOL
JpegCodec::
encode(
    ImgBufInfo const rSrcBufInfo, 
    ImgBufInfo const rDstBufInfo, 
    Rect const rROI, 
    MUINT32 const u4Rotation, 
    MUINT32 const u4Flip, 
    MUINT32 const u4Quality, 
    MUINT32 const u4IsSOI, 
    MUINT32 &u4EncSize
)
{
    MBOOL ret = MTRUE; 
    if (checkIfNeedImgTransform(rSrcBufInfo, rDstBufInfo, rROI, u4Rotation, u4Flip))
    {
        // 
        IMEM_BUF_INFO rTempMemBuf; 
        // Jpeg code width/height should align to 16x 
        MUINT32 u4AlignedWidth = (~0xf) & (0xf + rDstBufInfo.u4ImgWidth);
        MUINT32 u4AlignedHeight = (~0xf) & (0xf + rDstBufInfo.u4ImgHeight); 
        MY_LOGD("[encode] Ori (width, height) = (%d, %d), Aligned (width, height) = (%d, %d)", 
                          rDstBufInfo.u4ImgWidth, rDstBufInfo.u4ImgHeight, u4AlignedWidth, u4AlignedHeight); 
        rTempMemBuf.size = u4AlignedWidth *u4AlignedHeight* 2; 
        allocMem(rTempMemBuf); 
        // (1). Image transform 
        MUINT32 u4Stride[3] = {u4AlignedWidth, 0, 0}; 
        ImgBufInfo rTempImgBuf(ImgInfo(eImgFmt_YUY2, u4AlignedWidth, u4AlignedHeight), 
                          BufInfo(rTempMemBuf.size, rTempMemBuf.virtAddr, rTempMemBuf.phyAddr, rTempMemBuf.memID), u4Stride); 
        // 
        IImageTransform *pImgTransform = IImageTransform::createInstance(); 
        
        ret =  pImgTransform->execute(rSrcBufInfo, rTempImgBuf, rROI, u4Rotation, u4Flip, 10 * 1000);  //10s timeout
        if (mu4DumpFlag)
        {
            char fileName[256]; 
            sprintf(fileName, "/%s/trans_%dx%d.yuv", MEDIA_PATH, u4AlignedWidth, u4AlignedHeight); 
            MtkCamUtils::saveBufToFile(fileName, reinterpret_cast<MUINT8*>(rTempMemBuf.virtAddr), rTempMemBuf.size); 
        }

        pImgTransform->destroyInstance();
        // (2). Encode
        encode(rTempImgBuf, rDstBufInfo, u4Quality, u4IsSOI, u4EncSize); 
        // 
        deallocMem(rTempMemBuf); 
    }    
    else 
    {
        ret = encode(rSrcBufInfo, rDstBufInfo, u4Quality, u4IsSOI, u4EncSize); 
    }
    return ret;  
} 
MBOOL
SImager::
execute(MUINT32 const u4TimeoutMs)
{
    FUNCTION_LOG_START;
    //
    if (!isSupportedSrcFormat(mSrcImgBufInfo.eImgFmt)) 
    {
        MY_LOGE("Unsupport source format:0x%x", mSrcImgBufInfo.eImgFmt); 
        return MFALSE; 
    }   

    MUINT32 u4Width = mTargetImgInfo.u4ImgWidth; 
    MUINT32 u4Height = mTargetImgInfo.u4ImgHeight; 
    // rotation 
    if(90 == mTargetImgInfo.u4Rotation || 270 == mTargetImgInfo.u4Rotation)
    {
        u4Width = mTargetImgInfo.u4ImgHeight; 
        u4Height = mTargetImgInfo.u4ImgWidth; 
    }

    // stride 
    mTargetImgInfo.u4Stride[0] = (~(mu4StrideAlign[0]-1)) & ((mu4StrideAlign[0]-1) + NSCamShot::queryImgStride(mTargetImgInfo.eImgFmt, u4Width, 0)); 
    mTargetImgInfo.u4Stride[1] = (~(mu4StrideAlign[1]-1)) & ((mu4StrideAlign[1]-1) + NSCamShot::queryImgStride(mTargetImgInfo.eImgFmt, u4Width, 1)); 
    mTargetImgInfo.u4Stride[2] = (~(mu4StrideAlign[2]-1)) & ((mu4StrideAlign[2]-1) + NSCamShot::queryImgStride(mTargetImgInfo.eImgFmt, u4Width, 2)); 

    MY_LOGD("fmt = 0x%x, stride = (%d, %d, %d)", mTargetImgInfo.eImgFmt, mTargetImgInfo.u4Stride[0], mTargetImgInfo.u4Stride[1], mTargetImgInfo.u4Stride[2]); 
    MY_LOGD("(width, height) = (%d, %d)", u4Width, u4Height); 

    ImgBufInfo rTargetImgBuf(ImgInfo(mTargetImgInfo.eImgFmt, u4Width, u4Height), 
                        BufInfo(mTargetBufInfo), mTargetImgInfo.u4Stride); 

    if (mTargetImgInfo.eImgFmt == eImgFmt_JPEG)
    {
        encode(mSrcImgBufInfo, rTargetImgBuf, mTargetImgInfo.rROI, mTargetImgInfo.u4Rotation, mTargetImgInfo.u4Flip, mTargetImgInfo.u4Quality, mTargetImgInfo.u4IsSOI, mu4JpegSize);
    }
    else 
    {
        imgTransform(mSrcImgBufInfo, rTargetImgBuf, mTargetImgInfo.rROI, mTargetImgInfo.u4Rotation, mTargetImgInfo.u4Flip, u4TimeoutMs);    
    }

    FUNCTION_LOG_END;
     //
    return MTRUE;
}
Ejemplo n.º 3
0
int CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int StorageType)
{
	CDataFileReader DataFile;
	//DATAFILE *df = datafile_load(filename);
	if(!DataFile.Open(pStorage, pFileName, StorageType))
		return 0;
		
	Clean();

	// check version
	CMapItemVersion *pItem = (CMapItemVersion *)DataFile.FindItem(MAPITEMTYPE_VERSION, 0);
	if(!pItem)
	{
		// import old map
		/*MAP old_mapstuff;
		editor->reset();
		editor_load_old(df, this);
		*/
	}
	else if(pItem->m_Version == 1)
	{
		//editor.reset(false);
		
		// load images
		{
			int Start, Num;
			DataFile.GetType( MAPITEMTYPE_IMAGE, &Start, &Num);
			for(int i = 0; i < Num; i++)
			{
				CMapItemImage *pItem = (CMapItemImage *)DataFile.GetItem(Start+i, 0, 0);
				char *pName = (char *)DataFile.GetData(pItem->m_ImageName);

				// copy base info				
				CEditorImage *pImg = new CEditorImage(m_pEditor);
				pImg->m_External = pItem->m_External;

				if(pItem->m_External)
				{
					char aBuf[256];
					str_format(aBuf, sizeof(aBuf),"mapres/%s.png", pName);
					
					// load external
					CEditorImage ImgInfo(m_pEditor);
					if(m_pEditor->Graphics()->LoadPNG(&ImgInfo, aBuf, IStorage::TYPE_ALL))
					{
						*pImg = ImgInfo;
						pImg->m_TexID = m_pEditor->Graphics()->LoadTextureRaw(ImgInfo.m_Width, ImgInfo.m_Height, ImgInfo.m_Format, ImgInfo.m_pData, CImageInfo::FORMAT_AUTO, 0);
						pImg->m_External = 1;
					}
				}
				else
				{
					pImg->m_Width = pItem->m_Width;
					pImg->m_Height = pItem->m_Height;
					pImg->m_Format = CImageInfo::FORMAT_RGBA;
					
					// copy image data
					void *pData = DataFile.GetData(pItem->m_ImageData);
					pImg->m_pData = mem_alloc(pImg->m_Width*pImg->m_Height*4, 1);
					mem_copy(pImg->m_pData, pData, pImg->m_Width*pImg->m_Height*4);
					pImg->m_TexID = m_pEditor->Graphics()->LoadTextureRaw(pImg->m_Width, pImg->m_Height, pImg->m_Format, pImg->m_pData, CImageInfo::FORMAT_AUTO, 0);
				}

				// copy image name
				if(pName)
					str_copy(pImg->m_aName, pName, 128);

				m_lImages.add(pImg);
				
				// unload image
				DataFile.UnloadData(pItem->m_ImageData);
				DataFile.UnloadData(pItem->m_ImageName);
			}
		}
		
		// load groups
		{
			int LayersStart, LayersNum;
			DataFile.GetType(MAPITEMTYPE_LAYER, &LayersStart, &LayersNum);
			
			int Start, Num;
			DataFile.GetType(MAPITEMTYPE_GROUP, &Start, &Num);
			for(int g = 0; g < Num; g++)
			{
				CMapItemGroup *pGItem = (CMapItemGroup *)DataFile.GetItem(Start+g, 0, 0);
				
				if(pGItem->m_Version < 1 || pGItem->m_Version > CMapItemGroup::CURRENT_VERSION)
					continue;
				
				CLayerGroup *pGroup = NewGroup();
				pGroup->m_ParallaxX = pGItem->m_ParallaxX;
				pGroup->m_ParallaxY = pGItem->m_ParallaxY;
				pGroup->m_OffsetX = pGItem->m_OffsetX;
				pGroup->m_OffsetY = pGItem->m_OffsetY;
				
				if(pGItem->m_Version >= 2)
				{
					pGroup->m_UseClipping = pGItem->m_UseClipping;
					pGroup->m_ClipX = pGItem->m_ClipX;
					pGroup->m_ClipY = pGItem->m_ClipY;
					pGroup->m_ClipW = pGItem->m_ClipW;
					pGroup->m_ClipH = pGItem->m_ClipH;
				}
				
				for(int l = 0; l < pGItem->m_NumLayers; l++)
				{
					CLayer *pLayer = 0;
					CMapItemLayer *pLayerItem = (CMapItemLayer *)DataFile.GetItem(LayersStart+pGItem->m_StartLayer+l, 0, 0);
					if(!pLayerItem)
						continue;
						
					if(pLayerItem->m_Type == LAYERTYPE_TILES)
					{
						CMapItemLayerTilemap *pTilemapItem = (CMapItemLayerTilemap *)pLayerItem;
						CLayerTiles *pTiles = 0;
						
						if(pTilemapItem->m_Flags&1)
						{
							pTiles = new CLayerGame(pTilemapItem->m_Width, pTilemapItem->m_Height);
							MakeGameLayer(pTiles);
							MakeGameGroup(pGroup);
						}
						else
						{
							pTiles = new CLayerTiles(pTilemapItem->m_Width, pTilemapItem->m_Height);
							pTiles->m_pEditor = m_pEditor;
							pTiles->m_Color.r = pTilemapItem->m_Color.r;
							pTiles->m_Color.g = pTilemapItem->m_Color.g;
							pTiles->m_Color.b = pTilemapItem->m_Color.b;
							pTiles->m_Color.a = pTilemapItem->m_Color.a;
						}

						pLayer = pTiles;
						
						pGroup->AddLayer(pTiles);
						void *pData = DataFile.GetData(pTilemapItem->m_Data);
						pTiles->m_Image = pTilemapItem->m_Image;
						pTiles->m_Game = pTilemapItem->m_Flags&1;
						
						mem_copy(pTiles->m_pTiles, pData, pTiles->m_Width*pTiles->m_Height*sizeof(CTile));
						
						if(pTiles->m_Game && pTilemapItem->m_Version == MakeVersion(1, *pTilemapItem))
						{
							for(int i = 0; i < pTiles->m_Width*pTiles->m_Height; i++)
							{
								if(pTiles->m_pTiles[i].m_Index)
									pTiles->m_pTiles[i].m_Index += ENTITY_OFFSET;
							}
						}
						
						DataFile.UnloadData(pTilemapItem->m_Data);
					}
					else if(pLayerItem->m_Type == LAYERTYPE_QUADS)
					{
						CMapItemLayerQuads *pQuadsItem = (CMapItemLayerQuads *)pLayerItem;
						CLayerQuads *pQuads = new CLayerQuads;
						pQuads->m_pEditor = m_pEditor;
						pLayer = pQuads;
						pQuads->m_Image = pQuadsItem->m_Image;
						if(pQuads->m_Image < -1 || pQuads->m_Image >= m_lImages.size())
							pQuads->m_Image = -1;
						void *pData = DataFile.GetDataSwapped(pQuadsItem->m_Data);
						pGroup->AddLayer(pQuads);
						pQuads->m_lQuads.set_size(pQuadsItem->m_NumQuads);
						mem_copy(pQuads->m_lQuads.base_ptr(), pData, sizeof(CQuad)*pQuadsItem->m_NumQuads);
						DataFile.UnloadData(pQuadsItem->m_Data);
					}
					
					if(pLayer)
						pLayer->m_Flags = pLayerItem->m_Flags;
				}
			}
		}
		
		// load envelopes
		{
			CEnvPoint *pPoints = 0;
			
			{
				int Start, Num;
				DataFile.GetType(MAPITEMTYPE_ENVPOINTS, &Start, &Num);
				if(Num)
					pPoints = (CEnvPoint *)DataFile.GetItem(Start, 0, 0);
			}
			
			int Start, Num;
			DataFile.GetType(MAPITEMTYPE_ENVELOPE, &Start, &Num);
			for(int e = 0; e < Num; e++)
			{
				CMapItemEnvelope *pItem = (CMapItemEnvelope *)DataFile.GetItem(Start+e, 0, 0);
				CEnvelope *pEnv = new CEnvelope(pItem->m_Channels);
				pEnv->m_lPoints.set_size(pItem->m_NumPoints);
				mem_copy(pEnv->m_lPoints.base_ptr(), &pPoints[pItem->m_StartPoint], sizeof(CEnvPoint)*pItem->m_NumPoints);
				if(pItem->m_aName[0] != -1)	// compatibility with old maps
					IntsToStr(pItem->m_aName, sizeof(pItem->m_aName)/sizeof(int), pEnv->m_aName);
				m_lEnvelopes.add(pEnv);
			}
		}
	}
	
	return 1;
}
MBOOL
ImageTransform::
execute(
    ImgBufInfo const rSrcBufInfo, 
    ImgBufInfo const rDstBufInfo, 
    Rect const rROI, 
    MUINT32 const u4Rotation, 
    MUINT32 const u4Flip, 
    MUINT32 const u4TimeOutInMs
)
{
#define CHECK_RET(x, str)                            \
    do{                                              \
        if ( !(ret) ){                               \
            MY_LOGE("fail at %s", str);              \
            if( bInit )                              \
            {                                        \
                pXdpPipe->uninit();                  \
            }                                        \
            if( pXdpPipe )                           \
            {                                        \
                pXdpPipe->destroyInstance();         \
            }                                        \
            unlock();                                \
            return MFALSE;                           \
        }                                            \
    }while(0)

    FUNCTION_LOG_START;
    MtkCamUtils::CamProfile profile("execute", "ImageTransform");
    if (!lock(u4TimeOutInMs)) 
    {
        MY_LOGE("[execute] lock fail "); 
        return MFALSE; 
    }
    MBOOL ret = MTRUE;
    MBOOL bInit = MFALSE;
    // (1). Create Instance 
#warning [TODO] sensor type ??? 
    IXdpPipe    *pXdpPipe = IXdpPipe::createInstance(eSWScenarioID_CAPTURE_NORMAL, eScenarioFmt_RAW); //eScenarioFmt_RAW is never used? 
    CHECK_OBJECT(pXdpPipe); 
    //
    if (pXdpPipe != NULL) 
    {
        MY_LOGD("Pipe (Name, ID) = (%s, %d)", pXdpPipe->getPipeName(), pXdpPipe->getPipeId()); 
    }
    
    // (2). Query port property
    //vector<PortProperty> rInPortProperty; 
    //vector<PortProperty> rOutPortProperty;     
    //if (pXdpPipe->queryPipeProperty(rInPortProperty,rOutPortProperty))
    //{
    //    MY_LOGD("Port Property (IN, OUT): (%d, %d)", rInPortProperty.size(), rOutPortProperty.size()); 
    //    for (MUINT32 i = 0; i < rInPortProperty.size(); i++)
    //    {
    //        MY_LOGD("IN: (type, index, inout, fmt, rot, flip) = (%d, %d, %d, %d, %d, %d)", 
    //                     rInPortProperty.at(i).type, rInPortProperty.at(i).index, rInPortProperty.at(i).inout,  
    //                     rInPortProperty.at(i).u4SupportFmt, rInPortProperty.at(i).fgIsSupportRotate, rInPortProperty.at(i).fgIsSupportFlip); 
    //    }       
    //    for (MUINT32 i = 0; i < rOutPortProperty.size(); i++)
    //    {
    //        MY_LOGD("IN: (type, index, inout, fmt, rot, flip) = (%d, %d, %d, %d, %d, %d)", 
    //                     rOutPortProperty.at(i).type, rOutPortProperty.at(i).index, rOutPortProperty.at(i).inout,  
    //                     rOutPortProperty.at(i).u4SupportFmt, rOutPortProperty.at(i).fgIsSupportRotate, rOutPortProperty.at(i).fgIsSupportFlip); 
    //    } 
    //}    

    // (3). init 
    ret = pXdpPipe->init(); 
    CHECK_RET(ret,"init");
    bInit = MTRUE;

    // (4). setCallback
    pXdpPipe->setCallbacks(NULL, NULL, NULL); 

    // (5). Config pipe 
    // 
    MemoryInPortInfo rMemInPort(ImgInfo(rSrcBufInfo.eImgFmt, rSrcBufInfo.u4ImgWidth, rSrcBufInfo.u4ImgHeight), 
                                0, rSrcBufInfo.u4Stride, Rect(rROI.x, rROI.y, rROI.w, rROI.h)); 
    //   
    MemoryOutPortInfo rVdoPort(ImgInfo(rDstBufInfo.eImgFmt, rDstBufInfo.u4ImgWidth, rDstBufInfo.u4ImgHeight), 
                               rDstBufInfo.u4Stride, u4Rotation, u4Flip);   
    rVdoPort.index = 1;   
    //
    vector<PortInfo const*> vXdpInPorts;  
    vector<PortInfo const*> vXdpOutPorts; 
    //
    vXdpInPorts.push_back(&rMemInPort); 
    vXdpOutPorts.push_back(&rVdoPort); 
    //
    ret = pXdpPipe->configPipe(vXdpInPorts, vXdpOutPorts); 
    CHECK_RET(ret,"config");

    // (6). Enqueue, In buf
    // 
    QBufInfo rInBuf; 
    rInBuf.vBufInfo.clear(); 
    BufInfo rBufInfo(rSrcBufInfo.u4BufSize, rSrcBufInfo.u4BufVA, rSrcBufInfo.u4BufPA, rSrcBufInfo.i4MemID);  
    rInBuf.vBufInfo.push_back(rBufInfo); 
    ret = pXdpPipe->enqueBuf(PortID(EPortType_MemoryIn, 0, 0), rInBuf); 
    // 
    QBufInfo rOutBuf; 
    rOutBuf.vBufInfo.clear(); 
    rBufInfo.u4BufSize = rDstBufInfo.u4BufSize; 
    rBufInfo.u4BufVA = rDstBufInfo.u4BufVA; 
    rBufInfo.u4BufPA = rDstBufInfo.u4BufPA; 
    rBufInfo.i4MemID = rDstBufInfo.i4MemID; 
    //rBufInfo.eMemType = rDstBufInfo.eMemType;
    rOutBuf.vBufInfo.push_back(rBufInfo); 
    ret = pXdpPipe->enqueBuf(PortID(EPortType_MemoryOut, 1, 1), rOutBuf); 
    CHECK_RET(ret,"enqueBuf");
    // 
    profile.print(); 
    // (7). start
    ret = pXdpPipe->start(); 
    CHECK_RET(ret,"start");

    // (8). Dequeue Vdo Out Buf 
    QTimeStampBufInfo rQVdoOutBuf; 
    ret = pXdpPipe->dequeBuf(PortID(EPortType_MemoryOut, 1, 1), rQVdoOutBuf); 
    CHECK_RET(ret,"dequeBuf");
    // (8.1) Dequeue In Buf 
    QTimeStampBufInfo rQInBUf; 
    ret = pXdpPipe->dequeBuf(PortID(EPortType_MemoryIn, 0, 0), rQInBUf); 
    CHECK_RET(ret,"dequeBuf");
 
    // (9). Stop 
    ret = pXdpPipe->stop();
    CHECK_RET(ret,"stop");
#undef CHECK_RET
    // (10). uninit 
    if( bInit )
    {
        ret = pXdpPipe->uninit(); 
        if( !ret )
        {
            if( pXdpPipe )
            {
                pXdpPipe->destroyInstance(); 
            }
            return MFALSE;
        }
    }
    // (11). destory instance 
    if( pXdpPipe )
    {
        pXdpPipe->destroyInstance(); 
    }

    ret = unlock(); 
    profile.print(); 
    //
    return ret; 
}
MBOOL
ImageTransform::
execute(
    ImgBufInfo const rSrcBufInfo, 
    ImgBufInfo const rDstBufInfo, 
    Rect const rROI, 
    MUINT32 const u4Rotation, 
    MUINT32 const u4Flip, 
    MUINT32 const u4TimeOutInMs
)
{
    FUNCTION_LOG_START;
    MtkCamUtils::CamProfile profile("execute", "ImageTransform");
    if (!lock(u4TimeOutInMs)) 
    {
        MY_LOGE("[execute] lock fail "); 
        return MFALSE; 
    }
    // (1). Create Instance 
#warning [TODO] sensor type ??? 
    ICdpPipe    *pCdpPipe = ICdpPipe::createInstance(eSWScenarioID_CAPTURE_NORMAL, eScenarioFmt_RAW); 
    CHECK_OBJECT(pCdpPipe); 
    //
    if (pCdpPipe != NULL) 
    {
        MY_LOGD("Pipe (Name, ID) = (%s, %d)", pCdpPipe->getPipeName(), pCdpPipe->getPipeId()); 
    }
    
    // (2). Query port property
    vector<PortProperty> rInPortProperty; 
    vector<PortProperty> rOutPortProperty;     
    if (pCdpPipe->queryPipeProperty(rInPortProperty,rOutPortProperty))
    {
        MY_LOGD("Port Property (IN, OUT): (%d, %d)", rInPortProperty.size(), rOutPortProperty.size()); 
        for (MUINT32 i = 0; i < rInPortProperty.size(); i++)
        {
            MY_LOGD("IN: (type, index, inout, fmt, rot, flip) = (%d, %d, %d, %d, %d, %d)", 
                         rInPortProperty.at(i).type, rInPortProperty.at(i).index, rInPortProperty.at(i).inout,  
                         rInPortProperty.at(i).u4SupportFmt, rInPortProperty.at(i).fgIsSupportRotate, rInPortProperty.at(i).fgIsSupportFlip); 
        }       
        for (MUINT32 i = 0; i < rOutPortProperty.size(); i++)
        {
            MY_LOGD("IN: (type, index, inout, fmt, rot, flip) = (%d, %d, %d, %d, %d, %d)", 
                         rOutPortProperty.at(i).type, rOutPortProperty.at(i).index, rOutPortProperty.at(i).inout,  
                         rOutPortProperty.at(i).u4SupportFmt, rOutPortProperty.at(i).fgIsSupportRotate, rOutPortProperty.at(i).fgIsSupportFlip); 
        } 
    }    

    // (3). init 
    pCdpPipe->init(); 

    // (4). setCallback
    pCdpPipe->setCallbacks(NULL, NULL, NULL); 

    // (5). Config pipe 
    // 
    MemoryInPortInfo rMemInPort(ImgInfo(rSrcBufInfo.eImgFmt, rSrcBufInfo.u4ImgWidth, rSrcBufInfo.u4ImgHeight), 
                                0, rSrcBufInfo.u4Stride, Rect(rROI.x, rROI.y, rROI.w, rROI.h)); 
    //   
    MemoryOutPortInfo rVdoPort(ImgInfo(rDstBufInfo.eImgFmt, rDstBufInfo.u4ImgWidth, rDstBufInfo.u4ImgHeight), 
                               rDstBufInfo.u4Stride, u4Rotation, u4Flip);   
    rVdoPort.index = 1;   
    //
    vector<PortInfo const*> vCdpInPorts;  
    vector<PortInfo const*> vCdpOutPorts; 
    //
    vCdpInPorts.push_back(&rMemInPort); 
    vCdpOutPorts.push_back(&rVdoPort); 
    //
    pCdpPipe->configPipe(vCdpInPorts, vCdpOutPorts); 

    // (6). Enqueue, In buf
    // 
    QBufInfo rInBuf; 
    rInBuf.vBufInfo.clear(); 
    BufInfo rBufInfo(rSrcBufInfo.u4BufSize, rSrcBufInfo.u4BufVA, rSrcBufInfo.u4BufPA, rSrcBufInfo.i4MemID);  
    rInBuf.vBufInfo.push_back(rBufInfo); 
    pCdpPipe->enqueBuf(PortID(EPortType_MemoryIn, 0, 0), rInBuf); 
    // 
    QBufInfo rOutBuf; 
    rOutBuf.vBufInfo.clear(); 
    rBufInfo.u4BufSize = rDstBufInfo.u4BufSize; 
    rBufInfo.u4BufVA = rDstBufInfo.u4BufVA; 
    rBufInfo.u4BufPA = rDstBufInfo.u4BufPA; 
    rBufInfo.i4MemID = rDstBufInfo.i4MemID; 
    //rBufInfo.eMemType = rDstBufInfo.eMemType;
    rOutBuf.vBufInfo.push_back(rBufInfo); 
    pCdpPipe->enqueBuf(PortID(EPortType_MemoryOut, 1, 1), rOutBuf); 
    // 
    profile.print(); 
    // (7). start
    pCdpPipe->start(); 

    // (8). Dequeue Vdo Out Buf 
    QTimeStampBufInfo rQVdoOutBuf; 
    pCdpPipe->dequeBuf(PortID(EPortType_MemoryOut, 1, 1), rQVdoOutBuf); 
    // (8.1) Dequeue In Buf 
    QTimeStampBufInfo rQInBUf; 
    pCdpPipe->dequeBuf(PortID(EPortType_MemoryIn, 0, 0), rQInBUf); 
 
    // (9). Stop 
    pCdpPipe->stop();
    // (10). uninit 
    pCdpPipe->uninit(); 
    // (11). destory instance 
    pCdpPipe->destroyInstance(); 
    unlock(); 
    profile.print(); 
    //
    return 0; 
}