Difference between revisions of "VPU"

From FriendlyELEC WiKi
Jump to: navigation, search
(updated by API)
 
(updated by API)
Line 5: Line 5:
 
Tested on the following OS:
 
Tested on the following OS:
 
====Debian11 (bullseye)====
 
====Debian11 (bullseye)====
* rk3588-sd-debian-bullseye-desktop-6.1-arm64-20240116.img.gz
+
* rk3588-sd-debian-bullseye-desktop-6.1-arm64-20240117.img.gz
 
* rk3568-sd-debian-bullseye-desktop-6.1-arm64-20231113.img.gz
 
* rk3568-sd-debian-bullseye-desktop-6.1-arm64-20231113.img.gz
 
====Ubuntu20 (focal)====
 
====Ubuntu20 (focal)====
 
* rk3588-sd-ubuntu-focal-desktop-6.1-arm64-20240116.img.gz
 
* rk3588-sd-ubuntu-focal-desktop-6.1-arm64-20240116.img.gz
===Re-compile mpp (optional)===
+
====Buildroot====
 +
* rk3588-sd-buildroot-5.10-arm64-20240117.img.gz
 +
===Re-compile mpp on debian/ubuntu (optional)===
 +
On the target board:
 
<syntaxhighlight lang="text">
 
<syntaxhighlight lang="text">
 
sudo apt update
 
sudo apt update
Line 26: Line 29:
 
sudo cp mpi_dec_test /usr/local/bin/mpi_dec_test
 
sudo cp mpi_dec_test /usr/local/bin/mpi_dec_test
 
sudo cp mpi_enc_test /usr/local/bin/mpi_enc_test
 
sudo cp mpi_enc_test /usr/local/bin/mpi_enc_test
 +
</syntaxhighlight>
 +
 +
===Re-compile mpp on buildroot (optional)===
 +
On the Host PC:
 +
<syntaxhighlight lang="text">
 +
export PATH=/path/to/your/buildroot-rk3588/buildroot/output/rockchip_rk3588/host/bin/:$PATH
 +
cd buildroot-rk3588/external/mpp/build/linux/aarch64
 +
sed -i 's/aarch64-linux-gnu-gcc/aarch64-linux-gcc/g' ./arm.linux.cross.cmake
 +
sed -i 's/aarch64-linux-gnu-g++/aarch64-linux-g++/g' ./arm.linux.cross.cmake
 +
./make-Makefiles.bash
 +
make -j$(nproc)
 +
cd test
 +
</syntaxhighlight>
 +
Go to the mpp directory and copy librockchip_mpp.so.0 to the target board:
 +
<syntaxhighlight lang="text">
 +
wget http://YourIP/files/mpp/librockchip_mpp.so.0 -O /usr/lib/librockchip_mpp.so.0
 +
</syntaxhighlight>
 +
Go to the test directory and copy mpp_info_test,mpi_dec_test,mpi_enc_test to the target board:
 +
<syntaxhighlight lang="text">
 +
wget http://YourIP/files/mpp/mpp_info_test -O /usr/bin/mpp_info_test
 +
wget http://YourIP/files/mpp/mpi_dec_test -O /usr/bin/mpi_dec_test
 +
wget http://YourIP/files/mpp/mpi_enc_test -O /usr/bin/mpi_enc_test
 
</syntaxhighlight>
 
</syntaxhighlight>
  

Revision as of 10:11, 17 January 2024

查看中文

1 How to test VPU

1.1 OS

Tested on the following OS:

1.1.1 Debian11 (bullseye)

  • rk3588-sd-debian-bullseye-desktop-6.1-arm64-20240117.img.gz
  • rk3568-sd-debian-bullseye-desktop-6.1-arm64-20231113.img.gz

1.1.2 Ubuntu20 (focal)

  • rk3588-sd-ubuntu-focal-desktop-6.1-arm64-20240116.img.gz

1.1.3 Buildroot

  • rk3588-sd-buildroot-5.10-arm64-20240117.img.gz

1.2 Re-compile mpp on debian/ubuntu (optional)

On the target board:

sudo apt update
sudo apt install gcc g++ cmake make
cd ~
git clone https://github.com/friendlyarm/mpp
    # Or git clone https://github.com/rockchip-linux/mpp.git
cd mpp/build/linux/aarch64/
sed -i 's/aarch64-linux-gnu-gcc/gcc/g' ./arm.linux.cross.cmake
sed -i 's/aarch64-linux-gnu-g++/g++/g' ./arm.linux.cross.cmake
./make-Makefiles.bash
make -j$(nproc)
sudo make install
cd test
sudo cp mpp_info_test /usr/local/bin/mpp_info_test
sudo cp mpi_dec_test /usr/local/bin/mpi_dec_test
sudo cp mpi_enc_test /usr/local/bin/mpi_enc_test

1.3 Re-compile mpp on buildroot (optional)

On the Host PC:

export PATH=/path/to/your/buildroot-rk3588/buildroot/output/rockchip_rk3588/host/bin/:$PATH
cd buildroot-rk3588/external/mpp/build/linux/aarch64
sed -i 's/aarch64-linux-gnu-gcc/aarch64-linux-gcc/g' ./arm.linux.cross.cmake
sed -i 's/aarch64-linux-gnu-g++/aarch64-linux-g++/g' ./arm.linux.cross.cmake
./make-Makefiles.bash
make -j$(nproc)
cd test

Go to the mpp directory and copy librockchip_mpp.so.0 to the target board:

wget http://YourIP/files/mpp/librockchip_mpp.so.0 -O /usr/lib/librockchip_mpp.so.0

Go to the test directory and copy mpp_info_test,mpi_dec_test,mpi_enc_test to the target board:

wget http://YourIP/files/mpp/mpp_info_test -O /usr/bin/mpp_info_test
wget http://YourIP/files/mpp/mpi_dec_test -O /usr/bin/mpi_dec_test
wget http://YourIP/files/mpp/mpi_enc_test -O /usr/bin/mpi_enc_test

1.4 Check mpp version

mpp_info_test
tail /var/log/messages

1.5 Test hardware video decoding

wget http://112.124.9.243/test/200frames_count.h264 -O 200frames_count.h264
mpi_dec_test -t 7 -i 200frames_count.h264
tail /var/log/messages

1.6 Test hardware video encoding

Encoding nv12 video streams to h264:

wget http://112.124.9.243/test/4k_nv12.yuv.tar.gz -O 4k_nv12.yuv.tar.gz
tar xzf 4k_nv12.yuv.tar.gz
mpi_enc_test -w 3840 -h 2160 -t 7 -i 4k_nv12.yuv -f 0 -o 4k_nv12.h264
tail /var/log/messages

Packaged as playable mp4 file:

ffmpeg -i 4k_nv12.h264 -vcodec copy -f mp4 4k_nv12.mp4

Note: The above video stream file 4k_nv12.yuv was grabbed on the T6 via HDMI-In with the following command:

v4l2-ctl  -d /dev/video0 --set-fmt-video=width=3840,height=2160,pixelformat='NV12' --stream-mmap=4 --stream-skip=10  --stream-to=/tmp/4k_nv12.yuv --stream-count=240 --stream-poll