# APPLICATION DEVELOPMENT REFERENCE

## 1. SDK¶

### 1.1. Project List Description¶

Project List Description
board Store relevant configuration information, vdec firmware, ipl, uboot, mmap.ini, etc. For example, to modify the framebuffer output format, modify /project/board/i2m/SSC011A-S01A/config/fbdev. FB_HWWIN_FORMAT(5=ARGB8888，6=ARGB1555) in ini default fb will be driven to the corresponding format
configs Store and compile sdk, generate mirrored config, Such as the first step of compilation: ./setup_config.sh configs/nvr/i2m/8.2.1/nor.glibc-squashfs.011a.64
image Compile and package the main directory, Contains the compiled busybox image, source code, the final compiled burning script and burning image.
kbuild Kernel config and other settings needed to compile SDK
release The header files, lib, ko provided by the SDK, which contain the header files and data structure of each module
tools some debug tool

The main job of Project is to package the relevant lib and bin to generate an image, make rootfs and burn it to the board. The makefile at the beginning of the compilation is located in the project/makefile, through which the corresponding sub-makefile is called step by step to finally generate images and scripts.

The main makefile structure is as follows, customized rootfs production can be added in the makefile of rootfs.mk.

### 1.2. Takoyaki Common Module Description¶

Module Description
SYS SYS is the memory management of the SDK, responsible for streaming control, frame rate setting, etc.
VDEC Decoding, support H264, H265 decoding, maximum support 1080P
1. Need to set the width and height of ES stream
2. Need to set the decoding to output width and height of YUV, and the output value must be the same as the input setting of DISP, VDEC supports reducing the width and height of the ES stream, but doesnt support enlargement
DIVP YUV image processing module. Supports scaling and format conversion, commonly used in the binding and DISP VENC
DISP Image display module. Need to set the Input port property,tThe width and height need to be consistent with the output value of the previous binding module
VENC Encoding support JPEG
PANEL For display related configuration, refer to demo to fill in the corresponding parameters
GFX 2D engine, supports Fill, Blit, Blending, etc.
FB Standard framebuffer interface, the device node is /dev/fb0, some extended ioctls are added, see mstarFb.h for details

The main API usage of each commonly used module is introduced below. You can refer to Demo to encapsulate and implement the user's media architecture.

#### 1.2.1. SYS¶

MI_S32 MI_SYS_Init(void); //Call it before using other APIs
MI_S32 MI_SYS_Exit (void); //Corresponding to Init
`

If the module in the SDK needs to transmit YUV Stream, just bind the corresponding port, so that the YUV data processed by the upper module will be sent to the next.

Note: as shown in the figure above, some modules only have Input Port, some only have Output Port, and some have both.

#### 1.2.2. VDEC¶

After creating the decoding channel, you need to call MI_VDEC_SendStream to send the network stream or video file to VDEC.

Destroy the decoding channel:

#### 1.2.3. DISP¶

Set the disp dev attribute and enable dev.

Bind layer and disp dev.

Set disp input port parameters and enable it.

#### 1.2.4. Panel¶

The LCD of ttl fills in screen parameters according to spec, and then executes the following api, the screen parameters refer to the LCD header file of demo.

#### 1.2.5. Framebuffer¶

Initialize FB.

FB has extended iotcl, such as colorkey and Hide/Show.

Show/Hide:

ColorKey:

extended ioctl：