MBOOL Mhal_facebeauty:: createFullFrame(IMEM_BUF_INFO Srcbufinfo) { MBOOL ret = MTRUE; MINT32 err = 0; CPTLog(Event_FBShot_createFullFrame, CPTFlagStart); MY_LOGD("[createFullFrame] + \n"); NSCamShot::ISingleShot *pSingleShot = NSCamShot::ISingleShot::createInstance(eShotMode_FaceBeautyShot, "FaceBeautyshot"); // pSingleShot->init(); EImageFormat ePostViewFmt = static_cast<EImageFormat>(android::MtkCamUtils::FmtUtils::queryImageioFormat(mShotParam.ms8PostviewDisplayFormat)); ImgBufInfo rSrcImgInfo; rSrcImgInfo.u4ImgWidth = mu4W_yuv; rSrcImgInfo.u4ImgHeight = mu4H_yuv; rSrcImgInfo.eImgFmt = eImgFmt_YV16; rSrcImgInfo.u4Stride[0] = rSrcImgInfo.u4ImgWidth; rSrcImgInfo.u4Stride[1] = rSrcImgInfo.u4ImgWidth >> 1; rSrcImgInfo.u4Stride[2] = rSrcImgInfo.u4ImgWidth >> 1; rSrcImgInfo.u4BufSize = Srcbufinfo.size; rSrcImgInfo.u4BufVA = Srcbufinfo.virtAddr; rSrcImgInfo.u4BufPA = Srcbufinfo.phyAddr; rSrcImgInfo.i4MemID = Srcbufinfo.memID; pSingleShot->registerImgBufInfo(ECamShot_BUF_TYPE_YUV, rSrcImgInfo); ImgBufInfo rPostImgInfo; rPostImgInfo.u4ImgWidth = mShotParam.mi4PostviewWidth; rPostImgInfo.u4ImgHeight = mShotParam.mi4PostviewHeight; rPostImgInfo.eImgFmt = ePostViewFmt; rPostImgInfo.u4Stride[0] = rPostImgInfo.u4ImgWidth; rPostImgInfo.u4Stride[1] = rPostImgInfo.u4ImgWidth >> 1; rPostImgInfo.u4Stride[2] = rPostImgInfo.u4ImgWidth >> 1; // using blurimg buffer for reduce buffer size rPostImgInfo.u4BufSize = mpBlurImg.size; rPostImgInfo.u4BufVA = mpBlurImg.virtAddr; rPostImgInfo.u4BufPA = mpBlurImg.phyAddr; rPostImgInfo.i4MemID = mpBlurImg.memID; pSingleShot->registerImgBufInfo(ECamShot_BUF_TYPE_POSTVIEW, rPostImgInfo); // pSingleShot->enableDataMsg(ECamShot_DATA_MSG_YUV //| ECamShot_DATA_MSG_JPEG ); pSingleShot->enableNotifyMsg(NSCamShot::ECamShot_NOTIFY_MSG_EOF); // shot param NSCamShot::ShotParam rShotParam(eImgFmt_YV16, //yuv format mShotParam.mi4PictureWidth, //picutre width mShotParam.mi4PictureHeight, //picture height 0, //picture rotation in jpg 0, //picture flip ePostViewFmt, mShotParam.mi4PostviewWidth, //postview width mShotParam.mi4PostviewHeight, //postview height 0, //postview rotation 0, //postview flip mShotParam.mu4ZoomRatio //zoom ); // jpeg param NSCamShot::JpegParam rJpegParam(mJpegParam.mu4JpegQuality, //Quality MTRUE //isSOI ); // sensor param NSCamShot::SensorParam rSensorParam(static_cast<MUINT32>(MtkCamUtils::DevMetaInfo::queryHalSensorDev(getOpenId())), //Device ID #warning [FIXME] workaround for Alta phone capture mode can not work ACDK_SCENARIO_ID_CAMERA_CAPTURE_JPEG, //Scenaio //ACDK_SCENARIO_ID_CAMERA_PREVIEW, //Scenaio 10, //bit depth MFALSE, //bypass delay MFALSE //bypass scenario ); // pSingleShot->setCallbacks(fgCamShotNotifyCb, fgCamShotDataCb, this); // pSingleShot->setShotParam(rShotParam); // pSingleShot->setJpegParam(rJpegParam); // pSingleShot->startOne(rSensorParam); // pSingleShot->uninit(); // pSingleShot->destroyInstance(); if(mShotParam.ms8ShotFileName.string()!=NULL) { ret = createFBJpegImg(Srcbufinfo,mu4W_yuv,mu4H_yuv,1); if ( ! ret ) { goto lbExit; } } #ifdef Debug_Mode loadFileToBuf("/data/FBSOURCE.yuv",(uint8_t*)Srcbufinfo.virtAddr,Srcbufinfo.size); saveBufToFile("/sdcard/img.yuv", (uint8_t*)Srcbufinfo.virtAddr, Srcbufinfo.size); #endif CPTLog(Event_FBShot_createFullFrame, CPTFlagEnd); MY_LOGD("[createFullFrame] - \n"); lbExit: return ret; }
MBOOL TinnoShot:: createYUVFrame(IMEM_BUF_INFO Srcbufinfo) { MBOOL ret = MTRUE; MINT32 err = 0; // CPTLog(Event_FBShot_createFullFrame, CPTFlagStart); MY_LOGD("[createFullFrame] + \n"); NSCamShot::ISingleShot *pSingleShot = NSCamShot::ISingleShot::createInstance(eShotMode_TinnoShot, "TinnoShot"); // pSingleShot->init(); EImageFormat ePostViewFmt = static_cast<EImageFormat>(android::MtkCamUtils::FmtUtils::queryImageioFormat(mShotParam.ms8PostviewDisplayFormat)); ImgBufInfo rSrcImgInfo; rSrcImgInfo.u4ImgWidth = mu4W_yuv; rSrcImgInfo.u4ImgHeight = mu4H_yuv; rSrcImgInfo.eImgFmt = eImgFmt_YV16; rSrcImgInfo.u4Stride[0] = rSrcImgInfo.u4ImgWidth; rSrcImgInfo.u4Stride[1] = rSrcImgInfo.u4ImgWidth >> 1; rSrcImgInfo.u4Stride[2] = rSrcImgInfo.u4ImgWidth >> 1; rSrcImgInfo.u4BufSize = Srcbufinfo.size; rSrcImgInfo.u4BufVA = Srcbufinfo.virtAddr; rSrcImgInfo.u4BufPA = Srcbufinfo.phyAddr; rSrcImgInfo.i4MemID = Srcbufinfo.memID; pSingleShot->registerImgBufInfo(ECamShot_BUF_TYPE_YUV, rSrcImgInfo); // pSingleShot->enableDataMsg(ECamShot_DATA_MSG_YUV //| ECamShot_DATA_MSG_JPEG ); pSingleShot->enableNotifyMsg(NSCamShot::ECamShot_NOTIFY_MSG_EOF); // shot param NSCamShot::ShotParam rShotParam(eImgFmt_YV16, //yuv format mShotParam.mi4PictureWidth, //picutre width mShotParam.mi4PictureHeight, //picture height 0, //picture rotation in jpg 0, //picture flip ePostViewFmt, mShotParam.mi4PostviewWidth, //postview width mShotParam.mi4PostviewHeight, //postview height 0, //postview rotation 0, //postview flip mShotParam.mu4ZoomRatio //zoom ); // sensor param NSCamShot::SensorParam rSensorParam(static_cast<MUINT32>(MtkCamUtils::DevMetaInfo::queryHalSensorDev(getOpenId())), //Device ID ACDK_SCENARIO_ID_CAMERA_CAPTURE_JPEG, //Scenaio //ACDK_SCENARIO_ID_CAMERA_PREVIEW, //Scenaio 10, //bit depth MFALSE, //bypass delay MFALSE //bypass scenario ); // pSingleShot->setCallbacks(fgCamShotNotifyCb, fgCamShotDataCb, this); // pSingleShot->setShotParam(rShotParam); // pSingleShot->startOne(rSensorParam); // pSingleShot->uninit(); // pSingleShot->destroyInstance(); if ( ! ret ) { goto lbExit; } MY_LOGD("[pjtinno DumpYUV] \n"); saveBufToFile("/sdcard/img.bin", (uint8_t*)Srcbufinfo.virtAddr, Srcbufinfo.size); MY_LOGD("[createFullFrame] - \n"); lbExit: return ret; }