本文整理汇总了C++中ImgBufQueNode类的典型用法代码示例。如果您正苦于以下问题:C++ ImgBufQueNode类的具体用法?C++ ImgBufQueNode怎么用?C++ ImgBufQueNode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ImgBufQueNode类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doOT
bool
OTClient::
doOT(ImgBufQueNode const& rQueNode, bool &rIsDetected_OT)
{
bool ret = true;
MY_LOGD_IF(ENABLE_LOG_PER_FRAME, "+");
src_buf = (unsigned char *)rQueNode.getImgBuf()->getVirAddr();
dst_rgb = (unsigned char *)OTWorkingBuffer;
int ot_plane = Format::queryPlaneCount(Format::queryImageFormat(rQueNode->getImgFormat().string()));
mpOTHalObj->halOTBufferCreate(dst_rgb, src_buf, (MUINT8)ot_plane);
if((OT_StartX < -1000) || (OT_StartX > 1000) || (OT_StartY < -1000) || (OT_StartY > 1000))
{
MY_LOGD("Error! Incorrect Initial Coordinate\n");
return false;
}
//®y¼Ð´«ºâ
mpOTHalObj->halOTDo(dst_rgb, OT_StartX, OT_StartY);
#if (GET_OT_RESULT)
if( NULL != mpDetectedObjs )
numFace = mpOTHalObj->halOTGetResult(mpDetectedObjs);
MY_LOGD("OT Status: %d\n",numFace );
if(numFace>0)
rIsDetected_OT = 1;
else
rIsDetected_OT = 0;
#endif
return ret;
}
示例2: onCB_PostviewDisplay
//
// Callback of Postview for Display
//
// Arguments:
// i8Timestamp
// [I] Postview timestamp
//
// u4PostviewSize
// [I] Postview buffer size in bytes.
//
// puPostviewBuf
// [I] Postview buffer with its size = u4PostviewSize
//
bool
CamAdapter::
onCB_PostviewDisplay(
int64_t const i8Timestamp,
uint32_t const u4PostviewSize,
uint8_t const* puPostviewBuf
)
{
MY_LOGD("timestamp(%lld), size/buf=%d/%p", i8Timestamp, u4PostviewSize, puPostviewBuf);
#if 1
//
if ( ! u4PostviewSize || ! puPostviewBuf )
{
MY_LOGW("Bad callback: size/buf=%d/%p", i8Timestamp, u4PostviewSize, puPostviewBuf);
return false;
}
//
sp<IImgBufProvider> pImgBufPvdr = mpImgBufProvidersMgr->getProvider(IImgBufProvider::eID_DISPLAY);
if ( pImgBufPvdr == 0 )
{
MY_LOGW("Bad IImgBufProvider");
return false;
}
//
ImgBufQueNode node;
if ( ! pImgBufPvdr->dequeProvider(node) )
{
MY_LOGW("dequeProvider fail");
return false;
}
//
sp<IImgBuf> pImgBuf = node.getImgBuf();
if ( u4PostviewSize != pImgBuf->getBufSize() )
{
MY_LOGW(
"callback size(%d) != display:[%d %s %dx%d]",
u4PostviewSize, pImgBuf->getBufSize(), pImgBuf->getImgFormat().string(),
pImgBuf->getImgWidth(), pImgBuf->getImgHeight()
);
node.setStatus(ImgBufQueNode::eSTATUS_CANCEL);
}
else
{
::memcpy(pImgBuf->getVirAddr(), puPostviewBuf, u4PostviewSize);
globalcacheFlushAll();
MY_LOGD_IF(1, "- globalcacheFlushAll()");
//
pImgBuf->setTimestamp(i8Timestamp);
node.setStatus(ImgBufQueNode::eSTATUS_DONE);
}
//
if ( ! pImgBufPvdr->enqueProvider(node) )
{
MY_LOGW("enqueProvider fail");
return false;
}
//
#endif
return true;
}
示例3: threadLoop
// Derived class must implement threadLoop(). The thread starts its life
// here. There are two ways of using the Thread object:
// 1) loop: if threadLoop() returns true, it will be called again if
// requestExit() wasn't called.
// 2) once: if threadLoop() returns false, the thread will exit upon return.
virtual bool threadLoop()
{
ImgBufQueNode QueNode;
//
for (int i = 0; i < miLoopCount; i++)
{
if ( mpImgBufQueue->dequeProvider(QueNode) )
{
renderImgBuf(QueNode.getImgBuf());
//
mpImgBufQueue->enqueProvider(ImgBufQueNode(QueNode.getImgBuf(), ImgBufQueNode::eSTATUS_DONE));
}
//
::usleep(miSleepInUs);
}
return false;
}
示例4: doFD
bool
FDClient::
doFD(ImgBufQueNode const& rQueNode, bool &rIsDetected_FD, bool &rIsDetected_SD, bool rDoSD)
{
bool ret = true;
MINT32 SD_Result;
MY_LOGD_IF(ENABLE_LOG_PER_FRAME, "+");
//MY_LOGD("Rotation_Info1:%d", Rotation_Info);
//********************************************************************************************//
dst_rgb = (unsigned char *)DDPBuffer;
src_buf = (unsigned char *)rQueNode.getImgBuf()->getVirAddr();
g_BufferGroup = doBufferAnalysis(rQueNode);
//g_BufferGroup = 1;
mpFDHalObj->halFDBufferCreate(dst_rgb, src_buf, g_BufferGroup);
mpFDHalObj->halFDDo(0, (MINT32)dst_rgb, (MINT32)rQueNode.getImgBuf()->getVirAddr(), rDoSD, Rotation_Info);
//********************************************************************************************//
#if (GET_FD_RESULT)
if( NULL != mpDetectedFaces )
numFace = mpFDHalObj->halFDGetFaceResult(mpDetectedFaces);
MY_LOGD("Scenario FD Num: %d\n",numFace );
if(numFace>0)
rIsDetected_FD = 1;
else
rIsDetected_FD = 0;
#endif
#if (GET_SD_RESULT)
SD_Result = mpFDHalObj->halSDGetSmileResult();
MY_LOGD("Scenario SD Result1: %d\n",SD_Result );
if(SD_Result>0)
rIsDetected_SD = 1;
else
rIsDetected_SD = 0;
#endif
MY_LOGD_IF(ENABLE_LOG_PER_FRAME, "-");
return ret;
}
示例5: doBufferAnalysis
int
FDClient::
doBufferAnalysis(ImgBufQueNode const& a_rQueNode)
{
int plane =0;
int BufWidth = a_rQueNode.getImgBuf()->getImgWidth();
int BufHeight = a_rQueNode.getImgBuf()->getImgHeight();
//plane = a_rQueNode.getPlaneCount();
plane = FmtUtils::queryPlaneCount(a_rQueNode.getImgBuf()->getImgFormat().string());
//MY_LOGD("getImgWidth:%d, getImgHeight:%d", a_rQueNode.getImgBuf()->getImgWidth(), a_rQueNode.getImgBuf()->getImgHeight());
//MY_LOGD("plane: %d\n",plane );
//Need PlaneCount Information
if( (BufWidth==640) && (BufHeight == 480) && (plane==2))
return 0;
else if ( (BufWidth*3 == BufHeight*4) && (plane==2) )
return 1;
else if ( (BufWidth*3 == BufHeight*4) && (plane==3) )
return 2;
else if ( ( BufWidth*9 == BufHeight*16) && (plane==2) )
return 3;
else if ( ( BufWidth*9 == BufHeight*16) && (plane==3) )
return 4;
else if ( ( BufWidth*3 == BufHeight*5) && (plane==2) )
return 5;
else if ( ( BufWidth*3 == BufHeight*5) && (plane==3) )
return 6;
else if ( (plane==2) )
return 3;
else if ( (plane==3) )
return 4;
else
return 9;
return plane;
}
示例6: mapNodeToImageBuf
inline void
ZsdShot::
mapNodeToImageBuf(ImgBufQueNode & rNode, ImgBufInfo & rBuf)
{
rBuf.u4ImgWidth = rNode->getImgWidth();
rBuf.u4ImgHeight = rNode->getImgHeight();
rBuf.eImgFmt = static_cast<EImageFormat>(android::MtkCamUtils::FmtUtils::queryImageioFormat(rNode->getImgFormat()));
rBuf.u4Stride[0] = rNode->getImgWidthStride(0);
rBuf.u4Stride[1] = rNode->getImgWidthStride(1);
rBuf.u4Stride[2] = rNode->getImgWidthStride(2);
rBuf.u4BufSize = rNode->getBufSize();
rBuf.u4BufVA = (MUINT32)rNode->getVirAddr();
rBuf.u4BufPA = (MUINT32)rNode->getPhyAddr();
rBuf.i4MemID = rNode->getIonFd();
}
示例7: handleReturnBuffers
bool
PREFEATUREABSE::
handleReturnBuffers(sp<IImgBufQueue>const& rpBufQueue, ImgBufQueNode const &rQueNode)
{
bool ret = true;
ret = rpBufQueue->enqueProcessor(
ImgBufQueNode(rQueNode.getImgBuf(), ImgBufQueNode::eSTATUS_TODO));
if ( ! ret )
{
MY_LOGE("enqueProcessor() fails");
ret = false;
}
return ret;
}
示例8: waitAndHandleReturnBuffers
/******************************************************************************
* buffer can be reached either by client enque back buffer
* or by previewclient.
*******************************************************************************/
bool
PREFEATUREABSE::
waitAndHandleReturnBuffers(sp<IImgBufQueue>const& rpBufQueue, ImgBufQueNode &rQueNode)
{
bool ret = false;
Vector<ImgBufQueNode> vQueNode;
//
MY_LOGD_IF(ENABLE_LOG_PER_FRAME, "+");
//
// (1) wait and deque from processor
rpBufQueue->dequeProcessor(vQueNode);
if ( vQueNode.empty() )
{
ret = false;
MY_LOGD("Deque from processor is empty. Suppose stopProcessor has been called");
goto lbExit;
}
// (2) check vQueNode:
// - TODO or CANCEL
// - get and keep the latest one with TODO tag;
// - otherwise, return to processors
for (size_t i = 0; i < vQueNode.size(); i++)
{
if (vQueNode[i].isDONE() && vQueNode[i].getImgBuf() != 0)
{
if (rQueNode.getImgBuf() != 0 ) // already got
{
handleReturnBuffers(rpBufQueue, rQueNode);
}
rQueNode = vQueNode[i]; // update a latest one
ret = true;
}
else
{
handleReturnBuffers(rpBufQueue, vQueNode[i]);
}
}
lbExit:
//
MY_LOGD_IF(ENABLE_LOG_PER_FRAME, "-");
return ret;
}
示例9: mapNodeToImageBuf
MVOID
MultiShotCc::
mapNodeToImageBuf(ImgBufQueNode & rNode, ImgBufInfo & rImgBuf)
{
FUNCTION_LOG_START;
rImgBuf.u4ImgWidth = rNode->getImgWidth();
rImgBuf.u4ImgHeight = rNode->getImgHeight();
rImgBuf.eImgFmt = static_cast<EImageFormat>(android::MtkCamUtils::FmtUtils::queryImageioFormat(rNode->getImgFormat()));
rImgBuf.u4Stride[0] = rNode->getImgWidthStride(0);
rImgBuf.u4Stride[1] = rNode->getImgWidthStride(1);
rImgBuf.u4Stride[2] = rNode->getImgWidthStride(2);
rImgBuf.u4BufSize = rNode->getBufSize();
rImgBuf.u4BufVA = (MUINT32)rNode->getVirAddr();
rImgBuf.u4BufPA = (MUINT32)rNode->getPhyAddr();
rImgBuf.i4MemID = rNode->getIonFd();
MY_LOGD("[registerImgBufInfo] (width, height, format) = (%d, %d, 0x%x)", rImgBuf.u4ImgWidth, rImgBuf.u4ImgHeight, rImgBuf.eImgFmt);
MY_LOGD("[registerImgBufInfo] (VA, PA, Size, ID) = (0x%x, 0x%x, %d, %d)", rImgBuf.u4BufVA, rImgBuf.u4BufPA, rImgBuf.u4BufSize, rImgBuf.i4MemID);
FUNCTION_LOG_END;
}
示例10: enqueProcessor
bool
ImgBufQueue::
enqueProcessor(ImgBufQueNode const& rNode)
{
if ( ! rNode ) {
MY_LOGW("buffer is NULL");
return false;
}
//
Mutex::Autolock _lock(mTodoImgBufQueMtx);
//
MY_LOGV_IF(
ENABLE_LOG_PER_FRAME,
"+ Que.size(%d); %s: (CookieED/CookieDE)=(%p/%p); Buffer[%[email protected]%[email protected]%[email protected]%[email protected](%d)%dx%d-%[email protected](%lld)]",
mTodoImgBufQue.size(), ImgBufQueNodeStatus2Name(rNode.getStatus()), rNode.getCookieED(), rNode.getCookieDE(),
rNode->getBufName(), rNode->getVirAddr(), rNode->getBufSize(), rNode->getImgFormat().string(),
rNode->getImgWidthStride(), rNode->getImgWidth(), rNode->getImgHeight(),
rNode->getBitsPerPixel(), rNode->getTimestamp()
);
//
mTodoImgBufQue.push_back(rNode);
//
return true;
}
示例11: onClientThreadLoop
void
FDClient::
onClientThreadLoop()
{
MY_LOGD("+");
//(0) pre-check
sp<IImgBufQueue> pBufQueue = NULL;
{
//Mutex::Autolock _l(mModuleMtx);
//
pBufQueue = mpImgBufQueue;
if ( pBufQueue == 0 || ! isEnabledState())
{
MY_LOGE("pBufMgr(%p), isEnabledState(%d)", pBufQueue.get(), isEnabledState());
return;
}
}
//(1) prepare all TODO buffers
if ( ! initBuffers(pBufQueue) )
{
MY_LOGE("initBuffers failed");
return;
}
//(2) start
if ( !pBufQueue->startProcessor() )
{
MY_LOGE("startProcessor failed");
return;
}
//BinChang 2012/11/01
//Initial FD
int srcWidth=0, srcHeight=0;
mpParamsMgr->getPreviewSize(&srcWidth, &srcHeight);
//mpFDHalObj = new halFDBase();
mpFDHalObj = halFDBase::createInstance(HAL_FD_OBJ_FDFT_SW);
//mpFDHalObj->halFDInit(srcWidth, srcHeight, (MUINT32) FDWorkingBuffer, FDWorkingBufferSize, 1); //1:Enale SW resizer
mpFDHalObj->halFDInit(srcWidth, srcHeight, (MUINT32) FDWorkingBuffer, FDWorkingBufferSize, 1, mIsSDenabled); //1:Enale SW resizer
g_last_SDenabled = 0;
//************************************************************//
//BinChang 2014/01/07
//Initial GD Start
mpGDHalObj = halGSBase::createInstance(HAL_GS_OBJ_SW);
mpGDHalObj->halGSInit(srcWidth, srcHeight, (MUINT32) FDWorkingBuffer, FDWorkingBufferSize);
//************************************************************//
//ASD Init
mpASDClient = IAsdClient::createInstance(mpParamsMgr);
if ( mpASDClient == 0 || ! mpASDClient->init() )
{
MY_LOGE("mpASDClient init failed");
}
mpASDClient->setCallbacks(mpCamMsgCbInfo);
//(3) Do in loop until stopFaceDetection has been called
// either by sendCommand() or by stopPreview()
while ( isEnabledState() )
{
// (3.1) deque from processor
ImgBufQueNode rQueNode;
if ( ! waitAndHandleReturnBuffers(pBufQueue, rQueNode) )
{
MY_LOGD("No available deque-ed buffer; to be leaving");
continue;
}
if ( rQueNode.getImgBuf() == 0 )
{
MY_LOGE("rQueNode.getImgBuf() == 0");
continue;
}
// (3.2) do FD algorithm
bool isDetected_FD = false;
bool isDetected_SD = false;
bool isDetected_GD = false;
int const i4CamMode = mpParamsMgr->getInt(MtkCameraParameters::KEY_CAMERA_MODE);
if ( i4CamMode == MtkCameraParameters::CAMERA_MODE_NORMAL )
Rotation_Info = 180;
else
Rotation_Info = mpParamsMgr->getInt(CameraParameters::KEY_ROTATION);
//MY_LOGD("Rotation_Info:%d", Rotation_Info);
CPTLog(Event_Hal_Client_CamClient_FD, CPTFlagStart); // Profiling Start.
if ( ! isMsgEnabled() )
{
MY_LOGD("Don't do FD");
}
else
{
if( g_last_SDenabled != mIsSDenabled)
{
mpFDHalObj->halFDUninit();
//.........这里部分代码省略.........
示例12: enqueBuffer
MBOOL
EngBufHandlerImpl::
enqueBuffer(MUINT32 const data, IImageBuffer const * pImageBuffer)
{
Mutex::Autolock _l(mLock);
//
MINT32 i, bufQueIdx = mapNode2Dst(data);
ImgBufQueNode keepImgBufQueNode;
//
#if 0
MY_LOGD("data(0x%08X)",data);
#endif
//
if(bufQueIdx == -1)
{
return MFALSE;
}
//
if(bufQueIdx >= 0)
{
if(mvBufQueNode[bufQueIdx].size() > 0)
{
keepImgBufQueNode = mvBufQueNode[bufQueIdx][0];
}
else
{
MY_LOGE("mvBufQueNode[%d] size(%d) = 0",
bufQueIdx,
mvBufQueNode[bufQueIdx].size());
return MFALSE;
}
}
else
{
MY_LOGE("bufQueIdx(%d) < 0",bufQueIdx);
}
//
MUINTPTR keepAddr = (MUINTPTR)(mvBufQueNode[bufQueIdx][0].getImgBuf()->getVirAddr());
MUINTPTR enqueAddr = (MUINTPTR)(GET_IIMAGEBUFFER_BUF_VA(pImageBuffer, 0));
//
#if 0
MY_LOGD("Addr(0x%08X/0x%08X),Port(%d)",
keepAddr,
enqueAddr,
mvBufQueNode[bufQueIdx][0].getCookieDE());
#endif
//
if(keepAddr == enqueAddr)
{
MBOOL isAPClientFromFD = MFALSE;
sp<IImgBufProvider> bufProvider = NULL;
IImageBuffer* tempBuffer = const_cast<IImageBuffer*>(pImageBuffer);
//
switch(keepImgBufQueNode.getCookieDE())
{
case eBuf_Disp:
{
bufProvider = mspImgBufProvidersMgr->getDisplayPvdr();
break;
}
case eBuf_Rec:
{
bufProvider = mspImgBufProvidersMgr->getRecCBPvdr();
break;
}
case eBuf_AP:
{
bufProvider = mspImgBufProvidersMgr->getPrvCBPvdr();
const_cast<ImgBufQueNode*>(&keepImgBufQueNode)->setCookieDE(0); // 0 for preview
break;
}
case eBuf_Generic:
{
bufProvider = mspImgBufProvidersMgr->getGenericBufPvdr();
break;
}
case eBuf_FD:
{
bufProvider = mspImgBufProvidersMgr->getFDBufPvdr();
isAPClientFromFD = MTRUE;
break;
}
case eBuf_OT:
{
bufProvider = mspImgBufProvidersMgr->getOTBufPvdr();
break;
}
default:
{
MY_LOGE("unknown port(%d)",keepImgBufQueNode.getCookieDE());
return MFALSE;
}
}
//
if (bufProvider == NULL)
{
MY_LOGW("bufProvider(%d) is not available, drop it!", keepImgBufQueNode.getCookieDE());
tempBuffer->unlockBuf(LOG_TAG);
tempBuffer->decStrong(tempBuffer);
mvBufQueNode[bufQueIdx].erase(mvBufQueNode[bufQueIdx].begin());
//.........这里部分代码省略.........
示例13: dequeBuffer
MBOOL
EngBufHandlerImpl::
dequeBuffer(MUINT32 const data, ImgRequest * pImgReq)
{
Mutex::Autolock _l(mLock);
//
MBOOL isDequeProvider = MFALSE;
MBOOL doCacheInvalid = MFALSE;
MINT32 bufQueIdx = mapNode2Dst(data);
ImgBufQueNode node;
list<MAP_PORT_INFO>::iterator iterMapPort;
//
#if 0
MY_LOGD("data(0x%08X)",data);
#endif
//
if(bufQueIdx == -1)
{
return MFALSE;
}
//
for(iterMapPort = mlMapPort[bufQueIdx].begin(); iterMapPort != mlMapPort[bufQueIdx].end(); iterMapPort++)
{
#if 0
MY_LOGD("bufQueIdx(%d),data(%d,%d),bufType(%d)",
bufQueIdx,data,
(*iterMapPort).nodeType,
(*iterMapPort).bufType);
#endif
if(data == (*iterMapPort).nodeType)
{
sp<IImgBufProvider> bufProvider = NULL;
pImgReq->mUsage = NSIoPipe::EPortCapbility_None;
switch((*iterMapPort).bufType)
{
case eBuf_Disp:
{
bufProvider = mspImgBufProvidersMgr->getDisplayPvdr();
pImgReq->mUsage = NSIoPipe::EPortCapbility_Disp;
break;
}
case eBuf_Rec:
{
bufProvider = mspImgBufProvidersMgr->getRecCBPvdr();
pImgReq->mUsage = NSIoPipe::EPortCapbility_Rcrd;
break;
}
case eBuf_AP:
{
bufProvider = mspImgBufProvidersMgr->getPrvCBPvdr();
doCacheInvalid = MTRUE;
break;
}
case eBuf_Generic:
{
bufProvider = mspImgBufProvidersMgr->getGenericBufPvdr();
break;
}
case eBuf_FD:
{
bufProvider = mspImgBufProvidersMgr->getFDBufPvdr();
break;
}
case eBuf_OT:
{
bufProvider = mspImgBufProvidersMgr->getOTBufPvdr();
break;
}
default:
{
MY_LOGE("un-supported bufType(%d)",(*iterMapPort).bufType);
return MFALSE;
}
}
//
if(bufProvider != 0 && bufProvider->dequeProvider(node))
{
node.setCookieDE((*iterMapPort).bufType);
mvBufQueNode[bufQueIdx].push_back(node);
isDequeProvider = MTRUE;
break;
}
}
}
//
if(isDequeProvider)
{
size_t bufStridesInBytes[] = { GET_IIMGBUF_IMG_STRIDE_IN_BYTE(node.getImgBuf(), 0),
GET_IIMGBUF_IMG_STRIDE_IN_BYTE(node.getImgBuf(), 1),
GET_IIMGBUF_IMG_STRIDE_IN_BYTE(node.getImgBuf(), 2)};
size_t bufBoundaryInBytes[] = {0,0,0};
IImageBufferAllocator::ImgParam imgParam = IImageBufferAllocator::ImgParam(
Format::queryImageFormat(node.getImgBuf()->getImgFormat().string()),
MSize(
node.getImgBuf()->getImgWidth(),
node.getImgBuf()->getImgHeight()),
bufStridesInBytes,
bufBoundaryInBytes,
Format::queryPlaneCount(Format::queryImageFormat(node.getImgBuf()->getImgFormat().string())));
PortBufInfo_v1 portBufInfo = PortBufInfo_v1(
//.........这里部分代码省略.........