0.前言
? MPP 系統(tǒng)控制模塊,根據(jù)芯片特性,完成硬件各個部件的復(fù)位、基本初始化工作,同時負責(zé)完成 MPP(Media Process Platform 媒體處理平臺)系統(tǒng)各個業(yè)務(wù)模塊的初始化、去初始化以及管理 MPP 系統(tǒng)各個業(yè)務(wù)模塊的工作狀態(tài)、提供當(dāng)前 MPP 系統(tǒng)的版本信息等功能。 應(yīng)用程序啟動 MPP 業(yè)務(wù)前,必須完成 MPP 系統(tǒng)初始化工作。同理,應(yīng)用程序退出 MPP 業(yè)務(wù)后,也要完成 MPP 系統(tǒng)去初始化工作,釋放資源。
? 本章主要講述如何在Tina SDK中增加MPP補丁包和如何編譯使用,該補丁包含有MPP部分的源碼。具體MPP如何開發(fā)可以參考位于百度網(wǎng)盤中的100ASK_V853-PRO開發(fā)板的資料光盤中01_學(xué)習(xí)手冊/《100ASK-V853_Pro系統(tǒng)開發(fā)手冊》,該手冊中的第四篇 基礎(chǔ)組件開發(fā)中的第七章 Tina Linux 多媒體MPP 開發(fā)指南,此章節(jié)詳細說明了100ASK_V853-PRO開發(fā)板針對MPP 系統(tǒng)控制模塊的開發(fā)指導(dǎo)。
100ASK_V853-PRO開發(fā)板的資料光盤:
鏈接:https://pan.baidu.com/s/1TX742vfEde9bMLd9IrwwqA?pwd=sp6a
提取碼:sp6a
全志MPP_sample_使用說明:https://tina.100ask.net/SdkModule/Linux_MPP_Sample_Instructions-01/
100ASK_V853-PRO開發(fā)板資料匯總:
鏈接:100ASK_100ASK-PRO 資料匯總 - Allwinner / V853-Pro - 嵌入式開發(fā)問答社區(qū)
100ASK_V853-PRO開發(fā)板購買鏈接:100ASK_V853-PRO開發(fā)板
![pYYBAGRdo4yAf_iVAASQ3zSjFR0352.png](https://file.elecfans.com/web2/M00/A4/F2/pYYBAGRdo4yAf_iVAASQ3zSjFR0352.png)
1.增加MPP擴展包
MPP擴展包:
下載完成后,將sunxi-mpp.tar.gz
壓縮包放入虛擬機的任意目錄,假設(shè)放在/home/book/workspaces
目錄下,
例如:
ook@100ask:~/workspaces$ ls
100ASK_V853-PRO_TinaSDK sunxi-mpp.tar.gz tina-v853-open
解壓sunxi-mpp.tar.gz
壓縮包,輸入
tar -xzvf sunxi-mpp.tar.gz
例如:
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
...
等待解壓完成后進入sunxi-mpp
目錄下,即可查看當(dāng)前目錄下的文件
book@100ask:~/workspaces$ cd sunxi-mpp/
book@100ask:~/workspaces/sunxi-mpp$ ls
CMake CMakeLists.txt include lib README.md sample STAGING_DIR.sh toolchain
下面對各文件夾進行說明
CMake:設(shè)置mpp各文件的頭文件和依賴目錄
CMakeLists.txt:設(shè)置編譯文件、交叉編譯工具鏈位置、依賴等位置和規(guī)則信息
include:包含MPP擴展包所需的頭文件
lib:包含MPP擴展包所需的依賴文件
sample:包含MPP個應(yīng)用示例源碼
STAGING_DIR.sh:設(shè)置環(huán)境變量
toolchain:包含V853交叉編譯工具鏈
2.編譯MPP擴展包
添加交叉編譯環(huán)境變量,這里僅需要增加sunxi-mpp
的位置的環(huán)境變量,輸入
book@100ask:~/workspaces/sunxi-mpp$ export CMAKE_CURRENT_SOURCE_DIR=~/workspaces/sunxi-mpp
激活環(huán)境變量,輸入
book@100ask:~/workspaces/sunxi-mpp$ source STAGING_DIR.sh
創(chuàng)建build目錄,用于編譯和存儲編譯后的應(yīng)用程序
book@100ask:~/workspaces/sunxi-mpp$ mkdir build
進入build
目錄下,執(zhí)行cmake ..
,配置工具鏈、暫存目錄和編譯規(guī)則
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
執(zhí)行完成后會在build
目錄下生成以下文件,其中bin
目錄用于存儲生成后的二進制應(yīng)用程序。
book@100ask:~/workspaces/sunxi-mpp/build$ ls
bin CMakeCache.txt CMakeFiles cmake_install.cmake Makefile sample STAGING_DIR.sh
編譯mpp應(yīng)用程序,輸入
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
編譯完成后可以進入bin
目錄下查看編譯生成的二進制文件。
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
關(guān)于如何測試使用MPP應(yīng)用程序,請一定要參考:
全志MPP_sample_使用說明:https://tina.100ask.net/SdkModule/Linux_MPP_Sample_Instructions-01/
如果《全志MPP_sample_使用說明》中沒有測試說明,可查看每個示例程序中的Readme.txt
。例如,假設(shè)我需要sample_driverVipp
程序,需要進入該源碼目錄下,輸入
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
可以看到源碼目錄中有一個Readme.txt文件,該文件詳細說明了如何進行測試。
book@100ask:~/workspaces/sunxi-mpp/sample/sample_driverVipp$ cat Readme.txt
sample_driverVipp:
該sample演示直接調(diào)用linux內(nèi)核驅(qū)動獲取frame。按下ctrl+c,終止測試。
每隔若干幀保存一幀到指定的目錄。
讀取測試參數(shù)的流程:
sample只支持命令行模式輸入?yún)?shù)。如果不輸入?yún)?shù),會提示輸入。
從命令行啟動sample_driverVipp的指令:
./sample_driverVipp
或
./sample_driverVipp 0 1920 1080 8 60 0 10 60 /mnt/extsd
測試參數(shù)的說明:
(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總數(shù),0表示無限。
(7)store count: 指定保存的圖像數(shù)量。
(8)store interval: 指定保存圖像的周期,即每n幀圖像保存1幀。
(9)frame saving path: 指定保存圖像的目錄,該目錄要確保存在。
? 如果您想使用MPP進行開發(fā),編寫自己的應(yīng)用程序,請閱讀位于百度網(wǎng)盤資料中的100ASK_V853-PRO開發(fā)板的資料光盤中01_學(xué)習(xí)手冊/《100ASK-V853_Pro系統(tǒng)開發(fā)手冊》,該手冊中的第四篇 基礎(chǔ)組件開發(fā)中的第七章 Tina Linux 多媒體MPP 開發(fā)指南,此章節(jié)詳細說明了100ASK_V853-PRO開發(fā)板針對MPP 系統(tǒng)控制模塊的開發(fā)指導(dǎo)。
3.測試MPP應(yīng)用程序
測試MPP應(yīng)用程序需要增加開發(fā)板的依賴文件,該依賴文件位于sunxi-mpp/lib
目錄下,如下圖所示
![pYYBAGRdpOCAQpuCAADQyJW0AIM071.png](https://file.elecfans.com/web2/M00/A4/F3/pYYBAGRdpOCAQpuCAADQyJW0AIM071.png)
將該目錄下的全部文件拷貝到開發(fā)板的lib
目錄下,假設(shè)我使用TF卡將其拷貝到開發(fā)板上,將lib文件夾拷貝到TF卡中,在將TF插入100ASK_V853-PRO開發(fā)板上,掛載TF卡,輸入
root@TinaLinux:/# mount /dev/mmcblk1p1 /mnt/extsd/
掛載完成后進入TF目錄下
root@TinaLinux:/# cd /mnt/extsd/
root@TinaLinux:/mnt/extsd# ls
System Volume Information lib
可以看到lib
文件夾,將lib
目錄下的全部文件拷貝到開發(fā)板的lib
目錄下,輸入
root@TinaLinux:/mnt/extsd# cp lib/* /lib/
等待拷貝完成即可。
3.1 測試LCD上實時預(yù)覽攝像頭數(shù)據(jù)應(yīng)用程序
? 硬件要求:100ASK_V853-PRO開發(fā)板、4寸MIPI顯示屏、MIPI攝像頭。
? 示例名稱為:sample_virvi2vo
? 源碼路徑:sunxi-mpp/sample/sample_virvi2vo/
? 該示例演示了通過攝像頭獲取數(shù)據(jù)并實時顯示在LCD屏幕上,下面演示如何將編譯好的應(yīng)用程序在100ASK_V853-PRO開發(fā)板上運行。
? 編譯mpp擴展包后,會在sunxi-mpp/build/bin
目錄下生成sample_virvi2vo
文件,將生成的文件拷貝到TF卡上備用。
? 將sunxi-mpp/sample/sample_virvi2vo
目錄下的sample_virvi2vo.conf
拷貝到TF卡下備用。
? 將sunxi-mpp/lib
整個目錄拷貝到TF卡備用。
拷貝完成后,將TF卡插入100ASK_V853-PRO開發(fā)板后,將TF卡掛載到開發(fā)板上,輸入mount /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.
進入掛載目錄/mnt/extsd/
root@TinaLinux:/# cd /mnt/extsd/
查看對應(yīng)文件是否存在
root@TinaLinux:/mnt/extsd# ls
System Volume Information sample_virvi2vo
sample_virvi2vo.conf
運行測試程序,輸入./sample_virvi2vo -path ./sample_virvi2vo.conf
root@TinaLinux:/mnt/extsd# ./sample_virvi2vo -path ./sample_virvi2vo.conf
執(zhí)行完后,會在MIPI屏上實時顯示攝像頭獲取的圖像數(shù)據(jù)。
應(yīng)用程序執(zhí)行設(shè)定時間后會自動結(jié)束,也可以通過按下Crtl+C提前結(jié)束測試。
3.2 測試實時預(yù)覽人臉識別和人形識別應(yīng)用程序
? 硬件要求:100ASK_V853-PRO開發(fā)板、4寸MIPI顯示屏、MIPI攝像頭。
? 示例名稱為:sample_smartPreview_demo
? 源碼路徑:sunxi-mpp/sample/sample_smartPreview_demo
? 該示例演示了通過攝像頭獲取圖像數(shù)據(jù)后使用人臉模型或人形模型進行處理后,將打框后的結(jié)果實時顯示在LCD屏幕上,下面演示如何將編譯好的應(yīng)用程序在100ASK_V853-PRO開發(fā)板上運行。
? 編譯mpp擴展包后,會在sunxi-mpp/build/bin
目錄下生成sample_smartPreview_demo
文件,將生成的文件拷貝到TF卡上備用。
? 將sunxi-mpp/sample/sample_smartPreview_demo/models/fdet
目錄下的face.nb
人臉模型拷貝到TF卡中備用。
? 將sunxi-mpp/sample/sample_smartPreview_demo/models/pdet
目錄下的2.0.0_Gamma.nb
人形模型文件拷貝到TF卡中備用。
? 將sunxi-mpp/sample/sample_smartPreview_demo
目錄下的sample_smartPreview_demo.conf
參數(shù)文件拷貝到TF卡中備用。
拷貝完成后,將TF卡插入100ASK_V853-PRO開發(fā)板后,將TF卡掛載到開發(fā)板上,輸入mount /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.
進入掛載目錄/mnt/extsd/
root@TinaLinux:/# cd /mnt/extsd/
查看對應(yīng)文件是否存在
root@TinaLinux:/mnt/extsd# ls
2.0.0_Gamma.nb sample_smartPreview_demo
System Volume Information sample_smartPreview_demo.conf
face.nb
修改sample_smartPreview_demo.conf
文件,假設(shè)我這里使用的是百問網(wǎng)的4寸MIPI屏和2Line MIPI攝像頭,需要測試的是人臉識別模型,需要修改該文件為:
########### 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.
如果需要測試人形檢測,也需要修改sample_smartPreview_demo.conf
文件中的,將main_nn_nbg_type
設(shè)置為0、main_nn_nbg_file_path
設(shè)置為人形模型的路徑名稱,例如:
main_nn_nbg_type = 1
main_nn_nbg_file_path = "2.0.0_Gamma.nb"
運行測試程序:
root@TinaLinux:/mnt/extsd# ./sample_smartPreview_demo -path sample_smartPreview_demo.conf
執(zhí)行后,顯示屏端會接收攝像頭的數(shù)據(jù),但一開始會丟棄部分圖像數(shù)據(jù),可能會導(dǎo)致一開始的畫面卡頓。測試成功后會在顯示屏上實時顯示攝像頭的數(shù)據(jù),并可以對攝像頭的圖像中的人臉進行打框。
4.總結(jié)
? 對于其他應(yīng)用程序這里就不逐一去演示,大家可以參考每個示例的程序的Readme.txt或《全志MPP_sample_使用說明》進行測試體驗,參考《Tina Linux 多媒體MPP 開發(fā)指南》進行開發(fā)。MPP媒體處理平臺的可玩性和公開程度都適合大家去開發(fā)自己的應(yīng)用程序,希望通過這章節(jié)可以讓大家了解MPP的使用。
-
Linux
+關(guān)注
關(guān)注
87文章
11352瀏覽量
210547 -
AI
+關(guān)注
關(guān)注
87文章
31753瀏覽量
270543 -
媒體
+關(guān)注
關(guān)注
1文章
65瀏覽量
14467 -
開發(fā)板
+關(guān)注
關(guān)注
25文章
5137瀏覽量
98354 -
MPP
+關(guān)注
關(guān)注
0文章
24瀏覽量
10634
發(fā)布評論請先 登錄
相關(guān)推薦
1.100ASK_V853-PRO 環(huán)境配置及編譯燒寫
![1.100<b class='flag-5'>ASK_V853-PRO</b> 環(huán)境配置及編譯燒寫](https://file.elecfans.com/web2/M00/A4/01/poYBAGRbDdCASDpCAAD8vM6nc4U314.png)
2.100ASK-V853-PRO開發(fā)板支持WIFI和有線網(wǎng)卡
![2.100<b class='flag-5'>ASK-V853-PRO</b><b class='flag-5'>開發(fā)板</b><b class='flag-5'>支持</b>WIFI和有線網(wǎng)卡](https://file.elecfans.com/web2/M00/A4/0A/poYBAGRbPSGAK2nsAASRttIg-2k685.png)
3.100ASK_V853-PRO開發(fā)板支持七寸RGB屏
![3.100<b class='flag-5'>ASK_V853-PRO</b><b class='flag-5'>開發(fā)板</b><b class='flag-5'>支持</b>七寸RGB屏](https://file.elecfans.com/web2/M00/A4/8C/pYYBAGRbRjmAU6mRAAJP9fmA-qc811.png)
6.100ASK_V853-PRO開發(fā)板支持MIPI攝像頭
![6.100<b class='flag-5'>ASK_V853-PRO</b><b class='flag-5'>開發(fā)板</b><b class='flag-5'>支持</b>MIPI攝像頭](https://file.elecfans.com/web2/M00/A4/32/poYBAGRcTbaAeZuuAALAgVeFgKQ627.png)
9.100ASK_V853-PRO開發(fā)板支持E907小核開發(fā)
![9.100<b class='flag-5'>ASK_V853-PRO</b><b class='flag-5'>開發(fā)板</b><b class='flag-5'>支持</b>E907小核<b class='flag-5'>開發(fā)</b>](https://file.elecfans.com/web2/M00/A4/75/poYBAGRdpUGAYIkDAAKVeCYfPdA120.png)
12. 100ASK-V853-PRO開發(fā)板 MIPI屏測試指南
![12. <b class='flag-5'>100ASK-V853-PRO</b><b class='flag-5'>開發(fā)板</b> MIPI屏測試指南](https://file.elecfans.com/web2/M00/AD/13/pYYBAGSMES6AGP9xAA7T9bwlfXE611.png)
瑞芯微媒體處理軟件平臺(MPP)開發(fā)參考
【全志V853開發(fā)板試用】全志V853開發(fā)板試用測評報告
一鍵實現(xiàn)V853開發(fā)板攝像頭自由
【開源硬件大賽】基于全志V853設(shè)計的全功能BTB學(xué)習(xí)開發(fā)板
100ASK_全志V853-PRO開發(fā)板 環(huán)境配置及編譯燒寫
100ASK_全志V853-PRO開發(fā)板支持人形檢測和人臉識別
100ASK_V853-PRO開發(fā)板支持人形檢測與人臉檢測
![<b class='flag-5'>100ASK_V853-PRO</b><b class='flag-5'>開發(fā)板</b><b class='flag-5'>支持</b>人形檢測與人臉檢測](https://file1.elecfans.com/web2/M00/82/55/wKgaomRJ5YuAE6bvAACBLlLsIDA986.png)
評論