MI SCL API


REVISION HISTORY

Revision No.
Description
Date
3.0
  • Initial release
  • 12/04/2020
    3.1
  • Added Muffin flow chart
  • 07/25/2021
  • Added PROCFS introduction
  • 08/25/2021
    3.2
  • Added Mochi info
  • 02/17/2022
    3.3
  • Added MI_SCL_StretchBufOsd Info
  • Added PROCFS debug cmd
  • 03/21/2022
    3.4
  • Added Maruko information
  • 03/22/2022
    3.5
  • In Section 5.2 add debug CMD:ptsth/resethw/cmdqtimeout/outputfilter
  • 08/03/2022
    3.6
  • In Section 2.15 add MI_SCL_StretchBuf demo
  • 09/09/2022
    3.7
  • Added Opera info
  • In Section 1.2 modified the expression of Device Id to make it easier to understand
  • 10/28/2022
    3.8
  • In Section 5.2 add debug CMD:cmdqdelay/doublevsyncdrop
  • 12/01/2022
    3.9
  • Added souffle info
  • 02/13/2023
    3.10
  • Added Iford info
  • 12/01/2023
    3.11
  • Added pixel format gray8 support info
  • 03/04/2024
    3.12
  • Added Pcupid info
  • 04/10/2024
    3.13
  • optimize document description
  • 04/18/2025

    1. OVERVIEW


    1.1. Module description

    SCL scales the original image to the specified resolution of each output port. Each scl is divided into different devices according to the type of input data source,and each output port has a crop/scaling/mirror/flip/pixel conversion function.

    Keyword

    • Device

      Device consists of a fixed input type and a user assigned HWSclId.

    • Channel

      A device can be time-sharing multiplexed into multiple channels.

    • Input Port

      Input port on the channel and the input type supported by each device are shown in the flowchart of chapter 1.5.

    • Output port

      Output port on the Device, which corresponds to the HWSclId of the Device one-to-one.

    • Crop

      Crop the image.

    • Scaling

      Saling to reduce or enlarge the image.

    • Compress

      Compress mode,compress data transmission to save bandwidth.

    • Rotate

      Rotate the input image by a certain angle and output.


    1.2. Basic structure

    • The MI_SCL module processes raw image data from various input sources through the crop, scaling, mirror, and flip units of the target output port, converting it into the target image format resolution. The MI_SCL module can support multiple such output ports, with specific capabilities and the number of supported output ports depending on the particular chip platform. For details on the differences between chips, please refer to section 1.5.

    • MI_SCL classifies different devices based on various source data. Most devices support selecting all output ports, while a few devices only support selecting specific output ports. When creating a device, multiple output ports can be selected, but output ports occupied by other devices cannot be chosen. The capability of output ports varies depending on different chipset platforms; specific details can be found in Chapter 1.5, which covers chipset differences.

    • For a device with a data source from DRAM, the MI_SCL can additionally configure cropping for the input port. Note that rotation is not currently supported for this crop operation.

    • The device performing rotation operations utilizes the hardware resources of the scaling unit within the selected output port. Therefore, an output port that performs rotation cannot simultaneously handle other operations such as cropping, scaling, mirroring/flip, or pixel transformation. In other words, an output port configured for rotation can only perform rotation and cannot be used for scaling, cropping, or other functionalities.

    • The SCL backend can be venc, disp, or jpeg modules, or it can directly output the frame without any subsequent processing. The supported backend modules vary across different chip platforms. For details, refer to Section 1.5.1 Chip Specifications.

    Figure 1-1: SCL Hardware Block Diagram


    1.3. Function introduction

    MI_SCL supported features:

    • Support for image resolution scaling and image effect adjustment

    • Support for cropping specific regions of an image

    • Support for pixfmt conversion

    • Support for multiplexing a single data stream into multiple streams

    • Support for image mirroring and flipping

    • Support for rotation on certain platforms (refer to section 1.5.1 for chip specifications)

    • Support for input decompression and output compression on certain platforms (refer to section 1.5.1 for chip specifications)


    1.4. Application scenarios

    MI_SCL can be applied in the following scenarios:

    • Pure linux environment

      Applications can be developed based on the API interfaces provided by MI_SCL.

    • Pure rtos environment

      In an RTOS environment, applications can be developed based on the API interfaces provided by MI_SCL.

    • Dualos environment

      In a dual OS environment, applications running on the Linux side and applications running on the RTOS side can be developed based on the MI_SCL API.


    1.5. Chip difference


    The current chip is "Pcupid"

    1.5.1. Specification

    Both '\' and 'N' mean this function is not supported.

    • Module function specifications

      Function Tiramisu Mochi Muffin Maruko Opera Souffle Iford Pcupid
      Dev Number 4 2 7 3 5 4 2 2
      Chn Number 32 32 32 16 16 32 32 32
      Port Number 6 7 9 4 4 7 3 1
      InputCrop Y Y Y Y Y Y Y Y
      Rotation Y N Y N Y N N Y
      mirror Y Y Y Y Y Y Y Y
      flip Y Y Y Y Y Y Y Y
      OutPutCrop Y Y Y Y Y Y Y Y
      Scaling Y Y Y Y Y Y Y Y
      Compress N Y N Y Y Y N N
      Max Pixel Rate 4K30 4K60 4K60 4K30 6M30 4K60 4K24 4K20
    • Input specifications

      Input Tiramisu Mochi Muffin Maruko Opera Souffle Iford Pcupid
      pixel ARGB8888 Y Y Y Y Y Y Y Y
      ABGR8888 Y Y Y Y Y Y Y Y
      BGRA8888 Y Y Y Y Y Y Y Y
      yuv420SP NV12 Y Y Y Y Y Y Y Y
      yuv420SP NV21 Y Y Y Y Y Y Y Y
      yuv420 Planer Y Y Y Y Y Y Y Y
      yuv422 YUYV Y Y Y Y Y Y Y Y
      yuv422 YVYU Y Y Y Y Y Y Y Y
      YUV422 VYUY Y Y Y Y Y Y Y Y
      yuv422 UYVY Y Y Y Y Y Y Y Y
      yuv422 SP Y Y Y Y Y Y Y Y
      yuv422 Planer Y Y Y Y Y Y Y Y
      Gray8 N N N N N Y Y Y
      Crop Y Y Y Y Y Y Y Y
      CompressMode NONE Y Y Y Y Y Y Y N
      10TO6 N Y N Y Y Y N N
      resolution(yuv420 limit) MI_SCL_DEV_RDMA0 Max width 4096 4096 7680 3840 2688 8192 3840 1280
      MI_SCL_DEV_DIPR0 Max width 4096 \ 7680 \ 2688 8192 \ \
      MI_SCL_DEV_RDMA2 Max width \ \ 8192 \ \ \ \ \
      MI_SCL_DEV_DIPR1 Max width \ \ \ \ 2688 \ \ \
      MIN WxH 16x16 16x16 16x16 16x16 16x16 16x16 16x16 16x16
      Pixel Alignment (The same as rot source pixel) YUV Pack 8x2 2x2 2x2 2x2 2x2 2x2 2x2 2x2
      YUV SP 16x2 2x2 2x2 2x2 2x2 2x2 2x2 2x2
      YUV Planer 32x2 2x2 2x2 2x2 2x2 2x2 2x2 2x2
      ARGB 4x2 2x2 2x2 2x2 2x2 2x2 2x2 2x2
      Gray8 NA NA NA NA NA 2x2 2x2 2x2
      Rot source 2x2 NA 2x2 NA 2x2 NA NA 2x2

    • Output specifications

      Output Tiramisu Mochi Muffin Maruko Opera Souffle Iford Pcupid
      pixel ARGB8888 Y Y Y Y Y Y Y Y
      ABGR8888 Y Y Y Y Y Y Y Y
      BGRA8888 Y Y Y Y Y Y Y Y
      RGB565 N N N N N N N Y
      yuv420SP NV12 Y Y Y Y Y Y Y Y
      yuv420SP NV21 Y Y Y Y Y Y Y Y
      yuv420 Planer Y Y Y Y Y Y Y Y
      yuv422 YUYV Y Y Y Y Y Y Y Y
      yuv422 YVYU Y Y Y Y Y Y Y Y
      YUV422 VYUY Y Y Y Y Y Y Y Y
      yuv422 UYVY Y Y Y Y Y Y Y Y
      yuv422 SP Y Y Y Y Y Y Y Y
      yuv422 Planer Y Y Y Y Y Y Y Y
      Gray8 N N N N N Y Y Y
      CompressMode NONE Y Y Y Y Y Y Y N
      10TO6 N Y N Y Y Y N N
      IFC N N N Y Y Y N N
      Crop Y Y Y Y Y Y Y Y
      Scaling Y Y Y Y Y Y Y Y
      Mirror Y Y Y Y Y Y Y Y
      Flip Y Y Y Y Y Y Y Y
      Rotation Y N Y N Y N N Y
      Frame mode Y Y Y Y Y Y Y Y
      Realtime_JPEG Y Y N Y Y Y Y N
      Ring_H26x Y Y Y N N N N N
      HalfRing_H26x Y Y Y N N N N N
      MultiRing_H26x N N N Y(Only supported by E_MI_SCL_HWSCL0) Y(Only supported by E_MI_SCL_HWSCL0) Y(Only supported by E_MI_SCL_HWSCL0) Y(Only supported by E_MI_SCL_HWSCL0) N
      TileMode SclId(Used by Disp rot) E_MI_SCL_HWSCL5 \ \ \ E_MI_SCL_HWSCL3 \ \ \
      YUV420 MAX Width E_MI_SCL_HWSCL0 4608 4096 7680 3840 2688 8192 3840 1280
      E_MI_SCL_HWSCL1 4608 4096 7680 3840 2688 8192 3840 \
      E_MI_SCL_HWSCL2 4096 3840 3840 1920 1920 1920 1920 \
      E_MI_SCL_HWSCL3 4096 1920 1920 1920 2688 3840 \ \
      E_MI_SCL_HWSCL4 4096 1280 7680 \ \ 3840 \ \
      E_MI_SCL_HWSCL5 4096 1280 7680 \ \ 3840 \ \
      E_MI_SCL_HWSCL6 \ 4096 3840 \ \ 8192 \ \
      E_MI_SCL_HWSCL7 \ \ 1920 \ \ \ \ \
      E_MI_SCL_HWSCL8 \ \ 8192 \ \ \ \ \
      E_MI_SCL_HWSCL9 \ \ \ \ \ \ \ \
      Pixel Alignment Width 2 2 2 2 2 2 2 2
      Height 2 2 2 2 2 2 2 2


    1.5.2. Tiramisu

    Figure 1-2: Tiramisu Diagram

    Tiramisu MI_SCL has 6 scl hardware, which are divided into different Devices according to the type of input source.

    Device Id Input port source type
    MI_SCL_DEV_ISP_REALTIME0 Only supports connection with MI_ISP output port0 realtime
    MI_SCL_DEV_RDMA0 Support Frame mode reading data from Dram; Support binding with MI_JPD realtime
    MI_SCL_DEV_VIF_REALTIME0 Only supports connection with MI_VIF YUV Realtime
    MI_SCL_DEV_DIPR0 Only supports Frame mode reading data from Dram; Only E_MI_SCL_HWSCL5 can be used; Support Rotation, see MI_SCL_SetChnParam for function limitation

    1.5.3. Muffin

    Figure 1-3: Muffin Diagram

    MI_SCL muffin has 9 scl hardware, which are divided into different Devices according to the type of input source.

    Device Id Input port source type
    MI_SCL_DEV_ISP_REALTIME0 Only supports connection with MI_ISP device0 output port0 realtime
    MI_SCL_DEV_RDMA0 Support Frame mode reading data from Dram; Support binding with MI_JPD realtime
    MI_SCL_DEV_VIF_REALTIME0 Only supports connection with MI_VIF device8 YUV Realtime
    MI_SCL_DEV_DIPR0 Only support Frame mode reading data from Dram; Only E_MI_SCL_HWSCL8 can be used; Support Rotation, see MI_SCL_SetChnParam for function limitation;
    MI_SCL_DEV_ISP_REALTIME1 Only supports connection with MI_ISP device1 output port0 realtime
    MI_SCL_DEV_RDMA2 Support Frame mode reading data from Dram; Support binding with MI_JPD realtime
    MI_SCL_DEV_VIF_REALTIME1 Only supports connection with MI_VIF device24 YUV Realtime

    1.5.4. Mochi

    Figure 1-4: Mochi Diagram

    Mochi MI_SCL has 7 scl hardware, which are divided into different Devices according to the type of input source.

    Device Id Input port source type
    MI_SCL_DEV_ISP_REALTIME0 Only support connection with MI_ISP output port0 realtime.
    MI_SCL_DEV_RDMA0 Support Frame mode reading data from Dram; Support binding with MI_JPD realtime.

    1.5.5. Maruko

    Figure 1-5: Maruko Diagram

    Maruko MI_SCL has 4 scl hardware, which are divided into different Devices according to the type of input source.

    Device Id Input port source type
    MI_SCL_DEV_ISP_REALTIME0 Only support connection with MI_ISP output port0 realtime.
    MI_SCL_DEV_RDMA0 Support Frame mode reading data from Dram.
    MI_SCL_DEV_VIF_REALTIME0 Only supports connection with MI_VIF YUV Realtime.

    1.5.6. Opera

    Figure 1-6: Opera Diagram

    Opera MI_SCL has 4 scl hardware, which are divided into different Devices according to the type of input source.

    Device Id Input port source type
    MI_SCL_DEV_ISP_REALTIME0 Only support connection with MI_ISP output port0 realtime.
    MI_SCL_DEV_RDMA0 Support Frame mode reading data from Dram and MI_JPD realtime binding.
    MI_SCL_DEV_VIF_REALTIME0 Only supports connection with MI_VIF YUV Realtime.
    MI_SCL_DEV_DIPR0 Only support Frame mode reading data from Dram; Only E_MI_SCL_HWSCL3 can be used.
    MI_SCL_DEV_DIPR1 Only support Frame mode reading data from Dram; Only E_MI_SCL_HWSCL1 can be used; Support Rotation, see MI_SCL_SetChnParam for function limitation.
    MI_SCL_DEV_HVP_REALTIME0 Only support connection with MI_HVP realtime; Only E_MI_SCL_HWSCL3 can be used, no support scaling up.

    1.5.7. Souffle

    Figure 1-7: Souffle Diagram

    Souffle MI_SCL has 7 scl hardware, which are divided into different Devices according to the type of input source.

    Device Id Input port source type
    MI_SCL_DEV_ISP_REALTIME0 Only support connection with MI_ISP device0 output port0 realtime.
    MI_SCL_DEV_RDMA0 Support Frame mode reading data from Dram and MI_JPD realtime binding.
    MI_SCL_DEV_VIF_REALTIME0 Only supports connection with MI_VIF YUV Realtime.
    MI_SCL_DEV_DIPR0 Only support Frame mode reading data from Dram; Only E_MI_SCL_HWSCL6 can be used.

    1.5.8. Iford

    Figure 1-8: Iford Diagram

    Iford MI_SCL has 3 scl hardware, which are divided into different Devices according to the type of input source.

    Device Id Input port source type
    MI_SCL_DEV_ISP_REALTIME0 Only support connection with MI_ISP device0 output port0 realtime.
    MI_SCL_DEV_RDMA0 Support Frame mode reading data from Dram.

    1.5.9. Pcupid

    Figure 1-9: Pcupid Diagram

    Pcupid MI_SCL has 1 scl hardware, which are divided into different Devices according to the type of input source.

    Device Id Input port source type
    MI_SCL_DEV_ISP_REALTIME0 Only support connection with MI_ISP device0 output port0 realtime.
    MI_SCL_DEV_RDMA0 Support Frame mode reading data from Dram and Rotation. For the function limitation during rotation, please refer to MI_SCL_SetChnParam.

    1.6. Work principle

    NA


    1.7. Development process

    1.7.1. Compile configuration

    Figure 1-10: MI_SCL compilation configuration process

    1. Enter the project directory of alkaid, make menuconfig

    2. Press the enter key to select the "Sdk Config" submenu

    3. Press the Enter key again to enter the "Interface Compile Config" submenu

    4. Use the spacebar to select the "scl" submodule. Once selected, save your configuration and recompile the project

      After successful compilation, mi_scl.ko will be placed in the directory sdk/interface/src/scl/, mi_scl.h and mi_scl_datatype.h will be exported to the project/release directory. Under a pure Linux environment, these files will be automatically included in the images.


    1.7.2 Configure MI_SCL module parameter loading

    The "modparam.json" file is located in the "/config" directory. This file will be loaded during the SCL initialization phase. For details about the common fields and their interpretation in "modparam.json", please refer to section 6.


    1.7.3. API call flow

    Figure 1-11: API call flow

    The MI_SCL generic stream interface call is divided into the following steps:

    1. MI_SYS initialize

    2. Create MI_SCL Device

    3. Create MI_SCL Channel

    4. Set MI_SCL Channel parameter

    5. Start MI_SCL Channel

    6. Set MI_SCL Output port parameter

    7. Enable MI_SCL Output port

    8. Set MI_SCL Output port depth

    9. If MI_SCL has front and rear level modules, call the MI_SYS interface to bind MI_SCL with these modules

    10. The previous modules or SYS streams to SCL, SYS pulls streams from SCL, or SCL streams to the next stage

    11. Disable the enabled MI_SCL Output port

    12. Stop MI_SCL Channel

    13. Destroy MI_SCL Channel

    14. Destroy MI_SCL Device

    15. MI_SYS deinitialization


    1.8. Instance introduction

    This instance describes the initialization and deinitialization processes of the MI_SCL module.

    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <signal.h>
    #include <unistd.h>
    
    #include "mi_common.h"
    #include "mi_common_datatype.h"
    #include "mi_sys.h"
    #include "mi_sys_datatype.h"
    #include "mi_scl.h"
    #include "mi_scl_datatype.h"
    
    #define ExecFuncIfSuccess(_func_,_ret_)                      \
        if((_func_)!=_ret_)                                      \
        {                                                        \
            printf("[ %d ] exec function is failed\n",__LINE__); \
            exit(-1);                                            \
        }                                                        \
        else                                                     \
        {                                                        \
            printf("[ %d ] exec function is success\n",__LINE__);\
        }
    
    MI_BOOL bExit = FALSE;
    
    MI_SCL_DEV g_SclDevId = 1;
    MI_SCL_CHANNEL g_SclChnId = 0;
    MI_SCL_PORT g_SclPortId = 0;
    
    MI_S32 scl_Init(void)
    {
        MI_SCL_DevAttr_t createDevAttr;
        MI_SCL_ChannelAttr_t sclChnAttr;
        MI_SCL_ChnParam_t sclChnParam;
        MI_SCL_OutPortParam_t sclOutPortParam;
    
        MI_SYS_ChnPort_t stChnPort;
        MI_SYS_WindowRect_t   stSCLOutCropRect;
        MI_SYS_WindowSize_t   stSCLOutputSize;
    
        memset(&createDevAttr, 0x0, sizeof(MI_SCL_DevAttr_t));
        memset(&sclChnAttr, 0x0, sizeof(MI_SCL_ChannelAttr_t));
        memset(&sclChnParam, 0x0, sizeof(MI_SCL_ChnParam_t));
        memset(&sclOutPortParam, 0x0, sizeof(MI_SCL_OutPortParam_t));
    
        memset(&stChnPort, 0x0, sizeof(MI_SYS_ChnPort_t));
        memset(&stSCLOutCropRect, 0x0, sizeof(MI_SYS_WindowRect_t));
        memset(&stSCLOutputSize, 0x0, sizeof(MI_SYS_WindowSize_t));
    
        createDevAttr.u32NeedUseHWOutPortMask = E_MI_SCL_HWSCL0;
        ExecFuncIfSuccess(MI_SCL_CreateDevice(g_SclDevId, &createDevAttr), MI_SUCCESS);
    
        ExecFuncIfSuccess(MI_SCL_CreateChannel(g_SclDevId, g_SclChnId, &sclChnAttr), MI_SUCCESS);
    
        sclChnParam.eRot = E_MI_SYS_ROTATE_NONE;
        ExecFuncIfSuccess(MI_SCL_SetChnParam(g_SclDevId, g_SclChnId, &sclChnParam), MI_SUCCESS);
    
        ExecFuncIfSuccess(MI_SCL_StartChannel(g_SclDevId, g_SclChnId), MI_SUCCESS);
    
        sclOutPortParam.stSCLOutCropRect = stSCLOutCropRect;
        sclOutPortParam.stSCLOutputSize = stSCLOutputSize;
        sclOutPortParam.bMirror = FALSE;
        sclOutPortParam.bFlip = FALSE;
        sclOutPortParam.eCompressMode = E_MI_SYS_COMPRESS_MODE_NONE;
        sclOutPortParam.stSCLOutputSize.u16Width = 1280;
        sclOutPortParam.stSCLOutputSize.u16Height = 720;
        sclOutPortParam.ePixelFormat = E_MI_SYS_PIXEL_FRAME_YUV_SEMIPLANAR_420;
        ExecFuncIfSuccess(MI_SCL_SetOutputPortParam(g_SclDevId, g_SclChnId, g_SclPortId, &sclOutPortParam), MI_SUCCESS);
    
        ExecFuncIfSuccess(MI_SCL_EnableOutputPort(g_SclDevId, g_SclChnId, g_SclPortId), MI_SUCCESS);
    
        stChnPort.eModId = E_MI_MODULE_ID_SCL;
        stChnPort.u32DevId = g_SclDevId;
        stChnPort.u32ChnId = g_SclChnId;
        stChnPort.u32PortId = g_SclPortId;
        ExecFuncIfSuccess(MI_SYS_SetChnOutputPortDepth(0, &stChnPort, 0, 4), MI_SUCCESS);
    
        return MI_SUCCESS;
    }
    
    MI_S32 scl_unInit(void)
    {
        ExecFuncIfSuccess(MI_SCL_DisableOutputPort(g_SclDevId, g_SclChnId, g_SclPortId), MI_SUCCESS);
    
        ExecFuncIfSuccess(MI_SCL_StopChannel(g_SclDevId, g_SclChnId), MI_SUCCESS);
    
        ExecFuncIfSuccess(MI_SCL_DestroyChannel(g_SclDevId, g_SclChnId), MI_SUCCESS);
    
        ExecFuncIfSuccess(MI_SCL_DestroyDevice(g_SclDevId), MI_SUCCESS);
    
        return MI_SUCCESS;
    }
    
    void signalHandler(int signo)
    {
        printf("ctrl +c is input \n");
        bExit = TRUE;
        return;
    }
    
    int main(int argc, char** argv)
    {
        ExecFuncIfSuccess(MI_SYS_Init(0), MI_SUCCESS);
    
        ExecFuncIfSuccess(scl_Init(), MI_SUCCESS);
    
        //User defined streaming or extraction code snippets
    
        signal(SIGINT, signalHandler);
    
        while (!bExit)
        {
            sleep(1);
        }
    
        ExecFuncIfSuccess(scl_unInit(), MI_SUCCESS);
    
        ExecFuncIfSuccess(MI_SYS_Exit(0), MI_SUCCESS);
    }
    

    2. API REFERENCE


    This function module provides the following API:

    API Name Function
    MI_SCL_CreateDevice Create SCL device
    MI_SCL_DestoryDevice Destroy SCL device
    MI_SCL_CreateChannel Create SCL channel
    MI_SCL_DestroyChannel Destroy SCL channel
    MI_SCL_SetChnParam Set channel attribute
    MI_SCL_GetChnParam Get channel attribute
    MI_SCL_SetInputPortCrop Set channel input port crop
    MI_SCL_GetInputPortCrop Get channel input port crop information
    MI_SCL_StartChannel Start channel
    MI_SCL_StopChannel Stop channel
    MI_SCL_SetOutputPortParam Set output port parameter
    MI_SCL_GetOutputPortParam Get output port parameter
    MI_SCL_EnableOutputPort Enable output port
    MI_SCL_DisableOutputPort Disable output port
    MI_SCL_StretchBuf Zoom, stretch, crop the image data in the specified memory
    MI_SCL_StretchBufOsd Superimpose OsdBuf on the basis of Zoom, stretch, crop the image data in the specified memory

    2.1. MI_SCL_CreateDevice

    • Description

      Create SCL device.

    • Syntax

      MI_S32 MI_SCL_CreateDevice(MI_SCL_DEV DevId, MI_SCL_DevAttr_t *pstSclDevAttr)
      
    • Parameter

      Parameter name Description Input/Output
      DevId SCL device ID. Input
      pstSclDevAttr Scl device attribute. Input
    • Return value

      • MI_SUCCESS(0): successful.

      • Non-Zero: failed, see error code for details.

    • Dependence

      • Header: mi_scl_datatype.h, mi_scl.h

      • Library:

    • Note

      • For the characteristics of each device, please refer to Note in section 1.2.

    2.2. MI_SCL_DestroyDevice

    • Description

      Destroy SCL device.

    • Syntax

      MI_S32 MI_SCL_DestroyDevice(MI_SCL_DEV DevId)
      
    • Parameter

      Parameter name Description Input/Output
      DevId SCL device ID Input
    • Return value

      • MI_SUCCESS(0): successful.

      • Non-Zero: failed, see error code for details.

    • Dependence

      • Header: mi_scl_datatype.h, mi_scl.h

      • Library:

    • Note

      Disable all the output ports and channels on device, otherwise the failure will be returned.

    • Example

      See the example of MI_SCL_CreateDevice.

    • Related APIs

      MI_SCL_CreateDevice


    2.3. MI_SCL_CreateChannel

    • Description

      Create a SCL channel.

    • Syntax

      MI_S32 MI_SCL_CreateChannel(MI_SCL_DEV DevId, MI_SCL_CHANNEL ChnId, MI_SCL_ChannelAttr_t *pstChnAttr)
      
    • Parameter

      Parameter name Description Input/Output
      DevId SCL device ID Input
      ChnId SCL channel ID, value range (0 ~ 31) Input
      pstChnAttr SCL channel attribute Input
    • Return value

      • MI_SUCCESS(0): successful.

      • Non-Zero: failed, see error code for details.

    • Dependence

      • Header: mi_scl_datatype.h, mi_scl.h

      • Library:

    • Note

      Create device firstly, then channel can be created.

    • Example

      See the example of MI_SCL_CreateDevice.

    • Related APIs

      MI_SCL_DestroyChannel


    2.4. MI_SCL_DestroyChannel

    • Description

      Destroy SCL channel.

    • Syntax

      MI_S32 MI_SCL_DestroyChannel(MI_SCL_DEV DevId, MI_SCL_CHANNEL ChnId)
      
    • Parameter

      Parameter name Description Input/Output
      DevId SCL device ID Input
      ChnId SCL channel ID Input
    • Return value

      • MI_SUCCESS(0): successful.

      • Non-Zero: failed, see error code for details.

    • Dependence

      • Header: mi_scl_datatype.h, mi_scl.h

      • Library:

    • Note

      Disable all the output ports on device firstly, then the channel can be destroyed.

    • Example

      See the example of MI_SCL_CreateDevice.

    • Related APIs

      MI_SCL_CreateChannel


    2.5. MI_SCL_SetChnParam

    • Description

      Dynamically set channel parameters.

    • Syntax

      MI_S32 MI_SCL_SetChnParam(MI_SCL_DEV DevId, MI_SCL_CHANNEL ChnId, MI_SCL_ChnParam_t *pstChnParam)
      
    • Parameter

      Parameter name Description Input/Output
      DevId SCL device ID Input
      ChnId SCL channel ID Input
      pstChnParam Channel parameter Input
    • Return value

      • MI_SUCCESS(0): successful.

      • Non-Zero: failed, see error code for details.

    • Dependence

      • Header: mi_scl_datatype.h, mi_scl.h

      • Library:

    • Note

      • If the channel is running, use MI_SCL_StopChannel to stop it first and clear the buffer when you need to change the channel parameter.
      • When the channel sets rotation, it does not support crop, scaling, mirror, flip and pixel-change.
    • Example

      See the example of MI_SCL_CreateDevice.

    • Related APIs

      MI_SCL_GetChnParam


    2.6. MI_SCL_GetChnParam

    • Description

      Get channel parameter.

    • Syntax

      MI_S32 MI_SCL_GetChnParam(MI_SCL_DEV DevId, MI_SCL_CHANNEL ChnId, MI_SCL_ChnParam_t *pstChnParam)
      
    • Parameter

      Parameter name Description Input/Output
      DevId SCL device ID Input
      ChnId SCL channel ID Input
      pstChnParam SCL channel parameter Output
    • Return value

      • MI_SUCCESS(0): successful.

      • Non-Zero: failed, see error code for details.

    • Dependence

      • Header: mi_scl_datatype.h, mi_scl.h

      • Library:

    • Note

      When there is no setting, Parameter is all 0.

    • Related APIs

      MI_SCL_SetChnParam


    2.7. MI_SCL_SetInputPortCrop

    • Description

      Set channel input port crop area.

    • Syntax

      MI_S32 MI_SCL_SetInputPortCrop(MI_SCL_DEV DevId,MI_SCL_CHANNEL ChnId, MI_SYS_WindowRect_t *pstCropInfo)
      
    • Parameter

      Parameter name Description Input/Output
      DevId SCL device ID Input
      ChnId SCL channel ID Input
      pstCropInfo Crop area Input
    • Return value

      • MI_SUCCESS(0): successful.

      • Non-Zero: failed, see error code for details.

    • Dependence

      • Header: mi_scl_datatype.h, mi_scl.h

      • Library:

    • Note

      • This setting can only take effect when the Input port is reading data from DRAM.

      • When the input data compression mode is not E_MI_SYS_COMPRESS_MODE_NONE, the input data does not support cropping.

    • Example

      See the example of MI_SCL_CreateDevice.

    • Related APIs

      MI_SCL_GetInputPortCrop


    2.8. MI_SCL_GetInputPortCrop

    • Description

      Get channel input port crop area.

    • Syntax

      MI_S32 MI_SCL_GetInputPortCrop(MI_SCL_DEV DevId,MI_SCL_CHANNEL ChnId, MI_SYS_WindowRect_t *pstCropInfo)
      
    • Parameter

      Parameter name Description Input/Output
      DevId SCL device ID Input
      ChnId SCL channel ID Input
      pstCropInfo Crop area Output
    • Return value

      • MI_SUCCESS(0): successful.

      • Non-Zero: failed, see error code for details.

    • Dependence

      • Header: mi_scl_datatype.h, mi_scl.h

      • Library:

    • Note

      When no cropping is required, what you got is the input port resolution.

    • Related APIs

      MI_SCL_SetInputPortCrop


    2.9. MI_SCL_StartChannel

    • Description

      Start channel on device.

    • Syntax

      MI_S32 MI_SCL_StartChannel(MI_SCL_DEV DevId, MI_SCL_CHANNEL ChnId)
      
    • Parameter

      Parameter name Description Input/Output
      DevId SCL device ID Input
      ChnId SCL channel ID Input
    • Return value

      • MI_SUCCESS(0): successful.

      • Non-Zero: failed, see error code for details.

    • Dependence

      • Header: mi_scl_datatype.h, mi_scl.h

      • Library:

    • Note

      Called in pairs with MI_SCL_StopChannel.

    • Example

      See the example of MI_SCL_CreateDevice.

    • Related APIs

      MI_SCL_StopChannel


    2.10. MI_SCL_StopChannel

    • Description

      Stop channel on device.

    • Syntax

      MI_S32 MI_SCL_StopChannel(MI_SCL_DEV DevId, MI_SCL_CHANNEL ChnId)
      
    • Parameter

      Parameter name Description Input/Output
      DevId SCL device ID Input
      ChnId SCL channel ID Input
    • Return value

      • MI_SUCCESS(0): successful.

      • Non-Zero: failed, see error code for details.

    • Dependence

      • Header: mi_scl_datatype.h, mi_scl.h

      • Library:

    • Note

      All the channels can be stopped while creating, and then all the output ports will have no data output.

    • Example

      See the example of MI_SCL_CreateDevice.

    • Related APIs

      MI_SCL_StartChannel


    2.11. MI_SCL_SetOutputPortParam

    • Description

      Set channel output port parameter.

    • Syntax

      MI_S32 MI_SCL_SetOutputPortParam(MI_SCL_DEV DevId, MI_SCL_CHANNEL ChnId, MI_SCL_PORT PortId, MI_SCL_OutPortParam_t *pstOutPortParam)
      
    • Parameter

      Parameter name Description Input/Output
      DevId SCL device ID Input
      ChnId SCL channel ID Input
      PortId Output port ID Input
      pstOutPortParam Output port parameter Input
    • Return value

      • MI_SUCCESS(0): successful.

      • Non-Zero: failed, see error code for details.

    • Dependence

      • Header: mi_scl_datatype.h, mi_scl.h

      • Library:

    • Note

      • If the output port is enabled, and the output parameter need to be changed, you should call MI_SCL_DisableOutputPort to disable the port and set parameter, then restart the output port.

      • When VIF->ISP->SCL are all Realtime bindings, SCL Output setting Scaling up has the risk of FIFO FULL. It is not recommended to set Scaling up.

    • Example

      See the example of MI_SCL_CreateDevice.

    • Related APIs

      MI_SCL_GetOutputPortParam


    2.12. MI_SCL_GetOutputPortParam

    • Description

      Get output port parameter.

    • Syntax

      MI_S32 MI_SCL_GetOutputPortParam(MI_SCL_DEV DevId, MI_SCL_CHANNEL ChnId, MI_SCL_PORT PortId, MI_SCL_OutPortParam_t *pstOutPortParam)
      
    • Parameter

      Parameter name Description Input/Output
      DevId SCL device ID Input
      ChnId SCL channel ID Input
      PortId SCL output port ID Input
      pstOutPortParam SCL output port parameter Output
    • Return value

      • MI_SUCCESS(0): successful.

      • Non-Zero: failed, see error code for details.

    • Dependence

      • Header: mi_scl_datatype.h, mi_scl.h

      • Library:

    • Related APIs

      MI_SCL_SetOutputPortParam


    2.13. MI_SCL_EnableOutputPort

    • Description

      Enable output port.

    • Syntax

      MI_S32 MI_SCL_EnableOutputPort(MI_SCL_DEV DevId,MI_SCL_CHANNEL ChnId, MI_SCL_PORT PortId)
      
    • Parameter

      Parameter name Description Input/Output
      DevId SCL device ID Input
      ChnId SCL channel ID Input
      PortId SCL output port ID Input
    • Return value

      • MI_SUCCESS(0): successful.

      • Non-Zero: failed, see error code for details.

    • Dependence

      • Header: mi_scl_datatype.h, mi_scl.h

      • Library:

    • Note

      Called in pair withMI_SCL_DisableOutputPort.

    • Example

      See the example of MI_SCL_CreateDevice.

    • Related APIs

      MI_SCL_DisableOutputPort


    2.14. MI_SCL_DisableOutputPort

    • Description

      Disable output port.

    • Syntax

      MI_S32 MI_SCL_DisableOutputPort(MI_SCL_DEV DevId,MI_SCL_CHANNEL ChnId, MI_SCL_PORT PortId)
      
    • Parameter

      Parameter name Description Input/Output
      DevId SCL device ID Input
      ChnId SCL channel ID Input
      PortId Output port ID Input
    • Return value

      • MI_SUCCESS(0): successful.

      • Non-Zero: failed, see error code for details.

    • Dependence

      • Header: mi_scl_datatype.h, mi_scl.h

      • Library:

    • Note

      Called in pair with MI_SCL_EnableOutputPort.

    • Example

      See the example of MI_SCL_CreateDevice.

    • Related APIs

      MI_SCL_EnableOutputPort


    2.15. MI_SCL_StretchBuf

    • Description

      Zoom, stretch, crop the image data in the specified memory.

    • Syntax

      MI_S32 MI_SCL_StretchBuf(MI_SCL_DirectBuf_t *pstSrcBuf, MI_SYS_WindowRect_t *pstSrcCrop, MI_SCL_DirectBuf_t *pstDstBuf, MI_SCL_FilterType_e eFilterType)
      
    • Parameter

      Parameter name Description Input/Output
      pstSrcBuf Source data buffer parameter pointer Input
      pstSrcCrop Source data crop area Input
      pstDstBuf Output buffer parameter pointer Output
      eFilterType Scl filter type Input
    • Return value

      • MI_SUCCESS(0): successful.

      • Non-Zero: failed, see error code for details.

    • Dependence

      • Header: mi_scl_datatype.h, mi_scl.h

      • Library:

    • Note

      • This interface is in blocking mode, and the frame of data will not end until it is finished.

      • Before using this interface, you need to set the corresponding DEVID. The corresponding DEVIDs used by different series of chips are as follows:

        Chip StretchBuf used DEVID
        Tiramisu MI_SCL_DEV_DIPR0
        Muffin MI_SCL_DEV_DIPR0
        Mochi MI_SCL_DEV_RDMA0
        Maruko MI_SCL_DEV_RDMA0
        Souffle MI_SCL_DEV_RDMA0
        Iford MI_SCL_DEV_RDMA0
        Pcupid MI_SCL_DEV_RDMA0
      • Alignment requirements for input width, height and stride:

        pixel format width height stride
        YUV420SPNV12, YUV420SPNV21, YUV422SP, Gray8 2 2 16
        YUV422YUYV, YUV422UYVY, YUV422YVYU, YUV422VYUY 2 2 16
        ARGB8888, ABGR8888, BGRA8888 2 2 16
      • Alignment requirements for output width and height:

        pixel format width height stride
        YUV420SPNV12, YUV420SPNV21, YUV422SP, Gray8 2 2 16
        YUV422YUYV, YUV422UYVY, YUV422YVYU, YUV422VYUY 2 2 16
        ARGB8888, ABGR8888, BGRA8888 2 2 16
      • StretchBuf used HWSCLID:

        Chip StretchBuf used HWSCL ID
        Tiramisu E_MI_SCL_HWSCL5
        Muffin E_MI_SCL_HWSCL8
        Mochi E_MI_SCL_HWSCL6
        Maruko E_MI_SCL_HWSCL3
        Souffle E_MI_SCL_HWSCL6
        Iford E_MI_SCL_HWSCL2
        Pcupid E_MI_SCL_HWSCL0
    • Example

      MI_SCL_StretchBuf Usage:

      #define ALIGN_UP(x, align) (((x) + ((align) - 1)) & ~((align) - 1))
      
      int stretchBuffDemo()
      {
          MI_S32 s32Ret = 0;
          char *pInFilePath = "in.yuv";
          char *pOutFilePath = "out.yuv";
      
          MI_SCL_DirectBuf_t  stSrcBuff;
          memset(&stSrcBuff, 0x0, sizeof(MI_SCL_DirectBuf_t));
          stSrcBuff.u32Width = 1920;
          stSrcBuff.u32Height = 1080;
          stSrcBuff.ePixelFormat = E_MI_SYS_PIXEL_FRAME_YUV422_YUYV;
          stSrcBuff.u32Stride[0] = ALIGN_UP((stSrcBuff.u32Width*2),16);
          stSrcBuff.u32BuffSize = stSrcBuff.u32Stride[0]*stSrcBuff.u32Height;
      
          MI_SYS_WindowRect_t stoutputCrop;
          memset(&stoutputCrop, 0x0, sizeof(MI_SYS_WindowRect_t));
          stoutputCrop.u16X = 100;
          stoutputCrop.u16Y = 122;
          stoutputCrop.u16Width = 124;
          stoutputCrop.u16Height = 126;
      
          MI_SCL_DirectBuf_t  stDestBuff;
          memset(&stDestBuff, 0x0, sizeof(MI_SCL_DirectBuf_t));
          stDestBuff.u32Width = 100;
          stDestBuff.u32Height = 110;
          stDestBuff.ePixelFormat = E_MI_SYS_PIXEL_FRAME_YUV422_YUYV;
          stDestBuff.u32Stride[0] = ALIGN_UP((stDestBuff.u32Width*2),16);
          stDestBuff.u32BuffSize = stDestBuff.u32Stride[0]*stDestBuff.u32Height;
      
          void *pviraddr = NULL, *pviroutaddr = NULL;
          MI_PHY  phyInAllockAddr = 0, phyOutAllocAddr = 0;
      
          ExecFuncResult(MI_SYS_Init(0), s32Ret);
          ExecFuncResult(MI_SYS_MMA_Alloc(0, (MI_U8*)"mma_heap_name0", stSrcBuff.u32BuffSize, &phyInAllockAddr), s32Ret);
          ExecFuncResult(MI_SYS_Mmap(phyInAllockAddr, stSrcBuff.u32BuffSize, &pviraddr, FALSE), s32Ret);
          ExecFuncResult(MI_SYS_MMA_Alloc(0, (MI_U8*)"mma_heap_name0", stDestBuff.u32BuffSize, &phyOutAllocAddr), s32Ret);
          ExecFuncResult(MI_SYS_Mmap(phyOutAllocAddr, stDestBuff.u32BuffSize, &pviroutaddr, FALSE), s32Ret);
      
          stSrcBuff.phyAddr[0] = phyInAllockAddr;
          stDestBuff.phyAddr[0] = phyOutAllocAddr;
      
          FILE *src_fd = NULL;
          src_fd  = fopen(pInFilePath,"rb");
          fread(pviraddr, stSrcBuff.u32BuffSize, 1, src_fd);
          fclose(src_fd);
      
          MI_SCL_DEV DevId = 1;
          MI_SCL_DevAttr_t stDevAttr;
          stDevAttr.u32NeedUseHWOutPortMask = E_MI_SCL_HWSCL3;
          ExecFuncResult(MI_SCL_CreateDevice(DevId, &stDevAttr), s32Ret);
          ExecFuncResult(MI_SCL_StretchBuf(&stSrcBuff, &stoutputCrop, &stDestBuff, E_MI_SCL_FILTER_TYPE_AUTO), s32Ret);
      
          FILE *dst_fd = NULL;
          dst_fd  = fopen(pOutFilePath,"wb+");
          fwrite(pviroutaddr, stDestBuff.u32BuffSize, 1, dst_fd);
          fclose(dst_fd);
      
          ExecFuncResult(MI_SCL_DestroyDevice(DevId), s32Ret);
      
          MI_SYS_Munmap(pviraddr, stSrcBuff.u32BuffSize);
          MI_SYS_Munmap(pviroutaddr, stDestBuff.u32BuffSize);
          MI_SYS_MMA_Free(0,phyInAllockAddr);
          MI_SYS_MMA_Free(0,phyOutAllocAddr);
      
          EXIT:
      
          return MI_SUCCESS;
      
      }
      
    • Related APIs

      MI_SCL_CreateDevice


    2.16. MI_SCL_StretchBufOsd

    • Description

      Superimpose OsdBuf on the basis of Zoom, stretch, crop the image data in the specified memory.

    • Syntax

      MI_S32 MI_SCL_StretchBufOsd(MI_SCL_DirectBuf_t *pstSrcBuf,
      MI_SYS_WindowRect_t*pstSrcCrop,MI_SCL_DirectBuf_t *pstDstBuf,
      MI_SCL_DirectOsdBuf_t*pstDstOsdBuf,MI_SCL_FilterType_e eFilterType);
      
    • Parameter

      Parameter name Description Input/Output
      pstSrcBuf Source data buffer parameter pointer Input
      pstSrcCrop Source data crop area Input
      pstDstBuf Output buffer parameter pointer Output
      pstDstOsdBuf OsdBuf pointer superimposing on Output buffer Input
      eFilterType Scl filter type Input
    • Return value

      • MI_SUCCESS(0): successful.

      • Non-Zero: failed, see error code for details.

    • Dependence

      • Header: mi_scl_datatype.h, mi_scl.h

      • Library:

    • Note

      • Using this interface requires SCL to support OSD. Please refer to the MI RGN API for support.

      • Before using this interface, you need to create device first.

      • This interface is in blocking mode, and the frame of data will not end until it is finished.

      • The corresponding DEVIDs used by different series of chips are as follows:

        Chip StretchBuf used DEVID
        Tiramisu MI_SCL_DEV_DIPR0
        Muffin MI_SCL_DEV_DIPR0
        Mochi MI_SCL_DEV_RDMA0
        Maruko MI_SCL_DEV_RDMA0
        Souffle MI_SCL_DEV_RDMA0
        Iford MI_SCL_DEV_RDMA0
        Pcupid MI_SCL_DEV_RDMA0
      • Alignment requirements for input width, height and stride:

        pixel format width height stride
        YUV420SPNV12, YUV420SPNV21, YUV422SP, Gray8 2 2 16
        YUV422YUYV, YUV422UYVY, YUV422YVYU, YUV422VYUY 2 2 16
        ARGB8888, ABGR8888, BGRA8888 2 2 16
      • Alignment requirements for output width and height:

        pixel format width height stride
        YUV420SPNV12, YUV420SPNV21, YUV422SP, Gray8 2 2 16
        YUV422YUYV, YUV422UYVY, YUV422YVYU, YUV422VYUY 2 2 16
        ARGB8888, ABGR8888, BGRA8888 2 2 16
      • StretchBuf used HWSCLID:

        Chip StretchBuf used HWSCL ID
        Tiramisu E_MI_SCL_HWSCL5
        Muffin E_MI_SCL_HWSCL8
        Mochi E_MI_SCL_HWSCL6
        Maruko E_MI_SCL_HWSCL3
        Souffle E_MI_SCL_HWSCL6
        Iford E_MI_SCL_HWSCL2
        Pcupid E_MI_SCL_HWSCL0
    • Related APIs

      MI_SCL_CreateDevice


    3. SCL DATA TYPE


    The video Input related data types are defined as follows:

    Data type Description
    MI_SCL_DEV SCL device ID
    MI_SCL_CHANNEL SCL channel ID
    MI_SCL_PORT SCL output port ID
    MI_SCL_HWSclId_e SCL output port corresponded hardware scaling ID
    MI_SCL_DevAttr_t SCL device attribute
    MI_SCL_ChannelAttr_t SCL channel static attribute
    MI_SCL_ChnParam_t SCL channel dynamic attribute
    MI_SCL_OutPortParam_t SCL output port parameter
    MI_SCL_FilterType_e SCL filter type
    MI_SCL_DirectBuf_t SCL specified buffer parameter type
    MI_SCL_DirectOsdArgb1555Alpha_t Foreground and background Alpha settings of Argb1555 format
    MI_SCL_DirectOsdAlphaModePara_u The union of osd alpha mode parameters
    MI_SCL_DirectOsdAlphaMode_e The way to display with alpha mode
    MI_SCL_DirectOsdAlphaAttr_t The structure of the attribute of OSD ‘alpha’
    MI_SCL_DirectOsdInfo_t SCL direct processes Osdbuffer parameter Info
    MI_SCL_DirectOsdBuf_t SCL direct processes Osdbuffer parameter type
    MI_SCL_DEV_ISP_REALTIME0 SCL Device 0
    MI_SCL_DEV_RDMA0 SCL Device 1
    MI_SCL_DEV_VIF_REALTIME0 SCL Device 2
    MI_SCL_DEV_DIPR0 SCL Device 3
    MI_SCL_DEV_ISP_REALTIME1 SCL Device 4
    MI_SCL_DEV_RDMA2 SCL Device 5
    MI_SCL_DEV_VIF_REALTIME1 SCL Device 6
    MI_SCL_DEV_DIPR1 SCL Device 7
    MI_SCL_DEV_HVP_REALTIME0 SCL Device 8

    3.1. MI_SCL_DEV

    • Description

      Define SCL device ID type.

    • Definition

      typedef MI_U32 MI_SCL_DEV;
      

    3.2. MI_SCL_CHANNEL

    • Description

      Define SCL channel ID type.

    • Definition

      typedef MI_U32 MI_SCL_CHANNEL;
      

    3.3. MI_SCL_PORT

    • Description

      Define SCL output port ID type.

    • Definition

      typedef MI_U32 MI_SCL_PORT;
      

    3.4. MI_SCL_HWSclId_e

    • Description

      SCL device used hardware scaler Id enumeration.

    • Definition

      typedef enum
      {
          E_MI_SCL_HWSCLID_INVALID= 0,
          E_MI_SCL_HWSCL0         = 0x0001,
          E_MI_SCL_HWSCL2         = 0x0004,
          E_MI_SCL_HWSCL3         = 0x0008,
          E_MI_SCL_HWSCL1         = 0x0002,
          E_MI_SCL_HWSCL4         = 0x0010,
          E_MI_SCL_HWSCL5         = 0x0020,
          E_MI_SCL_HWSCL6         = 0x0040,
          E_MI_SCL_HWSCL7         = 0x0080,
          E_MI_SCL_HWSCL8         = 0x0100,
          E_MI_SCL_HWSCL_MAX      = 0xffff,
      }MI_SCL_HWSclId_e;
      
    • Note

      • For each HW scl id specification, please refer to HW sclid in Output specifications in Chapter 1.4, and select according to the scene.
    • Related data type and interface

      MI_SCL_DevAttr_t


    3.5. MI_SCL_DevAttr_t

    • Description

      SCL device attribute.

    • Definition

      typedef struct MI_SCL_DevAttr_s
      {
          MI_U32 u32NeedUseHWOutPortMask;
      }MI_SCL_DevAttr_t;
      
    • Member

      Member name Description
      u32NeedUseHWOutPortMask Scaler id used by device.
    • Note

      • u32NeedUseHWOutPortMask is composed of bit mask of MI_SCL_HWSclId_e.

        • Mapping with MI_SCL_HWSclId_e from low to high

        • The correspondence between portid and HWSCL ID on each Dev:

          stCreateDevAttr.u32NeedUseHWOutPortMask = E_MI_SCL_HWSCL2 | E_MI_SCL_HWSCL3 | E_MI_SCL_HWSCL4;

          Port0 → E_MI_SCL_HWSCL2

          Port1 → E_MI_SCL_HWSCL3

          Port2 → E_MI_SCL_HWSCL4

          PortID corresponds to HWSCL bitmask from least significant bit (LSB) to most significant bit (MSB)

      • The same HWSclId cannot be used across devices

        For example:

        MI_SCL_DEV_ISP_REALTIME0 pstSclDevAttr->u32NeedUseHWOutPortMask= E_MI_SCL_HWSCL2 | E_MI_SCL_HWSCL3;

        MI_SCL_DEV_RDMA0 pstSclDevAttr->u32NeedUseHWOutPortMask= E_MI_SCL_HWSCL0 | E_MI_SCL_HWSCL2;

        In this way, E_MI_SCL_HWSCL2 will be used by MI_SCL_DEV_ISP_REALTIME0 / MI_SCL_DEV_RDMA0 at the same time, and the err status will be returned when the device is created.

      • In Tiramisu, MI_SCL_DEV_DIPR0 will be created and used internally when MI_VDEC is used, and other device cannot use E_MI_SCL_HWSCL5 anymore, use the channel corresponding to MI_SCL_DEV_DIPR0 created by the user.

      • In Muffin, MI_SCL_DEV_DIPR0 will be created and used internally when MI_VDEC is used, and other device cannot use E_MI_SCL_HWSCL8 anymore, use the channel corresponding to MI_SCL_DEV_DIPR0 created by the user.

      • In Mochi, MI_SCL_DEV_RDMA0 will be created and used internally when MI_VDEC is used, and other device cannot use E_MI_SCL_HWSCL6 anymore, use the channel corresponding to MI_SCL_DEV_RDMA0 created by the user.

      • In Souffle, MI_SCL_DEV_DIPR0 will be created and used internally in MI_DISP, MI_SCL cannot use MI_SCL_DEV_DIPR0.

    • Related data type and interface

      MI_SCL_CreateDevice


    3.6. MI_SCL_ChannelAttr_t

    • Description

      Scl channel attribute.

    • Definition

      typedef struct MI_SCL_ChannelAttr_s
      {
          MI_U32 u32Reserved;
      }MI_SCL_ChannelAttr_t;
      
    • Member

      Member name Description
      u32Reserved Reserved.
    • Note

      Tiramisu has no channel static setting Parameter, which can be set directly to 0.

    • Related data type and interface

      MI_SCL_CreateChannel


    3.7. MI_SCL_ChnParam_t

    • Description

      SCL channel dynamic parameter type.

    • Definition

      typedef struct MI_SCL_ChnParam_s
      {
          MI_SYS_Rotate_e eRot;
      }MI_SCL_ChnParam_t;
      
    • Member

      Member name Description
      eRot Rotation Parameter
    • Note

      • When rotate 90/180/270 degree, output port only support rotation, do not support crop/scaling/pixel format conversion/Mirror/Filp.

      • When rotate 90/180/270 degree, MI_RGN attach is not supported to overlay osd/cover.

      • Chip support rotate situation:

        chip Support rotate devid
        Tiramisu MI_SCL_DEV_DIPR0
        Muffin MI_SCL_DEV_DIPR0
        Mochi Not support rotation
        Souffle Not support rotation
        Iford Not support rotation
        Pcupid Support rotation
      • Mochi/Souffle/Iford only supports E_MI_SYS_ROTATE_NONE.

    • Related data type and interface

      MI_SCL_SetChnParam


    3.8. MI_SCL_OutPortParam_t

    • Description

      SCL output port parameter.

    • Definition

      typedef struct MI_SCL_OutPortParam_s
      {
          MI_SYS_WindowRect_t stSCLOutCropRect;
          MI_SYS_WindowSize_t stSCLOutputSize;
          MI_BOOL bMirror;
          MI_BOOL bFlip;
          MI_SYS_PixelFormat_e ePixelFormat;
          MI_SYS_CompressMode_e eCompressMode;
      }MI_SCL_OutPortParam_t;
      
    • Member

      Member name Description
      stSCLOutCropRect Output crop area
      stSCLOutputSize Output size
      bMirror Enable horizontal flip
      bFlip Enable vertical flip
      ePixelFormat Output pixel format
      eCompressMode Output compression format
    • Note

      • eCompressMode support range:

        Chip Supported compress mode
        Tiramisu E_MI_SYS_COMPRESS_MODE_NONE
        Muffin E_MI_SYS_COMPRESS_MODE_NONE
        Mochi E_MI_SYS_COMPRESS_MODE_NONE
        E_MI_SYS_COMPRESS_MODE_TO_6BIT
        Maruko E_MI_SYS_COMPRESS_MODE_NONE
        E_MI_SYS_COMPRESS_MODE_TO_6BIT
        E_MI_SYS_COMPRESS_MODE_IFC
        Souffle E_MI_SYS_COMPRESS_MODE_NONE
        E_MI_SYS_COMPRESS_MODE_TO_6BIT
        E_MI_SYS_COMPRESS_MODE_IFC
        Iford E_MI_SYS_COMPRESS_MODE_NONE
        Pcupid E_MI_SYS_COMPRESS_MODE_NONE
        • eCompressMode limit

          Output_Compress 10TO6 IFC
          Pixel yuv420SP NV12 Y Y
          yuv422 YUYV Y N
          Pixel Alignment (WxH) yuv420SP NV12 2x2 2x2
          yuv422 YUYV 2x2 2x2
          bMirror N N
          bFlip Y N

        • E_MI_SYS_COMPRESS_MODE_IFC only supports one HW SclId at the same time.

    • Mochi/Maruko/Souffle/Iford/Pcupid does not support to enable Mirror when ePixelFormat is YUV422_UYVY / YUV422_VYUY; and Pcupid does not support to enable Mirror when ePixelFormat is RGB565.

    • Related data type and interface

      MI_SCL_SetOutputPortParam


    3.9. MI_SCL_FilterType_e

    • Description

      Scl filter type.

    • Definition

      typedef enum
      {
          E_MI_SCL_FILTER_TYPE_AUTO,
          E_MI_SCL_FILTER_TYPE_BYPASS,
          E_MI_SCL_FILTER_TYPE_BILINEAR,
          E_MI_SCL_FILTER_TYPE_BICUBIC,
          E_MI_SCL_FILTER_TYPE_MAX,
      } MI_SCL_FilterType_e;
      
    • Member

      Member name Description
      E_MI_SCL_FILTER_TYPE_AUTO Automatic filter selection
      E_MI_SCL_FILTER_TYPE_BYPASS Without algorithm filter
      E_MI_SCL_FILTER_TYPE_BILINEAR Bilinear filter
      E_MI_SCL_FILTER_TYPE_BICUBIC Bicubic interpolation filter
      E_MI_SCL_FILTER_TYPE_MAX Maximum filter type
    • Note

      Choose the same filter type as the algorithm to get more accurate algorithm results.

    • Related data type and interface

      MI_SCL_StretchBuf


    3.10. MI_SCL_DirectBuf_t

    • Description

      SCL direct processes buffer parameter type.

    • Definition

      typedef struct MI_SCL_DirectBuf_s
      {
          MI_SYS_PixelFormat_e ePixelFormat;
          MI_U32 u32Width;
          MI_U32 u32Height;
          MI_PHY phyAddr[2];
          MI_U32 u32Stride[2];
          MI_U32 u32BuffSize;
      }MI_SCL_DirectBuf_t;
      
    • Member

      Member name Description
      ePixelFormat Buffer pixel format
      u32Width Effective pixel width
      u32Height Effective pixel height
      phyAddr Buffer physical address
      u32Stride Buffer number of bytes in a row
      u32BuffSize Buffer size
    • Related data type and interface

      MI_SCL_StretchBuf

      MI_SCL_StretchBufOsd


    3.11. MI_SCL_DirectOsdArgb1555Alpha_t

    • Description

      Argb1555 only has one bit to describe the alpha, which divides two settings, the foreground alpha with alpha bit equal '1' and background alpha with alpha bit equal '0'.

    • Definition

      typedef struct MI_SCL_DirectBufOsdArgb1555Alpha_s
      {
          MI_U8 u8BgAlpha;
          MI_U8 u8FgAlpha;
      } MI_SCL_DirectOsdArgb1555Alpha_t;
      
    • Member

      Member name Description
      u8BgAlpha The alpha value to display in background when alpha bit is 0. Value range: 0~0xFF.
      u8FgAlpha The alpha value to display in foreground when alpha bit is 1. Value range: 0~0xFF.
    • Related data type and interface

      MI_SCL_StretchBufOsd


    3.12. MI_SCL_DirectOsdAlphaModePara_u

    • Description

      The union of osd alpha mode parameters.

    • Definition

      typedef union
      {
          MI_SCL_DirectOsdArgb1555Alpha_t stArgb1555Alpha;
          MI_U8 u8ConstantAlpha;
      } MI_SCL_DirectOsdAlphaModePara_u;
      
    • Member

      Member name Description
      stArgb1555Alpha The setting of argb1555 format foreground and background alpha.
      u8ConstantAlpha The setting in constant alpha case, and value range is from 0 to 0xFF.
    • Related data type and interface

      MI_SCL_StretchBufOsd


    3.13. MI_SCL_DirectOsdAlphaMode_e

    • Description

      The way to display with alpha mode.

    • Definition

      typedef enum
      {
          E_MI_SCL_DIRECT_BUF_OSD_PIXEL_ALPHA = 0,
          E_MI_SCL_DIRECT_BUF_OSD_CONSTANT_ALPHT
      } MI_SCL_DirectOsdAlphaMode_e;
      
    • Member

      Member name Description
      E_MI_SCL_DIRECT_BUF_OSD_PIXEL_ALPHA OSD displays every pixel with alpha value, which can support by these color formats 'argb1555/argb4444/arbg8888/i2/i4/i8'. Rgb565 without alpha value does not make sense.
      E_MI_SCL_DIRECT_BUF_OSD_CONSTANT_ALPHT The hardware ignores the alpha value (if exist) from the pixel format, In fact it use the specified alpha value to take the place of the original alpha value of each pixel.
    • Related data type and interface

      MI_SCL_StretchBufOsd


    3.14. MI_SCL_DirectOsdAlphaAttr_t

    • Description

      The structure of the attribute of OSD 'alpha'.

    • Definition

      typedef struct MI_SCL_DirectOsdAlphaAttr_s
      {
          MI_SCL_DirectOsdAlphaMode_e   eAlphaMode;
          MI_SCL_DirectOsdAlphaModePara_u stAlphaPara;
      } MI_SCL_DirectOsdAlphaAttr_t;
      
    • Member

      Member name Description
      eAlphaMode The OSD alpha mode enum.
      stAlphaPara The parameters of alpha mode.
    • Related data type and interface

      MI_SCL_StretchBufOsd


    3.15. MI_SCL_DirectOsdInfo_t

    • Description

      SCL direct processes Osdbuffer parameter Info.

    • Definition

      typedef struct MI_SCL_DirectOsdInfo_s
      {
          MI_U32           u32X;
          MI_U32           u32Y;
          MI_U32           u32Width;
          MI_U32           u32Height;
          MI_PHY           phyAddr;
          MI_U32           u32Stride;
          MI_SCL_DirectOsdAlphaAttr_t stOsdAlphaAttr;
      } MI_SCL_DirectOsdInfo_t;
      
    • Member

      Member name Description
      u32X X-axis
      u32Y Y-axis
      u32Width Effective pixel width
      u32Height Effective pixel height
      phyAddr Buffer physical address
      u32Stride Buffer number of bytes in a row
      stOsdAlphaAttr Osd Alpha attribute.
    • Related data type and interface

      MI_SCL_StretchBufOsd


    3.16. MI_SCL_DirectOsdBuf_t

    • Description

      SCL direct processes Osdbuffer parameter type.

    • Definition

      typedef struct MI_SCL_DirectOsdBuf_s
      {
          MI_U8         u8OsdBufCnt;
          MI_SYS_PixelFormat_e  ePixelFormat;
          MI_SCL_DirectOsdInfo_t astOsdBuf[MI_SCL_DIRECT_OSD_CNT_MAX];
      } MI_SCL_DirectOsdBuf_t;
      
    • Member

      Member name Description
      u8OsdBufCnt the quantity of OSD image data
      ePixelFormat the pixfmt of OSD Buffer
      astOsdBuf OSD image data
    • Note

      • u8OsdBufCnt Effective interval is [0, MI_SCL_DIRECT_OSD_CNT_MAX].

        #define MI_SCL_DIRECT_OSD_CNT_MAX (8)
        
      • For ePixelFormat support scope, please refer to MI_RGN_AttachToChn in MI_RGN_API_V3.

    • Related data type and interface

      MI_SCL_StretchBufOsd


    3.17. MI_SCL_DEV_ISP_REALTIME0

    • Description

      SCL Device 0

    • Definition

      #define MI_SCL_DEV_ISP_REALTIME0 (0x0)
      

    3.18. MI_SCL_DEV_RDMA0

    • Description

      SCL Device 1

    • Definition

      #define MI_SCL_DEV_RDMA0         (0x1)
      

    3.19. MI_SCL_DEV_VIF_REALTIME0

    • Description

      SCL Device 2

    • Definition

      #define MI_SCL_DEV_VIF_REALTIME0 (0x2)
      

    3.20. MI_SCL_DEV_DIPR0

    • Description

      SCL Device 3

    • Definition

      #define MI_SCL_DEV_DIPR0         (0x3)
      

    3.21. MI_SCL_DEV_ISP_REALTIME1

    • Description

      SCL Device 4

    • Definition

      #define MI_SCL_DEV_ISP_REALTIME1 (0x4)
      

    3.22. MI_SCL_DEV_RDMA2

    • Description

      SCL Device 5

    • Definition

      #define MI_SCL_DEV_RDMA2 (0x5)
      

    3.23. MI_SCL_DEV_VIF_REALTIME1

    • Description

      SCL Device 6

    • Definition

      #define MI_SCL_DEV_VIF_REALTIME1 (0x6)
      

    3.24. MI_SCL_DEV_DIPR1

    • Description

      SCL Device 7

    • Definition

      #define MI_SCL_DEV_DIPR1 (0x7)
      

    3.25. MI_SCL_DEV_HVP_REALTIME0

    • Description

      SCL Device 8

    • Definition

      #define MI_SCL_DEV_HVP_REALTIME0 (0x8)
      

    4. SCL ERROR CODE


    Video input APIs error code are as following.

    Error code Macro definition Description
    0XA0222000 MI_ERR_SCL_INVALID_DEVID Invalid device ID
    0XA0222001 MI_ERR_SCL_INVALID_CHNID Invalid channel ID
    0XA0222002 MI_ERR_SCL_INVALID_PORTID Invalid port ID
    0XA0222003 MI_ERR_SCL_ILLEGAL_PARAM Invalid parameter setting
    0XA0222004 MI_ERR_SCL_EXIST Device already exists
    0XA0222005 MI_ERR_SCL_UNEXIST Device already unexists
    0XA0222006 MI_ERR_SCL_NULL_PTR Input parameter null pointer error
    0XA0222007 MI_ERR_SCL_NOT_SUPPORT Operation not supported
    0XA0222008 MI_ERR_SCL_NOT_PERM Operation not allowed
    0XA0222009 MI_ERR_SCL_NOMEM Failed to allocate memory
    0XA022200a MI_ERR_SCL_NOBUF Buffer is full
    0XA022200b MI_ERR_SCL_BUF_EMPTY Buffer is empty
    0XA022200c MI_ERR_SCL_NOTREADY System is not initialized
    0XA022200d MI_ERR_SCL_BUSY System is busy

    5. PROCFS INTRODUCTION


    5.1. cat

    • Debug Information

      # cat /proc/mi_modules/mi_scl/mi_scl0
      

    • Debug Information Analysis

      Record the current use status and related attributes of the scaler, which can be dynamically obtained to facilitate debugging and testing.

    • Parameter Description

      Parameter Description
      module info InitCnt The count of connected module occurrence
      chip Chip index
      version Chip version
      UseSclMask The use status of scaler
      Device Info DevID Device ID
      refcnt The count of dev repeated creation
      src Input source
      sclmask Scaler id used by the device
      cmdq Cmdq pointer
      IrqEn IRQ enable status
      IrqMode IRQ mode
      Irqnum IRQ ID
      VsyncCnt ISR vsync Cnt
      crcFailCnt input crc check fail cnt
      FDCnt ISR Frame Done Cnt
      DropCnt IRQ Frame Drop or Double Vsync
      LdCnt Low Lantency Mode Match Line IRQ Cnt
      DVCnt double vsync cnt
      rstcnt reset hw cnt
      Channel Info DevId Device id
      ChnId Channel ID
      start Channel start or not
      Crop Channel Crop location
      Rot Rotation angle
      Size Input width/height
      pixel Input Pixel format
      compress input compress type
      Stride Input buffer stride
      Atom The count of buffers held by the bottom layer
      Atom0Cnt The count of times that the bottom layer cannot get buffer after buffer release
      PTMax/Cur Maximum hardware processing time/Current frame hardware processing time
      PreCnt/EnqCnt/BarCnt/checkin/
      checkout/DeqCnt
      The count of Callback interface execution
      MaxIv/MinIv callback execution interval
      DropCnt drop task cnt
      EnqOTNull The count that OutBuffer is Null while Enq
      Outputport Info DevId Device id
      ChnId Channel ID
      PortId Port ID
      sclid scaler ID
      bindtype 0: Real Time mode
      1: Ring mode
      2: frame mode
      Enable Enable status
      Pixel Output pixel format
      compress output compress type
      bMirr/flip Port mirror/flip
      PortCrop Port crop range
      OutputW/OutputH Output width/output height
      Histogram Scl Picture complexity
      MatchLine Low Lantency Mode Match Line Cnt
      Stride Output buffer stride, pixel byte
      GetCnt The count of outputbuffer to get
      FailCnt The count of outputbuffer failed to get
      FinishCnt The count of output buffer finished
      fps Output port frame rate


    5.2. echo

    Echo help can view available commands:

    # echo help > /proc/mi_modules/mi_scl/mi_scl0
    

    Function
    Set the crop Parameter of each scl port, which is directly set to the driver without going through the MI process.
    Command echo setprecrop [chnid portid X Y Width Height] > /proc/mi_modules/mi_scl/mi_scl0
    Parameter
    Description
    Chnid: channel id
    Portid: port id
    X,Y,width,height: crop range
    Example echo setprecrop 0 0 0 0 800 200 > /proc/mi_modules/mi_scl/mi_scl0
    Function
    After finishing the bottom layer buffer, stop channel to trigger the bottem layer.
    Command echo stopchnl [chnid, ON/OFF] > /proc/mi_modules/mi_scl/mi_scl0
    Parameter
    Description
    Chnid: channel id
    ON/OFF: ON means stop channel, OFF means open channel
    Example echo stopchnl 0 ON > /proc/mi_modules/mi_scl/mi_scl0
    echo stopchnl 0 OFF > /proc/mi_modules/mi_scl/mi_scl0
    Function
    Dump the output data of the selected channel and save it in the /path.
    Command echo dumptaskfile [chnid, Cnt, /path/, bOnlyDumpResChange, bdumpport] > /proc/mi_modules/mi_scl/mi_scl0
    Parameter
    Description
    Chnid: channel id
    Cnt: dump count
    Path: The path to store dumped files
    bOnlyDumpResChange: Sometimes some flower images are generated when the resolution is changed, and the dump command does not work well with the resolution changing. You can set this parameter first, and then change the resolution. When the program recognizes the resolution change, it will dump the buffer after the resolution change. (Optional parameter)
    Bdumpport: Only dump a certain portid, the default is to dump all the output ports. (Optional parameter)
    Example echo dumptaskfile 0 2 /tmp > /proc/mi_modules/mi_scl/mi_scl0
    Function
    Set pass atomvalue
    Command echo setatom [AtomValue] > /proc/mi_modules/mi_scl/mi_scl0
    Parameter
    Description
    AtomValue: The maximum number of buffers held by the driver.
    Example echo setatom 3 > /proc/mi_modules/mi_scl/mi_scl0
    PS: Sometimes the bottom layer is stuck, you can try to enlarge this atom, plug a buffer into the driver, and trigger again to see if it can be restored. Or when the frame is dropped, increase the atom to see if the frame can be full.
    Function
    Clear the input/output/done buffer of the specified channel port.
    Command echo clearbuf [chnid, portid, bClearInput, bClearoutput] > /proc/mi_modules/mi_scl/mi_scl0
    Parameter
    Description
    Chnid: channel id
    Portid: port id
    bClearInput: Clear input buffer
    bClearoutput: Clear output buffer
    Example echo clearbuf 0 0 1 0 > /proc/mi_modules/mi_scl/mi_scl0
    Function
    Set debug level
    Command echo debuglv [level] > /proc/mi_modules/mi_scl/mi_scl0
    echo debuglv [chnid][level] > /proc/mi_modules/mi_scl/mi_scl0
    Parameter
    Description
    Chnid: channel id
    Level:
    (1) When single parameter: 2:flow, 4:check irq done
    (2) When two parameters: 1:check buffer, 2:check loop, 4:check frame pts, 8:check fence done, 16:check func time, 32:check sidebandmsg
    Example echo debuglv 4 > /proc/mi_modules/mi_scl/mi_scl0 //Open check irq done related MI print.
    echo debuglv 0 3 > /proc/mi_modules/mi_scl/mi_scl0 //Open channel0 level3 print about buffer info and loop info.
    Function
    Set port enable or not
    Command echo enableport [chnid, portid, bEn] > /proc/mi_modules/mi_scl/mi_scl0
    Parameter
    Description
    Chnid: channel id
    Portid: port id
    bEn: 0:disable, 1:enable
    Example echo enableport 0 0 1 > /proc/mi_modules/mi_scl/mi_scl0
    Function
    Clear the buffer cached in Bind Q
    Command echo clearbindq [chnid bclear] > /proc/mi_modules/mi_scl/mi_scl0
    Parameter
    Description
    Chnid: channel id
    bclear: Whether to clear
    Example echo clearbindq 0 1 > /proc/mi_modules/mi_scl/mi_scl0 //clear channel0 bindQ
    Clear channel0 bindQ.
    Sometimes the front end can't get the buffer, and it is found that scl BindQ is full. Judge whether scl takes the buffer fast enough. Clear bindQ to see if bindQ will be accumulated. If it is still accumulated, it means that the scl is not fast enough. If it is not increased, it means that the previous exception has been stuffed in and has not been consumed.
    Function
    Print the value lower than the setting frame rate.
    Command echo fpsth [chnid portid fpsint fpsfloat] > /proc/mi_modules/mi_scl/mi_scl0
    Parameter
    Description
    Chnid: channel id
    Portid: port id
    fpsint: Frame rate integer bits
    fpsfloat: Frame rate demical bits
    Example echo fpsth 0 0 30 30 > /proc/mi_modules/mi_scl/mi_scl0
    //Print the fps lower than 30.30 in channel0 port0.
    Function
    Set the print pts, print if it is exceeding PTS interval.
    Command echo ptsth [chnid portid ptsmininterval ptsmaxinterval] > /proc/mi_modules/mi_scl/mi_scl0
    Parameter
    Description
    Chnid: channel id
    Portid: port id
    ptsmininterval: pts interval min value
    ptsmaxinterval: pts interval max value
    Example echo ptsth 0 0 30000 40000 > /proc/mi_modules/mi_scl/mi_scl0
    // Values with PTS interval less than 30ms and more than 40ms in channel0 port0 are printed out.
    Function
    Reset SCL entire hardware.
    Command echo resethw [chnid ] > /proc/mi_modules/mi_scl/mi_scl0
    Parameter
    Description
    Chnid: channel id
    Example echo resethw 0 > /proc/mi_modules/mi_scl/mi_scl0
    //mi_scl0 mens MI_SCL_DEV_ISP_REALTIME0, mi_scl1 means MI_SCL_DEV_RDMA0.
    Function
    Set output port parameters
    Command echo outputparam pixel [chnid, portid pixelmode] > /proc/mi_modules/mi_scl/mi_scl1
    echo outputparam compress [chnid, portid compressmode] > /proc/mi_modules/mi_scl/mi_scl1
    echo outputparam mirrorflip [chnid, portid bmirror bflip] > /proc/mi_modules/mi_scl/mi_scl1
    echo outputparam crop [chnid, portid cropX cropY cropW cropH] > /proc/mi_modules/mi_scl/mi_scl1
    echo outputparam size [chnid, portid sizeW sizeH] > /proc/mi_modules/mi_scl/mi_scl1
    echo outputparam all [chnid, portid pixelmode compressmode bmirror bflip cropX cropY cropW cropH sizeW sizeH] > /proc/mi_modules/mi_scl/mi_scl1
    Parameter
    Description
    Chnid: channel id
    Portid: port id
    Pixelmode: output pixel format
    Compressmode: ouput compress mode
    Bmirror: Ouput enable horizontal turn
    Bflip: Ouput enable vertical turn
    cropX: Output crop X coordinate
    cropY: Output crop Y coordinate
    cropW: Output crop width
    cropH: Output crop height
    sizeW: Output size width
    sizeH: Output size height
    Example echo outputparam pixel 0 0 11 > /proc/mi_modules/mi_scl/mi_scl1
    echo outputparam compress 0 0 5 > /proc/mi_modules/mi_scl/mi_scl1
    echo outputparam mirrorflip 0 0 1 1 > /proc/mi_modules/mi_scl/mi_scl1
    echo outputparam crop 0 0 0 0 1920 1080 > /proc/mi_modules/mi_scl/mi_scl1
    echo outputparam size 0 0 1920 1080 > /proc/mi_modules/mi_scl/mi_scl1
    echo outputparam all 0 0 11 5 1 1 0 0 1920 1080 1920 1080 > /proc/mi_modules/mi_scl/mi_scl1
    Function
    Set the crc of the output port.
    Command echo crcmode [chnid portid crcmode] > /proc/mi_modules/mi_scl/mi_scl0
    Parameter Description chnid: channel id
    Portid: port id
    crcmode: 0:not used, 1: used
    Example echo crcmode 0 1 1 > /proc/mi_modules/mi_scl/mi_scl0
    Function
    Set the bytewrite of the output port.
    Command echo bytewrite [chnid portid bEn offsetbyte] > /proc/mi_modules/mi_scl/mi_scl0
    Parameter Description chnid: channel id
    Portid: port id
    bEn: 0:disable, 1:enable
    offsetbyte: offset byte
    Example echo bytewrite 0 0 1 1 > /proc/mi_modules/mi_scl/mi_scl0
    Function
    Set the patengen of the input source.
    Command echo patengen [chnid bEn patengenmode] > /proc/mi_modules/mi_scl/mi_scl0
    Parameter Description chnid: channel id
    bEn: 0:disable, 1:enable
    patengenmode: 0:static, 1:dynamic
    Example echo patengen 0 1 0 > /proc/mi_modules/mi_scl/mi_scl0
    Function
    Set the command fetching information executed after cmdq timeout
    Command echo cmdqtimeout [bEn, keyword, cmdline, path] > /proc/mi_modules/mi_scl/mi_scl0
    Parameter
    Description
    bEn: 0:disable, 1:enable
    keyword: Commands executed
    cmdline: Executed string
    path: Information saving path
    Example echo 1 cat /proc/mi_modules/mi_isp/mi_scl0 /mnt/cmdqerr.txt > /proc/mi_modules/mi_isp/mi_scl0
    Function
    Set scl filter type.
    Command echo outputfilter [chnid, portid, filtertype] > /proc/mi_modules/mi_scl/mi_scl0
    Parameter
    Description
    Chnid: channel id
    Portid: port id
    filtertype: 0:auto, 1:bilinear, 2:bicubic
    Example echo outputfilter 0 0 1> /proc/mi_modules/mi_scl/mi_scl0
    Function
    Set cmdq delay time.
    Command echo cmdqdelay [time(ns)] > /proc/mi_modules/mi_scl/mi_scl1
    Parameter
    Description
    time: cmdq delay time (ns)
    Example echo cmdqdelay 100000 > /proc/mi_modules/mi_scl/mi_scl1
    Function
    Set double vsync drop enable.
    Command echo doublevsyncdrop [bEn] > /proc/mi_modules/mi_scl/mi_scl1
    Parameter
    Description
    bEn: 0:disable, 1:enable
    Example echo doublevsyncdrop 1 > /proc/mi_modules/mi_scl/mi_scl1

    6. MODPARAM.JSON INTRODUCTION

    6.1. The json file content

    { "E_MI_MODULE_ID_SCL" : { "bEnableMultiRing": "TRUE", "bDefaultDropFifoBuffer": "TRUE", "u32MaxChnNum": "32", "bUseHwResetArray": "1", "bCmdqTimeOutDbgArray": "0", "u16CpuMaskAffinityArray": "0", "u32threadPriorityArray": "98", "u32CmdqSizeArray": "91136", "u32PatMode": "0,0", "bDoubleVsyncDropDbgArray": "FALSE", "u64PmTimeoutLatencyNS": "1000000000", "u32BaseFrameIdxArray": "0", "u32DevDbgLv": "0", "u8ChnDbgLv": "0", "bCrcEnableArray": "0", "bEnableTileModeArray": "0", "u16ByteWriteArray": "0", "u16FilterTypeArray": "0", "u16RingLineCntArray": "-1" } }

    The modparam.json is under /config, when SCL is initialized, the json file will be loaded.


    6.2. SCL common paramaters and paramater description

    Parameters Default Support chip Customer configuration Function
    bEnableMultiRing TRUE Maruko, Opera, Souffle and later chip N Set scl to enable MultiRing mode or not, 0: disable, 1: enable
    bDefaultDropFifoBuffer TRUE Maruko, Opera, Souffle and later chip Y Set whether scl drop fifo buffer by defalt, 0: disable, 1: enable
    u32MaxChnNum 32 Maruko, Opera, Souffle and later chip Y Set scl max channel number per device,[0-U32MAX]
    bUseHwResetArray 1 Maruko, Opera, Souffle and later chip Y Enable isp dev default hw reset or not, 0: disable, 1: enable
    bCmdqTimeOutDbgArray 0 Maruko, Opera, Souffle and later chip N Enable dev default cmdq timeout debuginfo or not, 0: disable, 1: enable
    u16CpuMaskAffinityArray 0 Maruko, Opera, Souffle and later chip N Set which cpu scl dev thread can repond on, 0: Use all cpu by default, bit0-3 -> cpu 0-3, like: 6 means that use cpu1 and cpu2
    u32threadPriorityArray 98 Maruko, Opera, Souffle and later chip N Set scl dev work thread priority,[0-U32MAX]
    u32CmdqSizeArray 91136 Maruko, Opera, Souffle and later chip N Set scl dev cmdq size,[0-U32MAX]
    u32PatMode 0,0 Maruko, Opera, Souffle and later chip N Set scl dev pattern gen, [W,H], 0:disable
    bDoubleVsyncDropDbgArray FALSE Maruko, Opera, Souffle and later chip N Set whether scl dev drop double vsync buffer, 0: disable,1: enable
    u64PmTimeoutLatencyNS 1000000000 Maruko, Opera, Souffle and later chip N Set scl dev pm timeout,[0-U64MAX]
    u32BaseFrameIdxArray 0 Maruko, Opera, Souffle and later chip N Set scl dev basic frame index, [0-U32MAX]
    u32DevDbgLv 0 Maruko, Opera, Souffle and later chip N Set scl dev debug level,[0-U32MAX]
    u8ChnDbgLv 0 Maruko, Opera, Souffle and later chip N Set scl dev channel debug level,[0-U8MAX]
    bCrcEnableArray 0 Maruko, Opera, Souffle and later chip N Enable scl port crc or not, 0: disable, 1: enable
    bEnableTileModeArray 0 Maruko, Opera, Souffle and later chip N Enable scl port Tile mode or not, 0: disable, 1: enable
    u16ByteWriteArray 0 Maruko, Opera, Souffle and later chip N Set scl port ByteWrite pixel offset,[0-U16MAX]
    u16FilterTypeArray 0 Maruko, Opera, Souffle and later chip N Set scl port filter type, 0: Auto mode, 1: Bilinear mode, 2: Bicubic mode
    u16RingLineCntArray -1 Iford and later chip N Set the height of RingBuf used in scl port JPEG_EmiRing, -1: Auto mode, [0-OutSizeHeight]