neatvnc icon indicating copy to clipboard operation
neatvnc copied to clipboard

use memcpy if pixel format is the same

Open agners opened this issue 5 years ago • 2 comments

Use memcpy if the pixel format of source and destination is the same. This improves performance of raw encoding significantly in my test case with Weston.

agners avatar May 22 '20 19:05 agners

The problem here is that if bytes_per_cpixel = 3 and the pixel format is xRGB or xBGR big endian, then this breaks because VNC has this special "compact pixel" format that discards the unused byte when the depth = 24 bits and bits-per-pixel = 32 bits.

This function is written in such a way that it can be auto-vectorized. If you set --buildtype=release and with x86_64-simd in meson_options.txt set to avx2, you should get significant performance improvements.

However, keep in mind that it is fairly uncommon for clients to choose raw encoding, so optimising this particular function is probably not very good use of your time as it is definitely not going to be the tightest bottleneck when using tight or zrle encoding.

If you want to have a chat about performance and optimisation, drop by #wayvnc on freenode.

any1 avatar May 22 '20 20:05 any1