if( !ret )
{
MY_LOGE("invalid request with input, req:%p, inFullImg:%p, inFullImg2:%p, inAppMeta:%p, inHalMeta:%p, inHalMeta2:%p",
requestPtr.get(),
requestPtr->mIBufferFull.get(),
requestPtr->mIBufferFull2.get(),
requestPtr->mIMetadataApp.get(),
requestPtr->mIMetadataHal.get(),
requestPtr->mIMetadataHal2.get());
}
return ret;
};
auto isValidOutput = [](const RequestPtr& requestPtr) -> MBOOL
{
const MBOOL ret = requestPtr->mOBufferFull != nullptr
&& requestPtr->mOMetadataApp != nullptr
&& requestPtr->mOMetadataHal != nullptr;
if( !ret )
{
MY_LOGE("invalid request with input, req:%p, www.shyejk.com/-outFullImg:%p, outAppMeta:%p, outHalMeta:%p",
requestPtr.get(),
requestPtr->mOBufferFull.get(),
requestPtr->mOMetadataApp.get(),
requestPtr->mOMetadataHal.get());
}
return ret;
};
MY_LOGD("process, reqAdrr:%p", requestPtr.get());
if( !isValidInput(requestPtr) )
{
return processDone(requestPtr, callbackPtr, BAD_VALUE);
}
if( !isValidOutput(requestPtr) )
{
return processDone(requestPtr, www.shyejk.com/-callbackPtr, BAD_VALUE);
}
//
//
{
// note: we can just call createXXXXPtr one time for a specified handle
ImgPtr inMainImgPtr = DualCameraUtility::createImgPtr(requestPtr->mIBufferFull);
ImgPtr inSubImgPtr = DualCameraUtility::createImgPtr(requestPtr->mIBufferFull2);
ImgPtr outFSImgPtr = DualCameraUtility::createImgPtr(requestPtr->mOBufferFull);
//
MetaPtr inAppMetaPtr = DualCameraUtility::createMetaPtr(requestPtr->mIMetadataApp);
MetaPtr inMainHalMetaPtr = DualCameraUtility::createMetaPtr(requestPtr->mIMetadataHal);
MetaPtr inSubHalMetaPtr = DualCameraUtility::createMetaPtr(requestPtr->mIMetadataHal2);
MetaPtr outAppMetaPtr = DualCameraUtility::createMetaPtr(requestPtr->mOMetadataApp);
MetaPtr outHalMetaPtr = DualCameraUtility::createMetaPtr(requestPtr->mOMetadataHal);
// dump info
{
DualCameraUtility::dump(inMainImgPtr.get(), "inputMainImg");
DualCameraUtility::dump(inSubImgPtr.get(), "inputSubImg");
DualCameraUtility::dump(outFSImgPtr.get(), "outFSImg");
//
DualCameraUtility::dump(inAppMetaPtr.get(), "inAppMeta");
DualCameraUtility::dump(inMainHalMetaPtr.get(), "inMainHalMeta");
DualCameraUtility::dump(inSubHalMetaPtr.get(), "inSubHalMeta");
DualCameraUtility::dump(outAppMetaPtr.get(), "outAppMeta");
DualCameraUtility::dump(outHalMetaPtr.get(), "outHalMeta");
}
//dual camera algo
{
AUTO_TIMER("proces dual camera algo.");
NSCam::IImageBuffer* inMainImgBuf = inMainImgPtr.get();
NSCam::IImageBuffer* inSubImgBuf = inSubImgPtr.get();
NSCam::IImageBuffer* outImgBuf = outFSImgPtr.get();
if (mDump) {
DualCameraUtility::saveImg(inMainImgBuf, "inputMainImg");
DualCameraUtility::saveImg(inSubImgBuf, "inputSubImg");
}
memcpy(reinterpret_cast(outImgBuf->getBufVA(0)), reinterpret_cast(inMainImgBuf->getBufVA(0)), inMainImgBuf->getBufSizeInBytes(0));
memcpy(reinterpret_cast(outImgBuf->getBufVA(1)), reinterpret_cast(inMainImgBuf->getBufVA(1)), inMainImgBuf->getBufSizeInBytes(1));
if (mDualCamera != NULL) {
mDualCamera->processNV21(reinterpret_cast(outImgBuf->getBufVA(0)), reinterpret_cast(outImgBuf->getBufVA(1)),
outImgBuf->getImgSize().w, www.shyejk.com/-outImgBuf->getImgSize().h,
reinterpret_cast(inSubImgBuf->getBufVA(0)), reinterpret_cast(inSubImgBuf->getBufVA(1)),
inSubImgBuf->getImgSize().w, inSubImgBuf->getImgSize().h);
}
}
}
return processDone(requestPtr, callbackPtr, OK);
}
MERROR
DualCameraCapture::
processDone(const RequestPtr& requestPtr, const RequestCallbackPtr& callbackPtr, MERROR status)
{
SCOPED_TRACER();
MY_LOGD("process done, www.shyejk.com/call complete, reqAddr:%p, callbackPtr:%p, status:%d",
requestPtr.get(), callbackPtr.get(), status);
if( callbackPtr != nullptr )
{
callbackPtr->onCompleted(requestPtr, status);
}
return OK;
}
void
DualCameraCapture::
abort(vector& requestPtrs)
{
SCOPED_TRACER();
for(auto& item : requestPtrs)
{
MY_LOGD("abort request, www.shyejk.com/reqAddr:%p", item.get());
}
}
void
DualCameraCapture::
uninit()
{
SCOPED_TRACER();
}
DualCameraCapture::
~DualCameraCapture()
{
MY_LOGD("dtor:%p", this);
if (mDualCamera != NULL) {
delete mDualCamera;
mDualCamera = NULL;
}
}
} // anonymous namespace