Hello,
* @warning The input buffer must be FF_INPUT_BUFFER_PADDING_SIZE larger than * the actual read bytes because some optimized bitstream readers read 32 or 64 * bits at once and could read over the end.
We don't currently do that, and this could theoretically yield segfaults.
While we're at it, the input buffer should be aligned on a 32bit boundary, and it should end with a 0.
copy the input buffer and pad it with zeroes, allows us to drop the gil
Please review the patch above (replacing 32 with 8... bits vs bytes, 64 vs 32!)
Looks fine to me, let's also try to get some numbers using the test script, I suspect this will improve parallelism which may be slightly detrimental to "client UI thread latency" (since this code runs in the UI thread)
Padding all pixel packets would be much more costly and impractical.
We would need to use posix_memalign
to ensure the memory is aligned:
int posix_memalign (void **memptr, size_t alignment, size_t size)
What does it need to be aligned to? 32bit? alignment=4
?
from ahuillet on irc: "align to 64 bits, align to sizeof(void *) - that's the best"
comparing FPS before and after patch
comparing client CPU usage before and after patch
applied in r973
As can be seen here: We can push roughly the same number of frames per second, with the exception of the 'gtkperf' test (which is pathological) and 'eruption' (not sure why).
More importantly, we do not adversely affect CPU usage, which is mostly unchanged (user CPU + system CPU shown):
comparing client UI thread latency before and after patch
Also, since we don't hold the gil as much as before, the client UI thread latency is improved in most cases (except for gtkperf - which can be ignored as it creates many small and short-lived windows, and glxgears - unsure why):
sample from the test results in raw csv format
Need to fix win32:
codec.obj : error LNK2019: \ unresolved external symbol _posix_memalign referenced in function \ ___pyx_pf_4xpra_4x264_5codec_7Decoder_6decompress_image_to_rgb
Here is the win32 equivallent called _aligned_malloc
this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/146