I optimized and enhanced the code to feed NPU with 4 streams (h264 1080p) to detect objects and scaled it down to fit in 1920x1080 display with a reasonable result.
The code runs in wayland/weston and keeping the CPU at low frequency and low Temp.
Realistically with the npu only 3 1080p30 video steams to get decent interfering at ~30/35 fps and that is with a dedicated core to each stream.
Biggest issue I’m finding with video decoding/npu/gpu isn’t the cpu usage but the thermals. With active cooling the temperatures are reasonable. However with passive cooling and processing 16+ streams the temperatures can easily progress towards 80 degrees (celsius). For embedded solutions we’d prefer passive cooling to avoid undue maintenance.
I need to clean up the code and a way to handle rtsp, and release the code. Not sure about the license or any possible patent issue. I will push it to github when done.
Updating the progress on this. h264 rtsp is working, h264 USB camera and h264 streams. Cleaning up the code. The code will be licensed under Apache 2.0.
For this to work you will need:
Desktop with HW acceleration
FFmpeg with HW decoding
SDL3 with HW acceleration for Rockchip
librga and kernel patched for > 4GB
Current limitations are:
H264 only
Wayland/Weston positional windows need SDL and Weston hacks, not provided but you can find the patches on Rockchip and SDL github.
rtmp may be released soon or you can modify the code and add support for it., it’s straightforward.
I will try to provide all instructions later.
SDL3 for ROCKCHIP
If you don’t have SDL3 working on your board, you need to build it from sources and make sure 3D accel works.
git clone https://github.com/libsdl-org/SDL --depth=1
cd SDL
mkdir sdl3
cd sdl3
cmake .. -DSDL_TESTS=1 -DCMAKE_BUILD_TYPE=Release
make -j8
sudo cmake --install . --prefix /usr/local
sudo ldconfig
Test it:
cd test/
./testgles2
You will see a spinning cube, when you exit you see the FPS, which should be 1000 ~ 3000, depending on the Desktop (X11 or Wayland). If you get ~ 300 it is software rendered, you missed some prerequisites for HW accel during the build.
screenshot for imx415 fisheye rtsp module and h264 USB camera without yolov5 inference on video.
Yeah, i think RGA outputs buf with padding, without padding it scrambles the result as i pointed out on the git encoder issue, i guess for the same reason.
yeah ok, i know rga is being a b**tch when converting RGB, currently i also dont have so much idea about that. So basically rga converts when it inputs from h264_rkmpp_decoder but not from hevc or vp8?
I have an FFmpeg that can convert it to YCbCr_420_P (i think it is I420, the one the ffplay uses) but it uses dst hstride and vstride, that’s what i mean by padding, but RGB_888 can’t be with padding.
I guess @mtx512rk had exactly the same problem, that is why only h264.