0. Preface
The MPP system control module, according to the characteristics of the chip, completes the reset and basic initialization of each component of the hardware, and is also responsible for completing the initialization and de-initialization of each business module of the MPP (Media Process Platform) system and managing the operation of each business module of the MPP system. Functions such as working status and providing version information of the current MPP system. Before the application program starts the MPP business, the MPP system initialization work must be completed. Similarly, after the application exits the MPP service, it must complete the deinitialization of the MPP system and release resources.
This chapter mainly describes how to add the MPP patch package in Tina SDK and how to compile and use it. The patch contains the source code of the MPP part. For details on how to develop MPP, please refer to the 01_Learning Manual/"100ASK-V853_Pro System Development Manual" in the data CD of the 100ASK_V853-PRO development board located in the Baidu network disk, the fourth chapter in the development of basic components in this manual . Tina Linux Multimedia MPP Development Guide , this chapter details the development guide for the MPP system control module of the 100ASK_V853-PRO development board.
100ASK_V853-PRO development board data CD:
Link: https://pan.baidu.com/s/1TX742vfEde9bMLd9IrwwqA?pwd=sp6a
Extraction code: sp6a
Allwinner MPP_sample_ Instructions: https://tina.100ask.net/SdkModule/Linux_MPP_Sample_Instructions-01/
100ASK_V853-PRO development board data summary:
Link: 100ASK_100ASK-PRO Data Summary - Allwinner / V853-Pro - Embedded Development Q&A Community
100ASK_V853-PRO development board purchase link: 100ASK_V853-PRO development board
1. Add MPP extension package
MPP extension pack:
After the download is complete, put sunxi-mpp.tar.gz
the compressed package into any directory of the virtual machine, assuming it is placed /home/book/workspaces
in the directory,
For example:
ook@100ask:~/workspaces$ ls
100ASK_V853-PRO_TinaSDK sunxi-mpp.tar.gz tina-v853-open
Unzip sunxi-mpp.tar.gz
the compressed package, enter
tar -xzvf sunxi-mpp.tar.gz
For example:
book@100ask:~/workspaces$ tar -xzvf sunxi-mpp.tar.gz
sunxi-mpp/
sunxi-mpp/CMake/
sunxi-mpp/CMake/sunxi_mpp_lib.cmake
sunxi-mpp/CMake/sunxi_mpp_include.cmake
...
Wait for the decompression to complete and enter sunxi-mpp
the directory to view the files in the current directory
book@100ask:~/workspaces$ cd sunxi-mpp/
book@100ask:~/workspaces/sunxi-mpp$ ls
CMake CMakeLists.txt include lib README.md sample STAGING_DIR.sh toolchain
Each folder is described below
CMake:设置mpp各文件的头文件和依赖目录
CMakeLists.txt:设置编译文件、交叉编译工具链位置、依赖等位置和规则信息
include:包含MPP扩展包所需的头文件
lib:包含MPP扩展包所需的依赖文件
sample:包含MPP个应用示例源码
STAGING_DIR.sh:设置环境变量
toolchain:包含V853交叉编译工具链
2. Compile the MPP extension package
Add cross-compilation environment variables, here only need to increase sunxi-mpp
the environment variables of the location, enter
book@100ask:~/workspaces/sunxi-mpp$ export CMAKE_CURRENT_SOURCE_DIR=~/workspaces/sunxi-mpp
To activate the environment variable, enter
book@100ask:~/workspaces/sunxi-mpp$ source STAGING_DIR.sh
Create a build directory for compiling and storing compiled applications
book@100ask:~/workspaces/sunxi-mpp$ mkdir build
Enter build
the directory, execute cmake ..
, configure the toolchain, temporary directory and compilation rules
book@100ask:~/workspaces/sunxi-mpp$ cd build/
book@100ask:~/workspaces/sunxi-mpp/build$ cmake ..
-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- STAGING_DIR: build
-- Configuring done
-- Generating done
-- Build files have been written to: /home/book/workspaces/sunxi-mpp/build
build
After the execution is complete , the following files will be generated under the directory, where bin
the directory is used to store the generated binary application.
book@100ask:~/workspaces/sunxi-mpp/build$ ls
bin CMakeCache.txt CMakeFiles cmake_install.cmake Makefile sample STAGING_DIR.sh
To compile the mpp application, enter
book@100ask:~/workspaces/sunxi-mpp/build$ make
Scanning dependencies of target sample_virvi2vo
[ 1%] Building C object sample/sample_virvi2vo/CMakeFiles/sample_virvi2vo.dir/sample_virvi2vo.c.o
[ 2%] Linking C executable ../../bin/sample_virvi2vo
[ 2%] Built target sample_virvi2vo
...
Scanning dependencies of target sample_demux2adec2ao
[ 99%] Building C object sample/sample_demux2adec2ao/CMakeFiles/sample_demux2adec2ao.dir/sample_demux2adec2ao.c.o
[100%] Linking C executable ../../bin/sample_demux2adec2ao
[100%] Built target sample_demux2adec2ao
After the compilation is complete, you can enter bin
the directory to view the compiled binary files.
book@100ask:~/workspaces/sunxi-mpp/build$ cd bin/
book@100ask:~/workspaces/sunxi-mpp/build/bin$ ls
sample_adec sample_CodecParallel sample_MotionDetect sample_uvc2vo sample_virvi2venc
sample_aec sample_demux2adec sample_multi_vi2venc2muxer sample_uvcout sample_virvi2venc2muxer
sample_aenc sample_demux2adec2ao sample_rtsp sample_uvc_vo sample_virvi2vo
sample_ai sample_demux2vdec sample_smartIPC_demo sample_venc sample_virvi2vo_zoom
sample_ai2aenc sample_demux2vdec2vo sample_smartPreview_demo sample_venc2muxer sample_vo
sample_ai2aenc2muxer sample_demux2vdec_saveFrame sample_timelapse sample_vi_g2d yuv420pTobmp
sample_ao sample_driverVipp sample_UILayer sample_vin_isp_test
sample_ao_resample_mixer sample_g2d sample_uvc2vdec_vo sample_vi_reset
sample_aoSync sample_glog sample_uvc2vdenc2vo sample_virvi
For how to test applications using MPP, please be sure to refer to:
Allwinner MPP_sample_ Instructions: https://tina.100ask.net/SdkModule/Linux_MPP_Sample_Instructions-01/
If there is no test description in "Allwinner MPP_sample_ Instructions", you can check the test instructions in each sample program Readme.txt
. For example, suppose I need sample_driverVipp
a program and need to enter the source code directory, enter
book@100ask:~/workspaces/sunxi-mpp$ cd sample/sample_driverVipp/
book@100ask:~/workspaces/sunxi-mpp/sample/sample_driverVipp$ ls
CMakeLists.txt Readme.txt sample_driverVipp.c sample_driverVipp.h
You can see that there is a Readme.txt file in the source code directory, which details how to test.
book@100ask:~/workspaces/sunxi-mpp/sample/sample_driverVipp$ cat Readme.txt
sample_driverVipp:
该sample演示直接调用linux内核驱动获取frame。按下ctrl+c,终止测试。
每隔若干帧保存一帧到指定的目录。
读取测试参数的流程:
sample只支持命令行模式输入参数。如果不输入参数,会提示输入。
从命令行启动sample_driverVipp的指令:
./sample_driverVipp
或
./sample_driverVipp 0 1920 1080 8 60 0 10 60 /mnt/extsd
测试参数的说明:
(1)video device: 0~3 (vipp0~vipp3)
(2)capture_width:指定camera采集的图像宽度
(3)capture_height:指定camera采集的图像高度
(4)pixel_format:指定camera采集的图像格式
(5)fps:指定camera采集的帧率
(6)test frame count:指定测试采集的frame总数,0表示无限。
(7)store count: 指定保存的图像数量。
(8)store interval: 指定保存图像的周期,即每n帧图像保存1帧。
(9)frame saving path: 指定保存图像的目录,该目录要确保存在。
If you want to use MPP for development and write your own applications, please read the 01_Learning Manual/"100ASK-V853_Pro System Development Manual" in the data CD of the 100ASK_V853-PRO development board located in the Baidu network disk data. The seventh chapter of Tina Linux Multimedia MPP Development Guide in the fourth chapter of basic component development , this chapter details the development guide for the MPP system control module of the 100ASK_V853-PRO development board.
3. Test the MPP application
To test the MPP application program, you need to add the dependency file of the development board, which is located in sunxi-mpp/lib
the directory, as shown in the figure below
Copy all the files in this directory to lib
the directory of the development board. Suppose I use a TF card to copy it to the development board, copy the lib folder to the TF card, insert the TF into the 100ASK_V853-PRO development board, and hang load TF card, input
root@TinaLinux:/# mount /dev/mmcblk1p1 /mnt/extsd/
After the mount is complete, enter the TF directory
root@TinaLinux:/# cd /mnt/extsd/
root@TinaLinux:/mnt/extsd# ls
System Volume Information lib
You can see lib
the folder, copy lib
all the files in the directory to lib
the directory of the development board, enter
root@TinaLinux:/mnt/extsd# cp lib/* /lib/
Wait for the copy to complete.
3.1 Test the real-time preview camera data application on the LCD
Hardware requirements: 100ASK_V853-PRO development board, 4-inch MIPI display, MIPI camera.
The sample name is: sample_virvi2vo
Source path: sunxi-mpp/sample/sample_virvi2vo/
This example demonstrates the acquisition of data through the camera and real-time display on the LCD screen. The following demonstrates how to run the compiled application on the 100ASK_V853-PRO development board.
After compiling the mpp extension package, a file will be sunxi-mpp/build/bin
generated in the directory sample_virvi2vo
, and the generated file will be copied to the TF card for backup.
Copy the content sunxi-mpp/sample/sample_virvi2vo
in the directory sample_virvi2vo.conf
to the TF card for backup.
Copy sunxi-mpp/lib
the entire directory to the TF card for backup.
After copying, insert the TF card into the 100ASK_V853-PRO development board, mount the TF card to the development board, and entermount /dev/mmcblk1p1 /mnt/extsd/
root@TinaLinux:/# mount /dev/mmcblk1p1 /mnt/extsd/
[ 168.601231] FAT-fs (mmcblk1p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
Enter the mount directory/mnt/extsd/
root@TinaLinux:/# cd /mnt/extsd/
Check if the corresponding file exists
root@TinaLinux:/mnt/extsd# ls
System Volume Information sample_virvi2vo
sample_virvi2vo.conf
To run the test program, enter./sample_virvi2vo -path ./sample_virvi2vo.conf
root@TinaLinux:/mnt/extsd# ./sample_virvi2vo -path ./sample_virvi2vo.conf
After execution, the image data acquired by the camera will be displayed in real time on the MIPI screen.
The application program will end automatically after the set time is executed, and the test can also be terminated in advance by pressing Crtl+C.
3.2 Test real-time preview face recognition and human figure recognition application
Hardware requirements: 100ASK_V853-PRO development board, 4-inch MIPI display, MIPI camera.
The sample name is: sample_smartPreview_demo
Source path: sunxi-mpp/sample/sample_smartPreview_demo
This example demonstrates how to use the face model or human figure model to process the image data obtained through the camera, and display the framed results on the LCD screen in real time. The following demonstrates how to run the compiled application on the 100ASK_V853-PRO development board run on.
After compiling the mpp extension package, a file will be sunxi-mpp/build/bin
generated in the directory sample_smartPreview_demo
, and the generated file will be copied to the TF card for backup.
Copy the face model sunxi-mpp/sample/sample_smartPreview_demo/models/fdet
in the directory face.nb
to the TF card for backup.
Copy the humanoid model files sunxi-mpp/sample/sample_smartPreview_demo/models/pdet
in the directory 2.0.0_Gamma.nb
to the TF card for backup.
Copy the parameter files sunxi-mpp/sample/sample_smartPreview_demo
in the directory sample_smartPreview_demo.conf
to the TF card for backup.
After copying, insert the TF card into the 100ASK_V853-PRO development board, mount the TF card to the development board, and entermount /dev/mmcblk1p1 /mnt/extsd/
root@TinaLinux:/# mount /dev/mmcblk1p1 /mnt/extsd/
[ 168.601231] FAT-fs (mmcblk1p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
Enter the mount directory/mnt/extsd/
root@TinaLinux:/# cd /mnt/extsd/
Check if the corresponding file exists
root@TinaLinux:/mnt/extsd# ls
2.0.0_Gamma.nb sample_smartPreview_demo
System Volume Information sample_smartPreview_demo.conf
face.nb
Modify sample_smartPreview_demo.conf
the file, assuming that I am using the 4-inch MIPI screen and 2Line MIPI camera of Baiwen.com, the face recognition model needs to be tested, and the file needs to be modified as follows:
########### paramter (ref to tulip_cedarx.conf)############
[parameter]
main_isp_dev = 0
main_vipp_dev = 0
main_capture_width = 360
main_capture_height = 640
main_layer_num = 0
main_display_x = 0
main_display_y = 0
main_display_width = 480
main_display_height = 800
main_nn_nbg_type = 1 #-1:disable, 0:human, 1:face
main_nn_isp = 0
main_nn_vipp = 8
main_nn_vi_buf_num = 3
main_nn_src_frame_rate = 20 #fps
main_nn_nbg_file_path = "face.nb"
main_nn_draw_orl_enable = 1
sub_isp_dev = 1
sub_vipp_dev = 1
sub_capture_width = 1920
sub_capture_height = 1080
sub_layer_num = 1
sub_display_x = 0
sub_display_y = 00
sub_display_width = 480
sub_display_height = 800
sub_nn_nbg_type = 1 #-1:disable, 0:human, 1:face
sub_nn_isp = 1
sub_nn_vipp = 9
sub_nn_vi_buf_num = 3
sub_nn_src_frame_rate = 20 #fps
sub_nn_nbg_file_path = "face.nb"
sub_nn_draw_orl_enable = 1
disp_type = "lcd" #disp_type is lcd, hdmi, cvbs
pic_format = "nv21" #pic_format is yu12, yv12, nv21, nv12
frame_rate = 20 #fps
orl_thick=200
test_duration = 0 #unit:s, 0:Infinite duration.
If you need to test humanoid detection, you also need to modify sample_smartPreview_demo.conf
the file, main_nn_nbg_type
set it to 0, and main_nn_nbg_file_path
set it to the path name of the humanoid model, for example:
main_nn_nbg_type = 1
main_nn_nbg_file_path = "2.0.0_Gamma.nb"
Run the test program:
root@TinaLinux:/mnt/extsd# ./sample_smartPreview_demo -path sample_smartPreview_demo.conf
After execution, the display terminal will receive the data from the camera, but some image data will be discarded at the beginning, which may cause the initial screen freeze. After the test is successful, the data of the camera will be displayed in real time on the display screen, and the face in the image of the camera can be framed.
4. Summary
For other applications, we will not demonstrate them one by one here. You can refer to the Readme.txt of each sample program or "Allwinner MPP_sample_ Instructions" for testing experience, and refer to "Tina Linux Multimedia MPP Development Guide" for development. The playability and openness of the MPP media processing platform are suitable for everyone to develop their own applications. I hope that through this chapter, everyone can understand the use of MPP.