MI VPE API

Version 2.20


1. Overview


1.1. Module Description

VPE (video process engine) image processing engine supports image quality adjustment for an input image, including noise reduction, sharpening, brightness adjustment, etc. After the image quality adjustment, it zooms the image to a certain resolution to output through each output port. The module also includes HDR, rotation, cutting and other functions.


1.2. Flow Chart

1.2.1. Pretzel Flow Chart

1.2.2. Macaron Flow Chart

1.2.3. Pudding Flow Chart

1.2.4. Ispahan Flow Chart

1.2.5. Tiramisu Flow Chart

1.2.6. Ikayaki Flow Chart

Note:

In the flow chart, 8x2, 2x2 and 16x16 indicate the width/height alignment limit of this position.


1.3. Keyword

  • Channel

    VPE module processes channels, and each channel’s time-sharing multiplexing VPE hardware.

  • ISP

    Image signal processing unit is responsible for image noise reduction, color rendering, brightness adjustment and other functions.

  • SCL

    Short name for scale.

  • Port

    VPE includes an input port. For distribution of the output port, please refer to the flow chart.

  • 3DNR

    3D noise reduction.

    2D noise reduction: average one pixel with the surrounding pixels, and reduce the noise after average, with the disadvantage that the image will be blurred.

    3D noise reduction: add time-domain processing. 2D noise reduction only considers one frame of image, while 3D noise reduction further considers the time-domain relationship between frames, averaging each pixel in the time domain.

  • HDR

    High dynamic range.

  • Rotation

    Rotate the original image around the center point by 0/90/180/270°.

  • Crop

    Crop the input image.

  • HVSP

    Scaling process in H/V direction.

  • LDC

    Lens distortion correction.

  • ZOOM

    Fast zoom in/out, electronic zoom function.

  • View

    Window, a window in the internal LDC function.

  • Realtime

    Direct hardware connection between two modules

    Advantages: DRAM is not consumed between modules

    Disadvantage: Time-sharing is not supported; only one channel can be created at a time.


2. API LIST

This module provides the following APIs:

Name of API Function
MI_VPE_CreateChannel Create a VPE channel
MI_VPE_DestroyChannel Destroy a VPE channel
MI_VPE_GetChannelAttr Get a VPE channel attribute
MI_VPE_SetChannelAttr Set a VPE channel attribute
MI_VPE_StartChannel Start VPE channel
MI_VPE_StopChannel Stop VPE channel
MI_VPE_EnablePort Enable VPE port
MI_VPE_DisablePort Disable VPE port
MI_VPE_SetChannelParam Set VPE channel parameter
MI_VPE_GetChannelParam Get VPE channel parameter
MI_VPE_SetChannelCrop Set VPE channel crop window
MI_VPE_GetChannelCrop Get VPE channel crop window
MI_VPE_GetChannelRegionLuma Get VPE channel Luma histogram statistic
MI_VPE_SetChannelRotation Set VPE channel video rotation type
MI_VPE_GetChannelRotation Get VPE channel video rotation type
MI_VPE_SetPortMode Set VPE port mode
MI_VPE_GetPortMode Get VPE port mode
MI_VPE_SetInputportCrop Set VPE Input port crop window Parameters
MI_VPE_GetInputportCrop Get VPE Input port crop window Parameters
MI_VPE_SetPortCrop Set VPE out port crop window Parameters
MI_VPE_GetPortCrop Get VPE out port crop window Parameters
MI_VPE_SetPortShowPosition Set VPE Output port show position
MI_VPE_GetPortShowPosition Get VPE Output port show position
MI_VPE_Alloc_IspDataBuf Allocate MI_ISP API data buffer
MI_VPE_Free_IspDataBuf Free MI_ISP API data buffer
MI_VPE_LDCBegViewConfig View start of the configuration
MI_VPE_LDCEndViewConfig View end of the configuration
MI_VPE_LDCSetViewConfig View the config bin buffer
MI_VPE_SkipFrame Set skip frame num
MI_VPE_InitDev Initialize VPE device
MI_VPE_DeInitDev De-initialize VPE device
MI_VPE_CreateMultiChannelStitch Create a multi-channel fusion channel.
MI_VPE_CallBackTask_Register Register callback interface with VPE
MI_VPE_CallBackTask_Unregister Unregister callback interface with VPE
MI_VPE_LoadPortZoomTable Port load zoom table
MI_VPE_StartPortZoom Port starts running zoom
MI_VPE_StopPortZoom Port stop running zoom
MI_VPE_GetPortCurZoomAttr Gets the current port zoom attribute
MI_VPE_EnableInputPort Enable VPE input Port
MI_VPE_DisableInputPort Disable VPE input Port
MI_VPE_LDCSetBatchViewConfig Set Ldc Configs

2.1. MI_VPE_CreateChannel

  • Description

    Create a VPE channel.

  • Syntax

    MI_S32 MI_VPE_CreateChannel(MI_VPE_CHANNEL VpeCh,
    MI_VPE_ChannelAttr_t *pstVpeChAttr);
    
  • Parameters

    Parameter Name Description Input/Output
    VpeCh VPE channel number. Input
    pstVpeChAttr VPE channel attribute pointer. Input
  • Return Value

    • Zero: Successful

    • Non-zero: Failed, see ERROR CODE for details.

  • Dependence

    • Header file: mi_vpe.h

    • Library file: libmi_vpe.a/libmi_vpe.so

  • Note

    Multi channel is not supported in realtime mode.

  • Example

    Create a main stream channel and destroy the exit process:

    MI_VPE_ChannelAttr_t stChannelVpeAttr;
    MI_SYS_WindowRect_t stChnCropWin;
    MI_VPE_CHANNEL VpeChannel=0;
    MI_VPE_PORT VpePort=0;
    MI_VPE_ChannelPara_t stChannelVpeParam;
    MI_VPE_InitParam_t stInitParam;
    MI_SYS_Rotate_e eRot = E_MI_SYS_ROTATE_NONE;
    MI_SYS_WindowRect_t  stPortCropWin;
    MI_S32 s32Ret = MI_SUCCESS;
    
    MI_SNR_PAD_ID_e eSnrPadId = E_MI_SNR_PAD_ID_0;
    MI_SNR_PlaneInfo_t stSnrPlane0Info;
    MI_U32 u32CapWidth = 0, u32CapHeight = 0;
    MI_SYS_PixelFormat_e ePixFormat;
    
    memset(&stChannelVpeAttr, 0x0, sizeof(MI_VPE_ChannelAttr_t));
    memset(&stChannelVpeParam, 0x0, sizeof(MI_VPE_ChannelPara_t));
    memset(&stSnrPlane0Info, 0x0, sizeof(MI_SNR_PlaneInfo_t));
    memset(&stPortCrop, 0x0, sizeof(MI_SYS_WindowRect_t));
    memset(&stChnCropWin, 0x0, sizeof(MI_SYS_WindowRect_t));
    memset(&stInitParam, 0x0, sizeof(MI_VPE_InitParam_t));
    
    stInitParam.u32DevId = 0;
    stInitParam.u8Data = 0;
    s32Ret = MI_VPE_InitDev(&stInitParam);
    if(s32Ret != MI_SUCCESS)
    {
        return s32Ret;
    }
    
    MI_SNR_GetPlaneInfo(eSnrPadId, 0, &stSnrPlane0Info);
    
    u32CapWidth = stSnrPlane0Info.stCapRect.u16Width;
    u32CapHeight = stSnrPlane0Info.stCapRect.u16Height;
    ePixFormat = (MI_SYS_PixelFormat_e)RGB_BAYER_PIXEL(stSnrPlane0Info.ePixPrecision, stSnrPlane0Info.eBayerId);
    
    stChannelVpeAttr.u32MaxW = u32CapWidth ;
    stChannelVpeAttr.u32MaxH = u32CapHeight ;
    stChannelVpeAttr.bNREn= FALSE;
    stChannelVpeAttr.bEdgeEn= FALSE;
    stChannelVpeAttr.bESEn= FALSE;
    stChannelVpeAttr.bContrastEn= FALSE;
    stChannelVpeAttr.bUVInvert= FALSE;
    stChannelVpeAttr.ePixFmt = ePixFormat;
    stChannelVpeAttr.eRunningMode = E_MI_VPE_RUN_REALTIME_MODE;
    stChannelVpeAttr.eSensorBindId= E_MI_VPE_SENSOR0;
    
    s32Ret = MI_VPE_CreateChannel(VpeChannel, &stChannelVpeAttr);    
    if(s32Ret != MI_SUCCESS)
    {
        return s32Ret;
    }
    
    s32Ret = MI_VPE_GetChannelAttr(VpeChannel, & stChannelVpeAttr); 
    if(s32Ret != MI_SUCCESS)
    {
        return s32Ret;
    }
    
    stChannelVpeParam.eHDRType = E_MI_VPE_HDR_TYPE_OFF;
    stChannelVpeParam.e3DNRLevel = E_MI_VPE_3DNR_LEVEL2;
    stChannelVpeParam.bMirror = FALSE;
    stChannelVpeParam.bFlip = FALSE;
    s32Ret =MI_VPE_SetChannelParam(VpeChannel, &stChannelVpeParam);
    if(s32Ret != MI_SUCCESS)
    {
        return s32Ret;
    }
    
    s32Ret =MI_VPE_SetChannelRotation(VpeChannel, eRot);
    if(s32Ret != MI_SUCCESS)
    {
        return s32Ret;
    }
    
    s32Ret = MI_VPE_GetChannelCrop(VpeChannel, &stCropWin) 
    if(s32Ret != MI_SUCCESS)
    {
        return s32Ret;
    }
    
    stChnCropWin .u16X = 0;
    stChnCropWin .u16Y = 0;
    stChnCropWin .u16Width = 0;
    stChnCropWin .u16Height = 0;
    s32Ret = MI_VPE_SetChannelCrop(VpeChannel, & stChnCropWin );
    if(s32Ret != MI_SUCCESS)
    {
        return s32Ret;
    }
    
    s32Ret = MI_VPE_StartChannel (VpeChannel);
    if(s32Ret != MI_SUCCESS)
    {
        return s32Ret;
    }
    
    stPortCrop.u16X = 0;
    stPortCrop.u16Y = 0;
    stPortCrop.u16Width = 0;
    stPortCrop.u16Height = 0;
    s32Ret=MI_VPE_SetPortCrop(VpeChannel,VpePort,&stPortCrop);
    if(s32Ret != MI_SUCCESS)
    {
        return s32Ret;
    }
    
    stVpeMode.u16Width = u32CapWidth;
    stVpeMode.u16Height = u32CapHeight;
    stVpeMode.ePixelFormat = E_MI_SYS_PIXEL_FRAME_YUV_SEMIPLANAR_420;
    stVpeMode.eCompressMode = E_MI_SYS_COMPRESS_MODE_NONE;
    stVpeMode.bMirror = FALSE;
    stVpeMode.bFlip = FALSE;
    s32Ret =MI_VPE_SetPortMode(VpeChannel,VpePort, &stVpeMode);
    if(s32Ret != MI_SUCCESS)
    {
        return s32Ret;
    }
    
    s32Ret = MI_VPE_EnablePort(VpeChannel, VpePort);
    if(s32Ret != MI_SUCCESS)
    {
        return s32Ret;
    }
    
    /*****************************/
    /*  call sys bind interface */
    /*****************************/
    
    /*****************************/
    /*  Exit call sys unbind interface */
    /*****************************/
    s32Ret = MI_VPE_StopChannel (VpeChannel);
    if(s32Ret != MI_SUCCESS)
    {
        return s32Ret;
    }
    
    s32Ret = MI_VPE_DisablePort(VpeChannel, VpePort);
    if(s32Ret != MI_SUCCESS)
    {
        return s32Ret;
    }
    
    s32Ret = MI_VPE_DestroyChannel(VpeChannel);
    if(s32Ret != MI_SUCCESS)
    {
        return s32Ret;
    }
    s32Ret = MI_VPE_DeInitDev();
    if(s32Ret != MI_SUCCESS)
    {
        return s32Ret;
    }
    
  • Related APIs

    MI_VPE_DestroyChannel


2.2. MI_VPE_DestroyChannel

  • Description

    Destroy a VPE channel.

  • Syntax

    MI_S32 MI_VPE_DestroyChannel (MI_VPE_CHANNEL VpeCh);
    
  • Parameters

    Parameter Name Description Input/Output
    VpeCh VPE channel number. Input
  • Return Value

    • Zero: Successful

    • Non-zero: Failed, see ERROR CODE for details.

  • Dependence

    • Header file: mi_vpe.h

    • Library file: libmi_vpe.a/libmi_vpe.so

  • Example

    Refer to MI_VPE_CreateChannel

  • Related APIs

    MI_VPE_CreateChannel


2.3. MI_VPE_GetChannelAttr

  • Description

    Get a VPE channel attribute

  • Syntax

    MI_S32 MI_VPE_GetChannelAttr(MI_VPE_CHANNEL VpeCh,
    MI_VPE_ChannelAttr_t *pstGrpAttr);
    
  • Parameters

    Parameter Name Description Input/Output
    VpeCh VPE channel number. Input
    pstVpeChAttr VPE channel attribute pointer. Output
  • Return Value

    • Zero: Successful

    • Non-zero: Failed, see ERROR CODE for details.

  • Dependence

    • Header file: mi_vpe.h

    • Library file: libmi_vpe.a/libmi_vpe.so

  • Example

    Refer to MI_VPE_CreateChannel

  • Related APIs

    MI_VPE_SetChannelAttr


2.4. MI_VPE_SetChannelAttr

  • Description

    Set a VPE channel attribute.

  • Syntax

    MI_S32 MI_VPE_SetChannelAttr (MI_VPE_CHANNEL VpeCh,
    MI_VPE_ChannelAttr_t *pstVpeChAttr);
    
  • Parameters

    Parameter Name Description Input/Output
    VpeCh VPE channel number. Value range: [0, MI_VPE_MAX_CHANNEL_NUM]. Input
    pstVpeChAttr VPE channel attribute pointer. Input
  • Return Value

    • Zero: Successful

    • Non-zero: Failed, see ERROR CODE for details.

  • Dependence

    • Header file: mi_vpe.h

    • Library file: libmi_vpe.a/libmi_vpe.so

  • Note

    Only bNrEn, bEdgeEn, bEsEn, bContrastEn and bUvInvert parameters in MI_VPE_ChannelAttr_t can be changed in DVR mode.

  • Example

    Refer to MI_VPE_CreateChannel

  • Related APIs

    MI_VPE_GetChannelAttr


2.5. MI_VPE_StartChannel

  • Description

    Start VPE channel.

  • Syntax

    MI_S32 MI_VPE_StartChannel(MI_VPE_CHANNEL VpeCh);
    
  • Parameters

    Parameter Name Description Input/Output
    VpeCh VPE channel number. Value range: [0, MI_VPE_MAX_CHANNEL_NUM]. Input
  • Return Value

    • Zero: Successful

    • Non-zero: Failed, see ERROR CODE for details.

  • Dependence

    • Header file: mi_vpe.h

    • Library file: libmi_vpe.a/libmi_vpe.so

  • Example

    Refer to MI_VPE_CreateChannel

  • Related APIs

    MI_VPE_StopChannel


2.6. MI_VPE_StopChannel

  • Description

    Stop VPE channel

  • Syntax

    MI_S32 MI_VPE_StopChannel(MI_VPE_CHANNEL VpeCh);
    
  • Parameters

    Parameter Name Description Input/Output
    VpeCh VPE channel number. Input
  • Return Value

    • Zero: Successful

    • Non-zero: Failed, see ERROR CODE for details.

  • Dependence

    • Header file: mi_vpe.h

    • Library file: libmi_vpe.a/libmi_vpe.so

  • Note

    When changing the channel property, you need first to call the API, disable the channel, and then turn it on again after the channel property is set.

  • Example

    Refer to MI_VPE_CreateChannel

  • Related APIs

    MI_VPE_StartChannel


2.7. MI_VPE_EnablePort

  • Description

    Enable VPE port.

  • Syntax

    MI_S32 MI_VPE_EnablePort(MI_VPE_CHANNEL VpeCh,
    MI_VPE_PORT s32VpePort);
    
  • Parameters

    Parameter Name Description Input/Output
    VpeCh VPE channel number. Input
    s32VpePort s32Vpe port number. Input
  • Return Value

    • Zero: Successful

    • Non-zero: Failed, see ERROR CODE for details.

  • Dependence

    • Header file: mi_vpe.h

    • Library file: libmi_vpe.a/libmi_vpe.so

  • Example

    Refer to MI_VPE_CreateChannel

  • Related APIs

    MI_VPE_DisablePort


2.8. MI_VPE_DisablePort

  • Description

    Disable VPE port.

  • Syntax

    MI_S32 MI_VPE_DisablePort(MI_VPE_CHANNEL) VpeCh,
    MI_VPE_PORT VpePort);
    
  • Parameters

    Parameter Name Description Input/Output
    VpeCh VPE channel number. Input
    VpePort 32Vpe port number. Input
  • Return Value

    • Zero: Successful

    • Non-zero: Failed, see ERROR CODE for details.

  • Dependence

    • Header file: mi_vpe.h

    • Library file: libmi_vpe.a/libmi_vpe.so

  • Note

    When changing the port property, you need first to disable the port, and then enable it again after setting the port property.

  • Example

    Refer to MI_VPE_CreateChannel

  • Related APIs

    MI_VPE_EnablePort


2.9. MI_VPE_SetChannelParam

  • Description

    Set VPE channel parameter.

  • Syntax

    MI_S32 MI_VPE_SetChannelParam (MI_VPE_CHANNEL
    VpeCh, MI_VPE_ChannelPara_t *pstVpeParam);
    
  • Parameters

    Parameter Name Description Input/Output
    VpeCh VPE channel number. Input
    pstVpeParam Channel parameters Input
  • Return Value

    • Zero: Successful

    • Non-zero: Failed, see ERROR CODE for details.

  • Dependence

    • Header file: mi_vpe.h

    • Library file: libmi_vpe.a/libmi_vpe.so

  • Note

  • Related APIs

    MI_VPE_GetChannelParam


2.10. MI_VPE_GetChannelParam

  • Description

    Get VPE channel parameter.

  • Syntax

    MI_S32 MI_VPE_GetChannelParam (MI_VPE_CHANNEL VpeCh,
    MI_VPE_ChannelPara_t *pstVpeParam);
    
  • Parameters

    Parameter Name Description Input/Output
    VpeCh VPE channel number. Input
    pstVpeParam Channel parameters Output
  • Return Value

    • Zero: Successful

    • Non-zero: Failed, see ERROR CODE for details.

  • Dependence

    • Header file: mi_vpe.h

    • Library file: libmi_vpe.a/libmi_vpe.so

  • Note

    Refer to MI_VPE_ChannelPara_t for pstVpeParam after channel creation.

  • Related APIs

    MI_VPE_SetChannelParam


2.11. MI_VPE_SetChannelCrop

  • Description

    Set VPE channel crop window.

  • Syntax

    MI_S32 MI_VPE_SetChannelCrop (MI_VPE_CHANNEL VpeCh,
    MI_SYS_WindowRect_t *pstCropInfo);
    
  • Parameters

    Parameter Name Description Input/Output
    VpeCh VPE channel number. Value range: [0, MI_VPE_MAX_CHANNEL_NUM]. Input
    pstCropInfo Channel Crop Window parameter Input
  • Return Value

    • Zero: Successful

    • Non-zero: Failed, see ERROR CODE for details.

  • Dependence

    • Header file: mi_vpe.h

    • Library file: libmi_vpe.a/libmi_vpe.so

  • Note

    Chip Supported or not
    Pretzel Supported
    Macaron Not supported
    Pudding Supported when ChnPortMode >0
    Ispahan Not supported
    • The channel has been created successfully. The settings of the crop window are all based on the original screen size.

    • Only the OutputPort corresponding to ChnPortMode has ChannelCrop effect in Pudding

      Such as:

      u32ChnPortMode = E_MI_VPE_ZOOM_LDC_PORT0; //output port0 from RDMA

      Only OutputPort0 has the ChannelCrop effect

  • Related APIs

    MI_VPE_GetChannelCrop


2.12. MI_VPE_GetChannelCrop

  • Description

    Get VPE channel crop window.

  • Syntax

    MI_S32 MI_VPE_GetChannelCrop(MI_VPE_CHANNEL VpeCh,
    MI_SYS_WindowRect_t *pstCropInfo);
    
  • Parameters

    Parameter Name Description Input/Output
    VpeCh VPE channel number. Input
    pstCropInfo Channel Crop Window parameter Output
  • Return Value

    • Zero: Successful

    • Non-zero: Failed, see ERROR CODE for details.

  • Dependence

    • Header file: mi_vpe.h

    • Library file: libmi_vpe.a/libmi_vpe.so

  • Note

    Get VPE channel crop window after channel creation.

  • Related APIs

    MI_VPE_SetChannelCrop


2.13. MI_VPE_GetChannelRegionLuma

  • Description

    Get VPE channel Luma histogram statistics.

  • Syntax

    MI_S32 MI_VPE_GetChannelRegionLuma (MI_VPE_CHANNEL
    VpeCh, MI_VPE_RegionInfo_t *pstRegionInfo,
    MI_U32 *pu32LumaData,MI_S32 s32MilliSec);
    
  • Parameters

    Parameter Name Description Input/Output
    VpeCh VPE channel number. Input
    pstRegionInfo Indicate region and number of statistics. Input
    pu32LumaData Statistical data Output
    s32MilliSec Timeout (ms) of this API Input
  • Return Value

    • Zero: Successful

    • Non-zero: Failed, see ERROR CODE for details.

  • Dependence

    • Header file: mi_vpe.h

    • Library file: libmi_vpe.a/libmi_vpe.so

  • Note

    • The API is only supported by SAV538E/S, SAV638E/S, and SAV838E/S.

    • Channel has been created.


2.14. MI_VPE_SetChannelRotation

  • Description

    Set VPE channel video rotation type.

  • Syntax

    MI_S32 MI_VPE_SetChannelRotation (MI_VPE_CHANNEL
    VpeCh, MI_SYS_Rotate_e eType);
    
  • Parameters

    Parameter Name Description Input/Output
    VpeCh VPE channel number. Input
    eType Rotation angle Input
  • Return Value

    • Zero: Successful

    • Non-zero: Failed, see ERROR CODE for details.

  • Dependence

    • Header file: mi_vpe.h

    • Library file: libmi_vpe.a/libmi_vpe.so

  • Note

    Chip Usage Mode
    Pretzel The two channel running modes match with top and bottom respectively. The API is used on the bottom channel.
    Macaron Need Sensor Mirror/Flip Coordination: Rot 90 + Sensor Mirror Rot 180 + Sensor Mirror/Flip Rot 270 + Sensor Flip
    Pudding Simple use
    Ispahan Simple use
    Ikayaki Not support
  • Example

    The following is an example use of the Pretzel Rotation feature:

    stVpeChannelInfo.eRunningMode = E_MI_VPE_RUN_REALTIME_TOP_MODE;
    stVpeChannelInfo.eBindSensorId = E_MI_VPE_SENSOR0;
    stVpeChannelInfo.bRotation = TRUE;
    STCHECKRESULT(MI_VPE_CreateChannel(vpechn_top, &stVpeChannelInfo));
    STCHECKRESULT(MI_VPE_StartChannel(vpechn_top));
    
    VpePort=0//only can use port0
    STCHECKRESULT(MI_VPE_SetPortMode(vpechn_top, VpePort, &stVpeMode));
    STCHECKRESULT(MI_VPE_EnablePort(vpechn_top, VpePort));
    
    stVpeChannelInfo.eRunningMode = E_MI_VPE_RUN_REALTIME_BOTTOM_MODE;
    stVpeChannelInfo.eBindSensorId = E_MI_VPE_SENSOR_INVALID;
    stVpeChannelInfo.bRotation = TRUE;
    STCHECKRESULT(MI_VPE_CreateChannel(vpechn_bot, &stVpeChannelInfo));
    STCHECKRESULT(MI_VPE_StartChannel(vpechn_bot));
    
    STCHECKRESULT(MI_VPE_SetChannelRotation(vpechn_bot, E_MI_SYS_ROTATE_90));
    
    VpePort=2//0~3
    STCHECKRESULT(MI_VPE_SetPortMode(vpechn_bot, VpePort, &stVpeMode));
    STCHECKRESULT(MI_VPE_EnablePort(vpechn_bot, VpePort));
    
    /*****************************/
    /*  call sys bind interface 
        Bind vpechn_top vpechn_bot*/
    /*****************************/
    
  • Related APIs

    MI_VPE_GetChannelRotation


2.15. MI_VPE_GetChannelRotation

  • Description

    Get VPE channel video rotation type.

  • Syntax

    MI_S32 MI_VPE_GetChannelRotation (MI_VPE_CHANNEL
    VpeCh, MI_SYS_Rotate_e *pType);
    
  • Parameters

    Parameter Name Description Input/Output
    VpeCh VPE channel number. Input
    peType Rotation angle Output
  • Return Value

    • Zero: Successful

    • Non-zero: Failed, see ERROR CODE for details.

  • Dependence

    • Header file: mi_vpe.h

    • Library file: libmi_vpe.a/libmi_vpe.so

  • Note

    Get VPE channel video rotation type after channel creation

  • Related APIs

    MI_VPE_SetChannelRotation


2.16. MI_VPE_SetPortMode

  • Description

    Set VPE port mode.

  • Syntax

    MI_S32 MI_VPE_SetPortMode(MI_VPE_CHANNEL VpeCh,
    MI_VPE_PORT VpePort,
    MI_VPE_PortMode_t *pstVpeMode);
    
  • Parameters

    Parameter Name Description Input/Output
    VpeCh VPE channel number. Input
    VpePort VPE port number. Input
    pstVpeMode VPE port mode Output
  • Return Value

    • Zero: Successful

    • Non-zero: Failed, see ERROR CODE for details.

  • Dependence

    • Header file: mi_vpe.h

    • Library file: libmi_vpe.a/libmi_vpe.so

  • Note

    Max width/height

    Chip Port0 Port1 Port2 Port3 Port4 (IR) Port5 Port6 Port7
    Pretzel MaxWidth = 3840 MaxWidth = 2688 MaxWidth = 2688 MaxWidth = 3840 Scaling down ½ No support No support No support
    Macaron No Scaling MaxWidth = 2688 MaxWidth = 2688 No support No support No support No support No support
    Pudding MaxWidth = 3840 MaxWidth = 3840 MaxWidth = 3840 No Scaling Scaling down ½ No scaling No support No support
    Ispahan MaxWidth = 2688 MaxWidth = 2688 MaxWidth = 1920 MaxWidth = 1920 No support No support No support No support
    Tiramisu  MaxWidth:no yuv422 4608 Yuv422 8192 MaxWidth:no yuv422 4608 Yuv422 8192 MaxWidth = 4096 No Scaling Scaling down ½ MaxWidth = 4096 MaxWidth = 4096 MaxWidth = 4096
    Ikayaki MaxWidth:no Yuv422 1920 Yuv422 3840 No support No support MaxWidth = 1920 Scaling down ½ No support No support No support

    Pixel Format

    Chip Port0 Port1 Port2 Port3 Port4 (IR) Port5 Port6 Port7
    Pretzel YUV420 /YUV422 /ARGB8888/BGRA8888 Same as Port0 Same as Port0 Same as Port0 YUV420 NV12 No support No support No support
    Macaron YUV420 /YUV422 Same as Port0 Same as Port0 No support No support No support No support No support
    Pudding YUV420 /YUV422 /ARGB8888/BGRA8888/ABGR8888 Same as Port0 Same as Port0 YUV420 /YUV422 YUV420 NV12 Same as Port3 No support No support
    Ispahan YUV420 /YUV422 Same as Port0 Same as Port0 Same as Port0 No support No support No support No support
    Tiramisu  YUV420 /YUV422 /ARGB8888/BGRA8888/ABGR8888 Same as Port0 Same as Port0 YUV420 /YUV422 YUV420 NV12 Same as Port0 Same as Port0 Same as Port0
    Ikayaki YUV420 /YUV422 /ARGB8888/BGRA8888/ABGR8888 No support No support YUV420 /YUV422 YUV420 NV12 No support No support No support

    Bind type

    Chip Port0 Port1 Port2 Port3 Port4 (IR) Port5 Port6 Port7
    Pretzel Frame mode Frame mode Frame mode Frame mode Frame mode No support No support No support
    Macaron Frame mode /Jpeg realtime Frame mode /H26x ring mode Frame mode No support No support No support No support No support
    Pudding Frame /JPEG ring /JPEG realtime Same as Port0 Same as Port0 Frame mode Frame mode Same as Port3 No support No support
    Ispahan Frame mode /JPEG realtime Frame mode /H26x ring mode Frame mode Realtime bind DIVP No support No support No support No support
    Tiramisu Frame /Jpeg ring /Jpeg realtime /h26x ring Same as Port0 Same as Port0 Frame mode Frame mode Same as Port0 Same as Port0 Realtime bind DIVP
    Ikayaki Frame mode /JPEG realtime No support No support Frame mode Frame mode No support No support No support
  • Related APIs

    MI_VPE_GetPortMode


2.17. MI_VPE_GetPortMode

  • Description

    Get VPE port mode.

  • Syntax

    MI_S32 MI_VPE_GetPortMode (MI_VPE_CHANNEL VpeCh,
    MI_VPE_PORT VpePort,
    MI_VPE_PortMode_t *pstVpeMode);
    
  • Parameters

    Parameter Name Description Input/Output
    VpeCh VPE channel number. Input
    VpePort VPE port number. Input
    pstVpeMode VPE port mode Output
  • Return Value

    • Zero: Successful

    • Non-zero: Failed, see ERROR CODE for details.

  • Dependence

    • Header file: mi_vpe.h

    • Library file: libmi_vpe.a/libmi_vpe.so

  • Related APIs

    MI_VPE_SetPortMode


2.18. MI_VPE_SetInputportCrop

  • Description

    Set VPE Input port crop window Parameters.

  • Syntax

    MI_S32 MI_VPE_SetInputportCrop(MI_VPE_CHANNEL VpeCh,
    MI_VPE_PORT VpePort, MI_SYS_WindowRect_t
    *pstInCropInfo);
    
  • Parameters

    Parameter Name Description Input/Output
    VpeCh VPE channel number. Input
    VpePort VPE Input port number. Input
    pstInCropInfo VPE Input port crop window parameter Input
  • Return Value

    • Zero: Successful

    • Non-zero: Failed, see ERROR CODE for details.

  • Dependence

    • Header file: mi_vpe.h

    • Library file: libmi_vpe.a/libmi_vpe.so

  • Note

    RunningMode = E_MI_VPE_RUN_REALTIME_MODE does not support this function.

  • Related APIs

    MI_VPE_GetInputportCrop


2.19. MI_VPE_GetInputportCrop

  • Description

    Get VPE Input port crop window Parameters.

  • Syntax

    MI_S32 MI_VPE_GetInputportCrop(MI_VPE_CHANNEL VpeCh,
    MI_VPE_PORT VpePort, MI_SYS_WindowRect_t
    *pstInCropInfo);
    
  • Parameters

    Parameter Name Description Input/Output
    VpeCh VPE channel number. Input
    VpePort VPE Input port number. Input
    pstInCropInfo VPE Input port crop window parameter Output
  • Return Value

    • Zero: Successful

    • Non-zero: Failed, see ERROR CODE for details.

  • Dependence

    • Header file: mi_vpe.h

    • Library file: libmi_vpe.a/libmi_vpe.so

  • Related APIs

    MI_VPE_SetInputportCrop


2.20. MI_VPE_SetPortCrop

  • Description

    Set VPE out port crop window.

  • Syntax

    MI_S32 MI_VPE_SetPortCrop (MI_VPE_CHANNEL VpeCh,
    MI_VPE_PORT VpePort, MI_SYS_WindowRect_t *pstOutCropInfo);
    
  • Parameters

    Parameter Name Description Input/Output
    VpeCh VPE channel number. Input
    VpePort VPE Output port number. Input
    *pstOutCropInfo VPE Output port crop window setting Input
  • Return Value

    • Zero: Successful

    • Non-zero: Failed, see ERROR CODE for details.

  • Dependence

    • Header file: mi_vpe.h

    • Library file: libmi_vpe.a/libmi_vpe.so

  • Note

    • For Pretzel , the ports are as follows.

      Because the source of port1,2 is the output of port0:

      1. The cross win of port0 enable, port1,2 \< port0 size,

      2. Cross win \< VPE input of port0 disable, port1,2

    • For Pudding and Ispahan, the port crop is as follows.

      Macaron do not have the scaler0 shown in the figure above; the others are consistent.

      Because the source of port2 is the output of port1:

      1. Port1 enable, cross win \< port1 size of port2

      2. Port1 disable, cross win \< VPE input of port2

  • Related APIs

    MI_VPE_GetPortCrop


2.21. MI_VPE_GetPortCrop

  • Description

    Get VPE out port crop window parameters.

  • Syntax

    MI_S32 MI_VPE_GetPortCrop (MI_VPE_CHANNEL VpeCh,
    MI_VPE_PORT VpePort, MI_SYS_WindowRect_t *pstOutCropInfo);
    
  • Parameters

    Parameter Name Description Input/Output
    VpeCh VPE channel number. Input
    VpePort VPE Output port number. Input
    *pstOutCropInfo VPE Output port crop window parameter Output
  • Return Value

    • Zero: Successful

    • Non-zero: Failed, see ERROR CODE for details.

  • Dependence

    • Header file: mi_vpe.h

    • Library file: libmi_vpe.a/libmi_vpe.so

  • Related APIs

    MI_VPE_SetPortCrop


2.22. MI_VPE_SetPortShowPosition

  • Description

    Set VPE output port show position.

  • Syntax

    MI_S32 MI_VPE_SetPortShowPosition(MI_VPE_CHANNEL
    VpeCh, MI_VPE_PORT VpePort, MI_SYS_WindowRect_t *pstPortPositionInfo);
    
  • Parameters

    Parameter Name Description Input/Output
    VpeCh VPE channel number Input
    VpePort VPE port number Input
    * pstPortPositionInfo Show position parameters Input
  • Return Value

    • Zero: Successful

    • Non-zero: Failed, see ERROR CODE for details.

  • Dependence

    • Header file: mi_vpe.h

    • Library file: libmi_vpe.a/libmi_vpe.so

  • Note

    • If this API is not called, show width/height = portmode width/height is displayed by default.

    • You need to set this API after MI VPE setportmode, and after that, the area without show screen will be filled in black. The relationship between portmode width/height and show width/height is as follows:

  • Related APIs

    MI_VPE_GetPortShowPosition


2.23. MI_VPE_GetPortShowPosition

  • Description

    Get VPE output port show position.

  • Syntax

    MI_S32 MI_VPE_GetPortShowPosition(MI_VPE_CHANNEL VpeCh, MI_VPE_PORT
    VpePort, MI_SYS_WindowRect_t *pstPortPositionInfo);
    
  • Parameters

    Parameter Name Description Input/Output
    VpeCh VPE channel number Input
    VpePort VPE port number Input
    * pstPortPositionInfo Show position parameters Output
  • Return Value

    • Zero: Successful

    • Non-zero: Failed, see ERROR CODE for details.

  • Dependence

    • Header file: mi_vpe.h

    • Library file: libmi_vpe.a/libmi_vpe.so

  • Related APIs

    MI_VPE_SetPortShowPosition


2.24. MI_VPE_Alloc_IspDataBuf

  • Description

    Allocate MI_ISP API Data Buffer

  • Syntax

    MI_S32 MI_VPE_Alloc_IspDataBuf(MI_U32 u32Size,void **pUserVirAddr);
    
  • Parameters

    Parameter Name Description Input/Output
    u32Size Allocate Buffer Size Input
    **pUserVirAddr User Buffer pointer address Output
  • Return Value

    • Zero: Successful

    • Non-zero: Failed, see ERROR CODE for details.

  • Dependence

    • Header file: mi_vpe.h

    • Library file: libmi_vpe.a/libmi_vpe.so

  • Note

    A thread applies for an ISP data buffer to avoid buffer sharing among threads, which results in buffer stepping on each other.

  • Example

    #define  MI_ISP_MAX_DATA_SIZE  (80*1024)
    MI_VPE_Alloc_IspDataBuf(MI_ISP_MAX_DATA_SIZE, &pIspBuffer);
    MI_ISP_IQ_COLORTOGRAY_TYPE_t *pstColorToGray = (MI_ISP_IQ_COLORTOGRAY_TYPE_t *)pIspBuffer;
    MI_ISP_IQ_GetColorToGray( Channel, pstColorToGray);
    if(pstColorToGray->bEnable == SS_TRUE)
        pstColorToGray->bEnable = SS_FALSE;
    else
        pstColorToGray->bEnable = SS_TRUE;
    MI_ISP_IQ_SetColorToGray( Channel, pstColorToGray);
    
    MI_ISP_IQ_CONTRAST_TYPE_t  *pstContrast = (MI_ISP_IQ_CONTRAST_TYPE_t *)pIspBuffer;
    MI_ISP_IQ_GetContrast( Channel, pstContrast);
    MI_ISP_IQ_SetContrast( Channel, pstContrast);
    
    MI_VPE_Free_IspDataBuf(pIspBuffer)
    
  • Related APIs

    MI_VPE_Free_IspDataBuf


2.25. MI_VPE_Free_IspDataBuf

  • Description

    Buffer for releasing MI_ISP API data application

  • Syntax

    MI_S32 MI_VPE_Free_IspDataBuf(void *pUserBuf);
    
  • Parameters

    Parameter Name Description Input/Output
    *pUserBuf Pointer to applied ISP API Data Buffer Input
  • Return Value

    • Zero: Successful

    • Non-zero: Failed, see ERROR CODE for details.

  • Dependence

    • Header file: mi_vpe.h

    • Library file: libmi_vpe.a/libmi_vpe.so

  • Note

    Paired with MI_VPE_Alloc_IspDataBuf

  • Example

    See example in MI_VPE_Alloc_IspDataBuf

  • Related APIs

    MI_VPE_Alloc_IspDataBuf


2.26. MI_VPE_LDCBegViewConfig

  • Description

    Start configuring bin files for all LDC Windows

  • Syntax

    MI_S32 MI_VPE_LDCBegViewConfig(MI_VPE_CHANNEL VpeCh);
    
  • Parameters

    Parameter Name Description Input/Output
    VpeCh VPE channel number. Input
  • Return Value

    • Zero: Successful

    • Non-zero: Failed, see ERROR CODE for details.

  • Dependence

    • Header file: mi_vpe.h

    • Library file: libmi_vpe.a/libmi_vpe.so

  • Note

    • Only Pudding supports LDC function. benldc = true in MI_VPE_ChannelAttr_t will enable LDC.

    • Pair with MI VPE ldcendviewconfig.

    • You need to use this API only when the number of windows changes. There is no need to call this API if only one of the window properties is to be changed.

  • Example

    MI_VPE_LDCBegViewConfig(vpechn);
    
    for(i=0; i<viewnum;i++)
    
    {
    
        MI_VPE_LDCSetViewConfig(vpechn, ldcBinBuffer[i], u32LdcBinSize[i]);
    
        free(ldcBinBuffer[i]);
    
    }
    
    MI_VPE_LDCEndViewConfig(vpechn);
    
  • Related APIs

    MI_VPE_LDCEndViewConfig


2.27. MI_VPE_LDCEndViewConfig

  • Description

    End the bin file for configuring all LDC Windows

  • Syntax

    MI_S32 MI_VPE_LDCEndViewConfig(MI_VPE_CHANNEL VpeCh)
    
  • Parameters

    Parameter Name Description Input/Output
    VpeCh VPE channel number. Input
  • Return Value

    • Zero: Successful

    • Non-zero: Failed, see ERROR CODE for details.

  • Dependence

    • Header file: mi_vpe.h

    • Library file: libmi_vpe.a/libmi_vpe.so

  • Note

    • Only Pudding supports LDC function. benldc = true in MI_VPE_ChannelAttr_t will enable LDC.

    • Pair with MI VPE ldcendviewconfig.

    • You need to use this API only when the number of windows changes. There is no need to call this API if only one of the window properties is to be changed.

  • Example

    See example in MI_VPE_LDCBegViewConfig

  • Related APIs

    MI_VPE_LDCBegViewConfig


2.28. MI_VPE_LDCSetViewConfig

  • Description

    Configure the LDC window bin file

  • Syntax

    MI_S32 MI_VPE_LDCSetViewConfig(MI_VPE_CHANNEL VpeCh, void
    *pConfigAddr, MI_U32 u32ConfigSize);
    
  • Parameters

    Parameter Name Description Input/Output
    VpeCh VPE channel number. Input
    pConfigAddr Bin buffer pointer address Input
    u32ConfigSize Bin buffer size Input
  • Return Value

    • Zero: Successful

    • Non-zero: Failed, see ERROR CODE for details.

  • Dependence

    • Header file: mi_vpe.h

    • Library file: libmi_vpe.a/libmi_vpe.so

  • Note

    • If there is no change in the number of Windows save a change in some window bin buffer, the API can be used separately. When the number of Windows changes, it needs to be used together with MI_VPE_LDCBegViewConfig and MI_VPE_LDCEndViewConfig.

    • Each config bin buffer corresponds to the settings of a view window.

  • Example

    See example in MI_VPE_LDCBegViewConfig

  • Related APIs

    MI_VPE_LDCBegViewConfig

    MI_VPE_LDCEndViewConfig


2.29. MI_VPE_SkipFrame

  • Description

    Set Skip Frame Num

  • Syntax

    MI_S32 MI_VPE_SkipFrame(MI_VPE_CHANNEL VpeCh, MI_U32 u32FrameNum);
    
  • Parameters

    Parameter Name Description Input/Output
    VpeCh VPE channel number. Input
    u32FrameNum Frame Num Input
  • Return Value

    • Zero: Successful

    • Non-zero: Failed, see ERROR CODE for details.

  • Dependence

    • Header file: mi_vpe.h

    • Library file: libmi_vpe.a/libmi_vpe.so


2.30. MI_VPE_InitDev

  • Description

    Initialize VPE device.

  • Syntax

    MI_S32 MI_VPE_InitDev(MI_VPE_InitParam_t
    *pstInitParam);
    
  • Parameters

    Parameter Name Description Input/Output
    pstInitParam Initialization Parameter Input
  • Return value

    • MI_OK: Successful

    • Not MI_OK: Failed, see ERROR CODE for details.

  • Dependency

    • Header file: mi_common.h, mi_vpe.h

    • Library file: libmi_vpe.a

  • Note

    This interface is called when STR takes effect. If STR is invalid and the default initialization parameters are in use, this interface will not be called.

  • Example

    Refer to MI_VPE_CreateChannel


2.31. MI_VPE_DeInitDev

  • Description

    De-initialize VPE device.

  • Syntax

    MI_S32 MI_VPE_DeInitDev(void);
    
  • Return value

    • MI_OK: Successful

    • Not MI_OK: Failed, see ERROR CODE for details.

  • Dependency

    • Header file: mi_common.h, mi_vpe.h

    • Library file: libmi_vpe.a

  • Note

    • This interface is called only when STR takes effect.

    • This interface must be called after the VPE channel is destroyed, otherwise it will return MI_ERR_FAILED.

    • If the interface is called repeatedly, it will report fd is Invalid and return MI_ERR_FAILED.

  • Example

    Refer to MI_VPE_CreateChannel


2.32. MI_VPE_CreateMultiChannelStitch

  • Description

    Create a multi-channel fusion channel.

  • Syntax

    MI_S32 MI_VPE_CreateMultiChannelStitch(MI_VPE_CHANNEL VpeCh,
    MI_VPE_MultiChannelStitchAttr_t *pstVpeChAttr);
    
  • Parameters

    Parameter Name Description Input/Output
    VpeCh VPE channel number. Input
    pstVpeChAttr VPE channel attribute pointer. Input
  • Return value

    • MI_OK: Successful

    • Not MI_OK: Failed, see ERROR CODE for details.

  • Dependency

    • Header file: mi_common.h, mi_vpe.h

    • Library file: libmi_vpe.a

  • Example

    /************************************************
        Step1:  init VIF Multi Dev
        *************************************************/
    MI_VIF_DevAttr_t stDevAttr;
        memset(&stDevAttr, 0x0, sizeof(MI_VIF_DevAttr_t));
    
        stDevAttr.eIntfMode = stPad0Info.eIntfMode;
        stDevAttr.eWorkMode = pstVifDevAttr->eWorkMode;
        stDevAttr.eHDRType = (MI_VIF_HDRType_e)pstVpeChnattr->eHdrType;
        if(stDevAttr.eIntfMode == E_MI_VIF_MODE_BT656)
            stDevAttr.eClkEdge = stPad0Info.unIntfAttr.stBt656Attr.eClkEdge;
        else
            stDevAttr.eClkEdge = E_MI_VIF_CLK_EDGE_DOUBLE;
    
        if(stDevAttr.eIntfMode == E_MI_VIF_MODE_MIPI)
            stDevAttr.eDataSeq =stPad0Info.unIntfAttr.stMipiAttr.eDataYUVOrder;
        else
            stDevAttr.eDataSeq = E_MI_VIF_INPUT_DATA_YUYV;
    
        if(stDevAttr.eIntfMode == E_MI_VIF_MODE_BT656)
            memcpy(&stDevAttr.stSyncAttr, &stPad0Info.unIntfAttr.stBt656Attr.stSyncAttr, sizeof(MI_VIF_SyncAttr_t));
    
        stDevAttr.eBitOrder = E_MI_VIF_BITORDER_NORMAL;
        stDevAttr.u32DevStitchMask = E_MI_VIF_DEVICE_ID0|E_MI_VIF_DEVICE_ID2;
    
        STCHECKRESULT(MI_VIF_SetDevAttr(vifDev, &stDevAttr));
        STCHECKRESULT(MI_VIF_EnableDev(vifDev));
    
        MI_VIF_ChnPortAttr_t stVifPortInfo;
        memset(&stVifPortInfo, 0, sizeof(MI_VIF_ChnPortAttr_t));
        stVifPortInfo.stCapRect.u16X = stSnrPlane0Info.stCapRect.u16X;
        stVifPortInfo.stCapRect.u16Y = stSnrPlane0Info.stCapRect.u16Y;
        stVifPortInfo.stCapRect.u16Width =  stSnrPlane0Info.stCapRect.u16Width;
        stVifPortInfo.stCapRect.u16Height = stSnrPlane0Info.stCapRect.u16Height;
        stVifPortInfo.stDestSize.u16Width = u32CapWidth;
        stVifPortInfo.stDestSize.u16Height = u32CapHeight;
        stVifPortInfo.ePixFormat = ePixFormat;
    
        if(stDevAttr.eIntfMode == E_MI_VIF_MODE_BT656)
        {
            stVifPortInfo.eFrameRate = E_MI_VIF_FRAMERATE_FULL;
            stVifPortInfo.eCapSel = E_MI_SYS_FIELDTYPE_BOTH;
            stVifPortInfo.eScanMode = E_MI_SYS_FRAME_SCAN_MODE_PROGRESSIVE;
        }
        STCHECKRESULT(MI_VIF_SetChnPortAttr(vifChn, vifPort, &stVifPortInfo));
        STCHECKRESULT(MI_VIF_EnableChnPort(vifChn, vifPort));
    
        /************************************************
        Step2:  init VPE (create one VPE)
        *************************************************/
        MI_VPE_MultiChannelStitchAttr_t stChannelVpeAttr;
    memset(&stChannelVpeAttr, 0, sizeof(MI_VPE_MultiChannelStitchAttr_t));
    
        stChannelVpeAttr.u16MaxW = u32CapWidth;
        stChannelVpeAttr.u16MaxH = u32CapHeight;
        stChannelVpeAttr.ePixFmt = ePixFormat;
        stChannelVpeAttr.eRunningMode = E_MI_VPE_RUN_CAM_MODE;
        stChannelVpeAttr.u32StitchedSensorBitmap = E_MI_VPE_SENSOR0|E_MI_VPE_SENSOR1;
        stChannelVpeAttr.bEnLdc = pstVpeChnattr->bEnLdc;
        stChannelVpeAttr.u32ChnPortMode = E_MI_VPE_ZOOM_LDC_MAX;
        stChannelVpeAttr.eHDRType = pstVpeChnattr->eHdrType;
        stChannelVpeAttr.u32MultiChannelNum = 2;
        stChannelVpeAttr.u32Sync3AType = E_MI_VPE_SYNC3A_AE|E_MI_VPE_SYNC3A_AWB|E_MI_VPE_SYNC3A_IQ;
        stChannelVpeAttr.bForceOutputBufBeforeLDC = 0;
        STCHECKRESULT(MI_VPE_CreateMultiChannelStitch(vpechn, &stChannelVpeAttr));
    // The image of sensor0 and sensor1 is received by Vif dev0 and dev2, and then the two sensor images are spliced and fused into one image by VPE. The fusion effect is achieved by MI_ VPE LDC bin decision in MI_VPE_LDCSetViewConfig
    
  • Note

    • This API is mutually exclusive of the MI_VPE_CreateChannel API.

    • Must meet the requirement u32ChnPortMode = E_MI_VPE_ZOOM_LDC_MAX.

    • bEnLdc = true will have fusion effect, and bEnLdc = false will implement splicing without fusion.

  • Related topic

    MI_VPE_MultiChannelStitchAttr_t


2.33. MI_VPE_CallBackTask_Register

  • Description

    Register callback interface with VPE.

  • Syntax

    MI_S32 MI_VPE_CallBackTask_Register(MI_VPE_CallBackParam_t *pstCallBackParam);
    
  • Parameters

    Parameter Name Description Input/Output
    pstCallBackParam Callback Arguments Input
  • Return value

    • MI_OK: Successful

    • Not MI_OK: Failed, see ERROR CODE for details.

  • Dependency

    • Header file: mi_common.h, mi_vpe.h

    • Library file: libmi_vpe.a

  • Note

  • Example

    MI_S32 _MI_ISP_vsync1(MI_U64 u64Data)
    {
        DBG_ERR("DATA %llu \n", u64Data);
    
        return 0;
    }
    
    MI_S32 _MI_ISP_vsync2(MI_U64 u64Data)
    {
        DBG_ERR("DATA %llu \n", u64Data);
    
        return 0;
    }
    
    static MS_S32 _MI_VPE_testRegVpeCallback(void)
    {
        MI_VPE_CallBackParam_t stCallBackParam1;
        MI_VPE_CallBackParam_t stCallBackParam2;
    
        memset(&stCallBackParam1, 0x0, sizeof(MI_VPE_CallBackParam_t));
        memset(&stCallBackParam2, 0x0, sizeof(MI_VPE_CallBackParam_t));
    
        stCallBackParam1.eCallBackMode = E_MI_VPE_CALLBACK_ISR;
        stCallBackParam1. eIrqType = E_MI_VPE_IRQ_ISPVSYNC;
        stCallBackParam1.pfnCallBackFunc = _mi_ISP_vsync1;
        stCallBackParam1.u64Data = 12;
        MI_VPE_CallBackTask_Register(&stCallBackParam1);
    
        stCallBackParam2.eCallBackMode = E_MI_VPE_CALLBACK_ISR;
        stCallBackParam2. eIrqType = E_MI_VPE_IRQ_ISPVSYNC;
        stCallBackParam2.pfnCallBackFunc = _mi_ISP_vsync2;
        stCallBackParam2.u64Data = 23;
        MI_VPE_CallBackTask_Register(&stCallBackParam2);
    
        return 0;
    }
    
    static MS_S32 _mi_ldc_testUnRegVpeCallback(void)
    {
        MI_VPE_CallBackParam_t stCallBackParam1;
        MI_VPE_CallBackParam_t stCallBackParam2;
    
    memset(&stCallBackParam1, 0x0, sizeof(MI_VPE_CallBackParam_t));
        memset(&stCallBackParam2, 0x0, sizeof(MI_VPE_CallBackParam_t));
    
        stCallBackParam1.eCallBackMode = E_MI_VPE_CALLBACK_ISR;
        stCallBackParam1.eIrqType = E_MI_VPE_IRQ_ISPVSYNC;
        stCallBackParam1.pfnCallBackFunc = _mi_ISP_vsync1;
        stCallBackParam1.u64Data = 12;
        MI_VPE_CallBackTask_Unregister(&stCallBackParam1);
    
        stCallBackParam2.eCallBackMode = E_MI_VPE_CALLBACK_ISR;
        stCallBackParam2.eIrqType = E_MI_VPE_IRQ_ISPVSYNC;
        stCallBackParam2.pfnCallBackFunc = _mi_ISP_vsync2;
        stCallBackParam2.u64Data = 23;
        MI_VPE_CallBackTask_Unregister(&stCallBackParam2);
    
        return 0;
    }
    
  • Related topic

    MI_VPE_CallBackTask_Unregister


2.34. MI_VPE_CallBackTask_Unregister

  • Description

    Unregister callback interface with VPE.

  • Syntax

    MI_S32 MI_VPE_CallBackTask_Unregister(MI_VPE_CallBackParam_t
    *pstCallBackParam);
    
  • Parameters

    Parameter Name Description Input/Output
    pstCallBackParam Callback Arguments Input
  • Return value

    • MI_OK: Successful

    • Not MI_OK: Failed, see ERROR CODE for details.

  • Dependency

    • Header file: mi_common.h, mi_vpe.h

    • Library file: libmi_vpe.a

  • Note

  • Example

    Refer to MI_VPE_CallBackTask_Unregister example.

  • Related topic

    MI_VPE_CallBackTask_Register


2.35. MI_VPE_LoadPortZoomTable

  • Description

    Port load zoom table.

  • Syntax

    MI_S32 MI_VPE_LoadPortZoomTable(MI_VPE_CHANNEL VpeCh, MI_VPE_PORT
    VpePort, MI_VPE_ZoomTable_t *pZoomTable);
    
  • Parameters

    Parameter Name Description Input/Output
    VpePort VPE port number. Input
    pZoomTable Zoom Table parameter Input
  • Return value

    • MI_OK: Successful

    • Not MI_OK: Failed, see ERROR CODE for details.

  • Dependency

    • Header file: mi_common.h, mi_vpe.h

    • Library file: libmi_vpe.a

  • Note

    • Load table cannot be repeated during zoom operation. MI is required first call MI_VPE_StopPortZoom and reload the table.

    • When using zoom, MI_ VPE_ Setportcrop API function failed.

  • Related topic

    MI_VPE_StartPortZoom

    MI_VPE_StopPortZoom


2.36. MI_VPE_StartPortZoom

  • Description

    Port starts running zoom.

  • Syntax

    MI_S32 MI_VPE_StartPortZoom (MI_VPE_CHANNEL VpeCh, MI_VPE_PORT
    VpePort, MI_VPE_ZoomAttr_t *pstZoomAttr);
    
  • Parameters

    Parameter Name Description Input/Output
    VpeCh VPE channel number. Input
    VpePort VPE port number. Input
    pstZoomAttr The zoom property to start running. Input
  • Return value

    • MI_OK: Successful

    • Not MI_OK: Failed, see ERROR CODE for details.

  • Dependency

    • Header file: mi_common.h, mi_vpe.h

    • Library file: libmi_vpe.a

  • Note

    This interface must be called in pair with MI_VPE_StopPortZoom.

  • Example

    X0 Y0 W0 H0 SensorId=0
    X1 Y1 W1 H1 SensorId=0
    X2 Y2 W2 H2 SensorId=1
    X3 Y3 W3 H3 SensorId=1

    U32fromentryindex and u32toentryindex are any of index0 ~ 3 in the table.

    When u32fromentryindex! = u32toentryindex, the cross parameters from u32fromentryindex to u32toentryindex are applied frame by frame.

    When u32fromentryindex = = u32toentryindex, it will stop at the current u32fromentryindex parameter.

    When the MI detects that the sensor ID of the next entry is inconsistent with the current sensor ID, the sensor driver will be informed of the sensor ID after the current frame is finished, and switch to the corresponding sensor

  • Related topic

    MI_VPE_StopPortZoom


2.37. MI_VPE_StopPortZoom

  • Description

    Port stop running zoom.

  • Syntax

    MI_S32 MI_VPE_StopPortZoom (MI_VPE_CHANNEL VpeCh, MI_VPE_PORT
    VpePort);
    
  • Parameters

    Parameter Name Description Input/Output
    VpeCh VPE channel number. Input
    VpePort VPE port number. Input
  • Return value

    • MI_OK: Successful

    • Not MI_OK: Failed, see ERROR CODE for details.

  • Dependency

    • Header file: mi_common.h, mi_vpe.h

    • Library file: libmi_vpe.a

  • Note

    This interface must be called in pair with MI_VPE_StartPortZoom.

  • Related topic

    MI_VPE_StartPortZoom


2.38. MI_VPE_GetPortCurZoomAttr

  • Description

    Gets the current port zoom attribute.

  • Syntax

    MI_S32 MI_VPE_GetPortCurZoomAttr (MI_VPE_CHANNEL VpeCh, MI_VPE_PORT
    VpePort, MI_VPE_ZoomAttr_t *pstZoomAttr);
    
  • Parameters

    Parameter Name Description Input/Output
    VpeCh VPE channel number. Input
    VpePort VPE port number. Input
    pstZoomAttr Current zoom property. Output
  • Return value

    • MI_OK: Successful

    • Not MI_OK: Failed, see ERROR CODE for details.

  • Dependency

    • Header file: mi_common.h, mi_vpe.h

    • Library file: libmi_vpe.a

  • Related topic

    MI_VPE_StartPortZoom

    MI_VPE_StopPortZoom


2.39. MI_VPE_EnableInputPort

  • Description

    Enable VPE Input port.

  • Syntax

    MI_S32 MI_VPE_EnableInputPort(MI_VPE_CHANNEL VpeCh,
    MI_VPE_PORT VpePort);
    
  • Parameters

    Parameter Name Description Input/Output
    VpeCh VPE channel number. Input
    VpePort Vpe port number. Input
  • Return Value

    • Zero: Successful

    • Non-zero: Failed, see ERROR CODE for details.

  • Dependence

    • Header file: mi_vpe.h

    • Library file: libmi_vpe.a/libmi_vpe.so

  • Note

    Before calling this function,make sure called MI_VPE_StartChannel start channel

  • Related APIs

    MI_VPE_StartChannel

    MI_VPE_DisableInputPort


2.40. MI_VPE_DisableInputPort

  • Description

    Disable VPE Input port.

  • Syntax

    MI_S32 MI_VPE_DisableInputPort(MI_VPE_CHANNEL VpeCh,
    MI_VPE_PORT VpePort);
    
  • Parameters

    Parameter Name Description Input/Output
    VpeCh VPE channel number. Input
    VpePort 32Vpe port number. Input
  • Return Value

    • Zero: Successful

    • Non-zero: Failed, see ERROR CODE for details.

  • Dependence

    • Header file: mi_vpe.h

    • Library file: libmi_vpe.a/libmi_vpe.so

  • Note

    Before calling this function,make sure called MI_VPE_StartChannel start channel

  • Related APIs

    MI_VPE_StartChannel

    MI_VPE_EnableInputPort


2.41. MI_VPE_LDCSetBatchViewConfig

  • Description

    Set a batch of Ldc Configs, which can be used to change Ldc mode.

  • Syntax

    MI_S32 MI_VPE_LDCSetBatchViewConfig(MI_VPE_CHANNEL VpeCh,
    MI_VPE_LdcConfig_t*pstCfg, MI_U32 u32CfgNum)
    
  • Parameters

    Parameter Name Description Input/Output
    VpeCh VPE channel number. Input
    pstCfg Ldc config Pointer Input
    u32CfgNum Ldc Config Number Input
  • Return Value

    • Zero: Successful

    • Non-zero: Failed, see ERROR CODE for details.

  • Dependence

    • Header file: mi_vpe.h

    • Library file: libmi_vpe.a/libmi_vpe.so

  • Note

    • Only Pudding supports LDC function. When benldc = true in MI_VPE_ChannelAttr_t, enable LDC.

    • The API can be called when you want to change ldc mode (contain of a batch config) or make it work immediately.

    • Each config bin buffer corresponds to the settings of a view window.

  • Example

    MI_VPE_LdcConfig_t *pstLdcConfig =
        (MI_VPE_LdcConfig_t *)malloc(u32ViewNum * sizeof(MI_VPE_LdcConfig_t));
    
    for(i=0; i< u32ViewNum;i++)
    {
        pstLdcConfig[i].pCfgAddr = ldcBinBuffer[i]
        pstLdcConfig[i].u32CfgSize = u32LdcBinSize[i]
    }
    
    MI_VPE_LDCSetBatchViewConfig(vpechn, pstLdcConfig, viewnum);
    

3. VPE data type

VPE module related data types are listed below:

Data type Description
MI_VPE_CHANNEL Define VPE channel type
MI_VPE_PORT Define VPE port type
MI_VPE_RunningMode_e Define VPE running mode
MI_VPE_SensorChannel_e Define VPE sensor bind ID
MI_VPE_ChnPortMode_e Define the output schema for Port
MI_VPE_IspApiHeader_t Define VPE data header information to ISP
MI_VPE_ChannelAttr_t Define VPE channel attribute
MI_VPE_PqParam_t Define VPE PQ parameter (NR, EdgeGain, Contrast)
MI_VPE_HDRType_e Define VPE HDR type
MI_VPE_3DNR_Level_e Define 3DNR level
MI_VPE_ChannelPara_t Define VPE channel parameter
MI_VPE_RegionInfo_t Define VPE channel region statistics information
MI_VPE_PortMode_t Define VPE port mode
MI_VPE_IspInitPara_t Define ISP Init parameter
MI_VPE_InitParam_t Define the initialized parameter of VPE device
MI_VPE_SYNC3A_e Synchronize 3A parameters of each channel.
MI_VPE_MultiChannelStitchAttr_t Multichannel fusion parameters.
MI_VPE_CALLBK_FUNC Define callback function type
MI_VPE_CallBackMode_e Define callback mode
MI_VPE_IrqType_e Define hardware interrupt type
MI_VPE_CallBackParam_t Define callback parameters
MI_VPE_PortSource_e Define the output port source type
MI_VPE_OutputPortId_e Define output port ID
CHN_PORT_MODE Define and set chnportmode expression
MI_VPE_ZoomEntry_t Define zoom unit entry type
MI_VPE_ZoomTable_t Define zoom table type
MI_VPE_ZoomAttr_t Define zoom properties
MI_VPE_LdcConfig_t Define Ldc Config

3.1. MI_VPE_CHANNEL

  • Description

    Define VPE channel type

  • Definition

    typedef MI_S32 MI_VPE_CHANNEL
    

3.2. MI_VPE_PORT

  • Description

    Define VPE port type

  • Definition

    typedef MI_S32 MI_VPE_PORT
    

3.3. MI_VPE_RunningMode_e

  • Description

    Define VPE running mode

  • Definition

    typedef enum
    
    {
    
        E_MI_VPE_RUN_INVALID = 0x00,
    
        E_MI_VPE_RUN_DVR_MODE = 0x01,
    
        E_MI_VPE_RUN_CAM_TOP_MODE = 0x02,
    
        E_MI_VPE_RUN_CAM_BOTTOM_MODE = 0x04,
    
        E_MI_VPE_RUN_CAM_MODE =
    
        E_MI_VPE_RUN_CAM_TOP_MODE|E_MI_VPE_RUN_CAM_BOTTOM_MODE,
    
        E_MI_VPE_RUN_REALTIME_TOP_MODE = 0x08,
    
        E_MI_VPE_RUN_REALTIME_BOTTOM_MODE = 0x10,
    
        E_MI_VPE_RUN_REALTIME_MODE =
    
        E_MI_VPE_RUN_REALTIME_TOP_MODE |
        E_MI_VPE_RUN_REALTIME_BOTTOM_MODE,
    
        E_MI_VPE_RUNNING_MODE_MAX,
    
    } MI_VPE_RunningMode_e;
    
  • Note

    E_MI_VPE_RUN_DVR_MODE:
    When the input is in YUV format, ISP bypass is not processed by ISP.

    E_MI_VPE_RUN_CAM_MODE:
    When the input is in Bayer format and the data comes from DRAM, ISP supports time-sharing multiplexing, such as multi sensor scenarios.

    E_MI_VPE_RUN_REALTIME_MODE:
    When the input is in Bayer format, the hardware between Vif and ISP is directly connected. ISP does not support time-sharing multiplexing, but only supports one channel, such as single sensor scenario.

    Top/bottom mode is only supported on Pretzel chips. It is used in rotation scenarios. Top/bottom refers to the connection between ISP and scaler.

    The top channel does not have scaling capability. The bottom channel implements rotation. For the usage method, refer to the example of MI VPE setchannelrotation.


3.4. MI_VPE_SensorChannel_e

  • Description

    Define VPE sensor bind ID

  • Definition

    typedef enum
    
    {
    
        E_MI_VPE_SENSOR_INVALID = 0,
    
        E_MI_VPE_SENSOR0 = 0x1,
    
        E_MI_VPE_SENSOR1 = 0x2,
    
        E_MI_VPE_SENSOR2 = 0x4,
    
        E_MI_VPE_SENSOR3 = 0x8,
    
        E_MI_VPE_SENSOR4 = 0x10,
    
        E_MI_VPE_SENSOR5 = 0x20,
    
        E_MI_VPE_SENSOR6 = 0x40,
    
        E_MI_VPE_SENSOR7 = 0x80,
    
        E_MI_VPE_SENSOR_MAX
    
    }MI_VPE_SensorChannel_e;
    
    Mapping sensor device.
    
  • Note

    Use E_MI_VPE_SENSOR_INVALID with no sensor

  • Related Type

    MI_VPE_ChannelAttr_t

    MI_VPE_MultiChannelStitchAttr_t


3.5. MI_VPE_ChnPortMode_e

  • Description

    Define the output schema for Port

  • Definition

    typedef enum
    
    {
    
        E_MI_VPE_ZOOM_LDC_NULL,
    
        E_MI_VPE_ZOOM_LDC_PORT0 = 0X01,
    
        E_MI_VPE_ZOOM_LDC_PORT1 = 0X02,
    
        E_MI_VPE_ZOOM_LDC_PORT2 = 0X04,
    
        E_MI_VPE_ZOOM_LDC_MAX = E_MI_VPE_ZOOM_LDC_PORT0|
    
        E_MI_VPE_ZOOM_LDC_PORT1|E_MI_VPE_ZOOM_LDC_PORT2,
    
    }MI_VPE_ChnPortMode_e;
    
    The port0, 1, and 2 outputs contain zoom/ LDC effects.
    
  • Note

    Refer to notes in MI_VPE_ChannelAttr_t.

  • Related Type

    MI_VPE_ChannelAttr_t


3.6. MI_VPE_IspApiHeader_t

  • Description

    Define VPE data header information to ISP

  • Definition

    typedef struct MI_VPE_IspApiHeader_s
    
    {
    
        MI_U32 u32HeadSize; //Size of MIIspApiHeader_t
    
        MI_U32 u32DataLen; //Data length;
    
        MI_U32 u32CtrlID; //Function ID
    
        MI_U32 u32Channel; //Isp channel number
    
        MI_S32 s32Ret; //Isp api retuen value
    
    } MI_VPE_IspApiHeader_t;
    
  • Related Type

    MI_VPE_IspApiData_t.


3.7. MI_VPE_ChannelAttr_t

  • Description

    Define VPE channel attribute

  • Definition

    typedef struct MI_VPE_ChannelAttr_s
    
    {
    
        MI_U16 u16MaxW;
    
        MI_U16 u16MaxH;
    
        MI_SYS_PixelFormat_e ePixFmt;
    
        MI_VPE_SensorChannel_e eSensorBindId;
    
        MI_BOOL bNrEn;
    
        MI_BOOL bEdgeEn;
    
        MI_BOOL bEsEn;
    
        MI_BOOL bContrastEn;
    
        MI_BOOL bUvInvert;
    
        MI_BOOL bRotation;
    
        MI_VPE_RunningMode_e eRunningMode;
    
        MI_VPE_IspInitPara_t tIspInitPara;
    
        MI_BOOL bEnLdc; // true port3 for ldc or for Isp(skip pass2)
    
        MI_U32 u32ChnPortMode;
    
    }MI_VPE_ChannelAttr_t;
    
  • Member

    Member Name Description
    u32MaxW Maximum width
    u32MaxH Maximum height
    ePixFmt Input Pixel format.
    eSensorBindId Set sensor ID boundary if sensor exists in front end
    bNrEn Enable noise reduction
    bEdgeEn Enable edge
    bEsEn Enable edge smooth
    bContrastEn Enable contrast
    bUvInvert Enable UV invert
    eRunningMode VPE running mode
    bRotation Enable rotation
    tIspInitPara ISP Init parameter
    bEnLdc Enable LDC
    u32ChnPortMode The port output mode under the current channel is assigned by the MI_VPE_ChnPortMode_e member.
  • Note

    • Set to static attribute when channel is created, cannot be modified.

    • ePixFmt: When the erunningmode is E_MI_VPE_RUN_DVR_MODE, only E_MI_SYS_PIXEL_FRAME_YUV422_YUYV is supported. Other running mode pixels are obtained by sensor conversion, such as:

      ePixFormat = (MI_SYS_PixelFormat_e)RGB_BAYER_PIXEL(stSnrPlane0Info.ePixPrecision, stSnrPlane0Info.eBayerId);

    • eSensorBindId: The position of the sensor pad inserted in the front-end sensor of VPE channel. When erunningmode is E_MI_VPE_RUN_DVR_MODE, eSensorBindId = E_MI_VPE_SENSOR_INVALID.

    • For bNrEn/bEdgeEn/bEsEn/bContrastEn/bUvInvert, only setting on MSR930 chip is valid.

    • bRotation is only set in Pretzel series chip rotation scenario. Please refer to MI_VPE_SetChannelRotation example.

    • The control of u32chnportmode/benldc in Pudding is shown in the figure below:

    • The VPE internal flow chart is shown above:

      1. Normal scenario, u32ChnPortMode=0, realtime connection between ISP and all SCL, direct hardware connection, no buffer consumption.

      2. Scl1, 2 are the same source. Scl0 and scl½ can independently choose whether the source is from Realtime or RDMA through u32ChnPortMode. There are altogether 4 combinations, for example:

        u32ChnPortMode = E_MI_VPE_ZOOM_LDC_PORT0; //port0 from RDMA
        
        u32ChnPortMode = E_MI_VPE_ZOOM_LDC_PORT1|
        E_MI_VPE_ZOOM_LDC_PORT2;//port1,2 from RDMA
        
        u32ChnPortMode = E_MI_VPE_ZOOM_LDC_NULL; //all scl from realtime
        
        u32ChnPortMode =
        E_MI_VPE_ZOOM_LDC_PORT0|E_MI_VPE_ZOOM_LDC_PORT1|
        E_MI_VPE_ZOOM_LDC_PORT2; //all scl from RDMA
        
      3. bEnLdc==TRUE, RDMA buffer from LDC out, port3 from LDC,

        bEnLdc==FALSE, RDMA buffer from ZOOM out, port3 from ZOOM.

    • Compared with Pudding, the setting of Tiramisu series chip u32chnportmode has one more source, as shown in the figure below. You need CHN_PORT_MODE to obtain parameters. Refer to CHN_PORT_MODE An example of mode.

  • Related Type

    MI_VPE_RunningMode_e

    MI_VPE_SensorChannel_e

    MI_VPE_IspInitPara_t

    MI_VPE_ChnPortMode_e


3.8. MI_VPE_PqParam_t

  • Description

    Define VPE PQ parameter (NR, EdgeGain, Contrast)

  • Definition

    typedef struct MI_VPE_ChannelPara_s
    
    {
    
        MI_U8 u8NrcSfStr; //0 ~ 255;
    
        MI_U8 u8NrcTfStr; //0 ~ 255
    
        MI_U8 u8NrySfStr; //0 ~ 255
    
        MI_U8 u8NryTfStr; //0 ~ 255
    
        MI_U8 u8NryBlendMotionTh; //0 ~ 15
    
        MI_U8 u8NryBlendStillTh; //0 ~ 15
    
        MI_U8 u8NryBlendMotionWei; //0 ~ 31
    
        MI_U8 u8NryBlendOtherWei; //0 ~ 31
    
        MI_U8 u8NryBlendStillWei; //0 ~ 31
    
        MI_U8 u8EdgeGain[6];//0~255
    
        MI_U8 u8Contrast;//0~255
    
    } MI_VPE_ChannelPara_t;
    
  • Member

    Member Name Description
    u8NrcSfStr 0~255, special field color noise reduction strength
    u8NrcTfStr 0~255, time field color noise reduction strength
    u8NrySfStr 0~255, special field Y noise reduction strength
    u8NryTfStr 0~255, time field Y noise reduction strength
    u8NryBlendMotionTh 0~15, special field noise reduction of Motion region threshold
    u8NryBlendStillTh 0~15, special field noise reduction of still region threshold
    u8NryBlendMotionWei 0~31, Motion region noise reduction weight in special field over time field
    u8NryBlendOtherWei 0~31, Motion region and still region noise reduction weight in special field over time field
    u8NryBlendStillWei 0~31, Still region noise reduction weight in special field over time field
    u8EdgeGain[6] Sharpening effect upon different edge level Index 0 indicates small texture like hair, grasslands… The more this index increases, the sharper the texture is handled
    u8Contrast Influence on dark region and bright region tuning scale. A bigger value can enhance dark region tuning effect obviously, but the brightness will not be over-exposed.
  • Note

    • When the value of BLEND_WEI is bigger, this special field noise reduction is stronger.

    • It is suggested to set a bigger value for motion region to get better noise reduction effect.

    • It is suggested to set a smaller value for still region to reserve more texture.

  • Related Type

    MI_VPE_ChannelPara_t.


3.9. MI_VPE_HDRType_e

  • Description

    Define VPE HDR type

  • Definition

    typedef enum
    
    {
    
        E_MI_VPE_HDR_TYPE_OFF,
    
        E_MI_VPE_HDR_TYPE_VC, //virtual channel mode HDR,vc0->long,
        vc1->short
    
        E_MI_VPE_HDR_TYPE_DOL,
    
        E_MI_VPE_HDR_TYPE_EMBEDDED, //compressed HDR mode
    
        E_MI_VPE_HDR_TYPE_LI, //Line interlace HDR
    
        E_MI_VPE_HDR_TYPE_MAX
    
    } MI_VPE_HDRType_e
    
  • Note

    Which HDR type to use can be obtained through the MI_SNR_GetPadInfo interface.

  • Related Type

    MI_VPE_ChannelPara_t.


3.10. MI_VPE_3DNR_Level_e

  • Description

    Define 3DNR level

  • Definition

    typedef enu
    
    {
    
        E_MI_VPE_3DNR_LEVEL_OFF,
    
        E_MI_VPE_3DNR_LEVEL1,
    
        E_MI_VPE_3DNR_LEVEL2,
    
        E_MI_VPE_3DNR_LEVEL3,
    
        E_MI_VPE_3DNR_LEVEL4,
    
        E_MI_VPE_3DNR_LEVEL5,
    
        E_MI_VPE_3DNR_LEVEL6,
    
        E_MI_VPE_3DNR_LEVEL7,
    
        E_MI_VPE_3DNR_TYPE_NUM
    
     } MI_VPE_3DNR_Level_e;
    
  • Note

    • Set this data type after channel creation.

    • Set this just once because of static attribute.

    • 3DNR level could cause some 3DNR API parameters (NR3D_PARAM_t) to be unavailable, see the table below:

  • Name

    Parameter Name LEVEL_OFF Level 1 ~ 3 Level 4 ~ 7
    u16MdThd X O O
    u16MdDiv X O O
    u8TfStr X O O
    u8TfStrEx X O O
    u16MdThdPre X X O
    u16MdGainPre X X O
    u8TfStrPre X X O
    u8TfStrExPre X X O
    u8MdThdByY[16] X O O
    u8MdDivByY[16] X O O
    u8M2SLut[16] X O O
    u8TfLut[16] X O O
    u8YSfStr O O O
    u8YSfBlendLut[16] X O O
    u8CSfStr O O O
    u8CSfExStr O O O
    u8CSfExBlendGain X O O
    u16CSfExBlendClip X O O
    u16ShpBlendLut[16] X O O
  • Related Type

    MI_VPE_ChannelPara_t.

    MI_ISP_IQ_SetNR3D, MI_ISP_IQ_GetNR3D.

    MI_ISP_IQ_NR3D_TYPE_t.

    NR3D_PARAM_t.


3.11. MI_VPE_ChannelPara_t

  • Description

    Define VPE channel parameter

  • Definition

    typedef struct MI_VPE_ChannelPara_s
    
    {
    
       MI_VPE_PqParam_t  stPqParam; // only dvr use
    
       MI_VPE_HDRType_e   eHDRType;
    
       MI_VPE_3DNR_Level_e  e3DNRLevel;
    
        MI_BOOL bMirror;
    
        MI_BOOL bFlip;
    
       MI_BOOL         bWdrEn; //Wdr on/off
    
        MI_BOOL bEnLdc;
    
    } MI_VPE_ChannelPara_t;
    
  • Member

    Member Name Description
    stPqParam Pq Parameter Settings
    eHDRType HDR on/off parameter
    e3DNRLevel 3dnr level parameter
    bMirror Input Mirror on/off
    bFlip Input Flip on/off
    bWdrEn WDR on/off
    bEnLdc LDC on/off
  • Note

    Chip MAX e3DNRLevel bMirror/bFlip Support
    Pretzel E_MI_VPE_3DNR_LEVEL7 Not supported
    Macaron E_MI_VPE_3DNR_LEVEL2 Not supported
    Pudding E_MI_VPE_3DNR_LEVEL2 Supported
    Ispahan E_MI_VPE_3DNR_LEVEL2 Supported
    • The maximum 3dnr level supported by different chips is as shown in the table above. If the setting exceeds max, max level will be automatically used internally. The higher the level is, the stronger the 3dnr strength is, and the more buffers will be consumed.

    • The supported ehdrtype can be queried through MI_SNR_GetPadInfo.

    • stPqParam is only available in DVR mode

    • bmirror / bflip supports the chip family as shown in the table above to prevent some sensors from not supporting flipping

  • Related Type

    MI_VPE_PqParam_t

    MI_VPE_HDRType_e

    MI_VPE_3DNR_Level_e


3.12. MI_VPE_RegionInfo_t

  • Description

    Define VPE channel region statistics information

  • Definition

    typedef struct MI_VPE_RegionInfo_s

    {

    MI_VPE_Region_t *pstRegion; // region attribute
    
    MI_U32 u32RegionNum; // count of the region
    

    } MI_VPE_RegionInfo_t;

  • Member

    Member Name Description
    pstRegion Statistics region information
    u32RegionNum Statistics region number

3.13. MI_VPE_PortMode_t

  • Description

    Define VPE port mode

  • Definition

    typedef struct MI_VPE_PortMode_s
    
    {
    
        MI_U32 u32Width; // Width of target image
    
        MI_U32 u32Height; // Height of target image
    
        MI_SYS_PixelFormat_e ePixelFormat; // Pixel format of target image
    
        MI_SYS_CompressMode_e eCompressMode; // Compression mode of the Output
    
    }MI_VPE_PortMode_t;
    
  • Member

    Member Name Description
    u32Width Width of port output
    u32Height Height of port output
    ePixelFormat Pixel format of port output
    eCompressMode Compress mode of port output
  • Note

    Refer to the notes in MI_VPE_SetPortMode for relevant restrictions

  • Related Type

    MI_SYS_PixelFormat_e

    MI_SYS_CompressMode_e

    MI_VPE_SetPortMode


3.14. MI_VPE_IspInitPara_t

  • Description

    Define VPE ISP initial parameters Buffer.

  • Definition

    typedef struct MI_VPE_IspInitPara_s
    
    {
    
        MI_U32 u32Revision;
    
        MI_U32 u32Size;
    
        MI_U8 u8Data[64];
    
    }MI_VPE_IspInitPara_t;
    
  • Member

    Member Name Description
    u32Revision Version
    u32Size Buffer size
    u8Data Data
  • example

    #include <CusEarlyInit_para.h>
    
    MasterEarlyInitParam_t *pstEarlyInitParam = (MasterEarlyInitParam_t*) &stVpeChnAttr.tIspInitPara.u8Data[0];
    
    pstEarlyInitParam->u16SnrEarlyFps = pCameraBootSetting->u8SensorFrameRate;
    pstEarlyInitParam->u16SnrEarlyFlicker = pCameraBootSetting->u8AntiFlicker;
    pstEarlyInitParam->u32SnrEarlyShutter = pCameraBootSetting->u32shutter;
    pstEarlyInitParam->u32SnrEarlyGainX1024 = pCameraBootSetting->u32SensorGain;
    pstEarlyInitParam->u32SnrEarlyDGain = pCameraBootSetting->u32DigitalGain;
    pstEarlyInitParam->u16SnrEarlyAwbRGain = pCameraBootSetting->u16AWBRGain;
    pstEarlyInitParam->u16SnrEarlyAwbGGain = pCameraBootSetting->u16AWBGGain;
    pstEarlyInitParam->u16SnrEarlyAwbBGain = pCameraBootSetting->u16AWBBGain;
    
    stVpeChnAttr.tIspInitPara.u32Revision = EARLYINIT_PARAM_TYPE_MASTER;//branch or customer abbreviation
    stVpeChnAttr.tIspInitPara.u32Size = sizeof(MasterEarlyInitParam_t);
    
  • Related data types and interfaces

    MI_VPE_ChannelAttr_t


3.15. MI_VPE_InitParam_t

  • Description

    VPE device initialization parameter.

  • Definition

    typedef struct MI_VPE_InitParam_s
    
    {
    
        MI_U32 u32DevId;
    
        MI_U8 *u8Data;
    
    } MI_VPE_InitParam_t;
    
  • Member

    Member Name Description
    u32DevId Device ID
    u8Data Data pointer buffer
  • Related data types and interfaces

    MI_VPE_InitDev


3.16. MI_VPE_SYNC3A_e

  • Description

    Synchronize 3A parameters of each channel.

  • Definition

    typedef enum
    
    {
    
        E_MI_VPE_SYNC3A_NONE = 0x00,
    
        E_MI_VPE_SYNC3A_AE = 0x01,
    
        E_MI_VPE_SYNC3A_AWB = 0x02,
    
        E_MI_VPE_SYNC3A_IQ = 0x04
    
    }MI_VPE_SYNC3A_e;
    
  • Member

    Member Name Description
    E_MI_VPE_SYNC3A_NONE No 3A sync
    E_MI_VPE_SYNC3A_AE Sync AE
    E_MI_VPE_SYNC3A_AWB Sync AWB
    E_MI_VPE_SYNC3A_IQ Sync IQ
  • Related data types and interfaces

    MI_VPE_MultiChannelStitchAttr_t


3.17. MI_VPE_MultiChannelStitchAttr_t

  • Description

    Multichannel fusion parameters.

  • Definition

    typedef struct MI_VPE_MultiChannelStitchAttr_s
    
    {
    
        MI_U16 u16MaxW;
    
        MI_U16 u16MaxH;
    
        MI_SYS_PixelFormat_e ePixFmt;
    
        MI_VPE_HDRType_e eHDRType;
    
        MI_U32 u32StitchedSensorBitmap; //multi sensor bitmask by MI_VPE_SensorChannel_e
    
        MI_VPE_RunningMode_e eRunningMode;
    
        MI_VPE_IspInitPara_t tIspInitPara;
    
        MI_BOOL bEnLdc;
    
        MI_U32 u32ChnPortMode;
    
        MI_U32 u32MultiChannelNum;
    
        MI_U32 u32Sync3AType; //sync 3a bitmask by MI_VPE_SYNC3A_e
    
        MI_BOOL bForceOutputBufBeforeLDC;
    
    }MI_VPE_MultiChannelStitchAttr_t;
    
  • Member

    Member Name Description
    u32MaxW Maximum width
    u32MaxH Maximum height
    ePixFmt Input Pixel format
    eHDRType HDR type parameter
    u32StitchedSensorBitmap Set sensor ID boundary if sensor exists in front end
    eRunningMode VPE running mode
    tIspInitPara ISP Init parameter
    bEnLdc Enable LDC
    u32ChnPortMode The port output mode under the current channel is assigned by the MI_VPE_ChnPortMode_e member.
    u32MultiChannelNum The number of channels is created at the same time, and the attributes of each channel are the same
    u32Sync3AType Synchronous setting of each channel 3A
    bForceOutputBufBeforeLDC Port3 output LDC input data
  • Related data types and interfaces

    MI_VPE_CreateMultiChannelStitch


3.18. MI_VPE_CALLBK_FUNC

  • Description

    Define callback function type

  • Definition

    typedef MI_S32 (*MI_VPE_CALLBK_FUNC)(MI_U64 u64Data);
    
  • Related data types and interfaces

    MI_VPE_CallBackParam_t


3.19. MI_VPE_CallBackMode_e

  • Description

    Define callback mode.

  • Definition

    typedef enum
    
    {
    
        E_MI_VPE_CALLBACK_ISR,
    
        E_MI_VPE_CALLBACK_MAX,
    
    } MI_VPE_CallBackMode_e;
    
  • Member

    Member Name Description
    E_MI_VPE_CALLBACK_ISR Hardware interrupt mode callback
    E_MI_VPE_CALLBACK_MAX Callback mode Max
  • Related data types and interfaces

    MI_VPE_CallBackParam_t


3.20. MI_VPE_IrqType_e

  • Description

    Define hardware interrupt type

  • Definition

    typedef enum
    
    {
    
        E_MI_VPE_IRQ_ISPVSYNC,
    
        E_MI_VPE_IRQ_ISPFRAMEDONE,
    
        E_MI_VPE_IRQ_MAX,
    
    } MI_VPE_IrqType_e;
    
  • Member

    Member Name Description
    E_MI_VPE_IRQ_ISPVSYNC ISP Vsync interrupt type
    E_MI_VPE_IRQ_ISPFRAMEDONE ISP frame done interrupt type
  • Note

    • E_MI_VPE_IRQ_ISPVSYNC: Signal of the first pixel in each frame

    • E_MI_VPE_IRQ_ISPFRAMEDONE: ISP writes out every ending signal. When MI VPE port3 or LDC is turned on, the hardware interrupt will be turned on.

  • Related data types and interfaces

    MI_VPE_CallBackParam_t


3.21. MI_VPE_CallBackParam_t

  • Description

    Define callback parameters.

  • Definition

    typedef struct MI_VPE_CallBackParam_s
    
    {
    
        MI_VPE_CallBackMode_e eCallBackMode;
    
        MI_VPE_IrqType_e eIrqType;
    
        MI_VPE_CALLBK_FUNC pfnCallBackFunc;
    
        MI_U64 u64Data;
    
    } MI_VPE_CallBackParam_t;
    
  • Member

    Member Name Description
    eCallBackMode Callback mode
    eIrqType Hardware interrupt type
    pfnCallBackFunc Callback function
    u64Data Callback function parameters
  • Related data types and interfaces

    MI_VPE_CallBackTask_Register

    MI_VPE_CallBackTask_Unregister


3.22. MI_VPE_PortSource_e

  • Description

    Select the source of the output port.

  • Definition

    typedef enum
    
    {
    
        E_MI_VPE_PORTSRC_FRAME = 0X0,
    
        E_MI_VPE_PORTSRC_YUV_REALTIME = 0x01,
    
        E_MI_VPE_PORTSRC_BAYER_REALTIME = 0x02,
    
        E_MI_VPE_PORTSRC_MAX = 0xFF,
    
    }MI_VPE_PortSource_e;
    
  • Member

    Member Name Description
    E_MI_VPE_PORTSRC_FRAME Source from frame buffer
    E_MI_VPE_PORTSRC_YUV_REALTIME Source from yuv realtime is input port2
    E_MI_VPE_PORTSRC_BAYER_REALTIME Source from bayer realtime is input port0
    E_MI_VPE_PORTSRC_MAX Maximum number of sources
  • Related data types and interfaces

    CHN_PORT_MODE


3.23. MI_VPE_OutputPortId_e

  • Description

    Define Output Port Id.

  • Definition

    typedef enum
    
    {
    
        E_MI_VPE_OUTPUT_PORT0 = 0X01,//scl0
    
        E_MI_VPE_OUTPUT_PORT1 = 0X02,//scl1
    
        E_MI_VPE_OUTPUT_PORT2 = 0X04,//scl2
    
        E_MI_VPE_OUTPUT_PORT3 = 0X08,//isp dma/ldc
    
        E_MI_VPE_OUTPUT_PORT4 = 0X10,//ir port
    
        E_MI_VPE_OUTPUT_PORT5 = 0X20,//scl3
    
        E_MI_VPE_OUTPUT_PORT6 = 0X40,//scl4
    
        E_MI_VPE_OUTPUT_PORT7 = 0X80,//virtual port only src from bayer realtime
    
        E_MI_VPE_PORT_ALL = 0xFF
    
    }MI_VPE_OutputPortId_e;
    
  • Related data types and interfaces

    CHN_PORT_MODE


3.24. CHN_PORT_MODE

  • Description

    Define and set the chnportmode expression.

  • Definition

    #define CHN_PORT_MODE(PortSrc, PortId) (PortId <<(8* PortSrc))
    
    u32chnportmode is divided into four parts according to byte
    
    bit0~7 E_MI_VPE_PORTSRC_FRAME //RDMA path
    
    bit8~15 E_MI_VPE_PORTSRC_YUV_REALTIME //input port2 path
    
    bit16~23 E_MI_VPE_PORTSRC_BAYER_REALTIME //input port0 path
    
    bit24~31 invalid
    
  • Note

    • The source of output port3 / 4 / 7 is fixed input port0 and not optional.

    • When u32chnportmode = 0, or the source of port is not selected, the default port source is Bayer_ REALTIME。

  • Related data types and interfaces

    MI_VPE_ChannelAttr_t


3.25. MI_VPE_ZoomEntry_t

  • Description

    Define zoom unit entry type.

  • Definition

    typedef struct MI_VPE_ZoomEntry_s
    
    {
    
        MI_SYS_WindowRect_t stCropWin;
    
        MI_U8 u8ZoomSensorId;
    
    } MI_VPE_ZoomEntry_t;
    
  • Member

    Member Name Description
    stCropWin Crop position parameter
    u8ZoomSensorId Sensor ID corresponding to crop parameter
  • Note

    The u8zoomsensorid corresponds to the returned value of the interface pCus_sensor_GetCurSwtichSensorId callback function in the sensor driver.

  • Related data types and interfaces

    MI_VPE_LoadPortZoomTable

    MI_VPE_ZoomTable_t


3.26. MI_VPE_ZoomTable_t

  • Description

    Define zoom table type.

  • Definition

    typedef struct MI_VPE_ZoomTable_s
    
    {
    
        MI_U32 u32EntryNum;
    
        MI_VPE_ZoomEntry_t *pVirTableAddr;
    
    } MI_VPE_ZoomTable_t;
    
  • Member

    Member Name Description
    u32EntryNum Number of entries in zoom table
    pVirTableAddr Zoom Table Buffer Pointer
  • Related data types and interfaces

    MI_VPE_LoadPortZoomTable


3.27. MI_VPE_ZoomAttr_t

  • Description

    Define zoom properties.

  • Definition

    typedef struct MI_VPE_ZoomAttr_s
    
    {
    
        MI_U32 u32FromEntryIndex;
    
        MI_U32 u32ToEntryIndex;
    
        MI_U32 u32CurEntryIndex;
    
    } MI_VPE_ZoomAttr_t;
    
  • Member

    Member Name Description
    u32FromEntryIndex Start running the entry index for zoom
    u32ToEntryIndex End the index of entries running zoom
    u32CurEntryIndex Index of the current zoom position
  • Related data types and interfaces

    MI_VPE_StartPortZoom

    MI_VPE_GetPortCurZoomAttr


3.28. MI_VPE_LdcConfig

  • Description

    Define Ldc Config

  • Definition

    typedef struct MI_VPE_LdcConfig_s
    
    {
    
        void *pCfgAddr;
    
        MI_U32 u32CfgSize;
    
    } MI_VPE_LdcConfig_t;
    
  • Member

    Member Name Description
    pCfgAddr Addr of Config
    u32CfgSize Size of Config
  • Related data types and interfaces

    MI_VPE_LDCSetBatchViewConfig


4. Error code

VPE API error code is defined in the table below:

Error Code Macro Definition Description
0xA0078001 MI_ERR_VPE_INVALID_CHNID Channel ID invalid
0xA0078002 MI_ERR_VPE_INVALID_PORITD Port ID invalid
0xA0078003 MI_ERR_VPE_ILLEGAL_PARAM Channel parameter illegal
0xA0078004 MI_ERR_VPE_EXIST Channel port existed
0xA0078005 MI_ERR_VPE_UNEXIST Channel port un-existed
0xA0078006 MI_ERR_VPE_NULL_PTR Null pointer
0xA0078008 MI_ERR_VPE_NOT_SUPPORT Not supported
0xA0078009 MI_ERR_VPE_NOT_PERM Not permitted
0xA007800C MI_ERR_VPE_NOMEM No memory
0xA007800D MI_ERR_VPE_NOBUF No buffer
0xA007800E MI_ERR_VPE_BUF_EMPTY Buffer empty
0xA0078010 MI_ERR_VPE_NOTREADY Channel not ready
0xA0078012 MI_ERR_VPE_BUSY Channel busy