Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fast restride and xor in cython #839

Closed
totaam opened this issue Apr 19, 2015 · 2 comments
Closed

fast restride and xor in cython #839

totaam opened this issue Apr 19, 2015 · 2 comments

Comments

@totaam
Copy link
Collaborator

totaam commented Apr 19, 2015

Follow up from #465, we should provide an optional image wrapper function to restride and xor in one pass. (and maybe even do the byte swapping to RGB?)
This would be used by the rgb_encode to speed things up significantly, especially when we can / should xor the whole image buffer (ie: when shadowing a display and using a non-video encoding).

Bonus points if we can take advantage of realloc to do things in-place. Though I doubt this would be useful for the common case: when using an xshm image, we may not be allowed to write to it? or if we are, it would require extra work to ensure it does not get freed until after the packet has been sent... (or we could just force compression to ensure the buffer is consumed before we free the image)

Also, it's a shame that we cannot feed the data to lz4 one image row at a time, or we could then even combine restriding, xor, byteswapping and compression in one pass!

Another idea that just came up: the ability to provide the target buffer as an optional argument could be used with encoders like nvenc to copy directly into their input buffer as part of the restriding.

@totaam
Copy link
Collaborator Author

totaam commented May 4, 2015

memoryview was enabled by default for 0.16 in r9223.

The restride is now done as an optional method on the image wrapper class, only implemented for the ximage wrapper (also used by xshm image wrapper): done in r9235.

Looking at the other codepaths, they're all either fairly uncommon or cheap enough already. The only case that may warrant more work is the shadow servers: those don't use the x11 image wrapper and call get_rgb_rawdata.

@totaam
Copy link
Collaborator Author

totaam commented Sep 16, 2015

X11 shadow servers now use xshm to capture pixels (see #899 and r10246) so they will take advantage of this new code too.

This will do for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant