Esempio n. 1
0
bool
ZsdShot::
createJpegImg(ImgBufInfo const & rSrcImgBufInfo,
                    MUINT32 const u4u4Quality,
                    MUINT32 const u4fgIsSOI,
                    ImgBufInfo const & rJpgImgBufInfo,
                    MUINT32 & u4JpegSize)
{
    //FUNCTION_LOG_START;
    //MtkCamUtils::CamProfile profile("createJpegImg", "SingleShot");
    //
    // (1). Create Instance
    ISImager *pISImager = ISImager::createInstance(rSrcImgBufInfo);
    //CHECK_OBJECT(pISImager);

    // init setting
    BufInfo rBufInfo(rJpgImgBufInfo.u4BufSize, rJpgImgBufInfo.u4BufVA, rJpgImgBufInfo.u4BufPA, rJpgImgBufInfo.i4MemID);
    //
    pISImager->setTargetBufInfo(rBufInfo);
    //
    pISImager->setFormat(eImgFmt_JPEG);
    //
    // When ZSDCC, can not do rotation or flip in this stage, only create JPGE.
    pISImager->setRotation(0);
    //
    pISImager->setFlip(0);
    //
    pISImager->setResize(rJpgImgBufInfo.u4ImgWidth, rJpgImgBufInfo.u4ImgHeight);
    //
    pISImager->setEncodeParam(u4fgIsSOI, u4u4Quality);
    //
    pISImager->setROI(Rect(0, 0, rSrcImgBufInfo.u4ImgWidth, rSrcImgBufInfo.u4ImgHeight));
    //
    pISImager->execute();
    //
    u4JpegSize = pISImager->getJpegSize();

    pISImager->destroyInstance();

    //profile.print();
    //FUNCTION_LOG_END;
    return true;
}
MBOOL
SingleShot::
createJpegImg(ImgBufInfo const & rSrcImgBufInfo, JpegParam const & rJpgParm, MUINT32 const u4Rot, MUINT32 const u4Flip, ImgBufInfo const & rJpgImgBufInfo, MUINT32 & u4JpegSize)
{
    FUNCTION_LOG_START;
    AutoCPTLog cptlog(Event_SShot_createJpegImg);
    MtkCamUtils::CamProfile profile("createJpegImg", "SingleShot");
    //
    // (1). Create Instance 
    CPTLogStr(Event_SShot_createJpegImg, CPTFlagSeparator, "init");
    ISImager *pISImager = ISImager::createInstance(rSrcImgBufInfo); 
    CHECK_OBJECT(pISImager); 

    // init setting     
    BufInfo rBufInfo(rJpgImgBufInfo.u4BufSize, rJpgImgBufInfo.u4BufVA, rJpgImgBufInfo.u4BufPA, rJpgImgBufInfo.i4MemID); 
    //
    pISImager->setTargetBufInfo(rBufInfo); 
    //
    pISImager->setFormat(eImgFmt_JPEG); 
    //
    pISImager->setRotation(u4Rot); 
    //
    pISImager->setFlip(u4Flip); 
    // 
    pISImager->setResize(rJpgImgBufInfo.u4ImgWidth, rJpgImgBufInfo.u4ImgHeight); 
    //
    pISImager->setEncodeParam(rJpgParm.fgIsSOI, rJpgParm.u4Quality); 
    //
    pISImager->setROI(Rect(0, 0, rSrcImgBufInfo.u4ImgWidth, rSrcImgBufInfo.u4ImgHeight)); 
    //
    CPTLogStr(Event_SShot_createJpegImg, CPTFlagSeparator, "execute");
    pISImager->execute(); 
    //
    u4JpegSize = pISImager->getJpegSize(); 

    pISImager->destroyInstance(); 

    profile.print();
    FUNCTION_LOG_END;
    return MTRUE; 
}
MINT32 AcdkUtility::imageProcess(MUINT32 imgOutFormat, 
                                       MUINT32 srcImgW, 
                                       MUINT32 srcImgH, 
                                       MUINT32 orientaion,
                                       MUINT32 flip,
                                       IMEM_BUF_INFO srcImem, 
                                       IMEM_BUF_INFO dstImem,
                                       MUINT32 dstImgW,
                                       MUINT32 dstImgH)
{
    ACDK_LOGD("format(0x%x)",imgOutFormat);
  
    //====== Variable Setting ======
    
    // stride
    MUINT32 qvStride[3] = {0, 0, 0};    
    queryImageStride(eImgFmt_YUY2,srcImgW,0,&qvStride[0]);
    queryImageStride(eImgFmt_YUY2,srcImgW,1,&qvStride[1]);
    queryImageStride(eImgFmt_YUY2,srcImgW,2,&qvStride[2]);

    ACDK_LOGD("srcImgW(%u),srcImgH(%u)",srcImgW,srcImgH);
    ACDK_LOGD("orientaion(%u),flip(%u)",orientaion,flip);
    ACDK_LOGD("qvStride: 0(%u),1(%u),2(%u)",qvStride[0],qvStride[1],qvStride[2]);
    ACDK_LOGD("srcImem : size(%u),vir(0x%x),phy(0x%x),mimID(%d)",srcImem.size,srcImem.virtAddr,srcImem.phyAddr,srcImem.memID);
    ACDK_LOGD("dstImem : size(%u),vir(0x%x),phy(0x%x),mimID(%d)",dstImem.size,dstImem.virtAddr,dstImem.phyAddr,dstImem.memID);
   
    // src image buffer    
    ImgBufInfo rSrcImgInfo(ImgInfo(eImgFmt_YUY2, srcImgW, srcImgH), 
                            BufInfo(srcImem.size, srcImem.virtAddr, srcImem.phyAddr, srcImem.memID), qvStride);

    // dst image buffer
    BufInfo rDstImgInfo(dstImem.size, dstImem.virtAddr, dstImem.phyAddr, dstImem.memID); 

    //create SImage object
    ISImager *sImager = ISImager::createInstance(rSrcImgInfo);

    //====== SImage Process ======
    
    sImager->setTargetBufInfo(rDstImgInfo);     
    sImager->setFormat((EImageFormat)imgOutFormat);   
    sImager->setRotation(orientaion);
    sImager->setFlip(flip);

    if(dstImgW == 0 || dstImgH == 0)
    {
        sImager->setResize(srcImgW, srcImgH);
    }
    else
    {
        ACDK_LOGD("dstImgW(%u),dstImgH(%u)",dstImgW,dstImgH);
        sImager->setResize(dstImgW, dstImgH);
    }

    sImager->setROI(Rect(0, 0, srcImgW, srcImgH));
    sImager->execute();

    //====== Destory Instance ======
    
    sImager->destroyInstance();

    ACDK_LOGD("-");
    return ACDK_RETURN_NO_ERROR;
}