#include #include #include #include #include #include #include #include using namespace std; namespace icl{ namespace { inline void yuv_to_rgb(const icl32s y,const icl32s u,const icl32s v, icl8u &r, icl8u &g, icl8u &b){ // {{{ open icl32s u2 = 14343*u - 1828717; icl32s v2 = 20231*v - 2579497; r = clipped_cast(y + ( ( 290 * v2 ) >> 22 )); g = clipped_cast(y - ( ( 100 * u2 + 148 * v2) >> 22 )); b = clipped_cast(y + ( ( 518 * u2 ) >> 22 )); } } bool DefaultConvertEngine::isAbleToProvideParams(const ImgParams &desiredParams, depth desiredDepth) const{ UnicapFormat f = m_poDevice->getCurrentUnicapFormat(); if(desiredDepth == depth8u && desiredParams.getFormat() == formatRGB && desiredParams.getSize() == f.getSize() ){ return true; }else{ return false; } } void DefaultConvertEngine::cvt(const icl8u *rawData, const ImgParams &desiredParams, depth desiredDepth, ImgBase **ppoDst){ UnicapFormat f = m_poDevice->getCurrentUnicapFormat(); string fourcc = f.getFourCC(); Size size = f.getSize(); if(desiredParams.getFormat() == formatYUV){ // do something else !!! .. something faster ?? } if(fourcc == "Y444"){ // YUV444 size 160x120 ORDER: U Y V ensureCompatible(ppoDst,depth8u,size,formatRGB); icl8u *dstR = (*ppoDst)->asImg()->getData(0); icl8u *dstG = (*ppoDst)->asImg()->getData(1); icl8u *dstB = (*ppoDst)->asImg()->getData(2); const icl8u *pSrcEnd = rawData+size.getDim()*3; for(const icl8u *pSrc = rawData; pSrc asImg()); #else const icl8u *s = rawData; register int width = size.width; register int cnt = size.getDim(); register int col = 0; register int row = 0; register int pixpos = 0; register int tar_pos = 0; icl8u *dstR = (*ppoDst)->asImg()->getData(0); icl8u *dstG = (*ppoDst)->asImg()->getData(1); icl8u *dstB = (*ppoDst)->asImg()->getData(2); for (int i=0; iasImg()); #else icl8u *dstR = (*ppoDst)->asImg()->getData(0); icl8u *dstG = (*ppoDst)->asImg()->getData(1); icl8u *dstB = (*ppoDst)->asImg()->getData(2); const icl8u *pSrcEnd = rawData+2*size.getDim(); for(const icl8u *pSrc = rawData; pSrc asImg()->getData(0); icl8u *dstG = (*ppoDst)->asImg()->getData(1); icl8u *dstB = (*ppoDst)->asImg()->getData(2); const icl8u *pSrcEnd = rawData+size.getDim()+size.getDim()/2; for(const icl8u *pSrc = rawData; pSrc asImg()->getData(0)); }else if(fourcc == "BGR3"){ ensureCompatible(ppoDst,depth8u,size,formatRGB); icl8u *dstR = (*ppoDst)->asImg()->getData(0); icl8u *dstG = (*ppoDst)->asImg()->getData(1); icl8u *dstB = (*ppoDst)->asImg()->getData(2); const icl8u *r = rawData; const icl8u *rEnd = r + size.getDim()*3; while(rasImg()->getData(0); icl8u *dstG = (*ppoDst)->asImg()->getData(1); icl8u *dstB = (*ppoDst)->asImg()->getData(2); const icl8u *r = rawData; const icl8u *rEnd = r + size.getDim()*4; while(rasImg()->getData(0); icl8u *dstG = (*ppoDst)->asImg()->getData(1); icl8u *dstB = (*ppoDst)->asImg()->getData(2); const icl8u *r = rawData; const icl8u *rEnd = r + size.getDim()*4; while(r