MI IVE API


REVISION HISTORY

Revision No.
Description
Date
2.03
  • Initial release.
  • 04/12/2018
    2.04
  • Added function descriptions in regard to MI_IVE_Bernsen, MI_IVE_LineFilterHor, MI_IVE_LineFilterVer, MI_IVE_NoiseRemoveHor, MI_IVE_NoiseRemoveVer, MI_IVE_AdpThresh, MI_IVE_Resize, MI_IVE_BAT, and MI_IVE_Acc.
  • 06/05/2019
    2.05
  • Added function descriptions to MI_IVE_Matrix_Transform and MI_IVE_Image_Dot.
  • Added description of new input parameter for add function.
  • Added description of new input mode for lbp function.
  • 10/09/2019
    2.06
  • Added function description to MI_IVE_Shift_Detector.
  • 09/16/2020
    2.07
  • Modified the description of MI_IVE_Csc.
  • Modified the parameters range for matrix transform function.
  • Modified the description of return value.
  • Added API reference: MI_IVE_Shift_detector; MI_IVE_Alphablending.
  • 10/14/2020
    2.08
  • Correct the formula of MagAndAng and CannyHsysEdge.
  • Add description of MI_IVE_MatrTranfCtrlMode_e.
  • 08/13/2021
    2.09
  • More detailed description of MI_IVE_Ccl calling method.
  • Added fourth paragraph topic---Hardware acceleration implementation list.
  • 08/26/2021
    2.10
  • Add note for matrix_transform.
  • 01/26/2022
    2.11
  • Add new support enMode for CSC.
  • 03/15/2022
    2.12
  • Added function description to MI_IVE_Create_Handle.
  • Rename IVE lib.
  • 03/18/2022
    2.13
  • Fix format error.
  • 04/22/2022
    2.14
  • Add description about limitation.
  • 06/02/2022
    2.15
  • Add new API reference of MI_IVE_BGBlur.
  • Modify description of MI_IVE_Ccl & MI_IVE_Gmm & MI_IVE_Resize.
  • Add new datatype of MI_IVE_HANDLE_MAX & MI_IVE_ResizeMethod_e & MI_IVE_BgBlurMode_e & MI_IVE_BgBlurCtrl_t.
  • 12/13/2022
    2.16
  • Update the maximum resolution limitation of MI_IVE_Resize.
  • 03/30/2023
    2.17
  • Add Mask preprocess mode of BGBlur.
  • 07/31/2023
    2.18
  • Revise and refine formulas in document.
  • Refine the figure of coefficient template & MI_IVE_Thresh & MI_IVE_Gmm, and add the figure of MI_IVE_ThreshS16 & MI_IVE_ThreshU16.
  • Move the common part in MI_IVE_Filter to the front of API reference.
  • Modify the description of MI_IVE_Ccl & MI_IVE_Gmm & MI_IVE_Resize & MI_IVE_BGBlur.
  • 08/22/2023
    2.19
  • Refine the description and add the example for MI_IVE_Filter & MI_IVE_OrdStatFiler & MI_IVE_Resize.
  • Add new section 5.PROCFS INTRODUCTION.
  • 04/23/2024
    2.20
  • Document optimization.
  • 04/18/2025

    1. OVERVIEW


    1.1. Module Description

    MI_IVE(Intelligent Video Engine)refers to the image/video engine module, mainly providing the API of image algorithms. It can be used for tasks such as encoding, decoding, feature extraction, object detection, face recognition, image enhancement, image denoising, and motion detection of images and videos. There are two implementation sources. One is HW IVE, which is a hardware implementation and is used by calling the driver. One is SW IVE, which is implemented by software and used through the mve interface. The priority of the execution operators is: HW IVE > Neon > PureC.


    1.2. Basic Structure

    MI_IVE hardlinks the key software operators or common operators that consume the most CPU resources and are used in image and intelligent video analysis to form an image coprocessor. Before hardening, the operators are calculated using SW ALG. After hardening, the operators are calculated using HW. Therefore, there will be some changes in some resolution sizes, parameter ranges and the required memory space size. Compared with the previous calculation using SW ALG, the calculation using HW can improve the performance of the operator, thereby enhancing the ability and computing speed of the entire chip for video analysis.

    Figure 1‑1 MI_IVE Module Architecture


    1.3. Function Introduction

    MI_IVE supports the following functions:

    1. Support the execution of HW/SW operators

    2. Support the switching of hw<->sw operators

    3. Supports multiple input/output image resolutions and picture formats


    1.4. Application Scenarios

    MI_IVE can be applied to the following scenarios:

    1. Linux scenarios

      In the Linux environment, when users/modules call the MI IVE API, they need to link libmi_ive.a/so. When using non-public MI IVE APIs, they need to include "mi_ive_internal.h" to call the corresponding API.

    2. Rtos scenarios

      In the rtos environment, mi_ive.lib will be placed in the rtos binary. During the execution of the API, based on the selected defconfig configuration, it will be confirmed by MI_SYSCALL_SOCID to be executed into the code of mi_ive.ko or mi_ive.lib.


    1.5. Chip Difference

    The current is the description of the pcupid series chip.

    Table 1-1 Implementation table of Intelligent Acceleration Hardware API

    API Name Ispahan Pudding/Tiramisu/Muffin Souffle iFord pcupid
    MI_IVE_Csc v v v
    MI_IVE_FilterAndCsc v v v
    MI_IVE_Filter v v v v
    MI_IVE_MagAndAng v v v
    MI_IVE_Hist v v v
    MI_IVE_Integ v v v
    MI_IVE_Dilate v v v v
    MI_IVE_Erode v v v v
    MI_IVE_Map v v v
    MI_IVE_And v v v v
    MI_IVE_Or v v v v
    MI_IVE_Xor v v v v
    MI_IVE_Add v v v v
    MI_IVE_Sub v v v v
    MI_IVE_Ncc v v v
    MI_IVE_Sobel v v v
    MI_IVE_Thresh v v v v
    MI_IVE_ThreshS16 v v v v
    MI_IVE_ThreshU16 v v v v
    MI_IVE_16BitTo8Bit v v v
    MI_IVE_OrdStatFilter v v v v
    MI_IVE_Sad v v v v
    MI_IVE_Bernsen v v v v
    MI_IVE_Lbp v v v
    MI_IVE_BAT v v v
    MI_IVE_AdpThresh v v v
    MI_IVE_Matrix_Transform v v v
    MI_IVE_Image_Dot v v v
    MI_IVE_AlphaBlending v v v
    MI_IVE_Ccl v
    MI_IVE_Gmm v
    MI_IVE_Resize v v
    MI_IVE_BGBlur v v

    1.6. Working Principle


    1.6.1 API Process

    Figure 1‑1 MI_IVE API Process


    1.6.2 Description of the intelligent acceleration engine flush and Invalidate mechanism

    The intelligent acceleration engine supports pure software, Neon acceleration and hardware acceleration. When continuously calling the IVE API, it internally supports automatic Cache Invalidate and Cache Flush of the MI_IVE_Image_t structure variable. Only before and after calling the hardware acceleration operator and before and after the CPU's intervention in the operation, Cache Invalidate or Cache Flush needs to be performed independently. The following example illustrates that a MI_IVE_Image_t src is declared; src.u16Reserved is initialized to 0. During the operation process of the intelligent acceleration engine, this flag is used to record the status of software and hardware. If the IVE API is continuously called (as shown on the left in the figure), even if MI_IVE_Ccl is purely soft operation, It still supports automatic Cache Invalidate and Cache Flush internally. If the memory is intervened by the CPU for operation (as shown on the right in the figure), or when the API call ends, the user must perform a Cache Invalidate or Cache Flush by themselves and set src.u16Reserved to 0. The hardware acceleration supported by different chips should refer to Table 1-1.


    1.6.3 Instructions on Usage Restrictions of the Intelligent Acceleration Engine

    • address : 16-byte alignment

    • stride : 16-pixel alignment

    • width : 16-pixel alignment,MI_IVE_BGBlursupport 2-pixel alignment

    • height : 2-pixel alignment


    1.6.4 Confirmation Instructions for the use of the Intelligent acceleration Engine

    Can check the register of IVE for confirmation. Each function has its own corresponding code.

    Table 1-2 IVE Register Info-1

    Ispahan Pudding/Tiramisu/Muffin Souffle/iFord/pcupid
    BANK 1521 1191 151F
    OFFSET 0004 0004 0004

    Table 1-3 IVE Register Info-2

    op_type Function
    0x00 MI_IVE_Filter
    0x01 MI_IVE_Csc
    0x02 MI_IVE_FilterAndCsc
    0x03 MI_IVE_Sobel
    0x04 MI_IVE_MagAndAng
    0x05 MI_IVE_OrdStatFilter
    0x06 MI_IVE_Bernsen
    0x07 MI_IVE_Dilate
    0x08 MI_IVE_Erode
    0x09 MI_IVE_Thresh
    0x0A MI_IVE_ThreshS16
    0x0B MI_IVE_ThreshU16
    0x0C MI_IVE_And
    0x0D MI_IVE_Or
    0x0E MI_IVE_Xor
    0x0F MI_IVE_Add
    0x10 MI_IVE_Sub
    0x11 MI_IVE_16BitTo8Bit
    0x12 MI_IVE_Map
    0x13 MI_IVE_Hist
    0x14 MI_IVE_Integ
    0x15 MI_IVE_Sad
    0x16 MI_IVE_Ncc
    0x18 MI_IVE_Lbp
    0x1F MI_IVE_Matrix_Transform
    0x20 MI_IVE_Image_Dot
    0x21 MI_IVE_AlphaBlending
    0x22 MI_IVE_Ccl
    0x23 MI_IVE_Gmm
    0x24 MI_IVE_Resize
    0xFF MI_IVE_BGBlur

    1.7. Development Process


    1.7.1 Compilation Configuration

    1. Enter the root directory of alkaid project,make menuconfig

    2. Press Enter to enter the Sdk Config sub-options

    3. Press Enter to enter the Interface Compile Config sub-options

    4. Press the space bar to select the ive submodule,and recompile project

      After the compilation is completed, mi_ive.ko will be generated under sdk/interface/src/ive. Meanwhile, mi_ive.h and mi_ive_datatype.h will be released to the project/release directory. In the pure linux environment, it will be packaged into images by default. In the dualos environment, it is not packaged by default and needs to be manually compiled and installed.


    1.8. Example Introduction

    Take the use of the Filter operator as an example: MI_IVE_Filter


    2. API REFERENCE


    The MI IVE module provides the following APIs:

    Name of API Function
    MI_IVE_Create_Handle Create IVE handle index
    MI_IVE_Create Create an IVE handle
    MI_IVE_Destroy Destroy an IVE handle
    MI_IVE_Filter Execute a 5x5 template filter task
    MI_IVE_Csc Execute a color space conversion task
    MI_IVE_FilterAndCsc Execute a composite task of template filter plus color space conversion
    MI_IVE_Sobel Execute a 5x5 template Sobel-like gradient calculation task
    MI_IVE_MagAndAng Execute a 5x5 template gradient magnitude and angle calculation task
    MI_IVE_Dilate Execute a Dilate task
    MI_IVE_Erode Execute an Erode task
    MI_IVE_Thresh Execute an image thresholding task
    MI_IVE_And Execute an And task
    MI_IVE_Sub Execute a Subtract task
    MI_IVE_Or Execute an Or task
    MI_IVE_Integ Execute an integral graph statistics task
    MI_IVE_Hist Execute a histogram statistics task
    MI_IVE_ThreshS16 Execute an S16 data to 8-bit data thresholding task
    MI_IVE_ThreshU16 Execute a U16 data to U8 data thresholding task
    MI_IVE_16BitTo8Bit Execute a 16-bit data to 8-bit data linear transformation task
    MI_IVE_OrdStatFilter Execute a 3x3 template sequential statistic filtering task
    MI_IVE_Map Execute a Map (U8->U8 mapping assignment) task
    MI_IVE_EqualizeHist Execute a grayscale-image histogram equalization calculation task
    MI_IVE_Add Execute a weighted addition calculation task against two grayscale images
    MI_IVE_Xor Execute an XOR calculation task against two binary graphs
    MI_IVE_Ncc Execute a normalized cross-correlation calculation task against two images of the same resolution
    MI_IVE_Ccl Execute a connected region label task against binary images
    MI_IVE_Gmm Execute a GMM background modeling task
    MI_IVE_CannyHysEdge Execute a Canny strong edge extraction task against grayscale images
    MI_IVE_CannyEdge Execute the second half of Canny strong edge extraction task: connecting edge points to form a Canny edge map
    MI_IVE_Lbp Execute an LBP calculation task
    MI_IVE_NormGrad Execute a normalized gradient calculation task, in which the gradient average components are normalized to S8
    MI_IVE_LkOpticalFlow Execute a single layer LK optical flow calculation task
    MI_IVE_Sad Calculate 16-bit/8-bit SAD images of 4x4/8x8/16x16 blocks for two images, and threshold output for SAD
    MI_IVE_Bernsen Execute a Bernsen thresholding task for the 3x3 and 5x5 windows.
    MI_IVE_LineFilterHor Execute a horizontal density filter task for binary images.
    MI_IVE_LineFilterVer Execute a vertical density filter task for binary images.
    MI_IVE_NoiseRemoveHor Execute a horizontal noise removal task for binary images.
    MI_IVE_NoiseRemoveVer Execute a vertical noise removal task for binary images.
    MI_IVE_AdpThresh Execute an adaptive thresholding task.
    MI_IVE_Resize Execute an image scaling task.
    MI_IVE_BAT Execute the horizontal or vertical alternating time for binary images.
    MI_IVE_Acc Execute an accumulation task for two gray-scale images.
    MI_IVE_Matrix_Transform Execute the operation of matrix multiplication.
    MI_IVE_Image_Dot Execute the operation of dot product.
    MI_IVE_Shift_Detector Execute the operation of object tracking.
    MI_IVE_AlphaBlending Execute an independent weighted addition calculation task against two grayscale images.
    MI_IVE_BGBlur Execute the task of blur, replacement, mosaic or blur with mosaic for image background.

    Note:

    • Stride

      • MI_IVE_Image_t The stride of image data indicates the number of units which is calculated on the basis of "pixels" of an image in one line, the bit width of "pixel" can be 8/16-bit.

      • MI_IVE_Data_t The stride of two-dimensional data indicates the number of bytes in one line of two-dimensional data.

        MI_IVE_Data_t can be looked upon as an image with "pixels" presented in 8-bit addressing. In this light, the stride can be interpreted as the number of units which is calculated on the basis of "pixels" of an image or two-dimensional data in one line.

        Fig 1-1: Data Stride

    • Alignment

      For rapidly accessing the memory start address or data across rows, Hardware requires that the memory address/stride must be a multiple of the alignment factor.

      • Start address alignment for data memory

        The current IVE operator requires that the Input/Output start address should be 1 / 2 / 16-byte-aligned. For details, please refer to the parameter requirement in each APIs.

      • Stride alignment

        The stride of generalized two-dimensional images, two-dimensional single-component data and one-dimensional array data must be 16-pixel-aligned.

    • Input/Output data type (for detailed structure definition, please refer to Chapter IVE DATA TYPE)

    • Types of generalized two-dimensional image

      Image Type Image Description Memory Address Usage Stride Usage
      E_MI_IVE_IMAGE_TYPE_U8C1 8-bit unsigned single channel image aphyPhyAddr[0] and apu8VirAddr[0] are used Only u16Stride[0] is used
      E_MI_IVE_IMAGE_TYPE_S8C1 8-bit signed single channel image aphyPhyAddr[0] and apu8VirAddr[0] are used Only u16Stride[0] is used
      E_MI_IVE_IMAGE_TYPE_YUV420SP Image in YUV420 Semiplanar format aphyPhyAddr[0], apu8VirAddr[0] (Y component), aphyPhyAddr[1], apu8VirAddr[1] (UV component) are used
      the UV component data is placed in order of UV
      au16Stride[0] (stride of Y component), au16Stride[1] (stride of UV component) are used
      E_MI_IVE_IMAGE_TYPE_YUV422SP Image in YUV422 Semiplanar format aphyPhyAddr[0], apu8VirAddr[0] (Y component), aphyPhyAddr[1], apu8VirAddr[1] (UV component) are used
      the UV component data is placed in order of UV
      au16Stride[0] (stride of Y component), au16Stride[1] (stride of UV component) are used
      E_MI_IVE_IMAGE_TYPE_YUV420P Image in YUV420 Planar format aphyPhyAddr[0], apu8VirAddr[0] (Y component), aphyPhyAddr[1], apu8VirAddr[1] (U component), aphyPhyAddr[2], apu8VirAddr[2] (V component) are used au16Stride[0] (stride of Y component), au16Stride[1] (stride of U component), au16Stride[2] (stride of V component) are used
      E_MI_IVE_IMAGE_TYPE_YUV422P Image in YUV422 Planar format aphyPhyAddr[0], apu8VirAddr[0] (Y component), aphyPhyAddr[1], apu8VirAddr[1] (U component), aphyPhyAddr[2], apu8VirAddr[2] (V component) are used au16Stride[0] (stride of Y component), au16Stride[1] (stride of U component), au16Stride[2] (stride of V component) are used
      E_MI_IVE_IMAGE_TYPE_S8C2_PACKAGE 8-bit signed dual-channel image
      dual-channel image in package format
      aphyPhyAddr[0], apu8VirAddr[0] (channel 0&1 component) are used au16Stride[0] (stride of channel 0&1 component) is used
      E_MI_IVE_IMAGE_TYPE_S8C2_PLANAR 8 bit signed dual-channel image
      dual-channel image in planar format
      aphyPhyAddr[0], apu8VirAddr[0] (channel 0 component), aphyPhyAddr[1], apu8VirAddr[1] (channel 1 component) are used au16Stride[0] (stride of channel 0 component), au16Stride[1] (stride of channel 1 component) are used
      E_MI_IVE_IMAGE_TYPE_S16C1 16 bit signed single channel image aphyPhyAddr[0] and apu8VirAddr[0] are used Only u16Stride[0] is used
      E_MI_IVE_IMAGE_TYPE_U16C1 16 bit unsigned single channel image aphyPhyAddr[0] and apu8VirAddr[0] are used Only u16Stride[0] is used
      E_MI_IVE_IMAGE_TYPE_U8C3_PACKAGE 8-bit unsigned 3-channel image
      3-channel image in package format
      aphyPhyAddr[0], apu8VirAddr[0] (channel 0&1&2 component) are used au16Stride[0] (stride of channel 0&1&2 component) is used
      E_MI_IVE_IMAGE_TYPE_U8C3_PLANAR 8 bit unsigned 3-channel image
      3-channel image in planar format
      aphyPhyAddr[0], apu8VirAddr[0] (channel 0 component), aphyPhyAddr[1], apu8VirAddr[1] (channel 1 component), aphyPhyAddr[2], apu8VirAddr[2] (channel 2 component) are used au16Stride[0] (stride of channel 0 component), au16Stride[1] (stride of channel 1 component), au16Stride[2] (stride of channel 2 component) are used
      E_MI_IVE_IMAGE_TYPE_S32C1 32 bit signed single channel image aphyPhyAddr[0] and apu8VirAddr[0] are used Only u16Stride[0] is used
      E_MI_IVE_IMAGE_TYPE_U32C1 32 bit unsigned single channel image aphyPhyAddr[0] and apu8VirAddr[0] are used Only u16Stride[0] is used
      E_MI_IVE_IMAGE_TYPE_S64C1 64 bit signed single channel image aphyPhyAddr[0] and apu8VirAddr[0] are used Only u16Stride[0] is used
      E_MI_IVE_IMAGE_TYPE_U64C1 64 bit unsigned single channel image aphyPhyAddr[0] and apu8VirAddr[0] are used Only u16Stride[0] is used
      E_MI_IVE_IMAGE_TYPE_YUV420SP_NV21 Image in YUV420 Semiplanar format aphyPhyAddr[0], apu8VirAddr[0] (Y component), aphyPhyAddr[1], apu8VirAddr[1] (UV component) are used
      the UV component data is placed in order of VU
      au16Stride[0] (stride of Y component), au16Stride[1] (stride of UV component) are used
      E_MI_IVE_IMAGE_TYPE_YUV422_YUYV Image in YUV422 package format Only aphyPhyAddr[0] and apu8VirAddr[0] are used (Y&U&V component)
      the YUV component data is placed in order of YUYV
      Only u16Stride[0] is used (stride of Y&U&V component)

    • The matrix storage.

      • Row-major: the elements in the same row are placed in order in the memory.

      • Column-major: the elements in the same column are placed in order in the memory.

      • The storage example of the matrix which placed in row/column-major is as follows:


    2.1. MI_IVE_Create_Handle

    • Function

      Create IVE handle and available handle index.

    • Syntax

      MI_IVE_HANDLE MI_IVE_Create_Handle();
      
    • Return Value

      Return Value Description
      Handle index Range: [0, MI_IVE_HANDLE_MAX)
      MI_IVE_HANDLE_MAX Failed.
    • Requirement

      • Header: mi_common_datatype.h, mi_ive.h, mi_ive_datatype.h

      • Library: libmi_ive.a

    • Note

      • Please choose your process between MI_IVE_Create_Handle and MI_IVE_Create.

    2.2. MI_IVE_Create

    • Function

      Create an IVE handle

    • Syntax

      MI_S32 MI_IVE_Create(MI_IVE_HANDLE hHandle);
      
    • Parameter

      Parameter Name Description Input/Output
      hHandle Regional handle number.
      Must be an unused hHandle number.
      Parameter range: [0, MI_IVE_HANDLE_MAX)
      Input
    • Return Value

      Return Value Description
      0 Successful.
      Non-zero Failed. Please refer to ERROR CODE.
    • Requirement

      • Header: mi_common_datatype.h, mi_ive.h, mi_ive_datatype.h

      • Library: libmi_ive.a

    • Note


    2.3. MI_IVE_Destroy

    • Function

      Release an IVE handle

    • Syntax

      MI_S32 MI_IVE_Destroy(MI_IVE_HANDLE hHandle);
      
    • Parameter

      Parameter Name Description Input/Output
      hHandle Regional handle number.
      Parameter range: [0, MI_IVE_HANDLE_MAX).
      Input
    • Return Value

      Return Value Description
      0 Successful.
      Non-zero Failed. Please refer to ERROR CODE.
    • Requirement

      • Header: mi_common_datatype.h, mi_ive.h, mi_ive_datatype.h

      • Library: libmi_ive.a


    2.4. MI_IVE_Filter

    • Function

      Execute a 5x5 template filter task, and different filtering result including mean filtering and Gaussian filtering can be achieved by configuring specific coefficients.

    • Syntax

      MI_S32 MI_IVE_Filter(MI_IVE_HANDLE hHandle, MI_IVE_SrcImage_t *pstSrc, MI_IVE_DstImage_t *pstDst, MI_IVE_FilterCtrl_t *pstFltCtrl, MI_BOOL bInstant);
      
    • Parameter

      Parameter Name Description Input/Output
      hHandle Regional handle number. Parameter range: [0, MI_IVE_HANDLE_MAX). Input
      pstSrc Source image pointer. Cannot be null. Input
      pstDst Output image pointer. Cannot be null. Width and height same as pstSrc. Output
      pstFltCtrl Control info pointer. Cannot be null. Input
      bInstant Reserved. Input
      Parameter Name Supported Image Type Address Alignment Resolution
      pstSrc U8C1, YUV420SP, YUV422SP 16 byte 64x64 ~ 1920x1080
      pstDst Same as pstSrc 16 byte Same as pstSrc
      • U8C1, YUV420SP, and YUV422SP are the short form of MI_IVE_ImageType_e member. Other members will adopt the same naming rule throughout the rest of the document.

      • For Pcupid series: The hardware acceleration is supported when the format is U8C1 and the resolution is not exceeded 640x480.

    • Return Value

      Return Value Description
      0 Successful.
      Non-zero Failed. Please refer to ERROR CODE.
    • Requirement

      • Header: mi_common_datatype.h, mi_ive.h, mi_ive_datatype.h

      • Library: libmi_ive.a

    • Note

      • When the source data type is YUV420SP or YUV422SP, the output data stride must be consistent.

        Fig 1-2: Filter Calculation Formula.

      • The calculation formula of Filter is as follows:

        I_{out}(x,y)={\sum_{-2\leqslant i\leqslant2} \sum_{-2\leqslant j\leqslant2} I(x+i,y+j)*coef(x+i,y+j)}>>norm

        Where, I(x,y) refers to pstSrc, I_{out}(x,y) refers to pstDst, coef(x,y) refers to as8Mask[MI_IVE_MASK_SIZE_5X5] in pstFltCtrl, and norm refers to u8Norm in pstFltCtrl.

      • The classic Gaussian template is as illustrated below:

        \begin{bmatrix} 0 &0 &0 &0 &0 \\ 0 &1 &2 &1 &0 \\ 0 &2 &4 &2 &0 \\ 0 &1 &2 &1 &0 \\ 0 &0 &0 &0 &0 \end{bmatrix} \ u8Norm=4 \quad \begin{bmatrix} 1 &2 &3 &2 &1 \\ 2 &5 &6 &5 &2 \\ 3 &6 &8 &6 &3 \\ 2 &5 &6 &5 &2 \\ 1 &2 &3 &2 &1 \end{bmatrix} * 3 \ \ u8Norm=8 \quad \begin{bmatrix} 1 &4 &7 &4 &1 \\ 4 &16 &26 &16 &4 \\ 7 &26 &41 &26 &7 \\ 4 &16 &26 &16 &4 \\ 1 &4 &7 &4 &1 \end{bmatrix} \ u8Norm=8
    • Related API

      MI_IVE_FilterAndCsc

      MI_IVE_OrdStatFilter

    • Example

      MI_S32 Sample_Filter()
      {
          MI_IVE_HANDLE handle = 0;
          MI_IVE_SrcImage_t stSrc = {0};
          MI_IVE_DstImage_t stDst = {0};
          MI_IVE_FilterCtrl_t stCtrl =
          {
              // 3x3 coefficients for image sharpening
              .as8Mask =
              {
                  0,0,0,0,0,
                  0,-1,-1,-1,0,
                  0,-1, 9,-1,0,
                  0,-1,-1,-1,0,
                  0,0,0,0,0,
              },
              .u8Norm = 0
              /*
              // 5x5 coefficients for mean filter
              .as8Mask =
              {
                  41,41,41,41,41,
                  41,41,41,41,41,
                  41,41,40,41,41,
                  41,41,41,41,41,
                  41,41,41,41,41,
              },
              .u8Norm = 10
              */
          };
      
          // create IVE handle
          if (MI_SUCCESS != (s32Ret = MI_IVE_Create(handle)))
          {
              printf("Could not create IVE handle\n");
              return E_MI_ERR_FAILED;
          }
      
          while (loop_condition == true)
          {
              // ...set input image info to stSrc. e.g. stSrc.eType = E_MI_IVE_IMAGE_TYPE_U8C1;
              ...
      
              // ...set output image info to stDst. e.g. stDst.eType = E_MI_IVE_IMAGE_TYPE_U8C1;
              ...
      
              // Filter task.
              if (MI_SUCCESS != (s32Ret = MI_IVE_Filter(handle, &stSrc, &stDst, &stCtrl, 0)))
              {
                  printf("MI_IVE_Filter() return ERROR 0x%X\n", s32Ret);
                  MI_IVE_Destroy(handle);
                  return E_MI_ERR_FAILED;
              }
      
              // get output from stDst and do something expected.
              ...
          }
      
          // destroy IVE handle
          MI_IVE_Destroy(handle);
          return MI_SUCCESS;
      }
      

    2.5. MI_IVE_Csc

    • Function

      Execute a color space conversion task for color space conversion with respect to YUV2RGB/YUV2BGR/RGB2YUV/BGR2YUV.

    • Syntax

      MI_S32 MI_IVE_Csc(MI_IVE_HANDLE hHandle, MI_IVE_SrcImage_t *pstSrc, MI_IVE_DstImage_t *pstDst, MI_IVE_CscCtrl_t *pstCscCtrl, MI_BOOL bInstant);
      
    • Parameter

      Parameter Name Description Input/Output
      hHandle Regional handle number. Parameter range: [0, MI_IVE_HANDLE_MAX). Input
      pstSrc Source image pointer. Cannot be null. Input
      pstDst Output image pointer. Cannot be null. Width and height same as pstSrc. Output
      pstCscCtrl Control info pointer. Cannot be null. Input
      bInstant Reserved. Input
      Parameter Name Supported Image Type Address Alignment Resolution
      pstSrc YUV420SP(NV12), YUV422SP, U8C3_PLANAR, U8C3_PACKAGE, YUV420SP_NV21 16 byte 64x64 ~ 1920x1080
      pstDst YUV420SP(NV12), YUV422SP, U8C3_PLANAR, U8C3_PACKAGE, YUV420SP_NV21 16 byte Same as pstSrc
    • Return Value

      Return Value Description
      0 Successful.
      Non-zero Failed. Please refer to ERROR CODE.
    • Requirement

      • Header: mi_common_datatype.h, mi_ive.h, mi_ive_datatype.h

      • Library: libmi_ive.a

    • Note

      • When the output data type is U8C3_PLANAR, YUV420SP or YUV422SP, the output data stride must be consistent.

      • Different work modes have different output parameter ranges. For details, please refer to MI_IVE_CscMode_e.

      • Conversion formula as below :

        \begin{bmatrix} Y \\ U \\ V \\ \end{bmatrix} = \begin{bmatrix} 0.299 &0.587 &0.114 \\ -0.169 &-0.331 &0.5 \\ 0.5 &-0.419 &-0.081 \\ \end{bmatrix} \begin{bmatrix} R \\ G \\ B \\ \end{bmatrix} + \begin{bmatrix} 0 \\ 128 \\ 128 \\ \end{bmatrix}
        \begin{bmatrix} R \\ G \\ B \\ \end{bmatrix} = \begin{bmatrix} 1 &-0.00093 &1.401687 \\ 1 &-0.3437 &-0.71417 \\ 1 &1.77216 &0.00099 \\ \end{bmatrix} \begin{bmatrix} Y \\ U-128 \\ V-128 \\ \end{bmatrix}
    • Related API

      MI_IVE_FilterAndCsc


    2.6. MI_IVE_FilterAndCsc

    • Function

      Execute a composite task of 5x5 template filter plus YUV2RGB color space conversion, to accomplish two functions by one single execution.

    • Syntax

      MI_S32 MI_IVE_FilterAndCsc(MI_IVE_HANDLE hHandle, MI_IVE_SrcImage_t *pstSrc, MI_IVE_DstImage_t *pstDst, MI_IVE_FilterAndCscCtrl_t *pstFltCscCtrl, MI_BOOL bInstant);
      
    • Parameter

      Parameter Name Description Input/Output
      hHandle Regional handle number. Parameter range: [0, MI_IVE_HANDLE_MAX). Input
      pstSrc Source image pointer. Cannot be null. Input
      pstDst Input image pointer. Cannot be null. Width and height same as pstSrc. Output
      pstFltCscCtrl Control info pointer. Cannot be null. Input
      bInstant Reserved. Input
      Parameter Name Supported Image Type Address Alignment Resolution
      pstSrc YUV420SP, YUV422SP 16 byte 64x64 ~ 1920x1080
      pstDst U8C3_PLANAR, U8C3_PACKAGE 16 byte Same as pstSrc
    • Return Value

      Return Value Description
      0 Successful.
      Non-zero Failed. Please refer to ERROR CODE.
    • Requirement

      • Header: mi_common_datatype.h, mi_ive.h, mi_ive_datatype.h

      • Library: libmi_ive.a

    • Note

      • When the output data type is U8C3_PLANAR, the output data stride must be consistent.

      • Only the four work modes of YUV2RGB are supported. For details, please refer to MI_IVE_CscMode_e.

    • Related API

      MI_IVE_Filter


    2.7. MI_IVE_Sobel

    • Function

      Execute a 5x5 template Sobel-like gradient calculation task

    • Syntax

      MI_S32 MI_IVE_Sobel(MI_IVE_HANDLE hHandle, MI_IVE_SrcImage_t *pstSrc, MI_IVE_DstImage_t *pstDstH, MI_IVE_DstImage_t *pstDstV, MI_IVE_SobelCtrl_t *pstSobelCtrl, MI_BOOL bInstant);
      
    • Parameter

      Parameter Name Description Input/Output
      hHandle Regional handle number. Parameter range: [0, MI_IVE_HANDLE_MAX). Input
      pstSrc Source image pointer. Cannot be null. Input
      pstDstH Gradient component image H pointer gained by template filtering. According to pstSobelCtrl→eOutCtrl, this parameter cannot be null if output is required. Width and height same as pstSrc. Output
      pstDstV Gradient component image V pointer gained by transposed template filtering. According to pstSobelCtrl→eOutCtrl, this parameter cannot be null if output is required. Width and height same as pstSrc. Output
      pstSobelCtrl Control info pointer. Cannot be null. Input
      bInstant Reserved. Input
      Parameter Name Supported Image Type Address Alignment Resolution
      pstSrc U8C1 16 byte 64x64 ~ 1920x1080
      pstDstH S16C1 16 byte Same as pstSrc
      pstDstV S16C1 16 byte Same as pstSrc
    • Return Value

      Return Value Description
      0 Successful.
      Non-zero Failed. Please refer to ERROR CODE.
    • Requirement

      • Header: mi_common_datatype.h, mi_ive.h, mi_ive_datatype.h

      • Library: libmi_ive.a

    • Note

      • When the output mode is E_MI_IVE_SOBEL_OUT_CTRL_BOTH, the stride of pstDstH and the stride of pstDstV must be consistent.

      • Three output modes are available for configuration. Please refer to MI_IVE_SobelOutCtrl_e.

        Fig 1-3: Sobel Calculation Formula.

      • The calculation formula of Sobel is as follows:

        H_{out}(x,y)=\sum_{-2\leqslant i\leqslant2}\sum_{-2\leqslant j\leqslant2}I(x+i,y+j)*coef(x+i,y+j)
        V_{out}(x,y)=\sum_{-2\leqslant i\leqslant2}\sum_{-2\leqslant j\leqslant2}I(x+i,y+j)*coef(x+j,y+i)

        Where, I(x, y) refers to pstSrc, H_{out}(x, y) refers to pstDstH, V_{out}(x, y) refers to pstDstV, and coef(x,y) refers to as8Mask[MI_IVE_MASK_SIZE_5X5] in pstSobelCtrl.

      • Sobel template

        \begin{bmatrix} 0 &0 &0 &0 &0 \\ 0 &-1 &0 &1 &0 \\ 0 &-2 &0 &2 &0 \\ 0 &-1 &0 &1 &0 \\ 0 &0 &0 &0 &0 \end{bmatrix} \begin{bmatrix} 0 &0 &0 &0 &0 \\ 0 &-1 &-2 &-1 &0 \\ 0 &0 &0 &0 &0 \\ 0 &1 &2 &1 &0 \\ 0 &0 &0 &0 &0 \end{bmatrix}
        \begin{bmatrix} -1 &-2 &0 &2 &1 \\ -4 &-8 &0 &8 &4 \\ -6 &-12 &0 &12 &6 \\ -4 &-8 &0 &8 &4 \\ -1 &-2 &0 &2 &1 \end{bmatrix} \begin{bmatrix} -1 &-4 &-6 &-4 &-1 \\ -2 &-8 &-12 &-8 &-2 \\ 0 &0 &0 &0 &0 \\ 2 &8 &12 &8 &2 \\ 1 &4 &6 &4 &1 \end{bmatrix}
      • Scharr template

        \begin{bmatrix} 0 &0 &0 &0 &0 \\ 0 &-3 &0 &3 &0 \\ 0 &-10 &0 &10 &0 \\ 0 &-3 &0 &3 &0 \\ 0 &0 &0 &0 &0 \end{bmatrix} \begin{bmatrix} 0 &0 &0 &0 &0 \\ 0 &-3 &-10 &-3 &0 \\ 0 &0 &0 &0 &0 \\ 0 &3 &10 &3 &0 \\ 0 &0 &0 &0 &0 \end{bmatrix}
      • Laplace template

        \begin{bmatrix} 0 &0 &0 &0 &0 \\ 0 &0 &1 &0 &0 \\ 0 &1 &-4 &1 &0 \\ 0 &0 &1 &0 &0 \\ 0 &0 &0 &0 &0 \end{bmatrix} \begin{bmatrix} 0 &0 &0 &0 &0 \\ 0 &0 &-1 &0 &0 \\ 0 &-1 &4 &-1 &0 \\ 0 &0 &-1 &0 &0 \\ 0 &0 &0 &0 &0 \end{bmatrix}
        \begin{bmatrix} 0 &0 &0 &0 &0 \\ 0 &1 &1 &1 &0 \\ 0 &1 &-8 &1 &0 \\ 0 &1 &1 &1 &0 \\ 0 &0 &0 &0 &0 \end{bmatrix} \begin{bmatrix} 0 &0 &0 &0 &0 \\ 0 &-1 &-1 &-1 &0 \\ 0 &-1 &8 &-1 &0 \\ 0 &-1 &-1 &-1 &0 \\ 0 &0 &0 &0 &0 \end{bmatrix}
    • Related API

      MI_IVE_MagAndAng

      MI_IVE_NormGrad


    2.8. MI_IVE_MagAndAng

    • Function

      Execute a 5x5 template gradient magnitude and angle calculation task.

    • Syntax

      MI_S32 MI_IVE_MagAndAng(MI_IVE_HANDLE hHandle, MI_IVE_SrcImage_t *pstSrc, MI_IVE_DstImage_t *pstDstMag, MI_IVE_DstImage_t *pstDstAng, MI_IVE_MagAndAngCtrl_t *pstMagAndAngCtrl, MI_BOOL bInstant);
      
    • Parameter

      Parameter Name Description Input/Output
      hHandle Regional handle number. Parameter range: [0, MI_IVE_HANDLE_MAX). Input
      pstSrc Source image pointer. Cannot be null. Input
      pstDstMag Output magnitude image pointer. Cannot be null. Width and height same as pstSrc. Output
      pstDstAng Output angle image pointer. According to pstMagAndAngCtrl→eOutCtrl, this parameter cannot be null if output is required. Width and height same as pstSrc. Output
      pstMagAndAngCtrl Control info pointer. Cannot be null. Input
      bInstant Reserved. Input
      Parameter Name Supported Image Type Address Alignment Resolution
      pstSrc U8C1 16 byte 64x64 ~ 1920x1080
      pstDstMag U16C1 16 byte Same as pstSrc
      pstDstAng U8C1 16 byte Same as pstSrc
    • Return Value

      Return Value Description
      0 Successful.
      Non-zero Failed. Please refer to ERROR CODE.
    • Requirement

      • Header: mi_common_datatype.h, mi_ive.h, mi_ive_datatype.h

      • Library: libmi_ive.a

    • Note

      • When the output mode is E_MI_IVE_MAG_AND_ANG_OUT_CTRL_MAG_AND_ANG, the stride of pstDstMag and the stride of pstDstAng must be consistent.

      • Two output modes can be configured. For details, please refer to MI_IVE_MagAndAngOutCtrl_e.

        Fig 1-4: MagAndAng Calculation Formula.

      • User can utilize pstMagAndAngCtrl→u16Thr to do thresholding operation against magnitude map (to achieve EOH).

      • The calculation formula of MagAndAnd is as follows:

        H_{out}(x,y)=\sum_{-2\leqslant i\leqslant2}\sum_{-2\leqslant j\leqslant2}I(x+i,y+j)*coef(x+i,y+j)
        V_{out}(x,y)=\sum_{-2\leqslant i\leqslant2}\sum_{-2\leqslant j\leqslant2}I(x+i,y+j)*coef(x+j,y+i)
        Mag(x,y)=abs(H_{out}(x,y))+abs(V_{out}(x,y))
        Mag(x,y)=\left\{ \begin{aligned} 0 , Mag(x,y) < u16Thr \\ Mag(x,y) ,Mag(x,y)\geq u16Thr \end{aligned} \right.

        Where,

        • I(x,y) refers to pstSrc, Mag(x,y) refers to pstDstMag, \theta(x,y) refers to pstDstAng, and coef(x,y) refers to as8Mask[MI_IVE_MASK_SIZE_5X5] in pstMagAndAngCtrl.

        • According to H_{out}(x,y), V_{out}(x,y) and arctan(V_{out}/H_{out}), \theta(x,y) takes the direction value corresponding to 0 ~ 7 in the figure below.

    • Related API

      MI_IVE_CannyHysEdge

      MI_IVE_CannyEdge

      MI_IVE_Sobel


    2.9. MI_IVE_Dilate

    • Function

      Execute a binary image 5x5 template dilating task.

    • Syntax

      MI_S32 MI_IVE_Dilate(MI_IVE_HANDLE hHandle, MI_IVE_SrcImage_t *pstSrc, MI_IVE_DstImage_t *pstDst, MI_IVE_DilateCtrl_t *pstDilateCtrl, MI_BOOL bInstant);
      
    • Parameter

      Parameter Name Description Input/Output
      hHandle Regional handle number. Parameter range: [0, MI_IVE_HANDLE_MAX). Input
      pstSrc Source image pointer. Cannot be null. Input
      pstDst Output image pointer. Cannot be null. Width and height same as pstSrc. Output
      pstDilateCtrl Control info pointer. Input
      bInstant Reserved. Input
      Parameter Name Supported Image Type Address Alignment Resolution
      pstSrc U8C1 binary image 16 byte 64x64 ~ 1920x1080
      pstDst U8C1 binary image 16 byte Same as pstSrc
      • For Pcupid series: The hardware acceleration is supported when the resolution is not exceeded 640x480.
    • Return Value

      Return Value Description
      0 Successful.
      Non-zero Failed. Please refer to ERROR CODE.
    • Requirement

      • Header: mi_common_datatype.h, mi_ive.h, mi_ive_datatype.h

      • Library: libmi_ive.a

    • Note

      • The template coefficient can only be 0 or 255.

        Fig 1-5: Dilate Calculation Formula

      • The calculation formula of Dilate is as follows:

        I_{out}(x,y)=O_{-2\leqslant i\leqslant2}(O_{-2\leqslant j\leqslant2}(f(i,j))) \\
        O_{-2\leqslant k\leqslant 2}(g(k))=g(-2)\ |\ g(-1)\ |\ g(0)\ |\ g(1)\ |\ g(2) \\
        f(x,y)=I(x,y)\ \& \ coef(x,y)

        In the formula | is a bitwise OR operation, & is a bitwise AND operation, and % is a remainder operation. I(x,y) refers to pstSrc, I_{out}(x,y) refers to pstDst, and coef(x,y) refers to au8Mask[MI_IVE_MASK_SIZE_5X5] in pstDilateCtrl.

      • Template example

        \begin{bmatrix} 0 &0 &0 &0 &0 \\ 0 &0 &255 &0 &0 \\ 0 &255 &255 &255 &0 \\ 0 &0 &255 &0 &0 \\ 0 &0 &0 &0 &0 \end{bmatrix} \begin{bmatrix} 0 &0 &0 &0 &0 \\ 0 &255 &255 &255 &0 \\ 0 &255 &255 &255 &0 \\ 0 &255 &255 &255 &0 \\ 0 &0 &0 &0 &0 \end{bmatrix}
        \begin{bmatrix} 0 &255 &255 &255 &0 \\ 255 &255 &255 &255 &255 \\ 255 &255 &255 &255 &255 \\ 255 &255 &255 &255 &255 \\ 0 &255 &255 &255 &0 \end{bmatrix} \begin{bmatrix} 255 &255 &255 &255 &255 \\ 255 &255 &255 &255 &255 \\ 255 &255 &255 &255 &255 \\ 255 &255 &255 &255 &255 \\ 255 &255 &255 &255 &255 \end{bmatrix}
    • Related API

      MI_IVE_Erode

      MI_IVE_OrdStatFilter


    2.10. MI_IVE_Erode

    • Function

      Execute a binary image 5x5 template erosion task.

    • Syntax

      MI_S32 MI_IVE_Erode(MI_IVE_HANDLE hHandle, MI_IVE_SrcImage_t *pstSrc, MI_IVE_DstImage_t *pstDst, MI_IVE_ErodeCtrl_t *pstErodeCtrl, MI_BOOL bInstant);
      
    • Parameter

      Parameter Name Description Input/Output
      hHandle Regional handle number. Parameter range: [0, MI_IVE_HANDLE_MAX). Input
      pstSrc Source image pointer. Cannot be null. Input
      pstDst Output image pointer. Cannot be null. Width and height same as pstSrc. Output
      pstErodeCtrl Control info pointer. Cannot be null. Input
      bInstant Reserved. Input
      Parameter Name Supported Image Type Address Alignment Resolution
      pstSrc U8C1 binary image 16 byte 64x64 ~ 1920x1080
      pstDst U8C1 binary image 16 byte Same as pstSrc
      • For Pcupid series: The hardware acceleration is supported when the resolution is not exceeded 640x480.
    • Return Value

      Return Value Description
      0 Successful.
      Non-zero Failed. Please refer to ERROR CODE.
    • Requirement

      • Header: mi_common_datatype.h, mi_ive.h, mi_ive_datatype.h

      • Library: libmi_ive.a

    • Note

      • The template coefficient can only be 0 or 255.

        Fig 1-6: Erode Calculation Formula

      • The calculation formula of Erode is as follows:

        I_{out}(x,y)=O_{-2\leqslant i\leqslant 2}(O_{-2\leqslant j\leqslant2}(f(x+i,y+j)))
        O_{-2\leqslant k\leqslant 2}(g(k))=g(-2)\ |\ g(-1)\ |\ g(0)\ |\ g(1)\ |\ g(2)
        f(x,y) = I(x,y)\ | \ (255 - coef(x,y))

        In the formula | is a bitwise OR operation, & is a bitwise AND operation, and % is a remainder operation. I(x, y) refers to pstSrc, I_{out}(x, y) refers to pstDst, and coef(x,y) refers to au8Mask[MI_IVE_MASK_SIZE_5X5] in pstErodeCtrl.

      • Template example

        \begin{bmatrix} 0 &0 &0 &0 &0 \\ 0 &0 &255 &0 &0 \\ 0 &255 &255 &255 &0 \\ 0 &0 &255 &0 &0 \\ 0 &0 &0 &0 &0 \end{bmatrix} \begin{bmatrix} 0 &0 &0 &0 &0 \\ 0 &255 &255 &255 &0 \\ 0 &255 &255 &255 &0 \\ 0 &255 &255 &255 &0 \\ 0 &0 &0 &0 &0 \end{bmatrix}
        \begin{bmatrix} 0 &255 &255 &255 &0 \\ 255 &255 &255 &255 &255 \\ 255 &255 &255 &255 &255 \\ 255 &255 &255 &255 &255 \\ 0 &255 &255 &255 &0 \end{bmatrix} \begin{bmatrix} 255 &255 &255 &255 &255 \\ 255 &255 &255 &255 &255 \\ 255 &255 &255 &255 &255 \\ 255 &255 &255 &255 &255 \\ 255 &255 &255 &255 &255 \end{bmatrix}
    • Related API

      MI_IVE_Dilate

      MI_IVE_OrdStatFilter


    2.11. MI_IVE_Thresh

    • Function

      Execute a grayscale image thresholding task.

    • Syntax

      MI_S32 MI_IVE_Thresh(MI_IVE_HANDLE hHandle, MI_IVE_SrcImage_t *pstSrc, MI_IVE_DstImage_t *pstDst, MI_IVE_ThreshCtrl_t *pstThrCtrl, MI_BOOL bInstant);
      
    • Parameter

      Parameter Name Description Input/Output
      hHandle Regional handle number. Parameter range: [0, MI_IVE_HANDLE_MAX). Input
      pstSrc Source image pointer. Cannot be null. Input
      pstDst Output image pointer. Cannot be null. Width and height same as pstSrc. Output
      pstThrCtrl Control info pointer. Input
      bInstant Reserved. Input
      Parameter Name Supported Image Type Address Alignment Resolution
      pstSrc U8C1 1 byte 64x64 ~ 1920x1080
      pstDst U8C1 1 byte Same as pstSrc
    • Return Value

      Return Value Description
      0 Successful.
      Non-zero Failed. Please refer to ERROR CODE.
    • Requirement

      • Header: mi_common_datatype.h, mi_ive.h, mi_ive_datatype.h

      • Library: libmi_ive.a

    • Note

      • Eight operation modes are available for configuration. For details, please refer to MI_IVE_ThreshMode_e.

        Fig 1-7: Threshold Modes of Thresh.

      • The calculation formulas of different mode are as follows:

        • E_MI_IVE_THRESH_MODE_BINARY:

          I_{out}(x,y)=\left\{ \begin{aligned} minVal,\ I(x,y)\leqslant lowThr \\ maxVal,\ I(x,y)> lowThr \end{aligned} \right.

          midVal, highThr do not require to be assigned.

        • E_MI_IVE_THRESH_MODE_TRUNC:

          I_{out}(x,y)=\left\{ \begin{aligned} I(x,y),\ I(x,y)\leqslant lowThr \\ maxVal,\ I(x,y)>lowThr \end{aligned} \right.

          minVal, midVal, highThr do not require to be assigned.

        • E_MI_IVE_THRESH_MODE_TO_MINVAL:

          I_{out}(x,y)=\left\{ \begin{aligned} minVal,\ I(x,y)\leqslant lowThr \\ I(x,y),\ I(x,y)> lowThr \end{aligned} \right.

          midVal, maxVal, highThr do not require to be assigned.

        • E_MI_IVE_THRESH_MODE_MIN_MID_MAX:

          I_{out}(x,y)=\left\{ \begin{aligned} minVal,\ I(x,y)\leqslant lowThr \\ midVal,\ lowThr\leqslant I(x,y)\leqslant highThr \\ maxVal,\ I(x,y)>highThr \end{aligned} \right.
        • E_MI_IVE_THRESH_MODE_ORI_MID_MAX:

          I_{out}(x,y)=\left\{ \begin{aligned} I(x,y),\ I(x,y)\leqslant lowThr \\ midVal,\ lowThr\leqslant I(x,y)\leqslant highThr \\ maxVal,\ I(x,y)>highThr \end{aligned} \right.

          minVal does not require to be assigned.

        • E_MI_IVE_THRESH_MODE_MIN_MID_ORI:

          I_{out}(x,y)=\left\{ \begin{aligned} minVal,\ I(x,y) \leqslant lowThr \\ midVal,\ lowThr\leqslant I(x,y)\leqslant highThr \\ I(x,y),\ I(x,y)>highThr \end{aligned} \right.

          maxVal does not require to be assigned.

        • E_MI_IVE_THRESH_MODE_MIN_ORI_MAX:

          I_{out}(x,y)=\left\{ \begin{aligned} minVal,\ I(x,y) \leqslant lowThr \\ I(x,y),\ lowThr\leqslant I(x,y)\leqslant highThr \\ maxVal,\ I(x,y)>highThr \end{aligned} \right.

          midVal does not require to be assigned.

        • E_MI_IVE_THRESH_MODE_ORI_MID_ORI:

          I_{out}(x,y)=\left\{ \begin{aligned} I(x,y),\ I(x,y) \leqslant lowThr \\ midVal,\ lowThr\leqslant I(x,y)\leqslant highThr \\ I(x,y),\ I(x,y)>highThr \end{aligned} \right.

          minVal, maxVal do not require to be assigned

          Where,

          • I(x,y) refers to pstSrc, I_{out}(x,y) refers to pstDst.

          • mode, lowThr, highThr, minVal, midVal and maxVal refer respectively to eMode, u8LowThr, u8HighThr, u8MinVal, u8MidVal and u8MaxVal in pstThrCtrl.

          • u8MinVal, u8MidVal and u8MaxVal in pstThrCtrl do not need to satisfy the size relationship signified by the variable name.

    • Related API

      MI_IVE_ThreshS16

      MI_IVE_ThreshU16


    2.12. MI_IVE_And

    • Function

      Execute an AND task against two binary images.

    • Syntax

      MI_S32 MI_IVE_And(MI_IVE_HANDLE hHandle, MI_IVE_SrcImage_t *pstSrc1, MI_IVE_SrcImage_t *pstSrc2, MI_IVE_DstImage_t *pstDst, MI_BOOL bInstant);
      
    • Parameter

      Parameter Name Description Input/Output
      hHandle Regional handle number. Parameter range: [0, MI_IVE_HANDLE_MAX). Input
      pstSrc1 Source image 1 pointer. Cannot be null. Input
      pstSrc2 Source image 2 pointer. Cannot be null. Width and height same as pstSrc1. Input
      pstDst Output image pointer. Cannot be null. Width and height same as pstSrc1. Output
      bInstant Reserved. Input
      Parameter Name Supported Image Type Address Alignment Resolution
      pstSrc1 U8C1 binary image 1 byte 64x64 ~ 1920x1080
      pstSrc2 U8C1 binary image 1 byte Same as pstSrc1
      pstDst U8C1 binary image 1 byte Same as pstSrc1
    • Return Value

      Return Value Description
      0 Successful.
      Non-zero Failed. Please refer to ERROR CODE.
    • Requirement

      • Header: mi_common_datatype.h, mi_ive.h, mi_ive_datatype.h

      • Library: libmi_ive.a

    • Note

      • The calculation formula of And is as follows:

        I_{out}(x,y)=I_{src1}(x,y)\ \&\ I_{src2}(x,y)

        Where, I_{src1}(x,y) refers to pstSrc1, I_{src2}(x,y) refers to pstSrc2, and I_{out}(x,y) refers to pstDst

    • Related API

      MI_IVE_Or

      MI_IVE_Xor


    2.13. MI_IVE_Sub

    • Function

      Execute a SUBTRACT task against two grayscale images.

    • Syntax

      MI_S32 MI_IVE_Sub(MI_IVE_HANDLE hHandle, MI_IVE_SrcImage_t *pstSrc1, MI_IVE_SrcImage_t *pstSrc2, MI_IVE_DstImage_t *pstDst, MI_IVE_SubCtrl_t *pstSubCtrl, MI_BOOL bInstant);
      
    • Parameter

      Parameter Name Description Input/Output
      hHandle Regional handle number. Parameter range: [0, MI_IVE_HANDLE_MAX). Input
      pstSrc1 Source image 1 pointer. Cannot be null. Input
      pstSrc2 Source image 2 pointer. Cannot be null. Width and height same as pstSrc1. Input
      pstDst Output image pointer. Cannot be null. Width and height same as pstSrc1. Output
      pstSubCtrl Control info pointer. Cannot be null. Input
      bInstant Reserved. Input
      Parameter Name Supported Image Type Address Alignment Resolution
      pstSrc1 U8C1 1 byte 64x64 ~ 1920x1080
      pstSrc2 U8C1 1 byte Same as pstSrc1
      pstDst U8C1, S8C1 1 byte Same as pstSrc1
    • Return Value

      Return Value Description
      0 Successful.
      Non-zero Failed. Please refer to ERROR CODE.
    • Requirement

      • Header: mi_common_datatype.h, mi_ive.h, mi_ive_datatype.h

      • Library: libmi_ive.a

    • Note

      • Two output formats are available for configuration. For details, please refer to MI_IVE_SubMode_e.

      • The calculation formulas of differernt mode are as follows:

        • E_MI_IVE_SUB_MODE_ABS

          Calculation formula: I_{out}(x,y)=abs(I_{src1}(x,y) - I_{src2}(x,y))

          Output format: U8C1

        • E_MI_IVE_SUB_MODE_SHIFT

          Calculation formula: I_{out}(x,y)=(I_{src1}(x,y) - I_{src2}(x,y))>>1

          Output format: S8C1

        Where, I_{src1}(x,y) refers to pstSrc1, I_{src2}(x,y) refers to pstSrc2, and I_{out}(x,y) refers to pstDst.

    • Related API

      MI_IVE_Add


    2.14. MI_IVE_Or

    • Function

      Execute an OR task against two binary images.

    • Syntax

      MI_S32 MI_IVE_Or(MI_IVE_HANDLE hHandle, MI_IVE_SrcImage_t *pstSrc1, MI_IVE_SrcImage_t *pstSrc2, MI_IVE_DstImage_t *pstDst, MI_BOOL bInstant);
      
    • Parameter

      Parameter Name Description Input/Output
      hHandle Regional handle number. Parameter range: [0, MI_IVE_HANDLE_MAX). Input
      pstSrc1 Source image 1 pointer. Cannot be null. Input
      pstSrc2 Source image 2 pointer. Cannot be null. Width and height same as pstSrc1. Input
      pstDst Output image pointer. Cannot be null. Width and height same as pstSrc1. Output
      bInstant Reserved. Input
      Parameter Name Supported Image Type Address Alignment Resolution
      pstSrc1 U8C1 1 byte 64x64 ~ 1920x1080
      pstSrc2 U8C1 1 byte Same as pstSrc1
      pstDst U8C1 1 byte Same as pstSrc1
    • Return Value

      Return Value Description
      0 Successful.
      Non-zero Failed. Please refer to ERROR CODE.
    • Requirement

      • Header: mi_common_datatype.h, mi_ive.h, mi_ive_datatype.h

      • Library: libmi_ive.a

    • Note

      • The calculation formula of Or is as follows:

        I_{out}(x,y)=I_{src1}(x,y)\ | \ I_{src2}(x,y)

        Where, I_{src1}(x,y) refers to pstSrc1, I_{src2}(x,y) refers to pstSrc2, and I_{out}(x,y) refers to pstDst.

    • Related API

      MI_IVE_And

      MI_IVE_Xor


    2.15. MI_IVE_Integ

    • Function

      Execute an integral graph statistics task against grayscale images.

    • Syntax

      MI_S32 MI_IVE_Integ(MI_IVE_HANDLE hHandle, MI_IVE_SrcImage_t *pstSrc, MI_IVE_DstImage_t *pstDst, MI_IVE_IntegCtrl_t *pstIntegCtrl, MI_BOOL bInstant);
      
    • Parameter

      Parameter Name Description Input/Output
      hHandle Regional handle number. Parameter range: [0, MI_IVE_HANDLE_MAX). Input
      pstSrc Source image pointer. Cannot be null. Input
      pstDst Output image pointer. Cannot be null. Width and height same as pstSrc. Output
      pstIntegCtrl Control info pointer. Cannot be null. Input
      bInstant Reserved. Input
      Parameter Name Supported Image Type Address Alignment Resolution
      pstSrc U8C1 16 byte 32x16 ~ 1920x1080
      pstDst U32C1, U64C1 16 byte Same as pstSrc
    • Return Value

      Return Value Description
      0 Successful.
      Non-zero Failed. Please refer to ERROR CODE.
    • Requirement

      • Header: mi_common_datatype.h, mi_ive.h, mi_ive_datatype.h

      • Library: libmi_ive.a

    • Note

      • The calculation formulas of different mode are as follows:

        • E_MI_IVE_INTEG_OUT_CTRL_COMBINE(the combined output mode, the output image type must be E_MI_IVE_IMAGE_TYPE_U64C1)

          I_{sum}(x,y)=\sum^{i\leqslant x}_{i\geqslant0}\sum^{j\leqslant y}_{j\geqslant0}I(i,j) ,\quad I_{sq}(x,y)=\sum^{i\leqslant x}_{i\geqslant0}\sum^{j\leqslant y}_{j\geqslant0}(I(i,j)*I(i,j))
          I_{out}(x,y)=(i_{sq}(x,y)<<28)\ | \ (I_{sum}(x,y)\&0xFFFFFFF)
        • E_MI_IVE_INTEG_OUT_CTRL_SUM(the integral graph output mode, the output image type must be E_MI_IVE_IMAGE_TYPE_U32C1)

          I_{out}(x,y) = I_{sum}(x,y)=\sum^{i\leqslant x}_{i\geqslant0}\sum^{j\leqslant y}_{j\geqslant0}I(i,j)
        • E_MI_IVE_INTEG_OUT_CTRL_SQSUM(the square and integral graph output mode, the output image type must be E_MI_IVE_IMAGE_TYPE_U64C1)

          I_{out}(x,y) = I_{sq}(x,y)=\sum^{i\leqslant x}_{i\geqslant0}\sum^{j\leqslant y}_{j\geqslant0}(I(i,j)*I(i,j))

        Where, I(x,y) refers to pstSrc, and I_{out}(x,y) refers to pstDst.


    2.16. MI_IVE_Hist

    • Function

      Execute a histogram statistics task.

    • Syntax

      MI_S32 MI_IVE_Hist(MI_IVE_HANDLE hHandle, MI_IVE_SrcImage_t *pstSrc, MI_IVE_DstMemInfo_t *pstDst, MI_BOOL bInstant);
      
    • Parameter

      Parameter Name Description Input/Output
      hHandle Regional handle number. Parameter range: [0, MI_IVE_HANDLE_MAX). Input
      pstSrc Source image pointer. Cannot be null. Input
      pstDst Output data pointer. Cannot be null. The memory should at least has 1024 bytes. Output
      bInstant Reserved. Input
      Parameter Name Supported Image Type Address Alignment Resolution
      pstSrc U8C1 16 byte 64x64 ~ 1920x1080
      pstDst - 16 byte -
    • Return Value

      Return Value Description
      0 Successful.
      Non-zero Failed. Please refer to ERROR CODE.
    • Requirement

      • Header: mi_common_datatype.h, mi_ive.h, mi_ive_datatype.h

      • Library: libmi_ive.a

    • Note

      • The calculation formula of Hist is as follows:

        I_{out}(x)=\sum_i\sum_j((I(i,j)==x)?1:0) ,x=0...255

        Where, I(i,j) refers to pstSrc, and I_{out}(x) refers to pstDst.


    2.17. MI_IVE_ThreshS16

    • Function

      Execute an S16 data to 8-bit data thresholding task.

    • Syntax

      MI_S32 MI_IVE_ThreshS16(MI_IVE_HANDLE hHandle, MI_IVE_SrcImage_t *pstSrc, MI_IVE_DstImage_t *pstDst, MI_IVE_ThreshS16Ctrl_t *pstThrS16Ctrl, MI_BOOL bInstant);
      
    • Parameter

      Parameter Name Description Input/Output
      hHandle Regional handle number. Parameter range: [0, RGN_HANDLE_MAX). Input
      pstSrc Source image pointer. Cannot be null. Input
      pstDst Output image pointer. Cannot be null. Width and height same as pstSrc. Output
      pstThrS16Ctrl Control parameter pointer. Cannot be null. Input
      bInstant Reserved. Input
      Parameter Name Supported Image Type Address Alignment Resolution
      pstSrc S16C1 2 byte 64x64 ~ 1920x1080
      pstDst U8C1, S8C1 1 byte Same as pstSrc
    • Return Value

      Return Value Description
      0 Successful.
      Non-zero Failed. Please refer to ERROR CODE.
    • Requirement

      • Header: mi_common_datatype.h, mi_ive.h, mi_ive_datatype.h

      • Library: libmi_ive.a

    • Note

      • Four operation modes are available for configuration. For details, please refer to MI_IVE_ThreshS16Mode_e.

        Fig 1-8: Threshold Modes of ThreshS16

      • The calculation formulas of different mode are as follows:

        • E_MI_IVE_THRESH_S16_MODE_S16_TO_S8_MIN_MID_MAX:

          I_{out}(x,y)=\left \{ \begin{aligned} minVal,(I(x,y)\leqslant lowThr) \\ midVal,(lowThr< I(x,y)\leqslant highThr) \\ maxVal,(I(x,y)> highThr) \end{aligned} \right.

          Requirement: -32768 ≤ lowThr ≤ highThr ≤32767, -128 ≤ minVal, midVal, maxVal ≤ 127.

        • E_MI_IVE_THRESH_S16_MODE_S16_TO_S8_MIN_ORI_MAX:

          I_{out}(x,y)=\left \{ \begin{aligned} minVal,(I(x,y)\leqslant lowThr) \\ I(x,y),(lowThr< I(x,y)\leqslant highThr) \\ maxVal,(I(x,y)> highThr) \end{aligned} \right.

          Requirement: -128 ≤ lowThr ≤ highThr ≤127, -128 ≤ minVal, maxVal ≤127.

        • E_MI_IVE_THRESH_S16_MODE_S16_TO_U8_MIN_MID_MAX:

          I_{out}(x,y)=\left \{ \begin{aligned} minVal,(I(x,y)\leqslant lowThr) \\ midVal,(lowThr< I(x,y)\leqslant highThr) \\ maxVal,(I(x,y)> highThr) \end{aligned} \right.

          Requirement: -32768 ≤ lowThr ≤ highThr ≤32767, 0 ≤ minVal, midVal, maxVal ≤255.

        • E_MI_IVE_THRESH_S16_MODE_S16_TO_U8_MIN_ORI_MAX:

          I_{out}(x,y)=\left \{ \begin{aligned} minVal,(I(x,y)\leqslant lowThr) \\ I(x,y),(lowThr< I(x,y)\leqslant highThr) \\ maxVal,(I(x,y)> highThr) \end{aligned} \right.

          Requirement: -1 ≤ lowThr ≤ highThr ≤255, $ 0 ≤ minVal, maxVal ≤255$ .

          Where,

          • I(x,y) refers to pstSrc, I_{out}(x,y) refers to pstDst.

          • mode, lowThr, highThr, minVal, midVal and maxVal refer respectively to eMode, s16LowThr, s16HighThr, un8MinVal, un8MidVal and un8MaxVal in pstThrS16Ctrl.

          • un8MinVal, un8MidVal and un8MaxVal in pstThrS16Ctrl do not need to satisfy the size relationship signified by the variable name.

    • Related API

      MI_IVE_ThreshU16

      MI_IVE_16BitTo8Bit


    2.18. MI_IVE_ThreshU16

    • Function

      Execute a U16 data to U8 data thresholding task.

    • Syntax

      MI_S32 MI_IVE_ThreshU16(MI_IVE_HANDLE hHandle, MI_IVE_SrcImage_t *pstSrc, MI_IVE_DstImage_t *pstDst, MI_IVE_ThreshU16Ctrl_t *pstThrU16Ctrl, MI_BOOL bInstant);
      
    • Parameter

      Parameter Name Description Input/Output
      hHandle Regional handle number. Parameter range: [0, MI_IVE_HANDLE_MAX). Input
      pstSrc Source image pointer. Cannot be null. Input
      pstDst Output image pointer. Cannot be null. Width and height same as pstSrc. Output
      pstThrU16Ctrl Control parameter pointer. Cannot be null. Input
      bInstant Reserved. Input
      Parameter Name Supported Image Type Address Alignment Resolution
      pstSrc U16C1 2 byte 64x64 ~ 1920x1080
      pstDst U8C1 1 byte Same as pstSrc
    • Return Value

      Return Value Description
      0 Successful.
      Non-zero Failed. Please refer to ERROR CODE.
    • Requirement

      • Header: mi_common_datatype.h, mi_ive.h, mi_ive_datatype.h

      • Library: libmi_ive.a

    • Note

      • Two operation modes are available for configuration. For details, please refer to MI_IVE_ThreshU16Mode_e.

        Fig 1-9: Threshold Modes of ThreshU16

      • The calculation formulas of different mode are as follows:

        • E_MI_IVE_THRESH_U16_MODE_U16_TO_U8_MIN_MID_MAX:

          I_{out}(x,y)=\left \{ \begin{aligned} minVal,(I(x,y)\leqslant lowThr) \\ midVal,(lowThr< I(x,y)\leqslant highThr) \\ maxVal,(I(x,y)> highThr) \end{aligned} \right.

          Requirement: 0 ≤ lowThr ≤ highThr ≤65535;

        • E_MI_IVE_THRESH_U16_MODE_U16_TO_U8_MIN_ORI_MAX:

          I_{out}(x,y)=\left \{ \begin{aligned} minVal,(I(x,y)\leqslant lowThr) \\ I(x,y),(lowThr< I(x,y)\leqslant highThr) \\ maxVal,(I(x,y)> highThr) \end{aligned} \right.

          Requirement: 0 ≤ lowThr ≤ highThr ≤255;

        Where,

        • I(x,y) refers to pstSrc, I_{out}(x,y) refers to pstDst.

        • mode, lowThr, highThr, minVal, midVal and maxVal refer respectively to eMode, u16LowThr, u16HighThr, u8MinVal, u8MidVal and u8MaxVal in pstThrU16Ctrl.

        • u8MinVal, u8MidVal and u8MaxVal in pstThrU16Ctrl do not need to satisfy the size relationship signified by the variable name.

    • Related API

      MI_IVE_ThreshS16

      MI_IVE_16BitTo8Bit


    2.19. MI_IVE_16BitTo8Bit

    • Function

      Execute a 16-bit image data to 8-bit image data linear transformation task.

    • Syntax

      MI_S32 MI_IVE_16BitTo8Bit(MI_IVE_HANDLE hHandle, MI_IVE_SrcImage_t *pstSrc, MI_IVE_DstImage_t *pstDst, MI_IVE_16bitTo8BitCtrl_t *pst16BitTo8BitCtrl, MI_BOOL bInstant);
      
    • Parameter

      Parameter Name Description Input/Output
      hHandle Regional handle number. Parameter range: [0, MI_IVE_HANDLE_MAX). Input
      pstSrc Source image pointer. Cannot be null. Input
      pstDst Output image pointer. Cannot be null. Width and height same as pstSrc. Output
      pst16BitTo8BitCtrl Control parameter pointer. Cannot be null. Input
      bInstant Reserved. Input
      Parameter Name Supported Image Type Address Alignment Resolution
      pstSrc U16C1, S16C1 2 byte 64x64 ~ 1920x1080
      pstDst U8C1, S8C1 1 byte Same as pstSrc
    • Return Value

      Return Value Description
      0 Successful.
      Non-zero Failed. Please refer to ERROR CODE.
    • Requirement

      • Header: mi_common_datatype.h, mi_ive.h, mi_ive_datatype.h

      • Library: libmi_ive.a

    • Note

      • 4 modes are available for configuration. For details, please refer to MI_IVE_16BitTo8BitMode_e.

      • The calculation formulas of different mode are as follows:

        • E_MI_IVE_16BIT_TO_8BIT_MODE_S16_TO_S8:

          I_{out}(x,y)=\left\{ \begin{aligned} -128,(\frac{a}{b}I(x,y)<-128) \\ \frac{a}{b}I(x,y),(-128\leqslant \frac{a}{b}I(x,y)\leqslant 127) \\ 127,(\frac{a}{b}I(x,y)>127) \end{aligned} \right.

          E_MI_IVE_16BIT_TO_8BIT_MODE_S16_TO_U8_ABS:

          I_{out}(x,y)=\left\{ \begin{aligned} \left |\frac{a}{b}I(x,y) \right|,(\left| \frac{a}{b}I(x,y)\right|\leqslant 255) \\ 255,(\left| \frac{a}{b}I(x,y)\right|> 255) \end{aligned} \right.
        • E_MI_IVE_16BIT_TO_8BIT_MODE_S16_TO_U8_BIAS:

          I_{out}(x,y)=\left\{ \begin{aligned} 0,(\frac{a}{b}I(x,y)+bais< 0) \\ \frac{a}{b}I(x,y)+bais,(0\leqslant\frac{a}{b}I(x,y)+bais\leqslant 255) \\ 255, (\frac{a}{b}I(x,y)+bais> 255) \end{aligned} \right.
        • E_MI_IVE_16BIT_TO_8BIT_MODE_U16_TO_U8:

          I_{out}(x,y)=\left\{ \begin{aligned} 0,(\frac{a}{b}I(x,y)< 0) \\ \frac{a}{b}I(x,y),(0\leqslant\frac{a}{b}I(x,y)\leqslant 255) \\ 255, (\frac{a}{b}I(x,y)> 255) \end{aligned} \right.

        Where,

        • I(x,y) refers to pstSrc, I_{out}(x,y) refers to pstDst.

        • mode, a, b amd bias refer respectively to eMode, u8Numerator, u16Denominator, and s8Bias in pst16BitTo8BitCtrl.

        • Requirement: u8Numerator ≤ u16Denominator, and u16Denominator\neq0.

    • Related API

      MI_IVE_ThreshS16

      MI_IVE_ThreshU16


    2.20. MI_IVE_OrdStatFilter

    • Function

      Execute a 3x3 template sequential statistic filtering task in which Median, Max, and Min filtering are supported.

    • Syntax

      MI_S32 MI_IVE_OrdStatFilter(MI_IVE_HANDLE hHandle, MI_IVE_SrcImage_t *pstSrc, MI_IVE_DstImage_t *pstDst, MI_IVE_OrdStatFilter_t *pstOrdStatFltCtrl, MI_BOOL bInstant);
      
    • Parameter

      Parameter Name Description Input/Output
      hHandle Regional handle number. Parameter range: [0, MI_IVE_HANDLE_MAX). Input
      pstSrc Source image pointer. Cannot be null. Input
      pstDst Output image pointer. Cannot be null. Width and height same as pstSrc. Output
      pstOrdStatFltCtrl Control parameter pointerCannot be null. Input
      bInstant Reserved. Input
      Parameter Name Supported Image Type Address Alignment Resolution
      pstSrc U8C1 16 byte 64x64 ~ 1920x1080
      pstDst U8C1 16 byte Same as pstSrc
      • For Pcupid series: The hardware acceleration is supported when the resolution is not exceeded 640x480.
    • Return Value

      Return Value Description
      0 Successful.
      Non-zero Failed. Please refer to ERROR CODE.
    • Requirement

      • Header: mi_common_datatype.h, mi_ive.h, mi_ive_datatype.h

      • Library: libmi_ive.a

    • Note

      • Three filter modes are available for configuration. For details, please refer to MI_IVE_OrdStatFilterMode_e.

      • The calculation formula of different mode are as follows:

        • E_MI_IVE_ORD_STAT_FILTER_MODE_MEDIAN:

          I_{out}(x,y)=median_{-1\leqslant i\leqslant1,-1\leqslant j\leqslant1}\{I(x+i,y+j)\}
        • E_MI_IVE_ORD_STAT_FILTER_MODE_MAX:

          I_{out}(x,y)=max_{-1\leqslant i\leqslant1,-1\leqslant j\leqslant1}\{I(x+i,y+j)\}
        • E_MI_IVE_ORD_STAT_FILTER_MODE_MIN:

          I_{out}(x,y)=min_{-1\leqslant i\leqslant1,-1\leqslant j\leqslant1}\{I(x+i,y+j)\}

        Where, I(x,y) refers to pstSrc and I_{out}(x,y) refers to pstDst.

    • Related API

      MI_IVE_Filter

      MI_IVE_Dilate

      MI_IVE_Erode

    • Example

      MI_S32 Sample_OrdStatFilter()
      {
          MI_IVE_HANDLE handle = 0;
          MI_IVE_SrcImage_t stSrc = {0};
          MI_IVE_DstImage_t stDst = {0};
          MI_IVE_OrdStatFilter_t stCtrl =
          {
              .eMode = E_MI_IVE_ORD_STAT_FILTER_MODE_MEDIAN, // for median filter
          };
      
          // create IVE handle
          if (MI_SUCCESS != (s32Ret = MI_IVE_Create(handle)))
          {
              printf("Could not create IVE handle\n");
              return E_MI_ERR_FAILED;
          }
      
          while (loop_condition == true)
          {
              // ...set input image info to stSrc. e.g. stSrc.eType = E_MI_IVE_IMAGE_TYPE_U8C1;
              ...
              // ...set output image info to stDst. e.g. stDst.eType = E_MI_IVE_IMAGE_TYPE_U8C1;
              ...
      
              // OrdStatFilter task.
              if (MI_SUCCESS != (s32Ret = MI_IVE_OrdStatFilter(handle, &stSrc, &stDst, &stCtrl, 0)))
              {
                  printf("MI_IVE_OrdStatFilter() return ERROR 0x%X\n", s32Ret);
                  MI_IVE_Destroy(handle);
                  return E_MI_ERR_FAILED;
              }
      
              // get output from stDst and do something expected.
              ...
          }
      
          // destroy IVE handle
          MI_IVE_Destroy(handle);
          return MI_SUCCESS;
      }
      

    2.21. MI_IVE_Map

    • Function

      Execute a Map (mapping assignment) task, by looking up the Map to look for the value for each pixel of the source image in the lookup table, and assigning to the target image the value in the corresponding pixel lookup table. U8C1 to U8C1 mode mapping is supported.

    • Syntax

      MI_S32 MI_IVE_Map(MI_IVE_HANDLE hHandle, MI_IVE_SrcImage_t *pstSrc, MI_IVE_SrcMemInfo_t *pstMap, MI_IVE_DstImage_t *pstDst, MI_BOOL bInstant);
      
    • Parameter

      Parameter Name Description Input/Output
      hHandle Regional handle number. Parameter range: [0, MI_IVE_HANDLE_MAX). Input
      pstSrc Source image pointer. Cannot be null. Input
      pstMap Mapping table info pointer. Cannot be null. The memory should at least have the size of (MI_IVE_MapLutMem_t). Input
      pstDst Output image pointer. Cannot be null. Width and height same as pstSrc. Output
      bInstant Reserved. Input
      Parameter Name Supported Image Type Address Alignment Resolution
      pstSrc U8C1 1 byte 64x64 ~ 1920x1080
      pstMap - 16 byte -
      pstDst U8C1 1 byte Same as pstSrc
    • Return Value

      Return Value Description
      0 Successful.
      Non-zero Failed. Please refer to ERROR CODE.
    • Requirement

      • Header: mi_common_datatype.h, mi_ive.h, mi_ive_datatype.h

      • Library: libmi_ive.a

    • Note

      • The calculation formula of Map is as follows:

        I_{out}(x,y)=map[I(xy)]

        Where, I(x,y) refers to pstSrc, I_{out}(x,y) refers to pstDst, and map refers to pstMap.


    2.22. MI_IVE_EqualizeHist

    • Function

      Execute a grayscale-image histogram equalization calculation task.

    • Syntax

      MI_S32 MI_IVE_EqualizeHist(MI_IVE_HANDLE hHandle, MI_IVE_SrcImage_t *pstSrc, MI_IVE_DstImage_t *pstDst, MI_IVE_EqualizeHistCtrl_t *pstEqualizeHistCtrl, MI_BOOL bInstant);
      
    • Parameter

      Parameter Name Description Input/Output
      hHandle Regional handle number. Parameter range: [0, MI_IVE_HANDLE_MAX). Input
      pstSrc Source image pointer. Cannot be null. Input
      pstDst Output image pointer. Cannot be null. Width and height same as pstSrc. Output
      pstEqualizeHistCtrl Control parameter pointer. Cannot be null. Input
      bInstant Reserved. Input
      Parameter Name Supported Image Type Address Alignment Resolution
      pstSrc U8C1 16 byte 64x64 ~ 1920x1080
      pstDst U8C1 16 byte Same as pstSrc
      pstEqualizeHistCtrl→stMem - 16 byte -
    • Return Value

      Return Value Description
      0 Successful.
      Non-zero Failed. Please refer to ERROR CODE.
    • Requirement

      • Header: mi_common_datatype.h, mi_ive.h, mi_ive_datatype.h

      • Library: libmi_ive.a

    • Note

      • stMem in pstEqualizeHistCtrl should at least have the size of MI_IVE_EqualizeHistCtrlMem_t and agree with the histogram equalization calculation process.

    2.23. MI_IVE_Add

    • Function

      Execute a weighted addition calculation task against two grayscale images.

    • Syntax

      MI_S32 MI_IVE_Add(MI_IVE_HANDLE hHandle, MI_IVE_SrcImage_t *pstSrc1, MI_IVE_SrcImage_t *pstSrc2, MI_IVE_DstImage_t *pstDst, MI_IVE_AddCtrl_t *pstAddCtrl, MI_BOOL bInstant);
      
    • Parameter

      Parameter Name Description Input/Output
      hHandle Regional handle number. Parameter range: [0, MI_IVE_HANDLE_MAX). Input
      pstSrc1 Source image 1 pointer. Cannot be null. Input
      pstSrc2 Source image 2 pointer. Cannot be null. Width and height same as pstSrc1. Input
      pstDst Output image pointer. Width and height same as pstSrc1; Cannot be null. Output
      pstAddCtrl Control parameter pointer. Cannot be null. Input
      bInstant Reserved. Input
      Parameter Name Supported Image Type Address Alignment Resolution
      pstSrc1 U8C1 1 byte 64x64 ~ 1920x1080
      pstSrc2 U8C1 1 byte Same as pstSrc
      pstDst U8C1 1 byte Same as pstSrc
    • Return Value

      Return Value Description
      0 Successful.
      Non-zero Failed. Please refer to ERROR CODE.
    • Requirement

      • Header: mi_common_datatype.h, mi_ive.h, mi_ive_datatype.h

      • Library: libmi_ive.a

    • Note

      • The calculation formula of Add is as follows:

        I_{out}(x,y)=x*I_{src1}(x,y)+y*I_{src2}(x,y)

        Where,

        • I_{src1}(i,j) refers to pstSrc1, I_{src2}(i,j) refers to pstSrc2, I_{out}(i,j) refers to pstDst.

        • x, y refer to u0q16X and u0q16Y in pstAddCtrl. It is required that 0<x<1, 0<y<1, and \ x+y=1 before the fixed point.

    • Related API

      MI_IVE_Sub


    2.24. MI_IVE_Xor

    • Function

      Execute an XOR calculation task against two binary graphs.

    • Syntax

      MI_S32 MI_IVE_Xor(MI_IVE_HANDLE hHandle, MI_IVE_SrcImage_t *pstSrc1, MI_IVE_SrcImage_t *pstSrc2, MI_IVE_DstImage_t *pstDst, MI_BOOL bInstant);
      
    • Parameter

      Parameter Name Description Input/Output
      hHandle Regional handle number. Parameter range: [0, MI_IVE_HANDLE_MAX). Input
      pstSrc1 Source image 1 pointer. Cannot be null. Input
      pstSrc2 Source image 1 pointer. Cannot be null. Width and height same as pstSrc1. Input
      pstDst Output image pointer. Cannot be null. Width and height same as pstSrc1. Output
      bInstant Reserved. Input
      Parameter Name Supported Image Type Address Alignment Resolution
      pstSrc1 U8C1 1 byte 64x64 ~ 1920x1080
      pstSrc2 U8C1 1 byte Same as pstSrc1
      pstDst U8C1 1 byte Same as pstSrc1
    • Return Value

      Return Value Description
      0 Successful.
      Non-zero Failed. Please refer to ERROR CODE.
    • Requirement

      • Header: mi_common_datatype.h, mi_ive.h, mi_ive_datatype.h

      • Library: libmi_ive.a

    • Note

      • The calculation formula of Xor is as follows:

        I_{out}(x,y)=I_{src1}(x,y)\bigoplus{I_{src2}(x,y)}

        Where, I_{src1}(x,y) refers to pstSrc1, I_{src2}(x,y) refers to pstSrc2, and I_{out}(x,y) refers to pstDst.

    • Related API

      MI_IVE_And

      MI_IVE_Or


    2.25. MI_IVE_Ncc

    • Function

      Execute a normalized cross-correlation calculation task against two grayscale images of the same resolution.

    • Syntax

      MI_S32 MI_IVE_Ncc(MI_IVE_HANDLE hHandle, MI_IVE_SrcImage_t *pstSrc1, MI_IVE_SrcImage_t *pstSrc2, MI_IVE_DstMemInfo_t *pstDst, MI_BOOL bInstant);
      
    • Return Value

      Parameter Name Description Input/Output
      hHandle Regional handle number. Parameter range: [0, MI_IVE_HANDLE_MAX). Input
      pstSrc1 Source image 1 pointer. Cannot be null. Input
      pstSrc2 Source image 2 pointer. Cannot be null. Width and height same as pstSrc1. Input
      pstDst Output data pointer. Cannot be null. The memory should at least have the size of (MI_IVE_NccDstMem_t). Output
      bInstant Reserved. Input
      Parameter Name Supported Image Type Address Alignment Resolution
      pstSrc1 U8C1 1 byte 32x32 ~ 1920x1080
      pstSrc2 U8C1 1 byte Same as pstSrc1
      pstDst - 16 byte -
    • Return Value

      Return Value Description
      0 Successful.
      Non-zero Failed. Please refer to ERROR CODE.
    • Requirement

      • Header: mi_common_datatype.h, mi_ive.h, mi_ive_datatype.h

      • Library: libmi_ive.a

    • Note

      • The calculation formula of NCC is as follows:

        NCC(I_{src1},I_{src2})=\frac{\sum^w_{i-1}\sum^h_{j=1}(I_{src1}(i,j)*I_{src2}(i,j))}{\sqrt{\sum^w_{i=1}\sum^h_{j=1}(I^2_{src1}(i,j))}\sqrt{\sum^w_{i=1}\sum^h_{j=1}(I^2_{src2}(i,j))}}

        Only output the numerator and the two denominators before square root in the above formula:

        • pstDst→u64Numerator= \sum^w_{i-1}\sum^h_{j=1}(I_{src1}(i,j)*I_{src2}(i,j))

        • pstDst→u64QuadSum1= \sum^w_{i=1}\sum^h_{j=1}(I^2_{src1}(i,j))

        • pstDst→u64QuadSum2= \sum^w_{i=1}\sum^h_{j=1}(I^2_{src2}(i,j)).


    2.26. MI_IVE_Ccl

    • Function

      Execute a connected region label task against binary images.

    • Syntax

      MI_S32 MI_IVE_Ccl(MI_IVE_HANDLE hHandle, MI_IVE_Image_t *pstSrcDst, MI_IVE_DstMemInfo_t *pstBlob, MI_IVE_CclCtrl_t *pstCclCtrl, MI_BOOL bInstant);
      
    • Parameter

      Parameter Name Description Input/Output
      hHandle Regional handle number.
      Parameter range: [0, MI_IVE_HANDLE_MAX).
      Input
      pstSrcDst Source image pointer. Connected region is labeled on the source image, i.e. source image is also the labeled image output. Cannot be null. Input, Output
      pstBlob Connected region info pointer. Cannot be null. The memory should at least have the size of (MI_IVE_CcBlob_t), and output at most 254 valid connected regions. Output
      pstCclCtrl Control parameter pointer. Cannot be null. Input
      bInstant Reserved. Input
      Parameter Name Supported Image Type Address Alignment Resolution
      pstSrcDst U8C1 16 byte 16x4~720x640
      pstBlob - 16 byte -
      • For Souffle series: When the parameters meet the limitation of hardware acceleration usage, the maximum supported resolution is 1280x720.
    • Return Value

      Return Value Description
      0 Successful.
      Non-zero Failed. Please refer to ERROR CODE.
    • Requirement

      • Header: mi_common_datatype.h, mi_ive.h, mi_ive_datatype.h

      • Library: libmi_ive.a

    • Note

      • The labeled results are stored in the virtual address pstBlob→pu8VirAddr, use a pointer variable of MI_IVE_CcBlob_t to point to this address as below, the labeled results could be got by operating this pointer, for details, please refer to MI_IVE_CcBlob_t.

        MI_IVE_CcBlob_t* ccBlob = (MI_IVE_CcBlob_t*) pstBlob->pu8VirAddr;


    2.27. MI_IVE_Gmm

    • Function

      Execute a GMM background modelling task. Grayscale image is supported by RGB_PACKAGE image GMM background modelling. The Gaussian model number is 3 or 5.

    • Syntax

      MI_S32 MI_IVE_Gmm(MI_IVE_HANDLE hHandle, MI_IVE_SrcImage_t *pstSrc, MI_IVE_DstImage_t *pstFg, MI_IVE_DstImage_t *pstBg, MI_IVE_MemInfo_t *pstModel, MI_IVE_GmmCtrl_t *pstGmmCtrl, MI_BOOL bInstant);
      
    • Parameter

      Parameter Name Description Input/Output
      hHandle Regional handle number.
      Parameter range: [0, MI_IVE_HANDLE_MAX).
      Input
      pstSrc Source image pointer. Cannot be null. Input
      pstFg Foreground image pointer. Cannot be null.
      Width and height same as pstSrc.
      Output
      pstBg Background image pointer. Cannot be null.
      Width and height same as pstSrc.
      Output
      pstModel GMM modelling parameter pointer. Cannot be null. Input, Output
      pstGmmCtrl Control parameter pointer. Cannot be null. Input
      bInstant Reserved. Input
      Parameter Name Supported Image Type Address Alignment Resolution
      pstSrc U8C1, U8C3_PACKAGE 16 byte 64x64~1280x720
      pstFg U8C1 binary image 16 byte Same as pstSrc
      pstBg Same as pstSrc 16 byte Same as pstSrc
      pstModel - 16 byte -
    • Return Value

      Return Value Description
      0 Successful.
      Non-zero Failed. Please refer to ERROR CODE.
    • Requirement

      • Header: mi_common_datatype.h, mi_ive.h, mi_ive_datatype.h

      • Library: libmi_ive.a

    • Note

      • The GMM implementation refer to MOG and MOG2 in OpenCV.

      • Grayscale image GMM employs n (n=3 or 5) Gaussian models. The memory allocation of model data is as illustrated below.

        Fig 1-10: Grayscale Image GMM Model Memory Allocation

        Chips/Platforms Model_cnt Weight Mean Var Aligment Requirement Required Memory Size m of 3 Model Required Memory Size m of 5 Model
        Souffle 3 bits 2 bytes 2 bytes 3 bytes 16-bytes-aligned 3 bits + 3*(2+2+3) bytes
        m is 32 bytes after alignment
        3 bits + 5*(2+2+3) bytes
        m is 48 bytes after alignment
        Others - 2 bytes 2 bytes 3 bytes - 3*(2+2+3) bytes
        m is 21 bytes
        5*(2+2+3) bytes
        m is 35 bytes

      • RGB image GMM employs n (n=3 or 5) Gaussian models. The memory allocation of pstModel is as illustrated below.

        Fig 1-11: RGB Image GMM Model Memory Allocation

        Chips/Platforms Model_cnt Weight Mean Var Aligment Requirement Required Memory Size m of 3 Model Required Memory Size m of 5 Model
        Souffle 3 bits 2 bytes 3*2 bytes 3 bytes 16-bytes-aligned 3 bits + 3*(2+6+3) bytes
        m is 48 bytes after alignment
        3 bits + 5*(2+6+3) bytes
        m is 64 bytes after alignment
        Others - 4 bytes 3*4 bytes 4 bytes - 3*(4+12+4) bytes
        m is 60 bytes
        5*(4+12+4) bytes
        m is 100 bytes

        • According to the calculated m in above tabulation, the required memory size of model with different model num and output format can be represented as follows:

          pstModel→u32Size = m * pstSrc→u16Width * pstSrc→u16Height


    2.28. MI_IVE_CannyHysEdge

    • Function

      Execute the first half of Canny edge extraction task against grayscale images: Gradient, gradient amplitude calculation, hysteresis thresholding and non-maximum suppression.

    • Syntax

      MI_S32 MI_IVE_CannyHysEdge(MI_IVE_HANDLE hHandle, MI_IVE_SrcImage_t *pstSrc, MI_IVE_DstImage_t *pstEdge, MI_IVE_DstMemInfo_t *pstStack, MI_IVE_CannyHysEdgeCtrl_t *pstCannyHysEdgeCtrl, MI_BOOL bInstant);
      
    • Parameter

      Parameter Name Description Input/Output
      hHandle Regional handle number. Parameter range: [0, MI_IVE_HANDLE_MAX). Input
      pstSrc Source image pointer. Cannot be null. Input
      pstEdge Strong and weak edge mark image pointer. Cannot be null. Width and height same as pstSrc. Output
      pstStack Strong edge point coordinate stack. Cannot be null. Memory should at least be: pstSrc→u16Width * pstSrc→u16Height * (sizeof(MI_IVE_PointU16_t)) + sizeof(MI_IVE_CannyStackSize_t) Output
      pstCannyHysEdgeCtrl Control parameter pointer. Cannot be null. Input
      bInstant Reserved. Input
      Parameter Name Supported Image Type Address Alignment Resolution
      pstSrc U8C1 16 byte 64x64 ~ 1920x1080
      pstEdge U8C1 16 byte Same as pstSrc
      pstStack - 16 byte -
      pstCannyHysEdgeCtrl→stMem - 16 byte -
    • Return Value

      Return Value Description
      0 Successful.
      Non-zero Failed. Please refer to ERROR CODE.
    • Requirement

      • Header: mi_common_datatype.h, mi_ive.h, mi_ive_datatype.h

      • Library: libmi_ive.a

    • Note

      • pstEdge has only three values: 0, 1, and 2:

        0 means weak edge point.

        1 means non-edge point

        2 means strong edge point.

      • pstStack stores the coordinate information of strong edge point.

      • pstCannyHysEdgeCtrl→stMem requires at least the following memory size: pstCannyHysEdgeCtrl→stMem.u32Size = pstSrc→azu16Stride[0] * (pstSrc→u16Height + 3) * 4.

      • After completing the task, you must call the MI_IVE_CannyEdge function to output Canny edge image.

    • Related API

      MI_IVE_CannyEdge


    2.29. MI_IVE_CannyEdge

    • Function

      Execute the second half of Canny edge extraction task against grayscale images: connecting edge points to form a Canny edge map.

    • Syntax

      MI_S32 MI_IVE_CannyEdge(MI_IVE_HANDLE hHandle, MI_IVE_Image_t *pstEdge, MI_IVE_MemInfo_t *pstStack, MI_BOOL bInstant);
      
    • Parameter

      Parameter Name Description Input/Output
      hHandle Regional handle number. Parameter range: [0, MI_IVE_HANDLE_MAX). Input
      pstEdge Strong and weak edge mark image pointer when used as an input; edge binary image pointer when used as an output. Cannot be null. Input, Output
      pstStack Strong edge point coordinate stack. Cannot be null. Input, Output
      bInstant Reserved. Input
      Parameter Name Supported Image Type Address Alignment Resolution
      pstEdge U8C1 16 byte 64x64 ~ 1920x1080
      pstStack - 16 byte -
    • Return Value

      Return Value Description
      0 Successful.
      Non-zero Failed. Please refer to ERROR CODE.
    • Requirement

      • Header: mi_common_datatype.h, mi_ive.h, mi_ive_datatype.h

      • Library: libmi_ive.a

    • Note

    • Related API

      MI_IVE_CannyHysEdge


    2.30. MI_IVE_Lbp

    • Function

      Execute an LBP calculation task.

    • Syntax

      MI_S32 MI_IVE_Lbp(MI_IVE_HANDLE hHandle, MI_IVE_SrcImage_t *pstSrc1, MI_IVE_SrcImage_t *pstSrc2, MI_IVE_DstImage_t *pstDst, MI_IVE_LbpCtrrl_t *pstLbpCtrl, MI_BOOL bInstant);
      
    • Parameter

      Parameter Name Description Input/Output
      hHandle Regional handle number. Parameter range: [0, MI_IVE_HANDLE_MAX). Input
      pstSrc1 Source image pointer. Cannot be null. Input
      pstSrc2 Source image pointer. Cannot be null. If U8C1 is the input channel mode, it can be null. Input
      pstDst Output image pointer. Cannot be null. Width and height same as pstSrc. Output
      pstLbpCtrl Control info pointer. Cannot be null. Input
      bInstant Reserved. Input
      Parameter Name Supported Image Type Address Alignment Resolution
      pstSrc U8C1 16 byte 64x64 ~ 1920x1080
      pstDst U8C1 16 byte Same as pstSrc
    • Return Value

      Return Value Description
      0 Successful.
      Non-zero Failed. Please refer to ERROR CODE.
    • Requirement

      • Header: mi_common_datatype.h, mi_ive.h, mi_ive_datatype.h

      • Library: libmi_ive.a

    • Note

      • The LBP calculation formula of U8C1/U8C2 mode is as illustrated in the following figure.

        • U8C1 mode:

        • U8C2 mode:

      • The calculation formulas of different mode are as follows:

        • E_MI_IVE_LBP_CMP_NORMAL

          lbp(x,y)=\sum_{i=0}^7(I_i-I_c) \geq thr) << (7-i), \ thr \in [-128, 127]

        • E_MI_IVE_LBP_CMP_ABS

          lbp(x,y)=\sum_{i=0}^7(abs(I_i-I_c) \geq thr) << (7-i), \ thr \in [0, 255]

        • E_MI_IVE_LBP_CMP_ABS_MUL

          lbp(x,y)=\sum_{i=0}^7((I_i-I_c) \geq thr*I_c) << (7-i), \ thr \in [0, 1]

        Where,

        • I_i refers to pstSrc1, lpb(x,y) refers to pstDst, and thr refers to pstLbpCtrl→un8BitThr.

        • In U8C1 mode, I_c refers to pstScr1, In U8C2 mode, I_c refers to pstScr2.


    2.31. MI_IVE_NormGrad

    • Function

      Execute a normalized gradient calculation task, in which the gradient average components are normalized to S8.

    • Syntax

      MI_S32 MI_IVE_NormGrad(MI_IVE_HANDLE hHandle, MI_IVE_SrcImage_t *pstSrc, MI_IVE_DstImage_t *pstDstH, MI_IVE_DstImage_t *pstDstV, MI_IVE_DstImage_t *pstDstHV, MI_IVE_NormGradCtrl_t *pstNormGradCtrl, MI_BOOL bInstant);
      
    • Parameter

      Parameter Name Description Input/Output
      hHandle Regional handle number. Parameter range: [0, MI_IVE_HANDLE_MAX). Input
      pstSrc Source image pointer. Cannot be null. Input
      pstDstH Gradient component image H pointer gained by template filtering and normalization to S8. According to pstNormGradCtrl→eOutCtrl, this parameter cannot be null if
      output is required. Output
      pstDstV Gradient component image V pointer gained by transposed template filtering and normalization to S8. According to pstNormGradCtrl→eOutCtrl, this parameter cannot be null if
      output is required. Output
      pstDstHV Image pointer gained by template and transposed template filtering and normalization to S8. The image pointer is saved in package format. According to pstNormGradCtrl→eOutCtrl, this parameter cannot be null if
      output is required. Output
      pstNormGradCtrl Control info pointer. Input
      bInstant Reserved. Input
      Parameter Name Supported Image Type Address Alignment Resolution
      pstSrc U8C1 16 byte 64x64 ~ 1920x1080
      pstDstH S8C1 16 byte Same as pstSrc
      pstDstV S8C1 16 byte Same as pstSrc
      pstDstHV S8C2_PACKAGE 16 byte Same as pstSrc
    • Return Value

      Return Value Description
      0 Successful.
      Non-zero Failed. Please refer to ERROR CODE.
    • Requirement

      • Header: mi_common_datatype.h, mi_ive.h, mi_ive_datatype.h

      • Library: libmi_ive.a

    • Note

      • When the output mode is E_MI_IVE_NORM_GRAD_OUT_CTRL_HOR_AND_VER, pstDstH and pstDstV pointers cannot be null and the stride of pstDstH and pstDstV must be consistent.

      • Four output formats are available for configuration. For details, please refer to MI_IVE_NormGradOutCtrl_e.

      • The calculation formula of NormGrad is as follows:

        H_{out}={\sum_{-2<j<2}\sum_{-2<i<2}I(x+i,y+j)*coef(x+i,y+j)} >> norm

        V_{out}={\sum_{-2<j<2}\sum_{-2<i<2}I(x+i,y+j)*coef(x+j,y+i)} >> norm

    • Related API

      MI_IVE_Sobel


    2.32. MI_IVE_LkOpticalFlow

    • Function

      Execute a single layer LK optical flow calculation task.

    • Syntax

      MI_S32 MI_IVE_LKOpticalFlow(MI_IVE_HANDLE hHandle, MI_IVE_SrcImage_t*pstSrcPre, MI_IVE_SrcImage_t*pstSrcCur, MI_IVE_SrcMemInfo_t *pstPoint, MI_IVE_MemInfo_t *pstMv, MI_IVE_LkOpticalFlowCtrl_t *pstLkOptiFlowCtrl, MI_BOOL bInstant);
      
    • Parameter

      Parameter Name Description Input/Output
      hHandle Regional handle number. Parameter range: [0, MI_IVE_HANDLE_MAX). Input
      pstSrcPre Previous image pointer. Cannot be null. Input
      pstSrcCur Current image pointer. Cannot be null. Width and height same as pstSrcPre. Input
      pstPoint Current pyramid layer initial feature point coordinate. Cannot be null. The coordinate can only be of the type MI_IVE_PointS25Q7_t. The memory should at least have the size below: pstLkOptiFlowCtrl→u16CornerNum * sizeof(MI_IVE_PointS25Q7_t). Input
      pstMv Corresponds to pstPoint feature point motion displacement vector. Cannot be null. The first calculation needs to be initialized to 0 input; the subsequent layer calculation should input the motion displacement vector calculated by the upper layer. The displacement can only be of the type MI_IVE_MvS9Q7_t. The memory should at least have the size below: pstLkOptiFlowCtrl→u16CornerNum * sizeof(MI_IVE_MvS9Q7_t) Input, Output
      pstLkOptiFlowCtrl Control parameter pointer. Cannot be null. Input
      bInstant Reserved. Input
      Parameter Name Supported Image Type Address Alignment Resolution
      pstSrcPre U8C1 16 byte 64x64 ~ 1920x1080
      pstSrcCur U8C1 16 byte Same as pstSrcPre
    • Return Value

      Return Value Description
      0 Successful.
      Non-zero Failed. Please refer to ERROR CODE.
    • Requirement

      • Header: mi_common_datatype.h, mi_ive.h, mi_ive_datatype.h

      • Library: libmi_ive.a

    • Note

      • In solving the following optical flow equation, only 7x7 pixels around the feature point are used to calculate the corresponding I_x, I_y, I_t.

        \begin{bmatrix} \sum I_{x}^{2} & \sum I_{x}I_{y} \\ \sum I_{x}I_{y} & \sum I_{y}^{2} \\ \end{bmatrix} \begin{bmatrix} u \\ v \end{bmatrix} \begin{bmatrix} -\sum I_{x}I_{t}\\ -\sum I_{y}I_{t} \\ \end{bmatrix}

        Where, I_x, I_y, I_t refer respectively to the partial derivation of the current image in the x, y direction and the difference between the current image and the previous image.

      • Let’s take the following 3-layer pyramid LK optical flow calculation as an example. The width and height of the image of each layer must be half the width and height of the image of its upper layer. The calculation method is as shown in the following figure.

        Fig 1-12: 3-Layer Pyramid LK Optical Flow Calculation

        • According to the input feature point coordinates, the coordinates corresponding to the feature points of the three-layer pyramid are calculated: p0, p1, p2;

        • Using p2 and mv2, which is initially 0, as input, call the LK operator to find the displacement mv2 on the second layer;

        • Using p1 and mv2 as input, call the LK operator to find the displacement mv1 on the frist layer;

        • Using p0 and mv1 as input, call the LK operator to find the displacement mv0 on the zero layer;

        • If the zero layer is not the original image, the true displacement mv of the LK optical flow can be obtained according to the proportional relationship between the zero layer and the original image.

      • Design and usage restrictions: Each feature point is calculated only by the data of the fixed size window centered on the feature point. If the feature point displacement target point exceeds the fixed size window during the iterative calculation process, the calculation optical flow would fail.


    2.33. MI_IVE_Sad

    • Function

      Calculate 16-bit/8-bit SAD images of 4x4/8x8/16x16 blocks for two images, and threshold output for SAD

    • Syntax

      MI_S32 MI_IVE_Sad(MI_IVE_HANDLE hHandle, MI_IVE_SrcImage_t*pstSrc1, MI_IVE_SrcImage_t*pstSrc2, MI_IVE_DstImage_t *pstSad, MI_IVE_DstImage_t *pstThr, MI_IVE_SadCtrl_t *pstSadCtrl, MI_BOOL bInstant);
      
    • Parameter

      Parameter Name Description Input/Output
      hHandle Regional handle number. Parameter range: [0, MI_IVE_HANDLE_MAX). Input
      pstSrc1 Source image 1 pointer. Cannot be null. Input
      pstSrc2 Source image 2 pointer. Cannot be null. Width and height same as pstSrc1. Input
      pstSad Output SAD image pointer. Output
      pstThr Output SAD thresholding image pointer. According to pstSadCtrl→eOutCtrl, this parameter cannot be null if output is required.
      According to pstSadCtrl→eMode, refers to 4x4, 8x8, and 16x16 block modes, the width and height thereof being ¼, ⅛, and 1/16 of pstSrc1 respectively.
      According to pstSadCtrl→eOutCtrl, this parameter cannot be null if output is required.
      According to pstSadCtrl→eMode, refers to 4x4, 8x8, and 16x16 block modes, the width and height thereof being ¼, ⅛, and 1/16 of pstSrc1 respectively.
      Output
      pstSadCtrl Control info pointer. Cannot be null. Input
      bInstant Reserved. Input
      Parameter Name Supported Image Type Address Alignment Resolution
      pstSrc1 U8C1 1 byte 64x64 ~ 1920x1080
      pstSrc2 U8C1 1 byte Same as pstSrc1
      pstSad U8C1, U16C1 16 byte According to pstSadCtrl→eMode, refers to 4x4, 8x8, and 16x16 block modes, the width and height thereof being ¼, ⅛, and 1/16 of pstSrc1 respectively.
      pstThr U8C1 16 byte According to pstSadCtrl→eMode, refers to 4x4, 8x8, 16x16 block modes, the width and height thereof being ¼, ⅛, and 1/16 of pstSrc1 respectively.
    • Return Value

      Return Value Description
      0 Successful.
      Non-zero Failed. Please refer to ERROR CODE.
    • Requirement

      • Header: mi_common_datatype.h, mi_ive.h, mi_ive_datatype.h

      • Library: libmi_ive.a

    • Note

      • The calculation formula of SAD is as follows:

        SAD_{out}(x,y)=\sum_{i=0}^{n-1}\sum_{j=0}^{n-1}abs(I_{src1}(n*x+i, n*y+j) - I_{src2}(n*x+i, n*y+j))
        Thr(x,y)=\begin{cases} minVal \quad O(x,y) \leq Thresh \\ maxVal \quad O(x,y) > Thresh \\ \end{cases}

        Where,

        • I_{src1}(i,j) refers to pstSrc1, I_{src2}(i,j) refers to pstSrc2, SAD_{out}(x,y) refers to pstSad, Thr(x,y) refers to pstThr;

        • Thresh, minVal and maxVal refer respectively to pstSadCtrl→u16Thr, pstSadCtrl→u8MinVal and stSadCtrl→u8MaxVal.

        • n is related to pstSadCtrl→eMode and represents 4, 8 or 16 respectively when the eMode is E_MI_IVE_SAD_MODE_MB_4X4, E_MI_IVE_SAD_MODE_MB_8X8 or E_MI_IVE_SAD_MODE_MB_16X16;


    2.34. MI_IVE_Bernsen

    • Function

      Execute a Bernsen thresholding task for the 3x3 and 5x5 windows.

    • Syntax

      MI_S32 MI_IVE_Bernsen(MI_IVE_HANDLE hHandle, MI_IVE_SrcImage_t *pstSrc, MI_IVE_DstImage_t *pstDst, MVE_IVE_BernsenCtrl_t *pstBernsenCtrl, MI_BOOL bInstant);
      
    • Parameter

      Parameter Name Description Input/Output
      hHandle Regional handle number. Parameter range: [0, MI_IVE_HANDLE_MAX). Input
      pstSrc Source image pointer. Cannot be null. Input
      pstDst Pointer to the output image template. It cannot be null. The height and width are the same as those of pstSrc. Output
      pstBernsenCtrl Pointer to the control parameter. It cannot be null. Output
      bInstant Reserved. Input
      Parameter Name Supported Image Type Address Alignment Resolution
      pstSrc U8C1 16 byte 64x64 ~ 1920x1080
      pstDst S8C1 16 byte Same as pstSrc
      • For Pcupid series: The hardware acceleration is supported when the resolution is not exceeded 640x480.
    • Return Value

      Return Value Description
      0 Successful.
      Non-zero Failed. Please refer to ERROR CODE.
    • Requirement

      • Header: mi_common_datatype.h, mi_ive.h, mi_ive_datatype.h

      • Library: libmi_ive.a

    • Note

      • Two modes are supported. See MI_IVE_BernsenMode_e for details.

      • The calculation formulas of different mode are as follows:

        • MI_BERNSEN_MODE_NORMAL

          T(x,y)=0.5*(max_{-\omega\leqslant i\leqslant \omega,-\omega\leqslant j\leqslant \omega}I(x+i,y+j)+min_{-\omega\leqslant i\leqslant \omega,-\omega\leqslant j\leqslant \omega}I(x+i,y+j))
          I_{out}(x,y)=\left \{ \begin{aligned} 0,I(x,y)< T(x,y) \\ 1,I(x,y)\geqslant T(x,y) \end{aligned} \right.

          No value needs to be assigned to pstBernsenCtrl->u8Thr.

        • MI_BERNSEN_MODE_THRESH

          T(x,y)=0.5*(max_{-\omega\leqslant i\leqslant \omega,-\omega\leqslant j\leqslant \omega}I(x+i,y+j)+min_{-\omega\leqslant i\leqslant \omega,-\omega\leqslant j\leqslant \omega}I(x+i,y+j))
          I_{out}(x,y)=\left \{ \begin{aligned} 0,I(x,y)< 0.5*(T(x,y)+Thr) \\ 1,I(x,y)\geqslant 0.5*(T(x,y)+Thr) \end{aligned} \right.

        Where I(x,y) refer to pstSrc, I_{out}(x,y) refer to pstDst, and Thr refer to u8thr in pstBernsenCtrl.


    2.35. MI_IVE_LineFilterHor

    • Function

      Execute a horizontal density filter task for binary images.

    • Syntax

      MI_S32 MI_IVE_LineFilterHor(MI_IVE_HANDLE hHandle, MI_IVE_SrcImage_t *pstSrcDst, MVE_IVE_LineFilterHorCtrl_t *pstLineFilterHorCtrl, MI_BOOL bInstant);
      
    • Parameter

      Parameter Name Description Input/Output
      hHandle Regional handle number. Parameter range: [0, MI_IVE_HANDLE_MAX). Input
      pstSrcDst Pointer to the source image or the output after processing. It cannot be null. Input / Output
      pstLineFilterHorCtrl Pointer to the control parameter. It cannot be null. Input
      bInstant Reserved. Input
      Parameter Name Supported Image Type Address Alignment Resolution
      pstSrcDst U8C1 binary image 16 byte 64x64 ~ 1920x1080
    • Return Value

      Return Value Description
      0 Successful.
      Non-zero Failed. Please refer to ERROR CODE.
    • Requirement

      • Header: mi_common_datatype.h, mi_ive.h, mi_ive_datatype.h

      • Library: libmi_ive.a

    • Note

      • The images are counted in the horizontal direction. Each line consists of line segments that appear alternatively (white line segments) and gaps between the line segments (black line segments). The length of a black line segment is satisfied the following condition, the block line segment is set to a white line segment.

      • The calculation formula of LineFilterHor is as follows:

        1. Horizontally scan the binary image, and record the result, as shown in the figure below.

        2. Assume the current gap is line_black56, if conform to the condition as below, the black line segment will be set to a white line segment.

          Condition 1 : line_black34 > thr1

          Condition 2 : line_black78 > thr1

          Condition 3 :

          (line_white45 + line_black56 + line_white67) <= (line_white45 + line_white67)thr2

          Condition 4 : (line_white45 + line_white67) > 1

        3. Following these step (step 1 and step 2), until handle the whole binary image. The result is shown in figure below.

        4. Horizontally scan the binary image again. According to the relationship between the white line segment and black line segment, transform the black line segment into the white line segment.

          Assume the current gap is line_black34, if conform to the condition as below, the black line segment will be set to a white line segment.

          Condition 1 : line_block34 < thr3

          Condition 2 : line_white47 > 2thr3

          Condition 3 : line_white23 > 9

          Condition 4 : line_white23 < 3thr3

        5. Following step 3 and step 4, until handle the whole binary image.


    2.36. MI_IVE_LineFilterVer

    • Function

      Execute a vertical density filter task for binary images.

    • Syntax

      MI_S32 MI_IVE_LineFilterVer(MI_IVE_HANDLE hHandle, MI_IVE_SrcImage_t *pstSrcDst, MVE_IVE_LineFilterVerCtrl_t *pstLineFilterVerCtrl, MI_BOOL bInstant);
      
    • Parameter

      Parameter Name Description Input/Output
      hHandle Regional handle number. Parameter range: [0, MI_IVE_HANDLE_MAX). Input
      pstSrcDst Pointer to the source image or the output after processing. It cannot be null. Input / Output
      pstLineFilterVerCtrl Pointer to the control parameter. It cannot be null. Input
      bInstant Reserved. Input
      Parameter Name Supported Image Type Address Alignment Resolution
      pstSrcDst U8C1 binary image 16 byte 64x64 ~ 1920x1080
    • Return Value

      Return Value Description
      0 Successful.
      Non-zero Failed. Please refer to ERROR CODE.
    • Requirement

      • Header: mi_common_datatype.h, mi_ive.h, mi_ive_datatype.h

      • Library: libmi_ive.a

    • Note

      • The images are counted in the vertical direction. Each line consists of line segments that appear alternatively white line segments and gaps between the line segments (black line segments). The length of a black line segment is satisfied the following condition, the block line segment is set to a white line segment.

      • The calculation formula of LineFilterVer is as follows:

        1. Vertically scan the binary image, and record the result, as shown in the figure below.

        2. Assume the current gap is line_black56, if conform to the condition as below, the black line segment will be set to a white line segment.

          Condition 1 : line_black56 < thr

          Condition 2 : line_black67 > 6 & line_whitr67 < 25

          Condition 3 : line_white45 < 12

        3. Following these step (step 1 and step 2), until handle the whole binary image.


    2.37. MI_IVE_NoiseRemoveHor

    • Function

      Execute a horizontal noise removal task for binary images.

    • Syntax

      MI_S32 MI_IVE_NoiseRemoveHor(MI_IVE_HANDLE hHandle, MI_IVE_SrcImage_t *pstSrcDst, MVE_IVE_NoiseRemoveHorCtrl_t *pstNoiseRemoveHorCtrl, MI_BOOL bInstant);
      
    • Parameter

      Parameter Name Description Input/Output
      hHandle Regional handle number. Parameter range: [0, MI_IVE_HANDLE_MAX). Input
      pstSrcDst Pointer to the source image or the output after processing. It cannot be null. Input / Output
      pstNoiseRemoveHorCtrl Pointer to the control parameter. It cannot be null. Input
      bInstant Reserved. Input
      Parameter Name Supported Image Type Address Alignment Resolution
      pstSrcDst U8C1 binary image 16 byte 64x64 ~ 1920x1080
    • Return Value

      Return Value Description
      0 Successful.
      Non-zero Failed. Please refer to ERROR CODE.
    • Requirement

      • Header: mi_common_datatype.h, mi_ive.h, mi_ive_datatype.h

      • Library: libmi_ive.a

    • Note

      • The images are counted in the horizontal direction. Each line consists of line segments that appear alternatively (white line segments) and gaps between the line segments (black line segments). If the length of a line segment is smaller than the thr1 or bigger than the thr2, convert the line segment into a gap.

    2.38. MI_IVE_NoiseRemoveVer

    • Function

      Execute a vertical noise removal task for binary images.

    • Syntax

      MI_S32 MI_IVE_NoiseRemoveHor(MI_IVE_HANDLE hHandle, MI_IVE_SrcImage_t *pstSrcDst, MVE_IVE_NoiseRemoveVerCtrl_t *pstNoiseRemoveVerCtrl, MI_BOOL bInstant);
      
    • Parameter

      Parameter Name Description Input/Output
      hHandle Regional handle number. Parameter range: [0, MI_IVE_HANDLE_MAX). Input
      pstSrcDst Pointer to the source image or the output after processing. It cannot be null. Input / Output
      pstNoiseRemoveVerCtrl Pointer to the control parameter. It cannot be null. Input
      bInstant Reserved. Input
      Parameter Name Supported Image Type Address Alignment Resolution
      pstSrcDst U8C1 binary image 16 byte 64x64 ~ 1920x1080
    • Return Value

      Return Value Description
      0 Successful.
      Non-zero Failed. Please refer to ERROR CODE.
    • Requirement

      • Header: mi_common_datatype.h, mi_ive.h, mi_ive_datatype.h

      • Library: libmi_ive.a

    • Note

      • The images are counted in the vertical direction. Each line consists of line segments that appear alternatively (white line segments) and gaps between the line segments (black line segments). If the length of a line segment is smaller than the thr1 or bigger than the thr2, convert the line segment into a gap.

    2.39. MI_IVE_AdpThresh

    • Function

      Execute an adaptive thresholding task.

    • Syntax

      MI_S32 MI_IVE_AdpThresh(MI_IVE_HANDLE hHandle, MI_IVE_SrcImage_t *pstSrc, MI_IVE_SrcImage_t *pstInteg, MI_IVE_DstImage_t *pstDst, MVE_IVE_AdpThreshCtrl_t *pstAdpThrCtrl, MI_BOOL bInstant);
      
    • Parameter

      Parameter Name Description Input/Output
      hHandle Regional handle number. Parameter range: [0, MI_IVE_HANDLE_MAX). Input
      pstSrc Pointer to the source image or the output after processing. It cannot be null. Input
      pstInteg Pointer to the integral image of the source image. It cannot be null. Input
      pstDst Pointer to the target binary image. It cannot be null. Output
      pstAdpThrCtrl Pointer to the control parameter. It cannot be null. Input
      bInstant Reserved. Input
      Parameter Name Supported Image Type Address Alignment Resolution
      pstSrc U8C1 16 byte 64x64 ~ 1920x1080
      pstInteg U32C1 16 byte Same as pstSrc
      pstDst U8C1 16 byte Same as pstSrc
    • Return Value

      Return Value Description
      0 Successful.
      Non-zero Failed. Please refer to ERROR CODE.
    • Requirement

      • Header: mi_common_datatype.h, mi_ive.h, mi_ive_datatype.h

      • Library: libmi_ive.a

    • Note

      • The calculation formula of AdpThresh is as follows:

        T(x,y)=\frac{1}{w*h}*\sum_{i=-h/2}^{h/2}\sum_{j=-w/2}^{w/2}I(x+i,y+j)
        I_{out}(x,y)=\begin{cases} 255 \quad (I(x,y) > (T(x,y) * RateThr) - Offset) \quad |\quad (I(x,y) \geq ValueThr) \\ 0 \quad else \\ \end{cases}
        Integ(x,y)=\sum_{i=-h/2}^{h/2}\sum_{j=-w/2}^{w/2}I(x+i,y+j)

        Where,

        • w=u8HalfMaskx, h=u8HalfMasky, RateThr=u8RateThr / 10, Offset=s16Offset, ValueThr=u8ValueThr

        • I(x, y) refer to pstSrc, I_{out}(x,y) refer to pstDst and Integ(x,y) refer to pstInteg.


    2.40. MI_IVE_Resize

    • Function

      Execute an image scaling task, the input image can be scaling down or up to the indicated size and as output image.

    • Syntax

      MI_S32 MI_IVE_Resize(MI_IVE_HANDLE hHandle, MI_IVE_SrcImage_t *pstSrc, MI_IVE_DstImage_t *pstDst, MVE_IVE_ResizeCtrl_t * pstResizeCtrl, MI_BOOL bInstant);
      
    • Parameter

      Parameter Name Description Input/Output
      hHandle Regional handle number.
      Parameter range: [0, MI_IVE_HANDLE_MAX).
      Input
      pstSrc Pointer to the source image or the output after processing. It cannot be null. Input
      pstDst Pointer to the target binary image. It cannot be null. Output
      pstResizeCtrl Pointer to the control parameter. It cannot be null. Input
      bInstant Reserved. Input
      Parameter Name Supported Image Type Address Alignment Resolution
      pstSrc U8C1, U8C3_PLANAR, U8C3_PACKAGE and YUV420SP 16 byte 16x4 ~ 1920x1080
      pstDst U8C1, U8C3_PLANAR, U8C3_PACKAGE and YUV420SP 16 byte Same as pstSrc
      • For Pcupid series: The hardware acceleration is supported when the format is U8C1 and the resolution is not exceeded 640x480.
    • Return Value

      Return Value Description
      0 Successful.
      Non-zero Failed. Please refer to ERROR CODE.
    • Requirement

      • Header: mi_common_datatype.h, mi_ive.h, mi_ive_datatype.h

      • Library: libmi_ive.a

    • Note

      • Resize is implemented by referring to the standard bilinear and area method.

        • For Souffle/Pcupid series: The hardware acceleration is supported when the scaling factor is not exceeded 16, e.g. 16x16 image can be scaled up to 256x256 image at the most, 512x256 image can be scaled down to 32x16 image at the most.
    • Example

      MI_S32 Sample_Resize()
      {
          MI_IVE_HANDLE handle = 0;
          MI_IVE_SrcImage_t stSrc = {0};
          MI_IVE_DstImage_t stDst = {0};
          MVE_IVE_ResizeCtrl_t stCtrl =
          {
              .enMode = E_MI_IVE_RESIZE_TYPE_U8C1,
              .eResizeMethod = E_MI_IVE_RESIZE_METHOD_BILINEAR,
              // .eResizeMethod = E_MI_IVE_RESIZE_METHOD_AREA,
          };
      
          // create IVE handle
          if (MI_SUCCESS != (s32Ret = MI_IVE_Create(handle)))
          {
              printf("Could not create IVE handle\n");
              return E_MI_ERR_FAILED;
          }
      
          while (loop_condition == true)
          {
              // ...set input image info to stSrc. e.g. stSrc.eType = E_MI_IVE_IMAGE_TYPE_U8C1;
              ...
              // ...set output image info to stDst. e.g. stDst.eType = E_MI_IVE_IMAGE_TYPE_U8C1;
              ...
              stDst.u16Width = TargetWidth; // output width after resize, and should be 16-pixel-align
              stDst.u16Height = TargetHeight // output height after resize, and should be 2-pixel-align
      
              // Resize task.
              if (MI_SUCCESS != (s32Ret = MI_IVE_Resize(handle, &stSrc, &stDst, &stCtrl, 0)))
              {
                  printf("MI_IVE_Resize() return ERROR 0x%X\n", s32Ret);
                  MI_IVE_Destroy(handle);
                  return E_MI_ERR_FAILED;
              }
      
              // get output from stDst and do something expected.
              ...
          }
      
          // destroy IVE handle
          MI_IVE_Destroy(handle);
          return MI_SUCCESS;
      }
      

    2.41. MI_IVE_Bat

    • Function

      Execute the horizontal or vertical alternating time for binary images.

    • Syntax

      MI_S32 MI_IVE_BAT (MI_IVE_HANDLE hHandle, MI_IVE_SrcImage_t *pstSrc, MI_IVE_DstMemInfo_t *pstDstH, MI_IVE_DstMemInfo_t *pstDstV, MVE_IVE_BatCtrl_t *pstCtrl, MI_BOOL bInstant);
      
    • Parameter

      Parameter Name Description Input/Output
      hHandle Regional handle number. Parameter range: [0, MI_IVE_HANDLE_MAX). Input
      pstSrc Pointer to the source image. It cannot be null. Input
      pstDstH Pointer to the horizontal output image. It cannot be null. Output
      pstDstV Pointer to the vertical output image. It cannot be null. Output
      pstCtrl Pointer to the control parameter. It cannot be null. Input
      bInstant Reserved. Input
      Parameter Name Supported Image Type Address Alignment Resolution
      pstSrc U8C1 binary image 16 byte 64x64 ~ 1920x1080
      pstDstH U8C1 binary image 16 byte Same as pstSrc
      pstDstV U8C1 binary image 16 byte Same as pstSrc
    • Return Value

      Return Value Description
      0 Successful.
      Non-zero Failed. Please refer to ERROR CODE.
    • Requirement

      • Header: mi_common_datatype.h, mi_ive.h, mi_ive_datatype.h

      • Library: libmi_ive.a

    • Note

      • The calculation formula of BAT is as follows:

        O(y)=\left\{ \begin{aligned} 1,h(y)\geqslant u16HorTimes \\ 0,h(y)< u16HorTimes \end{aligned} \right.
        O(x)=\left\{ \begin{aligned} 1,v(x)\geqslant u16HorTimes \\ 0,v(x)< u16HorTimes \end{aligned} \right.

        Where h(y)/v(x) refer to the horizontal/vertical alternating times, O(y)/O(x) refer to the output image of horizontal/vertical direction.


    2.42. MI_IVE_Acc

    • Function

      Execute an accumulation task for two gray-scale images.

    • Syntax

      MI_S32 MI_IVE_Acc (MI_IVE_HANDLE hHandle, MI_IVE_SrcImage_t * pstSrc0, MI_IVE_SrcImage_t *pstSrc1, MI_IVE_DstImage_t *pstDst, MVE_IVE_AccCtrl_t * pstAccCtrl, MI_BOOL bInstant);
      
    • Parameter

      Parameter Name Description Input/Output
      hHandle Regional handle number. Parameter range: [0, MI_IVE_HANDLE_MAX). Input
      pstSrc0 Pointer to the source image or the output after processing. It cannot be null. Input
      pstSrc1 Pointer to the source image or the output after processing. It cannot be null. Input
      pstDst Pointer to the target binary image. It cannot be null. Output
      pstAccCtrl Pointer to the control parameter. It cannot be null. Input
      bInstant Reserved. Input
      Parameter Name Supported Image Type Address Alignment Resolution
      pstSrc0 U8C1 16 byte 64x64 ~ 1920x1080
      pstSrc1 U8C1 16 byte Same as pstSrc0
      pstDst U8C1 16 byte Same as pstSrc0
    • Return Value

      Return Value Description
      0 Successful.
      Non-zero Failed. Please refer to ERROR CODE.
    • Requirement

      • Header: mi_common_datatype.h, mi_ive.h, mi_ive_datatype.h

      • Library: libmi_ive.a

    • Note

      • The calculation formulas of different mode are as follows:

        • E_MI_IVE_ACC_MODE_INCREASE :

          I_{out}(x,y)=I_{src0}(x,y)+I_{src1}(x,y)
        • E_MI_IVE_ACC_MODE_DECREASE :

          I_{out}(x,y)=I_{src0}(x,y)-I_{src1}(x,y)
        • E_MI_IVE_ACC_MODE_INCREASE_MAP_255TO1 :

          I_{out}(x,y)=I_{src0}(x,y)+(I_{src1}(x,y)\&0x1)

        Where, I_{src0}(x,y) refer to pstSrc0, I_{src1}(x,y) refer to pstSrc1, I_{out}(x,y) refer to pstDst.


    2.43. MI_IVE_Matrix_Transform

    • Function

      Execute the operation of matrix multiplication

    • Syntax

      MI_S32 MI_IVE_Matrix_Transform(MI_IVE_HANDLE hHandle, MI_IVE_SrcImage_t *pstSrc1, MI_IVE_SrcImage_t *pstSrc2, MI_IVE_SrcImage_t *pstSrc3, MI_IVE_DstImage_t *pstDst1, MI_IVE_DstImage_t *pstDst2, MI_IVE_DstImage_t *pstDst3, MI_IVE_MatrTranfCtrl_t *pstMatrTranfCtrl, MI_BOOL bInstant);
      
    • Parameter

      Parameter Name Description Input/Output
      hHandle Regional handle number. Parameter range: [0, MI_IVE_HANDLE_MAX). Input
      pstSrc1 Pointer to the source image. It cannot be null. Input
      pstSrc2 Pointer to the source image. It cannot be null. Input
      pstSrc3 Pointer to the source image. It cannot be null. Input
      pstDst1 Pointer to the output image. It cannot be null. Output
      pstDst2 Pointer to the output image. It cannot be null. Output
      pstDst3 Pointer to the output image. It cannot be null. Output
      pstMatrTranfCtrl Pointer to the control parameter. It cannot be null. Input
      bInstant Reserved. Input
      Parameter Name Supported Image Type Address Alignment Resolution
      pstSrc1 S32C1 16 byte 64x64 ~ 1920x1080
      pstSrc2 S32C1 16 byte Same as pstSrc1
      pstSrc3 S32C1 16 byte Same as pstSrc1
      pstDst1 S32C1 16 byte Same as pstSrc1
      pstDst2 S32C1 16 byte Same as pstSrc1
      pstDst3 S32C1 16 byte Same as pstSrc1
    • Return Value

      Return Value Description
      0 Successful.
      Non-zero Failed. Please refer to ERROR CODE.
    • Requirement

      • Header: mi_common_datatype.h, mi_ive.h, mi_ive_datatype.h

      • Library: libmi_ive.a

    • Note

      • The matrix_transform calculation formula is as illustrated in the following figure.

        Fig 1-13: Illustration of Matrix_transform Calculation Formula

        Each input and output element consists of 16 integer, 15 decimal and 1 sign.

        Each input element of matrix consists of 16 integer, 15 decimal and 1 sign.

        • For Pudding series chips, each input element of matrix consists of 1 integer, 14 decimal and 1 sign.

        • The input type should be S32C1, for the common standard of different chip format.


    2.44. MI_IVE_Image_Dot

    • Function

      Execute the operation of dot product.

    • Syntax

      MI_S32 MI_IVE_Image_Dot (MI_IVE_HANDLE hHandle, MI_IVE_SrcImage_t *pstSrc1, MI_IVE_SrcImage_t *pstSrc2, MI_IVE_DstImage_t *pstDst, MI_BOOL bInstant);
      
    • Parameter

      Parameter Name Description Input/Output
      hHandle Regional handle number. Parameter range: [0, MI_IVE_HANDLE_MAX). Input
      pstSrc1 Pointer to the source image. It cannot be null. Input
      pstSrc2 Pointer to the source image. It cannot be null. Input
      pstDst Pointer to the output image. It cannot be null. Output
      bInstant Reserved. Input
      Parameter Name Supported Image Type Address Alignment Resolution
      pstSrc1 S32C1 16 byte 64x64 ~ 1920x1080
      pstSrc2 S32C1 16 byte Same as pstSrc1
      pstDst S32C1 16 byte Same as pstSrc1
    • Return Value

      Return Value Description
      0 Successful.
      Non-zero Failed. Please refer to ERROR CODE.
    • Requirement

      • Header: mi_common_datatype.h, mi_ive.h, mi_ive_datatype.h

      • Library: libmi_ive.a

    • Note

      • The calculation formula of Image Dot is as follows:

        I_{out}(x,y) = I_{src1}(x,y) \times I_{src2}(x,y)

        Where I_{src1}(x,y) refer to pstSrc1, I_{src2}(x,y) refer to pstSrc2, I_{out}(x,y) refer to pstDst.

        Each input and output element consists of 16 integer, 15 decimal and 1 sign.


    2.45. MI_IVE_Shift_Detector

    • Function

      Execute the operation of object tracking.

    • Syntax

      MI_S32 MI_IVE_Shift_Detector(MI_IVE_HANDLE hHandle, MI_IVE_SrcImage_t *pstSrc1, MI_IVE_SrcImage_t *pstSrc2, MI_IVE_DstImage_t MI_IVE_DstImage_t *pstDstX, MI_IVE_DstImage_t *pstDstY, MI_IVE_SHIFT_DETECT_CTRL_t *pstCtrl, MI_BOOL bInstant);
      
    • Parameter

      Parameter Name Description Input/Output
      hHandle Regional handle number. Parameter range: [0, MI_IVE_HANDLE_MAX). Input
      pstSrc0 Pointer to the first source image. It cannot be null. Input
      pstSrc1 Pointer to the second source image. It cannot be null. Input
      pstDstX Pointer to the shift x image. It cannot be null. Output
      pstDstY Pointer to the shift y image. It cannot be null. Output
      pstCtrl Pointer to the control parameter It cannot be null. Input
      bInstant Reserved. Input
      Parameter Name Supported Image Type Address Alignment Resolution
      pstSrc1 U8C1 16 byte 64x64 ~ 1920x1080
      pstSrc2 U8C1 16 byte Same as pstSrc1
      pstDstX U8C1 16 byte Same as pstSrc1
      pstDstY U8C1 16 byte Same as pstSrc1
    • Return Value

      Return Value Description
      0 Successful.
      Non-zero Failed. Please refer to ERROR CODE.
    • Requirement

      • Header: mi_common_datatype.h, mi_ive.h, mi_ive_datatype.h

      • Library: libmi_ive.a

    • Note

      • Enter two images (Tk and Tk+1) of the same scene but in different time series, and input the positions of Tk target area by controlling data pointer, and the shift detector would output the tracing result of the target area in Tk+1.

      • If enMode = E_MI_IVE_SHIFT_DETECT_MODE_MULTI, the shift detector would divide images into MxN blocks (block size = u16Width x u16Height) and track all objects in each block.

      • If enMode = E_MI_IVE_SHIFT_DETECT_MODE_SINGLE, the shift detector would only track single object on images.


    2.46. MI_IVE_AlphaBlending

    • Function

      Execute an independent weighted addition calculation task against two grayscale images.

    • Syntax

      MI_S32 MI_IVE_AlphaBlending (MI_IVE_HANDLE hHandle, MI_IVE_SrcImage_t *pstSrc1, MI_IVE_SrcImage_t *pstSrc2, MI_IVE_SrcImage_t *pstAlpha, MI_IVE_DstImage_t *pstDst, MI_BOOL bInstant);
      
    • Parameter

      Parameter Name Description Input/Output
      hHandle Regional handle number. Parameter range: [0, MI_IVE_HANDLE_MAX). Input
      pstSrc1 Pointer to the source image. It cannot be null. Input
      pstSrc2 Pointer to the source image. It cannot be null. Input
      pstAlpha Pointer to the alpha map. It cannot be null. Input
      pstDst Pointer to the output image. It cannot be null. Output
      bInstant Reserved. Input
      Parameter Name Supported Image Type Address Alignment Resolution
      pstSrc1 U8C1 16 byte 64x64 ~ 1920x1080
      pstSrc2 U8C1 16 byte Same as pstSrc1
      pstAlpha U8C1 16 byte Same as pstSrc1
      pstDst U8C1 16 byte Same as pstSrc1
    • Return Value

      Return Value Description
      0 Successful.
      Non-zero Failed. Please refer to ERROR CODE.
    • Requirement

      • Header: mi_common_datatype.h, mi_ive.h, mi_ive_datatype.h

      • Library: libmi_ive.a

    • Note

      • The calculation formula of AlphaBlending is as follows:

        I_{\text{Out}} = I_{Src1}\left( x,y \right) \times I_{\text{Alpha}}(x,y) + I_{Src2}(x,y) \times (255 - I_{\text{Alpha}}(x,y))

        Where I_{src1}(x,y) refer to pstSrc1, I_{src2}(x,y) refer to pstSrc2, I_{Alpha}(x,y) refer to pstAlpha, I_{out}(x,y) refer to pstDst.


    2.47. MI_IVE_BGBlur

    • Function

      Execute the task of blur, replacement, mosaic or blur with mosaic for image background.

    • Syntax

      MI_S32 MI_IVE_BGBlur(MI_IVE_HANDLE hHandle, MI_IVE_SrcImage_t *pstSrcYMask, MI_IVE_SrcImage_t *pstSrcUvMask, MI_IVE_SrcImage_t *pstSrcOri, MI_IVE_SrcImage_t *pstSrcRepBg, MI_IVE_DstImage_t *pstDst, MI_IVE_BgBlurCtrl_t *pstCtrl);
      
    • Parameter

      Parameter Name Description Input/Output
      hHandle Regional handle number.
      Parameter range: [0, MI_IVE_HANDLE_MAX).
      Input
      pstSrcYMask Pointer to the source image which labeled the foreground/background of the Y component of pstSrcOri. It cannot be null. Input
      pstSrcUvMask Pointer to the source image which labeled the foreground/background of the UV component of pstSrcOri. It cannot be null. Input
      pstSrcOri Pointer to the source image. It cannot be null. Input
      pstSrcRepBg Pointer to the source image. Please refer to the tabulation below. It cannot be null. Input
      pstDst Pointer to the output image. It cannot be null. Output
      pstCtrl Pointer to the control parameter. It cannot be null. Input

      Parameter declaration of Souffle series

      Parameter Name Supported Image Type Address Alignment Resolution
      pstSrcYMask U8C1 16 byte 640x360 or 1280x720
      pstSrcUvMask U8C1 16 byte 320x180 or 640x360, should be corresponding to pstSrcYMask
      pstSrcOri YUV420SP, YUV422_YUYV 16 byte 640x360~7680x4320, the width can be 2-pixel-align.
      pstSrcRepBg YUV420SP for background blur.
      YUV420SP, YUV422_YUYV for background replacement.
      16 byte Same as pstSrcYMask for background blur.
      64x64~7680x4320 for background replacement, the width can be 2-pixel-align.
      pstDst YUV420SP, YUV422_YUYV 16 byte Same as pstSrcOri

      Parameter declaration of iFord series

      Parameter Name Supported Image Type Address Alignment Resolution
      pstSrcYMask U8C1 16 byte The width is 640 or 480
      The height is ALIGN_DOWN(pstSrcYMask->u16Width * pstSrcOri->u16Height / pstSrcOri->u16Width, 1)
      pstSrcUvMask U8C1 16 byte The width/height is half of the width/height of pstSrcYMask.
      pstSrcOri YUV420SP 16 byte 640x360~3840x2160, the width can be 2-pixel-align.
      pstSrcRepBg YUV420SP 16 byte Same as pstSrcYMask.
      pstDst YUV420SP 16 byte Same as pstSrcOri.
      • For iFord series, the width of pstSrcYMask is 640 when pstSrcOri->u16Width >= pstSrcOri->u16Height, 480 when pstSrcOri->u16Width < pstSrcOri->u16Height.

      • ALIGN_DOWN(n, 1) indicates that n is aligned down to 2, e.g. ALIGN_DOWN(513, 1) = 512

    • Return Value

      Return Value Description
      0 Successful.
      Non-zero Failed. Please refer to ERROR CODE.
    • Requirement

      • Header: mi_common_datatype.h, mi_ive.h, mi_ive_datatype.h

      • Library: libmi_ive.a

    • Note

      • The BGBlur mode, please refer to MI_IVE_BgBlurMode_e .

        BGBlur mode The limitation of the source image size
        Background blur/Background Mosaic/Background blur and mosaic pstSrcYMask = pstSrcRepBg <= pstSrcOri
        Background replacement pstSrcYMask <= pstSrcOri;
        pstSrcOri / 16 <= pstSrcRepBg <= pstSrcOri
        NOTE: the resolution of pstSrcRepBg should be the same as pstSrcOri when the width of pstSrcRepBg is over 1280.
    • Example

      MI_S32 Sample_BGBlur()
      {
          MI_S32 s32Ret;
          MI_IVE_HANDLE handle = 0;
          MI_IVE_SrcImage_t stSrcOri, stSrcYMask, stSrcUvMask, stSrcRepBg;
          MI_IVE_DstImage_t stDst;
          MI_IVE_BgBlurCtrl_t ctrl =
          {
              .eBgBlurMode    = E_MI_IVE_BGBLUR_MODE_BLUR, // or other mode.
              .u8MaskThr      = 127, // [0, 255], depends on user.
              .u8BlurLv       = 0, // [0, 255], depends on user and only valid in Souffle series.
              .u8ScalingStage = 0, // [0, 255], used in E_MI_IVE_BGBLUR_MODE_BLUR.
              .eBgBlurMaskOp  = E_MI_IVE_BGBLUR_MASK_OP_DILATE, // depends on user, refer to MI_IVE_BgBlurMaskOp_e.
              .u8SaturationLv = 64, // [0, 128], depends on user and only iFord support.
              .u8MosaicSize   = 6, // [2, 4, 6, 8, 10], depends on user and only iFord support.
          };
      
          // Init IVE
          if (MI_SUCCESS != (s32Ret = MI_IVE_Create(handle)))
          {
              printf("Could not create IVE handle\n");
              break;
          }
      
          // ...set input image info to stSrcOri, stSrcYMask, stSrcUvMask, stSrcRepBg.
          ...
          // ...set output image info to stDst.
          ...
      
          // BGBlur task.
          if (MI_SUCCESS != (s32Ret = MI_IVE_BGBlur(handle, &stSrcYMask, &stSrcUvMask, &stSrcOri, &stSrcRepBg, &stDst, &ctrl)))
          {
              printf("MI_IVE_BGBlur() return ERROR 0x%X\n", s32Ret);
              return E_MI_ERR_FAILED;
          }
      
          // get output from stDst and do something expected.
          ...
      
          // Deinit IVE
          MI_IVE_Destroy(handle);
      
          return s32Ret;
      }
      

      Fig 1-14: Illustration of Background Blur.

      Fig 1-15: Illustration of Background Replacement.


    3. DATA TYPE


    3.1. Data Type List

    The table below lists the data structure definitions of the related IVE data types:

    Data type Definition
    MI_IVE_HANDLE_MAX Defines the maximum number of IVE handle.
    MI_IVE_HIST_NUM Defines histogram statistics bin number
    MI_IVE_MAP_NUM Defines number of mapping lookup table entries
    MI_IVE_MAX_REGION_NUM Defines maximum number of connected regions
    MI_IVE_ST_MAX_CORNER_NUM Defines maximum number of Shi-Tomasi-like corners
    MI_IVE_MASK_SIZE_5X5 Defines Mask size
    MI_IVE_CANNY_STACK_RESERVED_SIZE Defines Canny Stack Reserved Size
    MI_IVE_ImageType_e Defines image types supported by generalized two-dimensional images
    MI_IVE_Image_t Defines generalized two-dimensional image information
    MI_IVE_SrcImage_t Defines source image
    MI_IVE_DstImage_t Defines output image
    MI_IVE_Data_t Defines two-dimensional image information in byte unit
    MI_IVE_SrcData_t Defines two-dimensional source data information in byte unit
    MI_IVE_DstData_t Defines two-dimensional output data information in byte unit
    MI_IVE_MemInfo_t Defines one-dimensional data memory information
    MI_IVE_SrcMemInfo_t Defines one-dimensional source data
    MI_IVE_DstMemInfo_t Defines one-dimensional output data
    MI_IVE_Length8bit_u Defines 8-bit data union
    MI_IVE_PointU16_t Defines U16 point information structure
    MI_IVE_PointS25Q7_t Defines S25Q7 fixed point information structure
    MI_IVE_Rect_t Defines U16 rectangle information structure
    MI_IVE_FilterCtrl_t Defines template filter control information
    MI_IVE_CscMode_e Defines color space conversion mode
    MI_IVE_CscCtrl_t Defines color space conversion control information
    MI_IVE_FilterAndCscCtrl_t Defines template filter plus color space conversion composite function control information
    MI_IVE_SobelOutCtrl_e Defines Sobel output control information
    MI_IVE_SobelCtrl_t Defines Sobel edge extraction control information
    MI_IVE_MagAndAngOutCtrl_e Defines Canny edge magnitude and angle calculation output format
    MI_IVE_MagAndAngCtrl_t Defines Canny edge magnitude and angle calculation control information
    MI_IVE_DilateCtrl_t Defines Dilate control information
    MI_IVE_ErodeCtrl_t Defines Erode control information
    MI_IVE_ThreshMode_e Defines image thresholding output format
    MI_IVE_ThreshCtrl_t Defines image thresholding control information
    MI_IVE_SubMode_e Defines image subtraction output format
    MI_IVE_SubCtrl_t Defines image subtraction control parameter
    MI_IVE_IntegOutCtrl_e Defines integral map output control parameter
    MI_IVE_IntegCtrl_t Defines integral map calculation control parameter
    MI_IVE_ThreshS16Mode_e Defines 16-bit signed image thresholding mode
    MI_IVE_ThreshS16Ctrl_t Defines 16-bit signed image thresholding control parameter
    MI_IVE_ThreshU16Mode_e Defines 16-bit unsigned image thresholding mode
    MI_IVE_ThreshU16Ctrl_t Defines 16-bit unsigned image thresholding control parameter
    MI_IVE_16BitTo8BitMode_e Defines 16-bit image to 8-bit image conversion mode
    MI_IVE_16bitTo8BitCtrl_t Defines 16-bit image to 8-bit image conversion control parameter
    MI_IVE_OrdStatFilterMode_e Defines sequential statistic filtering mode
    MI_IVE_OrdStatFilter_t Defines sequential statistic filtering control parameter
    MI_IVE_MapLutMem_t Defines Map operator lookup table memory information
    MI_IVE_EqualizeHistCtrlMem_t Defines histogram equalization auxiliary memory
    MI_IVE_EqualizeHistCtrl_t Defines histogram equalization control parameter
    MI_IVE_AddMode_e Define the add calculation mode
    MI_IVE_AddCtrl_t Defines image weighted addition control parameter
    MI_IVE_NccDstMem_t Defines NCC output memory information
    MI_IVE_Region_t Defines connected region information
    MI_IVE_CcBlob_t Defines connected region label output information
    MI_IVE_CclMode_e Defines connected region mode
    MI_IVE_CclCtrl_t Defines connected region label control parameter
    MI_IVE_GmmCtrl_t Defines GMM background modelling control parameter
    MI_IVE_CannyStackSize_t Defines strong edge point stack size structure in Canny edge first-half calculation
    MI_IVE_CannyHysEdgeCtrl_t Defines control parameter in Canny edge first-half calculation
    MI_IVE_LbpCmpMode_e Defines LBP calculation comparison mode.
    MI_IVE_LbpChalMode_e Define LBP input channel mode
    MI_IVE_LbpCtrrl_t Defines LBP texture calculation control parameter
    MI_IVE_NormGradOutCtrl_e Defines normalized gradient information calculation task output control enumeration type
    MI_IVE_NormGradCtrl_t Defines normalized gradient information calculation control parameter
    MI_IVE_MvS9Q7_t Defines displacement structure
    MI_IVE_LkOpticalFlowCtrl_t Defines LK optical flow calculation control parameter
    MI_IVE_SadMode_e Defines SAD calculation mode
    MI_IVE_SadOutCtrl_e Defines SAD output control mode
    MI_IVE_SadCtrl_t Defines SAD control parameter
    MI_IVE_BernsenCtrl_t Defines Bernsen thresh control parameters.
    MI_IVE_BernsenMode_e Defines the Bernsen thresh mode.
    MI_IVE_LineFilterHorCtrl_t Defines control parameters for filtering the horizontal density of binary images.
    MI_IVE_LineFilterVerCtrl_t Defines control parameters for filtering the vertical density of binary images.
    MI_IVE_NoiseRemoveHor_t Defines the horizontal noise removal control parameter for the binary image.
    MI_IVE_NoiseRemoveVer_t Defines the vertical noise removal control parameter for the binary image.
    MI_IVE_AdpThreshCtrl_t Defines adaptive thresh control parameters.
    MI_IVE_ResizeMode_e Defines the resize input image mode
    MI_IVE_ResizeMethod_e Defines the resize method.
    MI_IVE_ResizeCtrl_t Defines the resize control parameter
    MI_IVE_BatCtrl_t Defines the bat control parameter
    MI_IVE_BatMode_e Defines the bat output control mode
    MI_IVE_AccCtrl_t Defines the acc control parameter
    MI_IVE_AccMode_e Defines the acc input control mode
    MI_IVE_MatrTranfMode_e Defines the input channel mode of matrix transform
    MI_IVE_MatrTranfCtrlMode_e Defines the input control mode of matrix transform.
    MI_IVE_MatrTranfCtrl_t Defines the control parameters of matrix transform.
    MI_IVE_SHIFT_DETECT_MODE_e Defines the shift detector input control mode.
    MI_IVE_SHIFT_DETECT_CTRL_t Defines control parameter of the shift detector.
    MI_IVE_BgBlurMode_e Defines the BGBlur mode.
    MI_IVE_BgBlurMaskOp_e Define the Mask Preprocess mode of BGBlur.
    MI_IVE_BgBlurCtrl_t Defines the control parameters of BGBlur.

    3.2. Fixed Point Data Type

    • Description

      Defines fixed point data type.

    • Definition

      typedef unsigned char   MI_U0Q8;
      typedef unsigned char   MI_U1Q7;
      typedef unsigned char   MI_U5Q3;
      typedef unsigned short  MI_U0Q16;
      typedef unsigned short  MI_U4Q12;
      typedef unsigned short  MI_U6Q10;
      typedef unsigned short  MI_U8Q8;
      typedef unsigned short  MI_U14Q2;
      typedef unsigned short  MI_U12Q4;
      typedef short           MI_S14Q2;
      typedef short           MI_S9Q7;
      typedef unsigned int    MI_U22Q10;
      typedef unsigned int    MI_U25Q7;
      typedef int             MI_S25Q7;
      typedef unsigned short  MI_U8Q4F4; /*8bits unsigned integer, 4bits decimal fraction, 4bits flag bits*/
      
    • Member

      Member Code Description
      MI_U0Q8 0 bit for the integer part, and 8 bits for the decimal part. Represented in document as UQ0.8.
      MI_U1Q7 High-order 1-bit unsigned data for the integer part, and low-order 7 bits for the demical part. Represented in document as UQ1.7.
      MI_U5Q3 High-order 5-bit unsigned data for the integer part, and low-order 3 bits for the demical part. Represented in document as UQ5.3.
      MI_U0Q16 0 bit for the integer part, and 16 bits for the demical part. Represented in document as UQ0.16.
      MI_U4Q12 High-order 4-bit unsigned data for the integer part, and low-order 12 bits for the demical part. Represented in document as UQ4.12.
      MI_U6Q10 High-order 6-bit unsigned data for the integer part, and low-order 10 bits for the demical part. Represented in document as UQ6.10.
      MI_U8Q8 High-order 8-bit unsigned data for the integer part, and low-order 8 bits for the demical part. Represented in document as UQ8.8.
      MI_U14Q2 High-order 14-bit unsigned data for the integer part, and low-order 2 bits for the demical part. Represented in document as UQ14.2.
      MI_U12Q4 High-order 12-bit unsigned data for the integer part, and low-order 4 bits for the demical part. Represented in document as UQ12.4.
      MI_S14Q2 High-order 14-bit signed data for the integer part, and low-order 2 bits for the demical part. Represented in document as SQ14.2.
      MI_S9Q7 High-order 9-bit signed data for the integer part, and low-order 7 bits for the demical part. Represented in document as SQ9.7.
      MI_U22Q10 High-order 22-bit unsigned data for the integer part, and low-order 10 bits for the demical part. Represented in document as UQ22.10.
      MI_U25Q7 High-order 25-bit unsigned data for the integer part, and low-order 7 bits for the demical part. Represented in document as UQ25.7.
      MI_S25Q7 High-order 25-bit signed data for the integer part, and low-order 7 bits for the demical part. Represented in document as SQ25.7.
      MI_U8Q4F4 High-order 8-bit unsigned data for the integer part, middle 4 bits for the demical part, and low-order 4 bits for flagging. Represented in document as UQF8.4.4.
    • Note

      • MI_UxQyFz/MI_SxQy:

        • The number x after the letter U means x bits of unsigned data are used for the integer part.

        • The number x after the letter S means x bits of signed data are used for the integer part.

        • The number y after the letter Q means y bits of data are used for the demical part.

        • The number z after the letter F means z bits are used for flagging.

        • Highest bit on the leftmost side and lowest bit on the rightmost side.


    3.3. MI_IVE_HANDLE_MAX

    • Description

      Defines the maximum number of IVE handle.

    • Definition

      #define MI_IVE_HANDLE_MAX 128
      

    3.4. MI_IVE_HIST_NUM

    • Description

      Defines histogram statistics bin number.

    • Definition

      #define MI_IVE_HIST_NUM 256
      

    3.5. MI_IVE_MAP_NUM

    • Description

      Defines number of mapping lookup table entries.

    • Definition

      #define MI_IVE_MAP_NUM 256
      

    3.6. MI_IVE_MAX_REGION_NUM

    • Description

      Defines maximum number of connected regions.

    • Definition

      #define MI_IVE_MAX_REGION_NUM 255
      

    3.7. MI_IVE_ST_MAX_CORNER_NUM

    • Description

      Defines maximum number of Shi-Tomasi-like corners.

    • Definition

      #define MI_IVE_ST_MAX_CORNER_NUM 200
      

    3.8. MI_IVE_MASK_SIZE_5X5

    • Description

      Defines mask size.

    • Definition

      #define MI_IVE_MASK_SIZE_5X5 25
      

    3.9. MI_IVE_CANNY_STACK_RESERVED_SIZE

    • Description

      Defines Canny stack reserved size.

    • Definition

      #define MI_IVE_CANNY_STACK_RESERVED_SIZE 12
      

    3.10. MI_IVE_ImageType_e

    • Description

      Defines image types supported by generalized two-dimensional images.

    • Definition

      typedef enum
      {
          E_MI_IVE_IMAGE_TYPE_U8C1          =0x0,
          E_MI_IVE_IMAGE_TYPE_S8C1          =0x1,
          E_MI_IVE_IMAGE_TYPE_YUV420SP      =0x2, /*YUV420 SemiPlanar*/
          E_MI_IVE_IMAGE_TYPE_YUV422SP      =0x3, /*YUV422 SemiPlanar*/
          E_MI_IVE_IMAGE_TYPE_YUV420P       =0x4, /*YUV420 Planar*/
          E_MI_IVE_IMAGE_TYPE_YUV422P       =0x5, /*YUV422 planar*/
          E_MI_IVE_IMAGE_TYPE_S8C2_PACKAGE  =0x6,
          E_MI_IVE_IMAGE_TYPE_S8C2_PLANAR   =0x7,
          E_MI_IVE_IMAGE_TYPE_S16C1         =0x8,
          E_MI_IVE_IMAGE_TYPE_U16C1         =0x9,
          E_MI_IVE_IMAGE_TYPE_U8C3_PACKAGE  =0xa,
          E_MI_IVE_IMAGE_TYPE_U8C3_PLANAR   =0xb,
          E_MI_IVE_IMAGE_TYPE_S32C1         =0xc,
          E_MI_IVE_IMAGE_TYPE_U32C1         =0xd,
          E_MI_IVE_IMAGE_TYPE_S64C1         =0xe,
          E_MI_IVE_IMAGE_TYPE_U64C1         =0xf,
          E_MI_IVE_IMAGE_TYPE_YUV420SP_NV21 =0x10,
          E_MI_IVE_IMAGE_TYPE_YUV422_YUYV   =0x11,
          E_MI_IVE_IMAGE_TYPE_BUTT
      }MI_IVE_ImageType_e;
      
    • Member

      Member Code Description
      E_MI_IVE_IMAGE_TYPE_U8C1 Single-channel image, in which each pixel is represented by one 8-bit unsigned data entry.
      E_MI_IVE_IMAGE_TYPE_S8C1 Single-channel image, in which each pixel is represented by one 8-bit signed data entry.
      E_MI_IVE_IMAGE_TYPE_YUV420SP Image in YUV420 semiplanar format.
      E_MI_IVE_IMAGE_TYPE_YUV422SP Image in YUV422 semiplanar format.
      E_MI_IVE_IMAGE_TYPE_YUV420P Image in YUV420 planar format.
      E_MI_IVE_IMAGE_TYPE_YUV422P Image in YUV422 planar format.
      E_MI_IVE_IMAGE_TYPE_S8C2_PACKAGE Dual-channel image in package format, in which each pixel is represented by two 8-bit signed data entries.
      E_MI_IVE_IMAGE_TYPE_S8C2_PLANAR Dual-channel image in planar format, in which each pixel is represented by two 8-bit signed data entries.
      E_MI_IVE_IMAGE_TYPE_S16C1 Single-channel image, in which each pixel is represented by one 16-bit signed data entry.
      E_MI_IVE_IMAGE_TYPE_U16C1 Single-channel image, in which each pixel is represented by one 16-bit unsigned data entry.
      E_MI_IVE_IMAGE_TYPE_U8C3_PACKAGE 3-channel image in package format, in which each pixel is represented by three 8-bit unsigned data entries.
      E_MI_IVE_IMAGE_TYPE_U8C3_PLANAR 3-channel image in planar format, in which each pixel is represented by three 8-bit unsigned data entries.
      E_MI_IVE_IMAGE_TYPE_S32C1 Single-channel image, in which each pixel is represented by one 32-bit signed data entry.
      E_MI_IVE_IMAGE_TYPE_U32C1 Single-channel image, in which each pixel is represented by one 32-bit unsigned data entry.
      E_MI_IVE_IMAGE_TYPE_S64C1 Single-channel image, in which each pixel is represented by one 64-bit signed data entry.
      E_MI_IVE_IMAGE_TYPE_U64C1 Single-channel image, in which each pixel is represented by one 64-bit unsigned data entry.
      E_MI_IVE_IMAGE_TYPE_YUV420SP_NV21 Image in YUV420 semiplanar format, the placement of UV component is opposite to E_MI_IVE_IMAGE_TYPE_YUV420SP.
      E_MI_IVE_IMAGE_TYPE_YUV422_YUYV Image in YUV422 package format which placed data in order of YUYV.
    • Related Data Type and Interface

      MI_IVE_Image_t

      MI_IVE_SrcImage_t

      MI_IVE_DstImage_t


    3.11. MI_IVE_Image_t

    • Description

      Defines generalized two-dimensional image information.

    • Definition

      typedef struct MI_IVE_Image_s
      {
          MI_IVE_ImageType_e eType;
          MI_PHY aphyPhyAddr[3];
          MI_U8 *apu8VirAddr[3];
          MI_U16 au16Stride[3];
          MI_U16 u16Width;
          MI_U16 u16Height;
          MI_U16 u16Reserved; /*Can be used such as elemSize*/
      }MI_IVE_Image_t;
      
    • Member

      Member Code Description
      enType Generalized image type.
      aphyPhyAddr[3] Generalized image physical address array.
      apu8VirAddr[3] Generalized image virtual address array.
      au16Stride[3] Generalized image stride.
      u16Width Generalized image width.
      u16Height Generalized image height.
      u16Reserved Mark the memory as being used by software or hardware to determine the operation of automatic Cache Invalidate and Cache Flush.
    • Note

      • Different operators have different requirements as to the alignment of image input/output address.

      • u16Width, u16Height and u16Stride are all in pixel unit.

    • Related Data Type and Interface

      MI_IVE_ImageType_e

      MI_IVE_SrcImage_t

      MI_IVE_DstImage_t


    3.12. MI_IVE_SrcImage_t


    3.13. MI_IVE_DstImage_t


    3.14. MI_IVE_Data_t

    • Description

      Defines two-dimensional data information in byte unit.

    • Definition

      typedef struct MI_IVE_Data_s
      {
          MI_PHY phyPhyAddr; /*Physical address of the data*/
          MI_U8 *pu8VirAddr;
          MI_U16 u16Stride; /*Data stride by byte*/
          MI_U16 u16Height; /*Data height by byte*/
          MI_U16 u16Width; /*Data width by byte*/
          MI_U16 u16Reserved;
      }MI_IVE_Data_t;
      
    • Member

      Member Code Description
      phyPhyAddr Image physical address.
      pu8VirAddr Image virtual address.
      u16Stride Image stride.
      u16Height Image width.
      u16Width Image height.
      u16Reserved Reserved.
    • Note

      • Represents two-dimensional data in byte unit; can be converted with MI_IVE_Image_t image.

    3.15. MI_IVE_SrcData_t

    • Description

      Defines two-dimensional source data information in byte unit

    • Definition

      typedef MI_IVE_Data_t MI_IVE_SrcData_t;
      
    • Related Data Type and Interface

      MI_IVE_Image_t

      MI_IVE_DstData_t


    3.16. MI_IVE_DstData_t

    • Description

      Defines two-dimensional output data information in byte unit.

    • Definition

      typedef MI_IVE_Data_t MI_IVE_DstData_t;
      
    • Related Data Type and Interface

      MI_IVE_Image_t

      MI_IVE_SrcImage_t


    3.17. MI_IVE_MemInfo_t

    • Description

      Defines one-dimensional data memory information.

    • Definition

      typedef struct MI_IVE_MemInfo_s
      {
          MI_PHY phyPhyAddr;
          MI_U8 *pu8VirAddr;
          MI_U32 u32Size;
      }MI_IVE_MemInfo_t;
      
    • Member

      Member Code Description
      phyPhyAddr One-dimensional data physical address.
      pu8VirAddr One-dimensional data virtual address.
      u32Size One-dimensional data byte size.
    • Related Data Type and Interface

      MI_IVE_SrcMemInfo_t

      MI_IVE_DstMemInfo_t


    3.18. MI_IVE_SrcMemInfo_t

    • Description

      Defines one-dimensional source data.

    • Definition

      typedef MI_IVE_MemInfo_t MI_IVE_SrcMemInfo_t;
      
    • Related Data Type and Interface

      MI_IVE_MemInfo_t

      MI_IVE_DstMemInfo_t


    3.19. MI_IVE_DstMemInfo_t

    • Description

      Defines one-dimensional output data.

    • Definition

      typedef MI_IVE_MemInfo_t MI_IVE_DstMemInfo_t;
      
    • Related Data Type and Interface

      MI_IVE_MemInfo_t

      MI_IVE_SrcMemInfo_t


    3.20. MI_IVE_Length8bit_u

    • Description

      Defines 8-bit data union.

    • Definition

      typedef union
      {
          MI_S8 s8Val;
          MI_U8 u8Val;
      } MI_IVE_Length8bit_u;
      
    • Member

      Member Code Description
      s8Val Signed 8-bit value.
      u8Val Unsigned 8-bit value.

    3.21. MI_IVE_PointU16_t

    • Description

      Defines U16 point information structure.

    • Definition

      typedef struct MI_IVE_PointU16_s
      {
          MI_U16 u16X;
          MI_U16 u16Y;
      }MI_IVE_PointU16_t;
      
    • Member

      Member Code Description
      u16X x coordinate of point.
      u16Y y coordinate of point.

    3.22. MI_IVE_PointS25Q7_t

    • Description

      Defines S25Q7 fixed-point information structure.

    • Definition

      typedef struct MI_IVE_PointS25Q7_s
      {
          MI_S25Q7 s25q7X; /*X coordinate*/
          MI_S25Q7 s25q7Y; /*Y coordinate*/
      }MI_IVE_PointS25Q7_t;
      
    • Member

      Member Code Description
      s25q7X x coordinate of point, in SQ25.7 representation.
      s25q7Y y coordinate of point, in SQ25.7 representation.

    3.23. MI_IVE_Rect_t

    • Description

      Defines U16 rectangle information structure.

    • Definition

      typedef struct MI_IVE_Rect_s
      {
          MI_U16 u16X;
          MI_U16 u16Y;
          MI_U16 u16Width;
          MI_U16 u16Height;
      }MI_IVE_Rect_t;
      
    • Member

      Member Code Description
      u16X X coordinate of the rectangle closest to the coordinate origin.
      u16Y Y coordinate of the rectangle closest to the coordinate origin.
      u16Width Width of rectangle.
      u16Height Height of rectangle.

    3.24. MI_IVE_FilterCtrl_t

    • Description

      Defines template filter control information.

    • Defines

      typedef struct MI_IVE_FilterCtrl_s
      {
          MI_S8 as8Mask[MI_IVE_MASK_SIZE_5X5]; /*Template parameter filter
          coefficient*/
          MI_U8 u8Norm; /*Normalization parameter, by right shift*/
      }MI_IVE_FilterCtrl_t;
      
    • Member

      Member Code Description
      as8Mask[MI_IVE_MASK_SIZE_5X5] 5x5 template coefficient. Setting the peripheral coefficient to 0 can realize a 3x3 template filter, configured in row-major order.
      u8Norm Normalization parameter. Parameter range: [0, 13].
    • Note

      • By configuring different template coefficients, you can obtain different filter effects.

    3.25. MI_IVE_CscMode_e

    • Description

      Defines color space conversion mode.

    • Definition

      typedef enum
      {
          E_MI_IVE_CSC_MODE_PIC_BT601_YUV2RGB      = 0x0,
          E_MI_IVE_CSC_MODE_PIC_BT601_YUV2BGR      = 0x1,
          E_MI_IVE_CSC_MODE_PIC_BT601_RGB2YUV      = 0x2,
          E_MI_IVE_CSC_MODE_PIC_BT601_BGR2YUV      = 0x3,
          E_MI_IVE_CSC_MODE_PIC_BT601_NV21_YUV2RGB = 0x4,
          E_MI_IVE_CSC_MODE_PIC_BT601_NV21_YUV2BGR = 0x5,
          E_MI_IVE_CSC_MODE_PIC_BT601_RGB2YUV_NV21 = 0x6,
          E_MI_IVE_CSC_MODE_PIC_BT601_BGR2YUV_NV21 = 0x7,
          E_MI_IVE_CSC_MODE_MAX
      }MI_IVE_CscMode_e;
      
    • Member

      Member Code Description
      E_MI_IVE_CSC_MODE_PIC_BT601_YUV2RGB YUV(NV12)2RGB image conversion.
      E_MI_IVE_CSC_MODE_PIC_BT601_YUV2BGR YUV(NV12)2BGR image conversion.
      E_MI_IVE_CSC_MODE_PIC_BT601_RGB2YUV RGB2YUV(NV12) image conversion.
      E_MI_IVE_CSC_MODE_PIC_BT601_BGR2YUV BGR2YUV(NV12) image conversion.
      E_MI_IVE_CSC_MODE_PIC_BT601_NV21_YUV2RGB YUV(NV21)2RGB image conversion.
      E_MI_IVE_CSC_MODE_PIC_BT601_NV21_YUV2BGR YUV(NV21)2BGR image conversion.
      E_MI_IVE_CSC_MODE_PIC_BT601_RGB2YUV_NV21 RGB2YUV(NV21) image conversion.
      E_MI_IVE_CSC_MODE_PIC_BT601_BGR2YUV_NV21 BGR2YUV(NV21) image conversion.
    • Note

      • Input and output data must satisfy 0≤Y, U, V≤255.

      • Input and output data must satisfy 0≤R, G, B≤255.

    • Related Data Type and Interface

      MI_IVE_CscCtrl_t

      MI_IVE_FilterAndCscCtrl_t


    3.26. MI_IVE_CscCtrl_t

    • Description

      Defines color space conversion control information.

    • Definition

      typedef struct MI_IVE_CscCtrl_s
      {
          MI_IVE_CscMode_e enMode; /*Working mode*/
      }MI_IVE_CscCtrl_t;
      
    • Member

      Member Code Description
      enMode Work mode.
    • Related Data Type and Interface

      MI_IVE_CscMode_e


    3.27. MI_IVE_FilterAndCscCtrl_t

    • Description

      Defines template filter plus color space conversion composite function control information.

      Defines

      typedef struct MI_IVE_FilterAndCscCtrl_s
      {
          MI_IVE_CscMode_e eMode; /*CSC working mode*/
          MI_S8 as8Mask[MI_IVE_MASK_SIZE_5X5]; /*Template parameter filter
          coefficient*/
          MI_U8 u8Norm; /*Normalization parameter, by right shift*/
      }MI_IVE_FilterAndCscCtrl_t;
      
    • Member

      Member Code Description
      eMode Work mode.
      as8Mask[MI_IVE_MASK_SIZE_5X5] 5x5 template coefficient, configured in row-major order.
      u8Norm Normalization parameter. Parameter range: [0, 13].
    • Note

      • Only 4 modes of YUV2RGB are supported.
    • Related Data Type and Interface

      MI_IVE_CscMode_e


    3.28. MI_IVE_SobelOutCtrl_e

    • Description

      Defines Sobel Output control information.

    • Definition

      typedef enum
      {
          E_MI_IVE_SOBEL_OUT_CTRL_BOTH = 0x0, /*Output horizontal and
          vertical*/
          E_MI_IVE_SOBEL_OUT_CTRL_HOR  = 0x1, /*Output horizontal*/
          E_MI_IVE_SOBEL_OUT_CTRL_VER  = 0x2, /*Output vertical*/
          E_MI_IVE_SOBEL_OUT_CTRL_BUTT
      
      }MI_IVE_SobelOutCtrl_e;
      
    • Member

      Member Code Description
      E_MI_IVE_SOBEL_OUT_CTRL_BOTH Output results of both template filtering and transposed template filtering.
      E_MI_IVE_SOBEL_OUT_CTRL_HOR Output template filtering results only.
      E_MI_IVE_SOBEL_OUT_CTRL_VER Output transposed template filtering results only.
    • Related Data Type and Interface

      MI_IVE_SobelCtrl_t


    3.29. MI_IVE_SobelCtrl_t

    • Description

      Defines Sobel-like gradient calculation control information.

    • Definition

      typedef struct MI_IVE_SobelCtrl_s
      {
          MI_IVE_SobelOutCtrl_e eOutCtrl; /*Output format*/
          MI_S8 as8Mask[MI_IVE_MASK_SIZE_5X5]; /*Template parameter*/
      
      }MI_IVE_SobelCtrl_t;
      
    • Member

      Member Code Description
      eOutCtrl Output control enumeration parameter.
      as8Mask[MI_IVE_MASK_SIZE_5X5] 5x5 template coefficient, configured in row-major order.
    • Related Data Type and Interface

      MI_IVE_SobelOutCtrl_e


    3.30. MI_IVE_MagAndAngOutCtrl_e

    • Description

      Defines gradient magnitude and angle calculation output format.

    • Definition

      typedef enum
      {
          E_MI_IVE_MAG_AND_ANG_OUT_CTRL_MAG         = 0x0,
          E_MI_IVE_MAG_AND_ANG_OUT_CTRL_MAG_AND_ANG = 0x1,
          E_MI_IVE_MAG_AND_ANG_OUT_CTRL_BUTT
      }MI_IVE_MagAndAngOutCtrl_e;
      
    • Member

      Member Code Description
      E_MI_IVE_MAG_AND_ANG_OUT_CTRL_MAG Output magnitude only.
      E_MI_IVE_MAG_AND_ANG_OUT_CTRL_MAG_AND_ANG Output both magnitude and angle.
    • Related Data Type and Interface

      MI_IVE_MagAndAngCtrl_t


    3.31. MI_IVE_MagAndAngCtrl_t

    • Description

      Defines gradient magnitude and angle calculation control information.

    • Definition

      typedef struct MI_IVE_MagAndAngCtrl_s
      {
          MI_IVE_MagAndAngOutCtrl_e eOutCtrl;
          MI_U16 u16Thr;
          MI_S8 as8Mask[MI_IVE_MASK_SIZE_5X5]; /*Template parameter.*/
      }MI_IVE_MagAndAngCtrl_t;
      
    • Member

      Member Code Description
      eOutCtrl Output format.
      u16Thr Threshold value for magnitude thresholding.
      as8Mask[MI_IVE_MASK_SIZE_5X5] 5x5 template coefficient, configured in row-major order.
    • Related Data Type and Interface

      MI_IVE_MagAndAngOutCtrl_e


    3.32. MI_IVE_DilateCtrl_t

    • Description

      Defines Dilate control information.

    • Definition

      typedef struct MI_IVE_DilateCtrl_s
      {
          MI_U8 au8Mask[MI_IVE_MASK_SIZE_5X5]; /*The template parameter value
          must be 0 or 255.*/
      }MI_IVE_DilateCtrl_t;
      
    • Member

      Member Code Description
      au8Mask[MI_IVE_MASK_SIZE_5X5] 5x5 template coefficient. Range: 0 or 255, configured in row-major order.

    3.33. MI_IVE_ErodeCtrl_t

    • Description

      Defines Erode control information.

    • Definition

      typedef struct MI_IVE_ErodeCtrl_s
      {
          MI_U8 au8Mask[MI_IVE_MASK_SIZE_5X5]; /*The template parameter value
          must be 0 or 255.*/
      }MI_IVE_ErodeCtrl_t;
      
    • Member

      Member Code Description
      au8Mask[MI_IVE_MASK_SIZE_5X5] 5x5 template coefficient. Range: 0 or 255, configured in row-major order.

    3.34. MI_IVE_ThreshMode_e

    • Description

      Defines image thresholding output format.

    • Definition

      typedef enum
      {
          E_MI_IVE_THRESH_MODE_BINARY      = 0x0, /*srcVal <= lowThr, dstVal = minVal; srcVal > lowThr, dstVal = maxVal.*/
          E_MI_IVE_THRESH_MODE_TRUNC       = 0x1, /*srcVal <= lowThr, dstVal = srcVal; srcVal > lowThr, dstVal = maxVal.*/
          E_MI_IVE_THRESH_MODE_TO_MINVAL   = 0x2, /*srcVal <= lowThr, dstVal = minVal; srcVal > lowThr, dstVal = srcVal.*/
          E_MI_IVE_THRESH_MODE_MIN_MID_MAX = 0x3, /*srcVal <= lowThr, dstVal = minVal; lowThr < srcVal <= highThr, dstVal = midVal; srcVal > highThr, dstVal = maxVal.*/
          E_MI_IVE_THRESH_MODE_ORI_MID_MAX = 0x4, /*srcVal <= lowThr, dstVal = srcVal; lowThr < srcVal <= highThr, dstVal = midVal; srcVal > highThr, dstVal = maxVal.*/
          E_MI_IVE_THRESH_MODE_MIN_MID_ORI = 0x5, /*srcVal <= lowThr, dstVal = minVal; lowThr < srcVal <= highThr, dstVal = midVal; srcVal > highThr, dstVal = srcVal.*/
          E_MI_IVE_THRESH_MODE_MIN_ORI_MAX = 0x6, /*srcVal <= lowThr, dstVal = minVal; lowThr < srcVal <= highThr, dstVal = srcVal; srcVal > highThr, dstVal = maxVal.*/
          E_MI_IVE_THRESH_MODE_ORI_MID_ORI = 0x7, /*srcVal <= lowThr, dstVal = srcVal; lowThr < srcVal <= highThr, dstVal = midVal; srcVal > highThr, dstVal = srcVal.*/
          E_MI_IVE_THRESH_MODE_BUTT
      }MI_IVE_ThreshMode_e;
      
    • Member

      Member Code Description
      E_MI_IVE_THRESH_MODE_BINARY srcVal ≤ lowThr, dstVal = minVal; srcVal > lowThr, dstVal = maxVal.
      E_MI_IVE_THRESH_MODE_TRUNC srcVal ≤ lowThr, dstVal = srcVal; srcVal > lowThr, dstVal = maxVal.
      E_MI_IVE_THRESH_MODE_TO_MINVAL srcVal ≤lowThr, dstVal = minVal; srcVal > lowThr, dstVal = srcVal.
      E_MI_IVE_THRESH_MODE_MIN_MID_MAX srcVal ≤ lowThr, dstVal = minVal; lowThr < srcVal ≤ highThr, dstVal = midVal; srcVal > highThr, dstVal = maxVal.
      E_MI_IVE_THRESH_MODE_ORI_MID_MAX srcVal ≤lowThr, dstVal = srcVal; lowThr < srcVal ≤ highThr, dstVal = midVal; srcVal > highThr, dstVal = maxVal.
      E_MI_IVE_THRESH_MODE_MIN_MID_ORI srcVal ≤lowThr, dstVal = minVal; lowThr < srcVal ≤highThr,dstVal = midVal; srcVal > highThr, dstVal = srcVal.
      E_MI_IVE_THRESH_MODE_MIN_ORI_MAX srcVal ≤ lowThr, dstVal = minVal; lowThr < srcVal ≤ highThr,dstVal = srcVal; srcVal > highThr, dstVal = maxVal.
      E_MI_IVE_THRESH_MODE_ORI_MID_ORI srcVal≤ lowThr, dstVal = srcVal; lowThr < srcVal ≤ highThr, dstVal = midVal; srcVal > highThr, dstVal = srcVal.
    • Note

      • For calculation formula, please refer to the Note provided with respect to MI_IVE_Thresh.
    • Related Data Type and Interface

      MI_IVE_ThreshCtrl_t


    3.35. MI_IVE_ThreshCtrl_t

    • Description

      Defines image thresholding control information.

    • Definition

      typedef struct MI_IVE_ThreshCtrl_s
      {
          MI_IVE_ThreshMode_e eMode;
          MI_U8 u8LowThr; /*user-defined threshold, 0<=u8LowThr<=255 */
          MI_U8 u8HighThr; /*user-defined threshold, if eMode<E_MI_IVE_THRESH_MODE_MIN_MID_MAX, u8HighThr is not used, else0<=u8LowThr<=u8HighThr<=255;*/
          MI_U8 u8MinVal; /*Minimum value when tri-level thresholding*/
          MI_U8 u8MidVal; /*Middle value when tri-level thresholding, if eMode<2, u32MidVal is not used; */
          MI_U8 u8MaxVal; /*Maxmum value when tri-level thresholding*/
      }MI_IVE_ThreshCtrl_t;
      
    • Member

      Member Code Description
      eMode Thresholding operation mode.
      u8LowThresh Low threshold. Parameter range: [0,255].
      u8HighThresh High threshold. 0≤u8LowThresh≤u8HighThresh≤255.
      u8MinVal Min. value. Parameter range: [0,255].
      u8MidVal Median value. Parameter range: [0,255].
      u8MaxVal Max. value. Parameter range: [0,255].
    • Related Data Type and Interface

      MI_IVE_ThreshMode_e


    3.36. MI_IVE_SubMode_e

    • Description

      Defines image subtraction output format.

    • Definition

      typedef enum
      {
          E_MI_IVE_SUB_MODE_ABS   = 0x0, /*Absolute value of the difference*/
          E_MI_IVE_SUB_MODE_SHIFT = 0x1, /*The output result is obtained by
          shifting the result one digit right to reserve the signed bit.*/
          E_MI_IVE_SUB_MODE_BUTT
      }MI_IVE_SubMode_e;
      
    • Member

      Member Code Description
      E_MI_IVE_SUB_MODE_ABS Absolute value of the difference.
      E_MI_IVE_SUB_MODE_SHIFT Output the result by right-shifting one bit, sign bit reserved.
    • Related Data Type and Interface

      MI_IVE_SubCtrl_t


    3.37. MI_IVE_SubCtrl_t

    • Description

      Defines image subtraction control parameter.

    • Definition

      typedef struct MI_IVE_SubCtrl_s
      {
          MI_IVE_SubMode_e eMode;
      }MI_IVE_SubCtrl_t;
      
    • Member

      Member Code Description
      eMode Image subtraction mode.
    • Related Data Type and Interface

      MI_IVE_SubMode_e


    3.38. MI_IVE_IntegOutCtrl_e

    • Description

      Defines integral map output control parameter.

    • Definition

      typedef enum
      {
          E_MI_IVE_INTEG_OUT_CTRL_COMBINE = 0x0,
          E_MI_IVE_INTEG_OUT_CTRL_SUM     = 0x1,
          E_MI_IVE_INTEG_OUT_CTRL_SQSUM   = 0x2,
          E_MI_IVE_INTEG_OUT_CTRL_BUTT
      }MI_IVE_IntegOutCtrl_e;
      
    • Member

      Member Code Description
      E_MI_IVE_INTEG_OUT_CTRL_COMBINE Output integral map sum and sum of square.
      E_MI_IVE_INTEG_OUT_CTRL_SUM Output integral map sum only.
      E_MI_IVE_INTEG_OUT_CTRL_SQSUM Output integral map sum of square only.
    • Related Data Type and Interface

      MI_IVE_IntegCtrl_t


    3.39. MI_IVE_IntegCtrl_t

    • Description

      Defines integral map calculation control parameter.

    • Definition

      typedef struct MI_IVE_IntegCtrl_s
      {
          MI_IVE_IntegOutCtrl_e eOutCtrl;
      }MI_IVE_IntegCtrl_t;
      
    • Member

      Member Code Description
      eOutCtrl Integral map output control parameter.
    • Related Data Type and Interface

      MI_IVE_IntegOutCtrl_e


    3.40. MI_IVE_ThreshS16Mode_e

    • Description

      Defines 16-bit signed image thresholding mode.

    • Definition

      typedef enum
      {
          E_MI_IVE_THRESH_S16_MODE_S16_TO_S8_MIN_MID_MAX = 0x0,
          E_MI_IVE_THRESH_S16_MODE_S16_TO_S8_MIN_ORI_MAX = 0x1,
          E_MI_IVE_THRESH_S16_MODE_S16_TO_U8_MIN_MID_MAX = 0x2,
          E_MI_IVE_THRESH_S16_MODE_S16_TO_U8_MIN_ORI_MAX = 0x3,
          E_MI_IVE_THRESH_S16_MODE_BUTT
      }MI_IVE_ThreshS16Mode_e;
      
    • Member

      Member Code Description
      E_MI_IVE_THRESH_S16_MODE_S16_ TO_S8_MIN_MID_MAX srcVal ≤ lowThr, dstVal = minVal; lowThr < srcVal ≤highThr, dstVal = idVal; srcVal > highThr, dstVal = maxVal;
      E_MI_IVE_THRESH_S16_MODE_S16_ TO_S8_MIN_ORI_MAX srcVal ≤ lowThr, dstVal = minVal; lowThr < srcVal ≤highThr, dstVal = rcVal; srcVal > highThr, dstVal = maxVal;
      E_MI_IVE_THRESH_S16_MODE_S16_ TO_U8_MIN_MID_MAX srcVal ≤ lowThr, dstVal = minVal; lowThr < srcVal ≤highThr, dstVal = idVal; srcVal > highThr, dstVal = maxVal;
      E_MI_IVE_THRESH_S16_MODE_S16_ TO_U8_MIN_ORI_MAX srcVal ≤ lowThr, dstVal = minVal; lowThr < srcVal ≤highThr, dstVal = rcVal; srcVal > highThr, dstVal = maxVal;
    • Note

      • For calculation formula, please refer to the Note provided with respect to MI_IVE_ThreshS16.
    • Related Data Type and Interface

      MI_IVE_ThreshS16Ctrl_t


    3.41. MI_IVE_ThreshS16Ctrl_t

    • Description

      Defines 16-bit signed image thresholding control parameter.

    • Definition

      typedef struct MI_IVE_ThreshS16Ctrl_s
      {
          MI_IVE_ThreshS16Mode_e eMode;
          MI_S16 s16LowThr; /*user-defined threshold*/
          MI_S16 s16HighThr; /*user-defined threshold*/
          MI_IVE_Length8bit_u un8MinVal; /*Minimum value when tri-level thresholding*/
          MI_IVE_Length8bit_u un8MidVal; /*Middle value when tri-level thresholding*/
          MI_IVE_Length8bit_u un8MaxVal; /*Maxmum value when tri-level thresholding*/
      }MI_IVE_ThreshS16Ctrl_t;
      
    • Member

      Member Code Description
      eMode Thresholding operation mode.
      s16LowThr Low threshold.
      s16HighThr High threshold.
      un8MinVal Min. value.
      un8MidVal Median value.
      un8MaxVal Max. value.
    • Note

      • For calculation formula, please refer to the Note provided with respect to MI_IVE_ThreshS16.
    • Related Data Type and Interface

      MI_IVE_ThreshS16Mode_e


    3.42. MI_IVE_ThreshU16Mode_e

    • Description

      Defines 16-bit unsigned image thresholding mode.

    • Definition

      typedef enum
      {
          E_MI_IVE_THRESH_U16_MODE_U16_TO_U8_MIN_MID_MAX = 0x0,
          E_MI_IVE_THRESH_U16_MODE_U16_TO_U8_MIN_ORI_MAX = 0x1,
          E_MI_IVE_THRESH_U16_MODE_BUTT
      }MI_IVE_ThreshU16Mode_e;
      
    • Member

      Member Code Description
      E_MI_IVE_THRESH_U16_MODE_U16_ TO_U8_MIN_MID_MAX srcVal ≤ lowThr, dstVal = minVal; lowThr < srcVal ≤highThr, dstVal = midVal; srcVal > highThr, dstVal = maxVal;
      E_MI_IVE_THRESH_U16_MODE_U16_ TO_U8_MIN_ORI_MAX srcVal ≤ lowThr, dstVal = minVal; lowThr < srcVal ≤highThr, dstVal = srcVal; srcVal > highThr, dstVal = maxVal;
    • Note

      • For calculation formula, please refer to the Note provided with respect to MI_IVE_ThreshU16.
    • Related Data Type and Interface

      MI_IVE_ThreshU16Ctrl_t


    3.43. MI_IVE_ThreshU16Ctrl_t

    • Description

      Defines 16-bit unsigned image thresholding control parameter.

    • Definition

      typedef struct MI_IVE_ThreshU16Ctrl_s
      {
          MI_IVE_ThreshU16Mode_e eMode;
          MI_U16 u16LowThr;
          MI_U16 u16HighThr;
          MI_U8 u8MinVal;
          MI_U8 u8MidVal;
          MI_U8 u8MaxVal;
      }MI_IVE_ThreshU16Ctrl_t;
      
    • Member

      Member Code Description
      eMode Thresholding operation mode.
      u16LowThr Low threshold.
      u16HighThr High threshold.
      u8MinVal Min. value. Parameter range: [0,255].
      u8MidVal Median value. Parameter range: [0,255].
      u8MaxVal Max. value. Parameter range: [0,255].
    • Note

      • For calculation formula, please refer to the Note provided with respect to MI_IVE_ThreshU16.
    • Related Data Type and Interface

      MI_IVE_ThreshU16Mode_e


    3.44. MI_IVE_16BitTo8BitMode_e

    • Description

      Defines 16-bit image data to 8-bit image data conversion mode.

    • Definition

      typedef enum
      {
          E_MI_IVE_16BIT_TO_8BIT_MODE_S16_TO_S8      = 0x0,
          E_MI_IVE_16BIT_TO_8BIT_MODE_S16_TO_U8_ABS  = 0x1,
          E_MI_IVE_16BIT_TO_8BIT_MODE_S16_TO_U8_BIAS = 0x2,
          E_MI_IVE_16BIT_TO_8BIT_MODE_U16_TO_U8      = 0x3,
          E_MI_IVE_16BIT_TO_8BIT_MODE_BUTT
      }MI_IVE_16BitTo8BitMode_e;
      
    • Member

      Member Code Description
      E_MI_IVE_16BIT_TO_8BIT_MODE_S16_TO_S8 S16 data to S8 data linear conversion.
      E_MI_IVE_16BIT_TO_8BIT_MODE_S16_TO_U8_ABS Linearly convert S16 data to S8 data and takes the absolute value to get U8 data.
      E_MI_IVE_16BIT_TO_8BIT_MODE_S16_TO_U8_BIAS Linearly convert S16 data to S8 data and truncate to U8 data after translation.
      E_MI_IVE_16BIT_TO_8BIT_MODE_U16_TO_U8 S16 data to U8 data linear conversion.
    • Note

    • Related Data Type and Interface

      MI_IVE_16bitTo8BitCtrl_t


    3.45. MI_IVE_16bitTo8BitCtrl_t

    • Description

      Defines 16-bit image data to 8-bit image data conversion control parameter.

    • Definition

      typedef struct MI_IVE_16bitTo8BitCtrl_s
      {
          MI_IVE_16BitTo8BitMode_e eMode;
          MI_U16 u16Denominator;
          MI_U8 u8Numerator;
          MI_S8 s8Bias;
      }MI_IVE_16bitTo8BitCtrl_t;
      
    • Member

      Member Code Description
      eMode 16-bit data to 8-bit data conversion mode.
      u16Denominator Denominator of linear conversion. Parameter range: [max
      u8Numerator Numerator of linear conversion. Parameter range: [0,255].
      s8Bias Translated item of linear conversion. Parameter range: [-128,127].
    • Note

      • For calculation formula, please refer to Note in MI_IVE_ThreshU16.

      • u8Numerator ≤u16Denominator, and u16Denominator≠0

    • Related Data Type and Interface

      MI_IVE_16BitTo8BitMode_e


    3.46. MI_IVE_OrdStatFilterMode_e

    • Description

      Defines sequential statistic filtering mode.

    • Definition

      typedef enum
      {
          E_MI_IVE_ORD_STAT_FILTER_MODE_MEDIAN = 0x0,
          E_MI_IVE_ORD_STAT_FILTER_MODE_MAX    = 0x1,
          E_MI_IVE_ORD_STAT_FILTER_MODE_MIN    = 0x2,
          E_MI_IVE_ORD_STAT_FILTER_MODE_BUTT
      }MI_IVE_OrdStatFilterMode_e;
      
    • Member

      Member Code Description
      E_MI_IVE_ORD_STAT_FILTER_MODE_MEDIAN Median filter.
      E_MI_IVE_ORD_STAT_FILTER_MODE_MAX Max. filter value, equivalent to the dilation of grayscale.
      E_MI_IVE_ORD_STAT_FILTER_MODE_MIN Min. filter value, equivalent to the erosion of grayscale.
    • Related Data Type and Interface

      MI_IVE_OrdStatFilter_t


    3.47. MI_IVE_OrdStatFilter_t

    • Description

      Defines sequential statistic filtering control parameter.

    • Definition

      typedef struct MI_IVE_OrdStatFilter_s
      {
          MI_IVE_OrdStatFilterMode_e eMode;
      }MI_IVE_OrdStatFilter_t;
      
    • Member

      Member Code Description
      eMode Sequential statistic filtering mode.
    • Related Data Type and Interface

      MI_IVE_OrdStatFilterMode_e


    3.48. MI_IVE_MapLutMem_t

    • Description

      Defines map operator lookup table memory information.

    • Definition

      typedef struct MI_IVE_MapLutMem_s
      {
          MI_U8 au8Map[MI_IVE_MAP_NUM];
      }MI_IVE_MapLutMem_t;
      
    • Member

      Member Code Description
      au8Map[MI_IVE_MAP_NUM] Map lookup table array.

    3.49. MI_IVE_EqualizeHistCtrlMem_t

    • Description

      Defines histogram equalization auxiliary memory.

    • Definition

      typedef struct MI_IVE_EqualizeHistCtrlMem_s
      {
          MI_U32 au32Hist[MI_IVE_HIST_NUM];
          MI_U8 au8Map[MI_IVE_MAP_NUM];
      }MI_IVE_EqualizeHistCtrlMem_t;
      
    • Member

      Member Code Description
      au32Hist[MI_IVE_HIST_NUM] Histogram statistics output.
      au8Map[MI_IVE_MAP_NUM] Map lookup table gained by statistical histogram calculation.
    • Related Data Type and Interface

      MI_IVE_EqualizeHistCtrl_t


    3.50. MI_IVE_EqualizeHistCtrl_t

    • Description

      Defines histogram equalization control parameter.

    • Definition

      typedef struct MI_IVE_EqualizeHistCtrl_s
      {
          MI_IVE_MemInfo_t stMem;
      }MI_IVE_EqualizeHistCtrl_t;
      
    • Member

      Member Code Description
      stMem The memory should at least have the size of (MI_IVE_EqualizeHistCtrlMem_t).
    • Related Data Type and Interface

      MI_IVE_EqualizeHistCtrlMem_t


    3.51. MI_IVE_AddMode_e

    • Description

      Define the add calculation mode.

    • Definition

      typedef enum
      {
          E_MI_IVE_ADD_MODE_ROUNDING = 0x0,
          E_MI_IVE_ADD_MOD_CLIPPING  = 0x1,
          E_MI_IVE_ADD_MODE_MAX
      }MI_IVE_AddMode_e;
      
    • Member

      Member Code Description
      E_MI_IVE_ADD_MODE_ROUNDING Rounding mode
      E_MI_IVE_ADD_MOD_CLIPPING Clipping mode
    • Related Data Type and Interface

      MI_IVE_AddCtrl_t


    3.52. MI_IVE_AddCtrl_t

    • Description

      Defines image weighted addition control parameter.

    • Definition

      typedef struct MI_IVE_AddCtrl_s
      {
          MI_IVE_AddMode_e eMode;
          MI_U0Q16 u0q16X; /*x of "xA+yB"*/
          MI_U0Q16 u0q16Y; /*y of "xA+yB"*/
      }MI_IVE_AddCtrl_t;
      
    • Member

      Member Code Description
      eMode Calculation mode.
      u0q16X Weighted addition by the weight “x” in “xA+yB.” Parameter range: [1, 65535].
      u0q16Y Weighted addition by the weight “y” in “xA+yB.” Parameter range:
    • Related Data Type and Interface

      MI_IVE_AddMode_e


    3.53. MI_IVE_NccDstMem_t

    • Description

      Defines NCC output memory information.

    • Definition

      typedef struct MI_IVE_NccDstMem_s
      {
          MI_U64 u64Numerator;
          MI_U64 u64QuadSum1;
          MI_U64 u64QuadSum2;
      }MI_IVE_NccDstMem_t;
      
    • Member

      Member Code Description
      u64Numerator Numerator of NCC calculation formula: \sum^w_{i=1}\sum^h_{j=1}(I_{src1}(i,j)*I_{src2}(i,j))
      u64QuadSum1 Denominator, the inner part of the root number, of NCC calculation formula: \sum^w_{i=1}\sum^h_{j=1}(I^2_{src1}(i,j))
      u64QuadSum2 Denominator, the inner part of the root number, of NCC calculation formula: \sum^w_{i=1}\sum^h_{j=1}(I^2_{src2}(i,j))
    • Note

      • For calculation formula, please refer to the Note provided with respect to MI_IVE_Ncc.

    3.54. MI_IVE_Region_t

    • Description

      Defines connected region information.

    • Definition

      typedef struct MI_IVE_Region_s
      {
          MI_U32 u32Area; /*Represented by the pixel number*/
          MI_U16 u16Left; /*Circumscribed rectangle left border*/
          MI_U16 u16Right; /*Circumscribed rectangle right border*/
          MI_U16 u16Top; /*Circumscribed rectangle top border*/
          MI_U16 u16Bottom; /*Circumscribed rectangle bottom border*/
      }MI_IVE_Region_t;
      
    • Member

      Member Code Description
      u32Area Area size of connected region, represented by number of pixels of the connected region.
      u16Left Leftmost coordinate of the circumscribed rectangle of connected region.
      u16Right Rightmost coordinate of the circumscribed rectangle of connected region.
      u16Top Uppermost coordinate of the circumscribed rectangle of connected region.
      u16Bottom Lowermost coordinate of the circumscribed rectangle of connected region.
    • Related Data Type and Interface

      MI_IVE_CcBlob_t


    3.55. MI_IVE_CcBlob_t

    • Description

      Defines connected region label output information.

    • Definition

      typedef struct MI_IVE_CcBlob_s
      {
          MI_U16 u16CurAreaThr; /*Threshold of the result regions' area*/
          MI_S8 s8LabelStatus; /*-1: Labeled failed ; 0: Labeled successfully*/
          MI_U8 u8RegionNum; /*Number of valid region, non-continuous stored*/
          MI_IVE_Region_t astRegion[MI_IVE_MAX_REGION_NUM];
      }MI_IVE_CcBlob_t;
      
    • Member

      Member Code Description
      u16CurAreaThr The regions in astRegion with area size smaller than this threshold will be deleted and merged when doing region deletion.
      s8LabelStatus Connected region labelled successfully or not.
      -1: Labelling failed, overflow is occurred; 0: Labelling successful.
      u8RegionNum Effective number of connected regions.
      astRegion[MI_IVE_MAX_REGION_NUM] Connected region information.

      Chips/Platforms u16CurAreaThr s8LabelStatus Regions Information with Label Index 1~254 Excluded Regions Information after Merging Deleted Regions
      Souffle 0 -1: Labelling failed, overflow occurred;
      0: Labelling successful
      astRegion[1]~astRegion[254] astRegion[0]
      Others Determined by deletion process -1: Labelling failed(u8RegionNum == 0) or Labelling successful(u8RegionNum != 0) with deletion process.
      0: Labelling successful
      astRegion[0]~astRegion[253] astRegion[254]

    • Note

      • CcBlob→u8RegionNum indicates the effective number of connected regions, and the maximum number of effective region is 254.

      • u16CurAreaThr will be outputed after region deletion when the effective number of connected regions is over 254, for details of deletion, please refer to MI_IVE_CclCtrl_t.

    • Related Data Type and Interface

      MI_IVE_Region_t

      MI_IVE_CclCtrl_t


    3.56. MI_IVE_CclMode_e

    • Description

      Defines connected region mode.

    • Definition

      typedef enum
      {
          E_MI_IVE_CCL_MODE_8C = 0x0, /*8-connectivity*/
          E_MI_IVE_CCL_MODE_4C = 0x1, /*4-connectivity*/
          E_MI_IVE_CCL_MODE_BUTT
      }MI_IVE_CclMode_e;
      
    • Member

      Member Code Description
      E_MI_IVE_CCL_MODE_4C 4-connectivity.
      E_MI_IVE_CCL_MODE_8C 8-connectivity.
    • Note

      • Only Souffle series supports this enumeration, others use 8-connectivity mode as default.

    3.57. MI_IVE_CclCtrl_t

    • Description

      Defines connected region label control parameter.

    • Definition

      typedef struct MI_IVE_CclCtrl_s
      {
          MI_U16 u16InitAreaThr;
          MI_U16 u16Step;
          MI_IVE_CclMode_e eCclMode;
      }MI_IVE_CclCtrl_t;
      
    • Member

      Member Code Description
      u16InitAreaThr Initial area threshold. Parameter range: [0, 65535]. Reference value: 4.
      u16Step Area threshold growth step. Parameter range: [1,65535]. Reference value: 2.
      eCclMode The mode of CCL.
      Only Souffle series support
    • Note

      • When the number of connected regions are over 254, use pstCclCtrl→u16InitAreaThr to exclude the region with small area. If the number of connected regions are still over 254 after region deletion, the threshold of area will be increased by step pstCclCtrl→u16Step and stored in u16CurAreaThe, and do deletion until the number of connected regions is less than 254 or the threshold of area reaches the maximum value 65535.
    • Related Data Type and Interface

      MI_IVE_CcBlob_t


    3.58. MI_IVE_GmmCtrl_t

    • Description

      Defines GMM background modelling control parameter.

    • Definition

      typedef struct MI_IVE_GmmCtrl_s
      {
          MI_U22Q10 u22q10NoiseVar; /*Initial noise Variance*/
          MI_U22Q10 u22q10MaxVar; /*Max Variance*/
          MI_U22Q10 u22q10MinVar; /*Min Variance*/
          MI_U0Q16 u0q16LearnRate; /*Learning rate*/
          MI_U0Q16 u0q16BgRatio; /*Background ratio*/
          MI_U8Q8 u8q8VarThr; /*Variance Threshold*/
          MI_U0Q16 u0q16InitWeight; /*Initial Weight*/
          MI_U8 u8ModelNum; /*Model number: 3 or 5*/
      }MI_IVE_GmmCtrl_t;
      
    • Member

      Member Code Description
      u22q10NoiseVar Initial noise variance. Parameter range: [0x1, 0xFFFFFF]. For grayscale GMM, please refer to noiseSigma * noiseSigma of OpenCV MOG grayscale model. Reference value: 15*15*(1<<10). For RGB GMM, please refer to noiseSigma * noiseSigma of OpenCV MOG RGB model 3 . Reference value: 3*15*15(1<<10).
      NOTE: Souffle series do not need to set this parameter.
      u22q10MaxVar Maximum value of model variance. Parameter range; [0x1, 0xFFFFFF]. Please refer to fVarMax of OpenCV MOG2. Reference value: 3*4000<<10 (RGB), 2000<<10 (grayscale).
      u22q10MinVar Minimum value of model variance. Parameter range: [0x1, 22q10MaxVar]. Please refer to fVarMin of OpenCV MOG2. Reference value: 600<<10 (RGB), 200<<10 (grayscale).
      u0q16LearnRate Learning rate. Parameter range: [1, 65535]. Please refer to learningRate of OpenCV MOG2. Reference value: if (frameNum<500) (1/frameNum)((1<<16)-1); else ((1/500)((1<<16)-1).
      u0q16BgRatio Background ratio threshold. Parameter range: [1, 65535]. Please refer to backgroundRatio of OpenCV MOG. Reference value: 0.8*((1<<16)-1).
      u8q8VarThr Variance threshold. Parameter range: [1, 65535]. Please refer to varThreshold of OpenCV MOG. This parameter is used to determine if a pixel hits the current model. Reference value: 6.25*(1<<8).
      u0q16InitWeight Initial weight. Parameter range: [1, 65535]. Please refer to defaultInitialWeight of OpenCV MOG. Reference value: 0.05*((1<<16)-1).
      NOTE: Souffle series do not need to set this parameter.
      u8ModelNum Model number. Parameter range:

    3.59. MI_IVE_CannyStackSize_t

    • Description

      Defines strong edge point stack size structure in the first half of Canny edge calculation.

    • Definition

      typedef struct MI_IVE_CannyStackSize_s
      {
          MI_U32 u32StackSize; /*Stack size for output*/
          MI_U8 u8Reserved[MI_IVE_CANNY_STACK_RESERVED_SIZE]; /*For 16 byte align*/
      }MI_IVE_CannyStackSize_t;
      
    • Member

      Member Code Description
      u32StackSize Stack size (number of strong edge points).
      u8Reserved[MI_IVE_CANNY_STACK_RESERVED_SIZE] Reserved.

    3.60. MI_IVE_CannyHysEdgeCtrl_t

    • Description

      Defines control parameter in Canny edge first-half calculation task.

    • Definition

      typedef struct MI_IVE_CannyHysEdgeCtrl_s
      {
          MI_IVE_MemInfo_t stMem;
          MI_U16 u16LowThr;
          MI_U16 u16HighThr;
          MI_S8 as8Mask[MI_IVE_MASK_SIZE_5X5];
      } MI_IVE_CannyHysEdgeCtrl_t;
      
    • Member

      Member Code Description
      stMem Auxiliary memory. For details on the memory allocation and size, please refer to the Note provided with respect to MI_IVE_CannyHysEdge.
      u16LowThr Low threshold. Parameter range: [0,255].
      u16HighThr High threshold. Parameter range: [u16LowThr,255].
      as8Mask[MI_IVE_MASK_SIZE_5X5] Parameter template used for gradient calculation.

    3.61. MI_IVE_LbpCmpMode_e

    • Description

      Defines LBP calculation comparison mode.

    • Definition

      typedef enum
      {
          E_MI_IVE_LBP_CMP_MODE_NORMAL  = 0x0,
          /* P(x)-P(center) >= un8BitThr.s8Val, s(x)=1; else s(x)=0; */
          E_MI_IVE_LBP_CMP_MODE_ABS     = 0x1,
          /* abs(P(x)-P(center)) >= un8BitThr.u8Val, s(x)=1; else s(x)=0; */
          E_MI_IVE_LBP_CMP_MODE_ABS_MUL = 0x2
          E_MI_IVE_LBP_CMP_MODE_MAX
      }MI_IVE_LbpCmpMode_e;
      
    • Member

      Member Code Description
      E_MI_IVE_LBP_CMP_MODE_NORMAL LBP normal comparison mode.
      E_MI_IVE_LBP_CMP_MODE_ABS LBP absolute comparison mode.
      E_MI_IVE_LBP_CMP_MODE_ABS_MUL LBP absolute multiply comparison mode
    • Note

      • For calculation formula, please refer to the Note provided with respect to MI_IVE_Lbp.
    • Related Data Type and Interface

      MI_IVE_LbpCtrrl_t


    3.62. MI_IVE_LbpChalMode_e

    • Description

      Defines LBP input channel mode.

    • Definition

      typedef enum
      {
          E_MI_IVE_LBP_CHAL_MODE_U8C1 = 0x0,
          E_MI_IVE_LBP_CHAL_MODE_U8C2 = 0x1,
          E_MI_IVE_LBP_CHAL_MODE_MAX
      } MI_IVE_LbpChalMode_e;
      
    • Member

      Member Code Description
      E_MI_IVE_LBP_CHAL_MODE_U8C1 Only one input
      E_MI_IVE_LBP_CHAL_MODE_U8C2 Two input
    • Related Data Type and Interface

      MI_IVE_LbpCtrrl_t


    3.63. MI_IVE_LbpCtrrl_t

    • Description

      Defines LBP texture calculation control parameter.

    • Definition

      typedef struct MI_IVE_LbpCtrrl_s
      {
          MI_IVE_LbpCmpMode_e eMode;
          MI_IVE_LbpChalMode_e chMode;
          MI_IVE_Length8bit_u un8BitThr;
      }MI_IVE_LbpCtrrl_t;
      
    • Member

      Member Code Description
      eMode LBP comparison mode.
      chMode LBP channel mode
      un8BitThr LBP comparison threshold. Parameter range for E_MI_IVE_LBP_CMP_MODE_NORMAL: [-128, 127]. Parameter range for E_MI_IVE_LBP_CMP_MODE_ABS: [0, 255]. Parameter range for E_MI_IVE_LBP_CMP_MODE_ABS: [0, 7].
    • Note

      • For calculation formula, please refer to the Note provided with respect to MI_IVE_Lbp.
    • Related Data Type and Interface

      MI_IVE_LbpCmpMode_e

      MI_IVE_LbpChalMode_e

      MI_IVE_Length8bit_u


    3.64. MI_IVE_NormGradOutCtrl_e

    • Description

      Defines enumeration type of normalized gradient information calculation task output control.

    • Definition

      typedef enum
      {
          E_MI_IVE_NORM_GRAD_OUT_CTRL_HOR_AND_VER = 0x0,
          E_MI_IVE_NORM_GRAD_OUT_CTRL_HOR         = 0x1,
          E_MI_IVE_NORM_GRAD_OUT_CTRL_VER         = 0x2,
          E_MI_IVE_NORM_GRAD_OUT_CTRL_COMBINE     = 0x3,
          E_MI_IVE_NORM_GRAD_OUT_CTRL_BUTT
      }MI_IVE_NormGradOutCtrl_e;
      
    • Member

      Member Code Description
      E_MI_IVE_NORM_GRAD_OUT_CTRL_ HOR_AND_VER Output H and V component maps of gradient information simultaneously. (For H and V definition, please refer to Parameter of MI_ IVE_NormGrad.)
      E_MI_IVE_NORM_GRAD_OUT_CTRL_ HOR Output H component map of gradient information.
      E_MI_IVE_NORM_GRAD_OUT_CTRL_ VER Output V component map of gradient information.
      E_MI_IVE_NORM_GRAD_OUT_CTRL_ COMBINE Output H, V component map in package format of gradient information.
    • Related Data Type and Interface

      MI_IVE_NormGradCtrl_t


    3.65. MI_IVE_NormGradCtrl_t

    • Description

      Defines normalized gradient information calculation control parameter.

    • Definition

      typedef struct MI_IVE_NormGradCtrl_s
      {
          MI_IVE_NormGradOutCtrl_e eOutCtrl;
          MI_S8 as8Mask[MI_IVE_MASK_SIZE_5X5];
          MI_U8 u8Norm;
      }MI_IVE_NormGradCtrl_t;
      
    • Member

      Member Code Description
      eOutCtrl Gradient information output control mode.
      as8Mask[MI_IVE_MASK_SIZE_5X5] Template required of gradient calculation.
      u8Norm Normalization parameter. Parameter range: [1, 13].
    • Related Data Type and Interface

      MI_IVE_NormGradOutCtrl_e


    3.66. MI_IVE_MvS9Q7_t

    • Description

      Defines LK optical flow displacement structure.

    • Description

      typedef struct MI_IVE_MvS9Q7_s
      {
          MI_S32 s32Status; /*Result of tracking: 0-success; -1-failure*/
          MI_S9Q7 s9q7Dx; /*X-direction component of the movement*/
          MI_S9Q7 s9q7Dy; /*Y-direction component of the movement*/
      }MI_IVE_MvS9Q7_t;
      
    • Member

      Member Code Description
      s32Status Feature point tracking result. 0: Successful. 1: Failed.
      s9q7Dx Displacement of X-direction component.
      s9q7Dy Displacement of Y-direction component.

    3.67. MI_IVE_LkOpticalFlowCtrl_t

    • Description

      Defines LK optical flow calculation control parameter.

    • Definition

      typedef struct MI_IVE_LkOpticalFlowCtrl_s
      {
          MI_U16 u16CornerNum; /*Number of the feature points,<200*/
          MI_U0Q8 u0q8MinEigThr; /*Minimum eigenvalue threshold*/
          MI_U8 u8IterCount; /*Maximum iteration times*/
          MI_U0Q8 u0q8Epsilon; /*Threshold of iteration for dx^2 + dy^2 < u0q8Epsilon */
      }MI_IVE_LkOpticalFlowCtrl_t;
      
    • Member

      Member Code Description
      u16CornerNum Number of input corner points / feature points. Parameter range: [1,200].
      u0q8MinEigThr Minimum Eigen value threshold. Parameter range: [1,255].
      u8IterCount Maximum number of iterations. Parameter range: [1,20].
      u0q8Epsilon Eteration convergence condition: dx^2 + dy^2 < u0q8Epsilon. Parameter range: [1,255]. Reference value: 2.

    3.68. MI_IVE_SadMode_e

    • Description

      Defines SAD calculation mode.

    • Definition

      typedef enum
      {
          E_MI_IVE_SAD_MODE_MB_4X4   = 0x0, /*4x4*/
          E_MI_IVE_SAD_MODE_MB_8X8   = 0x1, /*8x8*/
          E_MI_IVE_SAD_MODE_MB_16X16 = 0x2, /*16x16*/
          E_MI_IVE_SAD_MODE_BUTT
      }MI_IVE_SadMode_e;
      
    • Member

      Member Code Description
      E_MI_IVE_SAD_MODE_MB_4X4 Calculation of SAD by 4x4 pixel block.
      E_MI_IVE_SAD_MODE_MB_8X8 Calculation of SAD by 8x8 pixel block.
      E_MI_IVE_SAD_MODE_MB_16X16 Calculation of SAD by 16x16 pixel block.
    • Related Data Type and Interface

      MI_IVE_SadCtrl_t


    3.69. MI_IVE_SadOutCtrl_e

    • Description

      Defines SAD output control mode.

    • Definition

      typedef enum
      {
          E_MI_IVE_SAD_OUT_CTRL_16BIT_BOTH = 0x0, /*Output 16 bit sad and thresh*/
          E_MI_IVE_SAD_OUT_CTRL_8BIT_BOTH  = 0x1, /*Output 8 bit sad and thresh*/
          E_MI_IVE_SAD_OUT_CTRL_16BIT_SAD  = 0x2, /*Output 16 bit sad*/
          E_MI_IVE_SAD_OUT_CTRL_8BIT_SAD   = 0x3, /*Output 8 bit sad*/
          E_MI_IVE_SAD_OUT_CTRL_THRESH     = 0x4, /*Output thresh,16 bits sad */
          E_MI_IVE_SAD_OUT_CTRL_BUTT
      }MI_IVE_SadOutCtrl_e;
      
    • Member

      Member Code Description
      E_MI_IVE_SAD_OUT_CTRL_16BIT_BOTH 16-bit SAD map and thresholding map output mode.
      E_MI_IVE_SAD_OUT_CTRL_8BIT_BOTH 8-bit SAD map and thresholding map output mode.
      E_MI_IVE_SAD_OUT_CTRL_16BIT_SAD 16-bit SAD map output mode.
      E_MI_IVE_SAD_OUT_CTRL_8BIT_SAD 8-bit SAD map output mode.
      E_MI_IVE_SAD_OUT_CTRL_THRESH Thresholding map output mode.
    • Related Data Type and Interface

      MI_IVE_SadCtrl_t


    3.70. MI_IVE_SadCtrl_t

    • Description

      Defines SAD control parameter.

    • Definition

      typedef struct MI_IVE_SadCtrl_s
      {
          MI_IVE_SadMode_e eMode;
          MI_IVE_SadOutCtrl_e eOutCtrl;
          MI_U16 u16Thr; /*srcVal <= u16Thr, dstVal = minVal;srcVal > u16Thr, dstVal = maxVal.*/
          MI_U8 u8MinVal; /*Min value*/
          MI_U8 u8MaxVal; /*Max value*/
      }MI_IVE_SadCtrl_t;
      
    • Member

      Member Code Description
      eMode SAD calculation mode.
      eOutCtrl SAD output control mode.
      u16Thr Value for thresholding against calculated SAD map.
      u8MinVal Value for thresholding lower than u16Thr.
      u8MaxVal Value for thresholding higher than u16Thr.
    • Related Data Type and Interface

      MI_IVE_SadMode_e

      MI_IVE_SadOutCtrl_e


    3.71. MI_IVE_BernsenCtrl_t

    • Description

      Defines Bernsen thresh control parameters.

    • Definition

      typedef struct MVE_IVE_BernsenCtrl_s
      {
          MI_IVE_BernsenMode_e enMode;
          MI_U8 u8WinSize;
          MI_U8 u8MaxVal;
      } MVE_IVE_BernsenCtrl_t;
      
    • Member

      Member Code Description
      eMode Bernsen thresh mode.
      u8WinSize Window size for the local threshold calculation. Value range:
      u8MaxVal Thresh in MVE_BERNSEN_MODE_THRESH mode in which the global threshold is involved. Value range: [0, 255]
    • Related Data Type and Interface

      MI_IVE_BernsenMode_e


    3.72. MI_IVE_BernsenMode_e

    • Description

      Defines the Bernsen thresh mode.

    • Definition

      typedef enum
      {
          E_MI_IVE_BERNSEN_MODE_NORMAL = 0x0,
          E_MI_IVE_BERNSEN_MODE_THRESH = 0x1,
          E_MI_IVE_BERNSEN_MODE_MAX
      } MVE_IVE_BernsenMode_e;
      
    • Member

      Member Code Description
      E_MI_IVE_BERNSEN_MODE_NORMAL Simple Bernsen thresh
      E_MI_IVE_BERNSEN_MODE_THRESH Thresh based on the global threshold and local Bernsen threshold
      E_MI_IVE_BERNSEN_MODE_MAX Error mode.
    • Related Data Type and Interface

      MI_IVE_BernsenCtrl_t


    3.73. MI_IVE_LineFilterHorCtrl_t

    • Description

      Defines control parameters for filtering the horizontal density of binary images.

    • Definition

      typedef struct MVE_IVE_LineFilterHorCtrl_s
      {
          MI_U8 u8GapMinLen;
          MI_U8 u8DensityThr;
          MI_U8 u8HorThr;
      } MVE_IVE_LineFilterHorCtrl_t;
      
    • Member

      Member Code Description
      u8GapMinLen Minimum black line length. For details, see thr1 in the note field of MI_IVE_LineFilterHor. Value range: [1, 20] Reference value: 10
      u8DensityThr Density threshold. For details, see thr2 in the Note field of MI_IVE_LineFilterHor. Value range: [1, 50] Reference value: 20
      u8HorThr Horizontal line length threshold. For details, see thr3 in the note field of MI_IVE_LineFilterHor. Value range: [1, 50] Reference value: 20

    3.74. MI_IVE_LineFilterVerCtrl_t

    • Description

      Defines control parameters for filtering the vertical density of binary images.

    • Definition

      typedef struct MVE_IVE_LineFilterVerCtrl_s
      {
          MI_U8 u8VerThr;
      } MVE_IVE_LineFilterVerCtrl_t _t;
      
    • Member

      Member Code Description
      u8VerThr Vertical line length threshold. For details, see thr in the note field of MI_IVE_LineFilterVer. Value range: [1, 64] Reference value: 30

    3.75. MI_IVE_NoiseRemoveHor_t

    • Description

      Defines the horizontal noise removal control parameter for the binary image.

    • Definition

      typedef struct MVE_IVE_NoiseRemoveHorCtrl_s
      {
          MI_U8 u8HorThr;
          MI_U8 u8HorThrMax;
      } MVE_IVE_NoiseRemoveHorCtrl_t;
      
    • Member

      Member Code Description
      u8HorThr Length threshold for determining horizontal noises, see thr1 in the note field of MI_IVE_NoiseRemoveHor. Value range: [1, 100] Reference value: 25
      u8HorThrMax Maximum length threshold for determining horizontal , see thr2 in the note field of MI_IVE_NoiseRemoveHor. Value range: [1, 100] Reference value: 79
    • Note

      • u8HorThrMax is always bigger than u8HorThr.

    3.76. MI_IVE_NoiseRemoveVer_t

    • Description

      Defines the vertical noise removal control parameter for the binary image.

    • Definition

      typedef struct MVE_IVE_NoiseRemoveVerCtrl_s
      {
          MI_U8 u8VerThr;
          MI_U8 u8VerThrMax;
      } MVE_IVE_NoiseRemoveVerCtrl_t;
      
    • Member

      Member Code Description
      u8VerThr Length threshold for determining vertical noises, see thr1 in the note field of MI_IVE_NoiseRemoveVer. Value range: [1, 100] Reference value: 25
      u8VerThrMax Maximum Length threshold for determining vertical noises, see thr2 in the note field of MI_IVE_NoiseRemoveVer. Value range: [1, 100] Reference value: 79
    • Note

      • u8VerThrMax is always bigger than u8VerThr.

    3.77. MI_IVE_AdpThreshCtrl_t

    • Description

      Defines adaptive thresh control parameters.

    • Definition

      typedef struct MVE_IVE_AdpThreshCtrl_s
      {
          MI_U8 u8RateThr;
          MI_U8 u8HalfMaskx;
          MI_U8 u8HalfMasky;
          MI_U8 s16Offset;
          MI_U8 u8ValueThr;
      } MVE_IVE_AdpThreshCtrl_t;
      
    • Member

      Member Code Description
      u8RateThr Threshold rate for determining adaptive thresh. For details, see RateThr in the formula of MI_IVE_AdpThresh. Value range: [1, 20] Default: 10
      u8HalfMaskx Half of Mask size width for determining adaptive thresh. For details, see w in the formula of MI_IVE_AdpThresh. Value range: [1, 40] Default: 10
      u8HalfMasky Half of Mask size height for determining adaptive thresh. For details, see h in the formula of MI_IVE_AdpThresh. Value range: [1, 40] Default: 35
      s16Offset Offset for determining adaptive thresh. For details, see Offset in the formula of MI_IVE_AdpThresh. Value range: [-128, 127] Default: -100
      u8ValueThr Threshold pixel value for determining adaptive thresh. For details, see ValueThr in the formula of MI_IVE_AdpThresh. Value range: [1, 255] Default: 100

    3.78. MI_IVE_ResizeMode_e

    • Description

      Defines the resize control parameters.

    • Definition

      typedef enum
      {
          E_MI_IVE_RESIZE_TYPE_U8C1         = 0x0,
          E_MI_IVE_RESIZE_TYPE_U8C3_PLANAR  = 0x1,
          E_MI_IVE_RESIZE_TYPE_U8C3_PACKAGE = 0x2,
          E_MI_IVE_RESIZE_TYPE_YUV420SP     = 0x3,
          E_MI_IVE_RESIZE_TYPE_MAX
      } MVE_IVE_ResizeMode_e;
      
      • Member
      Member Code Description
      E_MI_IVE_RESIZE_TYPE_U8C1 Single-channel image of which each pixel is expressed by an 8-bit unsigned data segment.
      E_MI_IVE_RESIZE_TYPE_U8C3_PLANAR Three-channel image (stored in planar format) of which each pixel is expressed by three 8-bit unsigned data segments.
      E_MI_IVE_RESIZE_TYPE_U8C3_PACKAGE Three-channel image (stored in package format) of which each pixel is expressed by three 8-bit unsigned data segments.
      E_MI_IVE_RESIZE_TYPE_YUV420SP YUV420 semi-planar image.
      E_MI_IVE_RESIZE_TYPE_MAX Error mode.
    • Related Data Type and Interface

      MI_IVE_ResizeCtrl_t


    3.79. MI_IVE_ResizeMethod_e

    • Description

      Defines the resize method.

    • Definition

      typedef enum
      {
          E_MI_IVE_RESIZE_METHOD_BILINEAR = 0x0,
          E_MI_IVE_RESIZE_METHOD_AREA     = 0x1,
          E_MI_IVE_RESIZE_METHOD_MAX
      } MI_IVE_ResizeMethod_e;
      
    • Member

      Member Code Description
      E_MI_IVE_RESIZE_METHOD_BILINEAR Use Bilinear method to do resize, scaling up and down are supported.
      E_MI_IVE_RESIZE_METHOD_AREA Use area method to do resize, only scaling down is supported.
      E_MI_IVE_RESIZE_TYPE_MAX Error mode.
    • Note

      • Only Souffle series supports this enumeration, others use Bilinear mode as default.
    • Related Data Type and Interface

      MI_IVE_ResizeCtrl_t


    3.80. MI_IVE_ResizeCtrl_t

    • Description

      Defines the resize control parameters.

    • Definition

      typedef struct _MVE_IVE_ResizeCtrl_s
      {
          MVE_IVE_ResizeMode_e enMode;
          MI_IVE_ResizeMethod_e eResizeMethod;
      } MVE_IVE_ResizeCtrl_t;
      
    • Member

      Member Code Description
      enMode Input image mode. For detail, see MI_IVE_ResizeMode_e
      eResizeMethod Resize method.
      Only Souffle series support
    • Related Data Type and Interface

      MI_IVE_ResizeMode_e

      MI_IVE_ResizeMethod_e


    3.81. MI_IVE_BatCtrl_t

    • Description

      Defines the bat control parameters.

    • Definition

      typedef struct _MVE_IVE_BatCtrl_s
      {
          MVE_IVE_BatMode_e enMode;
          MI_U16 _t u16HorTimes;
          MI_U16 _t u16VerTimes;
      } MVE_IVE_BatCtrl_t;
      
    • Member

      Member Code Description
      enMode Input image mode. For detail, see MI_IVE_BatMode_e
      u16HorTimes Threshold of horizontal direction.
      u16VerTimes Threshold of vertical direction.
    • Related Data Type and Interface

      MI_IVE_BatMode_e


    3.82. MI_IVE_BatMode_e

    • Description

      Define the output control mode.

    • Definition

      typedef enum
      {
          E_MI_IVE_BAT_OUT_CTRL_BOTH = 0x0,
          E_MI_IVE_BAT_OUT_CTRL_HOR  = 0x1,
          E_MI_IVE_BAT_OUT_CTRL_VER  = 0x2,
          E_MI_IVE_BAT_OUT_CTRL_MAX
      } MVE_IVE_BatMode_e
      
    • Member

      Member Code Description
      E_MI_IVE_BAT_OUT_CTRL_BOTH Horizontal and vertical mode.
      E_MI_IVE_BAT_OUT_CTRL_HOR Horizontal mode.
      E_MI_IVE_BAT_OUT_CTRL_VER Vertical mode
      E_MI_IVE_BAT_OUT_CTRL_MAX Error mode.
    • Related Data Type and Interface

      MI_IVE_BatCtrl_t


    3.83. MI_IVE_AccCtrl_t

    • Description

      Define the acc control parameter.

    • Definition

      typedef struct MVE_IVE_AccCtrl_s
      {
          MVE_IVE_AccMode_e enMode;
      } MVE_IVE_AccCtrl_t;
      
    • Member

      Member Code Description
      enMode Input image mode. For detail, see MI_IVE_AccMode_e
    • Related Data Type and Interface

      MI_IVE_AccMode_e


    3.84. MI_IVE_AccMode_e

    • Description

      Define the acc input control mode.

    • Definition

      typedef enum
      {
          E_MI_IVE_ACC_MODE_INCREASE            = 0x0,
          E_MI_IVE_ACC_MODE_DECREASE            = 0x1,
          E_MI_IVE_ACC_MODE_INCREASE_MAP_255TO1 = 0x2,
          E_MI_IVE_ACC_MODE_MAX
      } MVE_IVE_AccMode_e
      
    • Member

      Member Code Description
      E_MI_IVE_ACC_MODE_INCREASE Increase mode.
      E_MI_IVE_ACC_MODE_DECREASE Decrease mode.
      E_MI_IVE_ACC_MODE_INCREASE_MAP_255TO1 Increase 255 to 1 mode.
      E_MI_IVE_ACC_MODE_MAX Error mode.
    • Related Data Type and Interface

      MI_IVE_AccCtrl_t


    3.85. MI_IVE_MatrTranfMode_e

    • Description

      Define the input channel mode of matrix transform.

    • Definition

      typedef enum
      {
          E_MI_IVE_MATRIX_TRANSFORM_TYPE_C1 = 0x0,
          E_MI_IVE_MATRIX_TRANSFORM_TYPE_C2 = 0x1,
          E_MI_IVE_MATRIX_TRANSFORM_TYPE_C3 = 0x2,
          E_MI_IVE_MATRIX_TRANSFORM_TYPE_MAX
      }MVE_IVE_MatrTranfMode_e;
      
    • Member

      Member Code Description
      E_MI_IVE_MATRIX_TRANSFORM_TYPE_C1 Only use one input source.
      E_MI_IVE_MATRIX_TRANSFORM_TYPE_C2 Two input sources.
      E_MI_IVE_MATRIX_TRANSFORM_TYPE_C3 Thress input sources.
    • Related Data Type and Interface

      MI_IVE_MatrTranfCtrl_t


    3.86. MI_IVE_MatrTranfCtrlMode_e

    • Description

      Define the input control mode of matrix transform.

    • Definition

      typedef enum
      {
          E_MI_IVE_MATRIX_TRANSFORM_CTRL_ROUNDING = 0x0,
          E_MI_IVE_MATRIX_TRANSFORM_CTRL_CLIPPING = 0x1,
          E_MI_IVE_MATRIX_TRANSFORM_CTRL_MAX
      } MVE_IVE_MatrTranfCtrlMode_e;
      
    • Member

      Member Code Description
      E_MI_IVE_MATRIX_TRANSFORM_CTRL_ROUNDING Rounding mode.
      E_MI_IVE_MATRIX_TRANSFORM_CTRL_CLIPPING Clipping mode.
      E_MI_IVE_MATRIX_TRANSFORM_CTRL_MAX Error mode.
    • Related Data Type and Interface

      MI_IVE_MatrTranfCtrl_t


    3.87. MI_IVE_MatrTranfCtrl_t

    • Description

      Define the control parameters of matrix transform.

    • Definition

      typedef struct MI_IVE_MatrTranfCtrl_S
      {
          MVE_IVE_MatrTranfMode_e enMode; *Input channel mode*/
          MVE_IVE_MatrTranfCtrlMode_e CtrlMode;
          MI_S32 s32MatrixArray[9]; //Official
      } MI_IVE_MatrTranfCtrl_t;
      
    • Member

      Member Code Description
      enMode Input image mode. For detail, see MI_IVE_MatrTranfMode_e.
      CtrlMode Input controling mode.
      s32MatrixArray[9]; Cofficients of matrix, configured in row-major order.
    • Note

      • If the enMode = E_MI_IVE_MATRIX_TRANSFORM_TYPE_C1, you only need to set value s32MatrixArray[0].

      • If the enMode = E_MI_IVE_MATRIX_TRANSFORM_TYPE_C2, the value s32MatrixArray[0] ~ s32MatrixArray[3] must be set.

      • If the enMode = E_MI_IVE_MATRIX_TRANSFORM_TYPE_C3, the all matrix value should be set.

    • Related Data Type and Interface

      MI_IVE_MatrTranfMode_e

      MI_IVE_MatrTranfCtrlMode_e


    3.88. MI_IVE_SHIFT_DETECT_MODE_e

    • Description

      Define the shift detector input control mode.

    • Definition

      typedef enum
      {
          E_MI_IVE_SHIFT_DETECT_MODE_SINGLE = 0x0,
          E_MI_IVE_SHIFT_DETECT_MODE_MULTI  = 0x1,
          E_MI_IVE_SHIFT_DETECT_MODE_MAX
      }MVE_IVE_MatrTranfMode_e;
      
    • Member

      Member Code Description
      E_MI_IVE_SHIFT_DETECT_MODE_SINGLE Only use one input source.
      E_MI_IVE_SHIFT_DETECT_MODE_MULTI Two input sources.
      E_MI_IVE_SHIFT_DETECT_MODE_MAX Error mode
    • Related Data Type and Interface

      MI_IVE_SHIFT_DETECT_CTRL_t


    3.89. MI_IVE_SHIFT_DETECT_CTRL_t

    • Description

      Define control parameter of the shift detector.

    • Definition

      typedef struct MVE_IVE_SHIFT_DETECT_CTRL_S
      {
          MVE_IVE_SHIFT_DETECT_MODE_e enMode;
          MI_U8 pyramid_level;
          MI_U8 search_range;
          MI_U16 u16Left;
          MI_U16 u16Top;
          MI_U16 u16Width;
          MI_U16 u16Height;
      } MI_IVE_SHIFT_DETECT_CTRL_t;
      
    • Member

      Member Code Description
      enMode Input image mode. For detail, see MI_IVE_MatrTranfMode_e
      pyramid_level The size of the image pyramid.
      search_range The searching region around the bounding box
      u16Left The top left x location of the bounding box
      u16Top The top left y location of the bounding box
      u16Width The width of the bounding box
      u16Height The height of the bounding box
    • Note

      • If enMode = E_MI_IVE_SHIFT_DETECT_MODE_SINGLE, u16Width and u16Height represent the width and height of target region.

      • If enMode = E_MI_IVE_SHIFT_DETECT_MODE_MULTI, u16Width and u16Height represent square size of global tracking.

    • Related Data Type and Interface

      MI_IVE_SHIFT_DETECT_MODE_e


    3.90. MI_IVE_BgBlurMode_e

    • Description

      Define the BGBlur mode.

    • Definition

      typedef enum
      {
          E_MI_IVE_BGBLUR_MODE_BLUR            = 0x0,
          E_MI_IVE_BGBLUR_MODE_REPLACE         = 0x1,
          E_MI_IVE_BGBLUR_MODE_MOSAIC          = 0x2,
          E_MI_IVE_BGBLUR_MODE_BLUR_AND_MOSAIC = 0x3,
          E_MI_IVE_BGBLUR_MODE_MAX
      } MI_IVE_BgBlurMode_e;
      
    • Member

      Member Code Description
      E_MI_IVE_BGBLUR_MODE_BLUR The background blur mode of BGBlur.
      E_MI_IVE_BGBLUR_MODE_REPLACE The background replacing mode of BGBlur.
      Only Souffle series support
      E_MI_IVE_BGBLUR_MODE_MOSAIC The background mosaic mode of BGBlur.
      Only iFord series support
      E_MI_IVE_BGBLUR_MODE_BLUR_AND_MOSAIC The background blur and mosaic mode of BGBlur.
      Only iFord series support
      E_MI_IVE_BGBLUR_MODE_MAX Error mode
    • Related Data Type and Interface

      MI_IVE_BgBlurCtrl_t


    3.91. MI_IVE_BgBlurMaskOp_e

    • Description

      Define the Mask Preprocess mode of BGBlur.

    • Definition

      typedef enum
      {
          E_MI_IVE_BGBLUR_MASK_OP_DILATE = 0x0,
          E_MI_IVE_BGBLUR_MASK_OP_NONE   = 0x1,
          E_MI_IVE_BGBLUR_MASK_OP_ERODE  = 0x2,
          E_MI_IVE_BGBLUR_MASK_OP_MAX
      } MI_IVE_BgBlurMaskOp_e;
      
    • Member

      Member Code Description
      E_MI_IVE_BGBLUR_MASK_OP_DILATE The Mask dilation preprocess mode
      E_MI_IVE_BGBLUR_MASK_OP_NONE No Mask preprocess mode
      E_MI_IVE_BGBLUR_MASK_OP_ERODE The Mask corrosion preprocess mode
      E_MI_IVE_BGBLUR_MASK_OP_MAX Error mode
    • Note

      • The output of BGBlur will arise halo/flicker in foreground or penetration in background when the Mask content is not fitted with the shape of real foreground, in this case, use Mask preprocess can improve the output of BGBlur.

      • E_MI_IVE_BGBLUR_MASK_OP_DILATE is recommended when background has less texture and the contrast between background and foreground is biggish.

      • E_MI_IVE_BGBLUR_MASK_OP_NONE or E_MI_IVE_BGBLUR_MASK_OP_ERODE is recommended when background has rich texture.

    • Related Data Type and Interface

      MI_IVE_BgBlurCtrl_t


    3.92. MI_IVE_BgBlurCtrl_t

    • Description

      Define the control parameter of BGBlur.

    • Definition

      typedef struct MI_IVE_BgBlurCtrl_S
      {
          MI_IVE_BGBLUR_MODE_e eBgBlurMode;
          MI_U8 u8MaskThr;
          MI_U8 u8BlurLv;
          MI_U8 u8ScalingStage;
          MI_IVE_BgBlurMaskOp_e eBgBlurMaskOp;
          MI_U8 u8SaturationLv;
          MI_U8 u8MosaicSize;
      } MI_IVE_BgBlurCtrl_t;
      
    • Member

      Member Code Description
      eBgBlurMode The BGBlur mode.
      u8MaskThr The threshold for binarization of Mask source image, parameter range: [0, 255].
      u8BlurLv The level of background blur, parameter range: [0, 255].
      Only valid in Souffle series
      u8ScalingStage The scaling stage of background blur, parameter range: [1, 15].
      eBgBlurMaskOp The Mask Preprocess mode of BGBlur.
      u8SaturationLv The saturation level of U/V component in output image, parameter range: [0, 128].
      Only iFord series support
      u8MosaicSize The granularity of background mosaic, parameter range: [2, 4, 6, 8, 10].
      Only iFord series support
    • Note

      • Parameter u8BlurLv is used for indicating the weight of Alpha blending, the strength of blur reaches maximum when u8BlurLv is 0, other description can be referred in MI_IVE_AlphaBlending.

      • Parameter u8ScalingStage is used for indicating scaling stage of small original image. When configuring background blur, the small original image will be resized, and the blur degree of the acquired background is directly proportional to the scaling stage, the strength reaches maximum when u8ScalingStage is 15.

      • Parameter u8SaturationLv is used for indicating the saturation level of U/V component in output image, background is gray image when u8SaturationLv is 0, full color image when u8SaturationLv is 128.

      • Parameter u8MosaicSize is used for indicating the granularity of background mosaic, the mosaic strength reaches maximum when u8MosaicSize is 10.

    • Related Data Type and Interface

      MI_IVE_BgBlurMode_e

      MI_IVE_BgBlurMaskOp_e


    4. ERROR CODE

    The following table lists the Intellegient Acceleration Engine API ERROR CODE.

    Table 3-1: Intellegient Acceleration Engine API Error Codes

    Error Code Macro Definition Description
    0xA0002001 MI_IVE_ERR_INVALID_DEVID Invalid ID
    0xA0002002 MI_IVE_ERR_INVALID_CHNID Invalid channel ID or area handle
    0xA0002003 MI_IVE_ERR_ILLEGAL_PARAM Illegal parameter
    0xA0002004 MI_IVE_ERR_EXIST Device, channel or resource already exists
    0xA0002005 MI_IVE_ERR_UNEXIST Device, channel or resource to be used or destroyed does not exist
    0xA0002006 MI_IVE_ERR_NULL_PTR Null pointer found in function parameter
    0xA0002007 MI_IVE_ERR_NOT_CONFIG Module not configured
    0xA0002008 MI_IVE_ERR_NOT_SUPPORT Parameter or function not supported
    0xA0002009 MI_IVE_ERR_NOT_PERM Operation, e.g. attempt to modify static configuration parameter, not permitted
    0xA000200C MI_IVE_ERR_NOMEM Memory allocaton failed, e.g. system memory not enough
    0xA000200D MI_IVE_ERR_NOBUF Buffer allocation failed, e.g. image buffer area too broad
    0xA000200E MI_IVE_ERR_BUF_EMPTY No image in buffer area
    0xA000200F MI_IVE_ERR_BUF_FULL Image full in buffer area
    0xA0002010 MI_IVE_ERR_SYS_NOTREADY System not initialized or corresponding module not loaded
    0xA0002011 MI_IVE_ERR_BADADDR Invalid address
    0xA0002012 MI_IVE_ERR_BUSY System busy
    0xA0002013 MI_IVE_ERR_CHN_NOT_STARTED Channel not start
    0xA0002014 MI_IVE_ERR_CHN_NOT_STOPED Channel not stop
    0xA0002015 MI_IVE_ERR_NOT_INIT Module not initialized before being used
    0xA0002019 MI_IVE_ERR_SYS_TIMEOUT System timeout
    0xA000201F MI_IVE_ERR_FAILED Unexpected error

    5. PROCFS INTRODUCTION


    5.1. cat

    • Debug info analysis

      # cat /proc/mi_modules/mi_ive/mi_ive0
      

    • Debug info analysis

      Record the current debug info of IVE device which can be used for debugging or testing, and in which device info, request list management info, timeout info and channels info are included.

    • Parameters Description

      Parameters Description
      Dev info DevState Device state
      ClkRate Used clock rate
      IrqNum Interrupt number
      TaskCnt Unfinished task count
      FireCnt Processed task count
      IsrDoneCnt Finished task count
      IsrBackPresCnt Back pressure interrupt count
      IsrOtherCnt Abnormal interrupt count
      ResetCnt Reset count
      Request List info No. Request list index
      1stTaskState The First task state in Request list N
      ReadyTaskCnt The count of task with state Ready in Request list N
      DoingTaskCnt The count of task with state Doing in Request list N
      DoneTaskCnt The count of task with state Done in Request list N
      InQTaskCnt The count of task with state InQ in Request list N
      Timeout info No. Timeout info idx
      Op Recorded operator when timeout
      Pri Recorded task priority when timeout
      inW inH Fmt Recorded input width/height/format when timeout
      OutW OutH Fmt Recorded output width/height/format when timeout
      OpConfig Other recorded configuration when timeout
      Chns info ChnId Channel identifier
      CurOp Current used operator
      CurWidth Current input width
      CurHeight Current input height
      OpHistory Used histroy of operator
      HwCallTimes Times of using operator with hardware acceleration
      SwCallTimes Times of using operator without hardware acceleration
      HwSwitchSwTimes Times of using operator with parameters which is not satisfied with hardware acceleration requirement