本文整理汇总了C++中ImgBufQueNode::getImgBuf方法的典型用法代码示例。如果您正苦于以下问题:C++ ImgBufQueNode::getImgBuf方法的具体用法?C++ ImgBufQueNode::getImgBuf怎么用?C++ ImgBufQueNode::getImgBuf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImgBufQueNode
的用法示例。
在下文中一共展示了ImgBufQueNode::getImgBuf方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
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: if
//
// 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: doBufferAnalysis
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: if
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: ImgBufQueNode
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;
}
示例7: handleReturnBuffers
/******************************************************************************
* 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;
}
示例8: isEnabledState
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();
//.........这里部分代码省略.........
示例9: _l
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());
//.........这里部分代码省略.........