Ejemplo n.º 1
0
/******************************************************************************
* convert image format by HW Bitblt 
*******************************************************************************/
bool hwConvertImageFormat(uint8_t *pbufIn, uint32_t inFmt, uint32_t width, uint32_t height, uint8_t *pbufOut, uint32_t outFmt)
{
    int32_t status = 0;

    // It's hw convert, the buffer address must be physical address
    MY_LOGV("[converImgFmt] pbufIn: 0x%x, inFmt = 0x%d, width: %d, height: %d , pbufOut: 0x%x, outFmt = %d\n",
                          (uint32_t) pbufIn, inFmt, width, height, (uint32_t) pbufOut, outFmt);

    mHalBltParam_t bltParam;
    memset(&bltParam, 0, sizeof(bltParam));
    bltParam.srcAddr   = (MUINT32)(pbufIn);
    bltParam.srcX      = 0;
    bltParam.srcY      = 0;
    bltParam.srcW      = width;
    bltParam.srcWStride= width;
    bltParam.srcH      = height;
    bltParam.srcHStride= height;
    bltParam.srcFormat = inFmt;
    bltParam.dstAddr   = (MUINT32)(pbufOut);
    bltParam.dstW      = width;
    bltParam.dstH      = height;
    bltParam.dstFormat = outFmt;
    bltParam.pitch     = width;
    bltParam.orientation = MHAL_BITBLT_ROT_0;

    status = mHalIoCtrl(MHAL_IOCTL_BITBLT, &bltParam, sizeof(bltParam), NULL, 0, NULL);
    if (0 != status) {
        MY_LOGE("[converImgFmt] err: %d, can't do bitblt operation \n", status);
    }
    return (status != 0) ? true : false;
}
int
mHalIoctl(
    void*           fd, 
    unsigned int    uCtrlCode, 
    void*           pvInBuf, 
    unsigned int    uInBufSize, 
    void*           pvOutBuf, 
    unsigned int    uOutBufSize, 
    unsigned int*   puBytesReturned
)
{
    MINT32 err = MHAL_NO_ERROR;
    //
    if  (uCtrlCode & MHAL_IOCTL_CAMERA_GROUP_MASK) {
        err = mHalCamIoctl(fd, uCtrlCode, pvInBuf, uInBufSize, pvOutBuf, uOutBufSize, puBytesReturned);
        return  err;
    }
    //
    //
    return  mHalIoCtrl(uCtrlCode, pvInBuf, uInBufSize, pvOutBuf, uOutBufSize, puBytesReturned);
}