コード例 #1
0
ファイル: test_multishot.cpp プロジェクト: Scorpio92/mediatek
static MBOOL handleJpegCallback(CamShotDataInfo const msg)
{
    MY_LOGD("handleJpegCallback");
    char fileName[256] = {'\0'};
    sprintf(fileName, "/data/jpeg%02d.jpg", u4CapCnt);
    saveBufToFile(fileName, (MUINT8*)msg.pBuffer->getBufVA(0), msg.pBuffer->getBitstreamSize());

    IImageBuffer* pThumbImg = reinterpret_cast<IImageBuffer*>(msg.ext1);
    memset(fileName, '\0', 256);
    sprintf(fileName, "/data/thumb%02d.jpg", u4CapCnt);
    saveBufToFile(fileName, (MUINT8*)pThumbImg->getBufVA(0), pThumbImg->getBitstreamSize());

    return 0;
}
コード例 #2
0
MBOOL
Pass2NodeImpl::
enquePass2(MBOOL const doCallback)
{
    //workaround for start/stop recording
    Mutex::Autolock lock(mRecordingLock);

    NG_TRACE_CALL();
    QParams enqueParams;
    vector<p2data> vP2data;
    MUINT32 trace_begin = muEnqFrameCnt;

    if( !getPass2Buffer(vP2data) )
    {
        // no dst buffers
        return MTRUE;
    }

    if( vP2data.size() == 0 )
    {
        MY_LOGE("no src/dst buf");
        return MFALSE;
    }

    enqueParams.mvIn.reserve( vP2data.size() );
    //enqueParams.mvOut.reserve(dstCount);

    MUINT32 index = 0;
    vector<p2data>::const_iterator pData = vP2data.begin();
    while( pData != vP2data.end() )
    {
        MUINT32 magicNum;
        MVOID*  pPrivateData;
        MUINT32 privateDataSize;
        MCropRect p2InCrop;
        MSize srcSize;
        MINT64 timestamp;

        // input
        Input src;
        //
        src.mPortID = mapToPortID(pData->src.data);
        src.mPortID.group = index;
        src.mBuffer = pData->src.buf;
        //
        if( pData->doCrop )
        {
            mpIspSyncCtrlHw->getPass2Info(
                    src.mBuffer,
                    pData->dstSize,
                    magicNum,
                    pPrivateData,
                    privateDataSize,
                    p2InCrop);
        }
        else
        {
            MBOOL isRrzo;
            mpIspSyncCtrlHw->queryImgBufInfo(
                    src.mBuffer,
                    magicNum,
                    isRrzo,
                    pPrivateData,
                    privateDataSize);
            p2InCrop.p_integral = MPoint(0, 0);
            p2InCrop.p_fractional = MPoint(0, 0);
            p2InCrop.s = src.mBuffer->getImgSize();
        }
        //
        if( !isPreviewPath() )
            magicNum = SetCap(magicNum);
        //
        enqueParams.mvPrivaData.push_back(pPrivateData);
        enqueParams.mvMagicNo.push_back(magicNum);
        enqueParams.mvIn.push_back(src);
        //
        srcSize = src.mBuffer->getImgSize();
        timestamp = src.mBuffer->getTimestamp();
        //
        MY_LOGD("i %d data %d, buf 0x%x, va 0x%x, # 0x%X, type %d cnt %d", 
                index,
                pData->src.data,
                src.mBuffer,
                src.mBuffer->getBufVA(0),
                magicNum,
                mPass2Type,
                muEnqFrameCnt);
        //output
        //
        MCrpRsInfo crop1;
        crop1.mGroupID    = 1;
        crop1.mCropRect.s = srcSize;
        crop1.mResizeDst  = srcSize;
        //
        MCrpRsInfo crop2;
        crop2.mGroupID    = 2;
        crop2.mCropRect   = p2InCrop;
        //crop2.mResizeDst = MSize(0,0);
        // output
        MUINT32 i = 0;
        for( vector<ImgRequest>::const_iterator pOutReq = pData->vDstReq.begin();
                pOutReq != pData->vDstReq.end(); pOutReq++, i++ )
        {
            const MUINT32 dstDataType = pData->vDstData[i];
            Output dst;
            IImageBuffer* pDstBuf = const_cast<IImageBuffer*>(pOutReq->mBuffer);
            //
            MY_LOGD("data %d, buf 0x%x, va 0x%x, tans %d usg %d", 
                    dstDataType,
                    pDstBuf, 
                    pDstBuf->getBufVA(0),
                    pOutReq->mTransform,
                    pOutReq->mUsage);
            //
            dst.mPortID             = mapToPortID(dstDataType);
            dst.mPortID.group       = index;
            dst.mPortID.capbility   = (NSIoPipe::EPortCapbility)(pOutReq->mUsage);
            //
            dst.mBuffer     = pDstBuf;
            dst.mTransform  = pOutReq->mTransform;
            //
            dst.mBuffer->setTimestamp(timestamp);
            //
            enqueParams.mvOut.push_back(dst);
            //
            if(mapToPortID(dstDataType) == IMG2O)
            {
                crop1.mCropRect = p2InCrop;
                crop1.mResizeDst = dst.mBuffer->getImgSize();
                MY_LOGD("IMG2O:B(%p),S(%dx%d),C(%d,%d,%dx%d)",
                        dst.mBuffer,
                        crop1.mResizeDst.w,
                        crop1.mResizeDst.h,
                        crop1.mCropRect.p_integral.x,
                        crop1.mCropRect.p_integral.y,
                        crop1.mCropRect.s.w,
                        crop1.mCropRect.s.h);
            }
        }
        //
        enqueParams.mvCropRsInfo.push_back( crop1 ); 
        enqueParams.mvCropRsInfo.push_back( crop2 ); 
        //
        // next src/dst pair
        pData++;
        muEnqFrameCnt++;
        index++;
    }
    //
    configFeature();

    //
#if PASS2_CALLBACL_ENABLE
    if( doCallback )
    {
        enqueParams.mpfnCallback = pass2CbFunc;
        enqueParams.mpCookie = this;
    }
    else
#endif
    {
        enqueParams.mpfnCallback = NULL;
        enqueParams.mpCookie = NULL;
    }
    //
    if( !mpIspSyncCtrlHw->lockHw(IspSyncControlHw::HW_PASS2) )
    {
        MY_LOGE("isp sync lock pass2 failed");
        return MFALSE;
    }
    //
    NG_TRACE_FMT_BEGIN("enqP2:%d", trace_begin);
    if( !mpPostProcPipe->enque(enqueParams) )
    {
        NG_TRACE_FMT_END();
        MY_LOGE("enque pass2 failed");
        AEE_ASSERT("ISP pass2 enque fail");
        return MFALSE;
    }
    NG_TRACE_FMT_END();
    return MTRUE;
}