-
Notifications
You must be signed in to change notification settings - Fork 776
Add VA-API JPEG decoder again #563
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
Conversation
|
@christiankerl I implemented your original idea of memory pool of size 2. As I expected, this is tricky to get right across multiple threads, as there is no explicit guarantee (there are some implicit conditions, but easy to get wrong) that the frame will be freed before the next allocation. I used your design such that a potential future improvement of zerocopy between processors and frame listeners can be done in similar ways without changing the API. @rastaxe @tlind @guanchar The VAAPI feature is now ready for merge. Can you give it a run, and I'll merge it next week. Note that there seems to be some performance regression between kernel 3.19 and 4.x. |
| return new VTRgbPacketProcessor(); | ||
| #elif defined(LIBFREENECT2_WITH_VAAPI_SUPPORT) | ||
| RgbPacketProcessor *vaapi = new VaapiRgbPacketProcessor(); | ||
| if (vaapi->good()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you add a factory method to VaapiRgbPacketProcessor like tryCreate, which returns true if vaapi is available and false otherwise, depending on this you choose the code path here. this would avoid extension of the packetprocessor api with the good() method which is only used here (as far as I can see)?!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could. I am thinking of adding check against errors in packet processors. Errors can happen anytime at runtime in packet processors. Once errors happen, there should be a way to report this to the user. Something outside of packet processors needs the check for the error state. I chose the interface as PackteProcessor::good(). What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, didn't know this
|
did you try the allocator stuff with your cuda depth processor? just want to see if the api is sufficient or needs more changes. |
|
I had not. I have been cleaning up the cuda series since yesterday. |
|
v6:
Major changes, need retesting. |
|
v7: Cosmetic |
|
I tried it with cuda processor. The API is OK. |
|
v8: Fixed a memory leak in |
It was somehow protected accidentally.
|
v9: Changed PoolAllocator can allocate in the same thread at most twice, then the next allocate() will block until free()'d by another thread (but this won't happen between stream parsers and processors - this blocking is intended for between processors and frame listeners). |
Provide memory-mapped packet buffers allocated by VA-API to the RGB stream parser to save a 700KB malloc & memcpy. Reuse decoding results from the first JPEG packet for all following packets, assuming JPEG coding parameters do not change based on some testing.
Previous attempt: #210 (including performance numbers)
Now tested with each commit tested on Debian/Ubuntu.
abigailreports some "indirect sub-type change" ofPacketPipeline::comp_. Actual testing using old Protonect with new libfreenect.so works. I consider this OK, unless any ABI experts point out the problem.Interestingly there is a performance regression from kernel 3.19 (230Hz) to 4.2 (160Hz) without userspace change. The kernel performance regression is fixed in torvalds/linux@f87a780 (4.4-rc7). For Ubuntu kernels, 4.2.0-28.33~14.04.1, or 4.4+ have this fixed. Kernels of 4.0 or earlier are not affected.