We still get this warning on both server and client:
[swscaler @ 0x2f4c200] Warning: data is not aligned! This can lead to a speedloss
get_rgb_rawdata
:
pixbuf.get_from_drawable(pixmap, pixmap.get_colormap(), x, y, 0, 0, width, height)
So here, the best solution is probably to just bypass gtk's pixmap/pixbuf and use the raw X11 drawable, hopefully this will be aligned... and if not, we can copy it just once.
memcopy the pixel data so it is memaligned before we do the colourspace conversion
For the client, it looks like there is another solution, at least when we build ffmpeg ourselves (osx, static centos builds - and maybe even win32 if we wanted to, although this one is likely to be tedious and time consuming: ffmpeg win32 tutorial):
./configure --enable-memalign-hack (...)
Note, the docs apparently say (from this cvslog message):
docs: Don't recommend adding --enable-memalign-hack
But this does not seem to work IMO, otherwise, we are we getting all those warnings still?
See also #168
Another solution for the non-GL rendering case is to use ffmpeg's CODEC_CAP_DR1
feature:
with overridden get/release_buffer() (needs CODEC_CAP_DR1) the user decides into what buffer the decoder decodes and the decoder tells the user once it does not need the data anymore, the user app can at this point free/reuse/keep the memory as it sees fit
Then we can use our xmemalign
to do the memory allocation in:
int (*get_buffer)(struct AVCodecContext *c, AVFrame *pic); void (*release_buffer)(struct AVCodecContext *c, AVFrame *pic);
I've looked at the code and ffmpeg allocates memory aligned to 8 bytes and swscale wants it aligned to 16... dumb really. And duplicating all the code in the default get_buffer
implementation just to change this alignment would be overkill/bug-prone.
Let's ignore it and rely on accelerated yuv rendering instead.
More info: although the buffer stuff will get solved (at least for the client side, when going from the video decoder to the csc) by #345, this won't solve our problems because this warning comes from the rowstride... which is dictated to us by the X11 server when we create the XImage
...
this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/159