Exemple #1
0
bool
EngShot::
onCmd_capture()
{ 
    MBOOL ret = MTRUE; 

    NSIspTuning::IspTuningMgr::getInstance().setOperMode(NSIspTuning::EOperMode_EM);
    if (EngParam::ENG_SENSOR_MODE_PREVIEW == mEngParam->mi4EngSensorMode)
    {
        MINT32 err1;
        err1 = NS3A::AeMgr::getInstance().CCTOPAESetCaptureMode(0);
        CAM_LOGD("CCTOPAESetCaptureMode(0): %d", err1);

        MBOOL err2;
        err2 = NSIspTuning::IspTuningMgr::getInstance().setSensorMode(NSIspTuning::ESensorMode_Preview);
        CAM_LOGD("setSensorMode(NSIspTuning::ESensorMode_Preview): %d", err2);
    }
    else if (EngParam::ENG_SENSOR_MODE_CAPTURE == mEngParam->mi4EngSensorMode)
    {
        MINT32 err1;
        err1 = NS3A::AeMgr::getInstance().CCTOPAESetCaptureMode(1);
        CAM_LOGD("CCTOPAESetCaptureMode(1): %d", err1);

        MBOOL err2;
        err2 = NSIspTuning::IspTuningMgr::getInstance().setSensorMode(NSIspTuning::ESensorMode_Capture);
        CAM_LOGD("setSensorMode(NSIspTuning::ESensorMode_Capture): %d", err2);
    }
    else if (EngParam::ENG_SENSOR_MODE_VIDEO_PREVIEW == mEngParam->mi4EngSensorMode)
    {
        MINT32 err1;
        err1 = NS3A::AeMgr::getInstance().CCTOPAESetCaptureMode(2);
        CAM_LOGD("CCTOPAESetCaptureMode(2): %d", err1);

        MBOOL err2;
        err2 = NSIspTuning::IspTuningMgr::getInstance().setSensorMode(NSIspTuning::ESensorMode_Video);
        CAM_LOGD("setSensorMode(NSIspTuning::ESensorMode_Video): %d", err2);
    }
    else if (EngParam::ENG_SENSOR_MODE_ZSD == mEngParam->mi4EngSensorMode)
    {
        MINT32 err1;
        err1 = NS3A::AeMgr::getInstance().CCTOPAESetCaptureMode(1);
        CAM_LOGD("CCTOPAESetCaptureMode(1): ZSD %d", err1);

        MBOOL err2;
        err2 = NSIspTuning::IspTuningMgr::getInstance().setSensorMode(NSIspTuning::ESensorMode_Capture);
        CAM_LOGD("setSensorMode(NSIspTuning::ESensorMode_Capture): %d", err2);
    }
    
    NSCamShot::ISingleShot *pSingleShot = NSCamShot::ISingleShot::createInstance(static_cast<EShotMode>(mu4ShotMode), "EngShot"); 
    // 
    pSingleShot->init(); 

    // 
    pSingleShot->enableNotifyMsg(NSCamShot::ECamShot_NOTIFY_MSG_SOF); 
    //
    EImageFormat ePostViewFmt = static_cast<EImageFormat>(android::MtkCamUtils::FmtUtils::queryImageioFormat(mShotParam.ms8PostviewDisplayFormat)); 

    MINT32 i4msg = 0;
    if (mEngParam->mi4EngRawSaveEn)
    {
        i4msg |= NSCamShot::ECamShot_DATA_MSG_BAYER;
    }
    pSingleShot->enableDataMsg(NSCamShot::ECamShot_DATA_MSG_JPEG | i4msg
                               | ((ePostViewFmt != eImgFmt_UNKNOWN) ? NSCamShot::ECamShot_DATA_MSG_POSTVIEW : NSCamShot::ECamShot_DATA_MSG_NONE)
                               ); 

    // shot param 
    NSCamShot::ShotParam rShotParam(eImgFmt_YUY2,         //yuv format 
                         mShotParam.mi4PictureWidth,      //picutre width 
                         mShotParam.mi4PictureHeight,     //picture height
                         mShotParam.mi4Rotation,          //picture rotation 
                         0,                               //picture flip 
                         ePostViewFmt,                    // postview format 
                         mShotParam.mi4PostviewWidth,      //postview width 
                         mShotParam.mi4PostviewHeight,     //postview height 
                         0,                               //postview rotation 
                         0,                               //postview flip 
                         mShotParam.mu4ZoomRatio           //zoom   
                        );                                  
 
    // jpeg param 
    NSCamShot::JpegParam rJpegParam(NSCamShot::ThumbnailParam(mJpegParam.mi4JpegThumbWidth, mJpegParam.mi4JpegThumbHeight, 
                                                                mJpegParam.mu4JpegThumbQuality, MTRUE),
                                                        mJpegParam.mu4JpegQuality,       //Quality 
                                                        MFALSE                            //isSOI 
                         ); 
 
                                                                     
    // sensor param 
    MUINT32 u4Scenario;
    if (1 == mEngParam->mi4EngRawSaveEn)
    {
        u4Scenario = mEngParam->mi4EngSensorMode;
        if (EngParam::ENG_SENSOR_MODE_ZSD == mEngParam->mi4EngSensorMode)
        {
            u4Scenario = EngParam::ENG_SENSOR_MODE_CAPTURE;
        }
    }
    else
    {
#warning [FIXME] workaround for Alta phone capture mode cant work 
            u4Scenario = ACDK_SCENARIO_ID_CAMERA_PREVIEW; // u4Scenario = ACDK_SCENARIO_ID_CAMERA_CAPTURE_JPEG;
    }
    NSCamShot::SensorParam rSensorParam(static_cast<MUINT32>(MtkCamUtils::DevMetaInfo::queryHalSensorDev(getOpenId())),                             //Device ID 

#warning [FIXME] workaround for Alta phone capture mode cant work 
                             //ACDK_SCENARIO_ID_CAMERA_CAPTURE_JPEG,         //Scenaio 
                             u4Scenario,         //Scenaio 
                             10,                                       //bit depth 
                             MFALSE,                                   //bypass delay 
                             MFALSE,                                   //bypass scenario 
                             mEngParam->mi4EngIspMode); 
    //
    mEngParam->u4Bitdepth = rSensorParam.u4Bitdepth;
    NSCamShot::querySensorInfo(rSensorParam.u4DeviceID, rSensorParam.u4Scenario, rSensorParam.u4Bitdepth,
                                mEngParam->eImgFmt,
                                mEngParam->u4SensorWidth,
                                mEngParam->u4SensorHeight,
                                mEngParam->u4RawPixelID /* SENSOR_OUTPUT_FORMAT_RAW_B=0, SENSOR_OUTPUT_FORMAT_RAW_Gb, SENSOR_OUTPUT_FORMAT_RAW_Gr, SENSOR_OUTPUT_FORMAT_RAW_R */ );

    pSingleShot->setCallbacks(fgCamShotNotifyCb, fgCamShotDataCb, this); 
    //     
    ret = pSingleShot->setShotParam(rShotParam); 
    
    //
    ret = pSingleShot->setJpegParam(rJpegParam); 

    // 
    ret = pSingleShot->startOne(rSensorParam); 
   
    //
    ret = pSingleShot->uninit(); 

    //
    pSingleShot->destroyInstance(); 


    return ret;
}
bool
ZsdShot::
onRaw_capture(CapBufQueNode & rNode)
{
    FUNCTION_LOG_START;
    MBOOL ret = MTRUE;
    NSCamShot::ISingleShot *pSingleShot = NSCamShot::ISingleShot::createInstance(static_cast<EShotMode>(mu4ShotMode), "ZsdShot");
    //
    pSingleShot->init();

    //
    pSingleShot->enableNotifyMsg(NSCamShot::ECamShot_NOTIFY_MSG_EOF);
    //
    EImageFormat ePostViewFmt = static_cast<EImageFormat>(android::MtkCamUtils::FmtUtils::queryImageioFormat(mShotParam.ms8PostviewDisplayFormat));

    pSingleShot->enableDataMsg(NSCamShot::ECamShot_DATA_MSG_JPEG
                               | ((ePostViewFmt != eImgFmt_UNKNOWN) ? NSCamShot::ECamShot_DATA_MSG_POSTVIEW : NSCamShot::ECamShot_DATA_MSG_NONE)
                               );


    // shot param
    NSCamShot::ShotParam rShotParam(eImgFmt_YUY2,         //yuv format
                         mShotParam.mi4PictureWidth,      //picutre width
                         mShotParam.mi4PictureHeight,     //picture height
                         mShotParam.mi4Rotation,          //picture rotation
                         0,                               //picture flip
                         ePostViewFmt,                    // postview format
                         mShotParam.mi4PostviewWidth,      //postview width
                         mShotParam.mi4PostviewHeight,     //postview height
                         0,                               //postview rotation
                         0,                               //postview flip
                         mShotParam.mu4ZoomRatio           //zoom
                        );

    // jpeg param
    NSCamShot::JpegParam rJpegParam(NSCamShot::ThumbnailParam(mJpegParam.mi4JpegThumbWidth, mJpegParam.mi4JpegThumbHeight,
                                                                mJpegParam.mu4JpegThumbQuality, MTRUE),
                                                        mJpegParam.mu4JpegQuality,       //Quality
                                                        MFALSE                            //isSOI
                         );


    // sensor param
    NSCamShot::SensorParam rSensorParam(static_cast<MUINT32>(MtkCamUtils::DevMetaInfo::queryHalSensorDev(getOpenId())),                             //Device ID
                             ACDK_SCENARIO_ID_CAMERA_CAPTURE_JPEG,         //Scenaio
                             10,                                       //bit depth
                             MFALSE,                                   //bypass delay
                             MFALSE                                   //bypass scenario
                            );
    //
    pSingleShot->setCallbacks(fgCamShotNotifyCb, fgCamShotDataCb, this);
    //
    ret = pSingleShot->setShotParam(rShotParam);

    //
    ret = pSingleShot->setJpegParam(rJpegParam);


    ImgBufInfo rImgBufInfo;
    mapNodeToImageBuf(rNode.mainImgNode, rImgBufInfo);

    //

    //ret = pSingleShot->startOne(rImgBufInfo);
    ret = pSingleShot->startOne(rSensorParam ,rImgBufInfo);

    //
    ret = pSingleShot->uninit();

    //
    pSingleShot->destroyInstance();

    FUNCTION_LOG_END;

    return ret;

}
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;
}
Exemple #4
0
bool
CapBufShot::
onCmd_capture()
{ 
    AutoCPTLog cptlog(Event_Shot_capture);
    MBOOL ret = MTRUE; 
    NSCamShot::ISingleShot *pSingleShot = 
        NSCamShot::ISingleShot::createInstance(static_cast<EShotMode>(mu4ShotMode), "CapBufShot"); 
    //
    MUINT32 nrtype = queryCapNRType( getPreviewIso() );
    // 
    pSingleShot->init(); 
    // 
    pSingleShot->enableNotifyMsg( SHUTTER_TIMING ); 
    //
    EImageFormat ePostViewFmt = 
        static_cast<EImageFormat>(mShotParam.miPostviewDisplayFormat);

    pSingleShot->enableDataMsg(
            NSCamShot::ECamShot_DATA_MSG_JPEG
#if 0
            | ((ePostViewFmt != eImgFmt_UNKNOWN) ? 
             NSCamShot::ECamShot_DATA_MSG_POSTVIEW : NSCamShot::ECamShot_DATA_MSG_NONE)
#endif
            ); 

    // shot param 
    NSCamShot::ShotParam rShotParam(
            eImgFmt_YUY2,                    //yuv format 
            mShotParam.mi4PictureWidth,      //picutre width 
            mShotParam.mi4PictureHeight,     //picture height
            mShotParam.mu4Transform,         //picture transform 
            ePostViewFmt,                    //postview format 
            mShotParam.mi4PostviewWidth,     //postview width 
            mShotParam.mi4PostviewHeight,    //postview height 
            0,                               //postview transform
            mShotParam.mu4ZoomRatio          //zoom   
            );                                  
 
    // jpeg param 
    NSCamShot::JpegParam rJpegParam(
            NSCamShot::ThumbnailParam(
                mJpegParam.mi4JpegThumbWidth, 
                mJpegParam.mi4JpegThumbHeight, 
                mJpegParam.mu4JpegThumbQuality, 
                MTRUE),
            mJpegParam.mu4JpegQuality,         //Quality 
            MFALSE                             //isSOI 
            );

    // sensor param 
    NSCamShot::SensorParam rSensorParam(
            getOpenId(),                             //sensor idx
            SENSOR_SCENARIO_ID_NORMAL_CAPTURE,       //Scenaio 
            10,                                      //bit depth 
            MFALSE,                                  //bypass delay 
            MFALSE                                   //bypass scenario 
            );  
    //
    pSingleShot->setCallbacks(fgCamShotNotifyCb, fgCamShotDataCb, this); 
    //     
    ret = pSingleShot->setShotParam(rShotParam); 
    //
    ret = pSingleShot->setJpegParam(rJpegParam); 
    //
    if(mu4ShotMode == NSCam::eShotMode_ZsdShot)
    {
        CAM_LOGD("ZSD Shot");
        ret = pSingleShot->sendCommand(
                                NSCamShot::ECamShot_CMD_SET_CAPTURE_STYLE,
                                NSCamShot::ECamShot_CMD_STYLE_NORMAL,
                                0,
                                0);
    }
    else
    if(mu4ShotMode == NSCam::eShotMode_VideoSnapShot)
    {
        CAM_LOGD("VSS Shot");
        ret = pSingleShot->sendCommand(
                                NSCamShot::ECamShot_CMD_SET_CAPTURE_STYLE,
                                NSCamShot::ECamShot_CMD_STYLE_VSS,
                                0,
                                0);
    }
    else
    {
        CAM_LOGE("Un-supported Shot");
    }
    //
    ret = pSingleShot->sendCommand( NSCamShot::ECamShot_CMD_SET_NRTYPE, nrtype, 0, 0 );
    //
    IImageBuffer* pImageBuffer;
    mpCapBufMgr->dequeBuf(pImageBuffer);
    ret = pSingleShot->startOne(rSensorParam, pImageBuffer); 
    mpCapBufMgr->enqueBuf(pImageBuffer);
    //
    ret = pSingleShot->uninit(); 
    //
    pSingleShot->destroyInstance(); 


    return ret;
}
Exemple #5
0
bool
EngShot::
onCmd_capture()
{ 
    MBOOL ret = MTRUE; 

    MUINT32 sensorDev = (MUINT32)NSCam::IHalSensorList::get()->querySensorDevIdx(getOpenId());
    //
    NSIspTuning::IspTuningMgr::getInstance().setOperMode(sensorDev, NSIspTuning::EOperMode_EM);
    if (EngParam::ENG_SENSOR_MODE_PREVIEW == mEngParam->mi4EngSensorMode)
    {
        /*MINT32 err1;
        err1 = NS3A::IAeMgr::getInstance().CCTOPAESetCaptureMode(sensorDev,0);
        CAM_LOGD("CCTOPAESetCaptureMode(0): %d", err1);*/

        MBOOL err2;
        err2 = NSIspTuning::IspTuningMgr::getInstance().setSensorMode(sensorDev, NSIspTuning::ESensorMode_Preview);
        CAM_LOGD("setSensorMode(NSIspTuning::ESensorMode_Preview): %d", err2);
    }
    else if (EngParam::ENG_SENSOR_MODE_CAPTURE == mEngParam->mi4EngSensorMode)
    {
        /*MINT32 err1;
        err1 = NS3A::IAeMgr::getInstance().CCTOPAESetCaptureMode(sensorDev,1);
        CAM_LOGD("CCTOPAESetCaptureMode(3): %d", err1);*/

        MBOOL err2;
        err2 = NSIspTuning::IspTuningMgr::getInstance().setSensorMode(sensorDev, NSIspTuning::ESensorMode_Capture);
        CAM_LOGD("setSensorMode(NSIspTuning::ESensorMode_Capture): %d", err2);
    }
    else if (EngParam::ENG_SENSOR_MODE_VIDEO_PREVIEW == mEngParam->mi4EngSensorMode)
    {
        /*MINT32 err1;
        err1 = NS3A::IAeMgr::getInstance().CCTOPAESetCaptureMode(sensorDev,2);
        CAM_LOGD("CCTOPAESetCaptureMode(3): %d", err1);*/

        MBOOL err2;
        err2 = NSIspTuning::IspTuningMgr::getInstance().setSensorMode(sensorDev, NSIspTuning::ESensorMode_Video);
        CAM_LOGD("setSensorMode(NSIspTuning::ESensorMode_Video): %d", err2);
    }
    
    NSCamShot::ISingleShot *pSingleShot = NSCamShot::ISingleShot::createInstance(static_cast<EShotMode>(mu4ShotMode), "EngShot"); 
    // 
    pSingleShot->init(); 

    // 
    pSingleShot->enableNotifyMsg(NSCamShot::ECamShot_NOTIFY_MSG_SOF); 
    //
    EImageFormat ePostViewFmt = static_cast<EImageFormat>(android::MtkCamUtils::FmtUtils::queryImageioFormat(mShotParam.ms8PostviewDisplayFormat)); 

    MINT32 i4msg = 0;
    if (mEngParam->mi4EngRawSaveEn)
    {
        i4msg |= NSCamShot::ECamShot_DATA_MSG_BAYER;
    }
    pSingleShot->enableDataMsg(NSCamShot::ECamShot_DATA_MSG_JPEG | i4msg
                               | ((ePostViewFmt != eImgFmt_UNKNOWN) ? NSCamShot::ECamShot_DATA_MSG_POSTVIEW : NSCamShot::ECamShot_DATA_MSG_NONE)
                               ); 
    //
    IHalSensorList* const pIHalSensorList = IHalSensorList::get();
        if(pIHalSensorList)
        {
            MUINT32 sensorDev = (MUINT32)pIHalSensorList->querySensorDevIdx(getOpenId());
            
            NSCam::SensorStaticInfo sensorStaticInfo;
            memset(&sensorStaticInfo, 0, sizeof(NSCam::SensorStaticInfo));
            pIHalSensorList->querySensorStaticInfo(sensorDev, &sensorStaticInfo);
    
            mEngParam->u4RawPixelID = sensorStaticInfo.sensorFormatOrder; /* SENSOR_OUTPUT_FORMAT_RAW_B=0, SENSOR_OUTPUT_FORMAT_RAW_Gb, SENSOR_OUTPUT_FORMAT_RAW_Gr, SENSOR_OUTPUT_FORMAT_RAW_R */
    
#define scenario_case(scenario, KEY, mEngParam)       \
            case scenario:                            \
                (mEngParam)->u4SensorWidth = sensorStaticInfo.KEY##Width;  \
                (mEngParam)->u4SensorHeight = sensorStaticInfo.KEY##Height; \
                break;
    
            switch (mEngParam->mi4EngSensorMode)
            {
            scenario_case( EngParam::ENG_SENSOR_MODE_PREVIEW, preview, mEngParam );
            scenario_case( EngParam::ENG_SENSOR_MODE_CAPTURE, capture, mEngParam );
            scenario_case( EngParam::ENG_SENSOR_MODE_VIDEO_PREVIEW, video, mEngParam );
            scenario_case( EngParam::ENG_SENSOR_MODE_SLIM_VIDEO1, video1, mEngParam );
            scenario_case( EngParam::ENG_SENSOR_MODE_SLIM_VIDEO2, video2, mEngParam );
            scenario_case( EngParam::ENG_SENSOR_MODE_CUSTOM1, SensorCustom1, mEngParam );
            scenario_case( EngParam::ENG_SENSOR_MODE_CUSTOM2, SensorCustom2, mEngParam );
            scenario_case( EngParam::ENG_SENSOR_MODE_CUSTOM3, SensorCustom3, mEngParam );
            scenario_case( EngParam::ENG_SENSOR_MODE_CUSTOM4, SensorCustom4, mEngParam );
            scenario_case( EngParam::ENG_SENSOR_MODE_CUSTOM5, SensorCustom5, mEngParam );        
            default:
                MY_LOGE("not support sensor scenario(0x%x)", mEngParam->mi4EngSensorMode);
                ret = MFALSE;
                    break;
            }
        }
#undef  scenario_case 


    // Align Jpeg Size to RAW Size 
    //Only when raw save and in normal mode 
    if ((mEngParam->mi4EngRawSaveEn == 1 && getBootMode() == 0) && 
    	    (mEngParam->mi4EngSensorMode != EngParam::ENG_SENSOR_MODE_CAPTURE)&&
            (mEngParam->mi4EngSensorMode != EngParam::ENG_SENSOR_MODE_VIDEO_PREVIEW)&&
            (mEngParam->mi4EngSensorMode != EngParam::ENG_SENSOR_MODE_SLIM_VIDEO1)&&
            (mEngParam->mi4EngSensorMode != EngParam::ENG_SENSOR_MODE_SLIM_VIDEO2))
    {
        // 1. keep to the same ratio 
        // 2. size is closed to sensor raw. 

        // srcW/srcH < dstW/dstH 
        if (mEngParam->u4SensorWidth * mShotParam.mi4PostviewHeight <= mShotParam.mi4PostviewWidth * mEngParam->u4SensorHeight) {
            mShotParam.mi4PictureWidth = ( mEngParam->u4SensorWidth ) & (~0xF); 
            mShotParam.mi4PictureHeight = ( mEngParam->u4SensorWidth * mShotParam.mi4PostviewHeight / mShotParam.mi4PostviewWidth ) & (~0xF);     
        }
        //srcW/srcH > dstW/dstH
        else
        { 
            mShotParam.mi4PictureWidth = ( mEngParam->u4SensorHeight* mShotParam.mi4PostviewWidth / mShotParam.mi4PostviewHeight ) & (~0xF); 
            mShotParam.mi4PictureHeight = ( mEngParam->u4SensorHeight ) & (~0xF); 
        }
        
    }

    // shot param 
    NSCamShot::ShotParam rShotParam(eImgFmt_YUY2,         //yuv format 
                         mShotParam.mi4PictureWidth,      //picutre width 
                         mShotParam.mi4PictureHeight,     //picture height
                         mShotParam.mi4Rotation,          //picture rotation 
                         0,                               //picture flip 
                         ePostViewFmt,                    // postview format 
                         mShotParam.mi4PostviewWidth,      //postview width 
                         mShotParam.mi4PostviewHeight,     //postview height 
                         0,                               //postview rotation 
                         0,                               //postview flip 
                         mShotParam.mu4ZoomRatio           //zoom   
                        );                                  
 
    // jpeg param 
    NSCamShot::JpegParam rJpegParam(NSCamShot::ThumbnailParam(mJpegParam.mi4JpegThumbWidth, mJpegParam.mi4JpegThumbHeight, 
                                                                mJpegParam.mu4JpegThumbQuality, MTRUE),
                                                        mJpegParam.mu4JpegQuality,       //Quality 
                                                        MFALSE                            //isSOI 
                         ); 
 
                                                                     
    // sensor param 
    MUINT32 u4Scenario;
    if (1 == mEngParam->mi4EngRawSaveEn)
    {
            u4Scenario = mEngParam->mi4EngSensorMode;
    }
    else
    {
#warning [FIXME] workaround for Alta phone capture mode cant work 
            u4Scenario = SENSOR_SCENARIO_ID_NORMAL_PREVIEW; // u4Scenario = ACDK_SCENARIO_ID_CAMERA_CAPTURE_JPEG;
    }
    NSCamShot::SensorParam rSensorParam(static_cast<MUINT32>(MtkCamUtils::DevMetaInfo::queryHalSensorDev(getOpenId())),                             //Device ID 

#warning [FIXME] workaround for Alta phone capture mode cant work 
                             //ACDK_SCENARIO_ID_CAMERA_CAPTURE_JPEG,         //Scenaio 
                             u4Scenario,         //Scenaio 
                             10,                                       //bit depth 
                             MFALSE,                                   //bypass delay 
                             MFALSE,                                   //bypass scenario 
                             mEngParam->mi4EngIspMode); 
    //
    mEngParam->u4Bitdepth = rSensorParam.u4Bitdepth;
    NSCamShot::querySensorInfo(rSensorParam.u4DeviceID, rSensorParam.u4Scenario, rSensorParam.u4Bitdepth,
                                mEngParam->eImgFmt,
                                mEngParam->u4SensorWidth,
                                mEngParam->u4SensorHeight,
                                mEngParam->u4RawPixelID /* SENSOR_OUTPUT_FORMAT_RAW_B=0, SENSOR_OUTPUT_FORMAT_RAW_Gb, SENSOR_OUTPUT_FORMAT_RAW_Gr, SENSOR_OUTPUT_FORMAT_RAW_R */ );

    pSingleShot->setCallbacks(fgCamShotNotifyCb, fgCamShotDataCb, this); 
    //     
    ret = pSingleShot->setShotParam(rShotParam); 
    
    //
    ret = pSingleShot->setJpegParam(rJpegParam); 

    // 
    ret = pSingleShot->startOne(rSensorParam); 
   
    //
    ret = pSingleShot->uninit(); 

    //
    pSingleShot->destroyInstance(); 


    return ret;
}
Exemple #6
0
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;
}