LED-11. Make a very big size 384 X 512 RGB Matrix #5

 In the previous post, the LED player using Python failed to process the image packet transmitted through UDP at high speed.
An error occurred in the 30 FPS processing. To dramatically improve performance, this time I will port our Python code to C/C++. It is expected that performance improvement of several to tens of times is possible.

 

 Porting Python code to C/C++

 Henner Zeller's rpi-rgb-led-matrix library was originally written for C/C++. Therefore, it is not difficult to port Parison code. And image packet reception using UDP communication can also be easily implemented using C/C++ socket communication.

 Since the length of the code is quite long and it is divided into several source codes, I will not introduce the code in the main body.

 I will put the source code on GitHub for those who need it to download.

 C/C++ programs are available with two options. The first is to receive packets, assemble and update the LED display all in one thread. And the second is that one thread is responsible for receiving and assembling packets and the second thread is responsible for updating the display. Perhaps the performance of the second method is expected to be twice as good.

 

 single-threaded

 Set the following values in the global.h file in the source code to 0.

#define THREAD_USE 0

 And completely rebuild the source code.

make clean
make

 

 The following is the result of using a program built in a single-threaded method.


 The LED server is transmitting the display image at 32FPS.
The player shows the ability to handle more than about 55 FPS. And the "Reshape Error" message doesn't happen either. This is enough for stable use at 30 FPS. It shows about twice the performance of existing Python programs.

 

 

multi-threaded

This time, after changing the THREAD_USE value of the global.h file to 1, build a new one and then test.

 

#define THREAD_USE 1

 And completely rebuild the source code.

make clean
make

 

The following is the result of using a program built in a multi-threaded method.

 


 The LED server transmits images at 32FPS as before.
The player shows the ability to handle 180FPS ~ 200FPS. This value is about 10 times the performance of the previous Python. With this level of performance, there is no problem at all in handling high FPS values.

Here is the last tested image. The white line in the picture is invisible to the real human eye.

And this test set pwm_bits = 10. If this value is lowered, the refresh rate can be increased, but the image quality is deteriorated.


Wrapping up

I successfully made a 384X512 LED sign using Henner Zeller's rpi-rgb-led-matrix library.
By applying the contents of this article, you can easily make a larger-sized electric sign board. You will probably need more Raspberry Pis.

The source code can be downloaded from my Gitgub.



 

 

 

 

 

 

 

 

댓글

이 블로그의 인기 게시물

LED-12. Displaying HDMI Contents

LED - 5. Raspberry Pi 4 + DietPi Buster + Electrodragon HAT - Part 1

LED-11. Make a very big size 384 X 512 RGB Matrix #6(final)