-
Notifications
You must be signed in to change notification settings - Fork 11
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
decoder: h264: Use Cow instead of slice #66
base: main
Are you sure you want to change the base?
Conversation
I tested the changes using fluster and there seems to be no effect on the test results |
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.
Looking good, a few comments inline. Having CL descriptions shortly explain what happens in the CL would also make reviews easier imho.
src/codec/h264/nalu.rs
Outdated
offset: nalu_offset, | ||
sc_offset: start_code_offset, | ||
offset: nalu_offset - start_code_offset, | ||
sc_offset: 0, |
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.
This looks unrelated to the switch to Cow
. Actually, this looks more like it should be part of the next commit that removes sc_offset
?
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.
Yeah, It it was related to the comment below. But I've moved to the next commit.
src/utils.rs
Outdated
let end = n.offset + n.size; | ||
&n.data[start..end] | ||
}) | ||
.ok() |
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.
Same here, this should be unrelated to using Cow
IIUC.
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.
Unfortunately it is
error[E0515]: cannot return value referencing local data `n.data`
--> src/utils.rs:175:17
|
175 | &n.data[start..end]
| ^------^^^^^^^^^^^^
| ||
| |`n.data` is borrowed here
| returns a value referencing data owned by the current function
I've moved slicing the bitstream to a separate commit, however before that commit this slicing had to be handled separately for Cow::Owned
, like it is now.
src/utils.rs
Outdated
let start = n.sc_offset; | ||
let end = n.offset + n.size; | ||
&n.data[start..end] | ||
}) |
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.
Same.
39c9a51
to
3039f54
Compare
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.
Thank you @Gnurou for the review! Hopefully it's better now 😁
src/utils.rs
Outdated
let end = n.offset + n.size; | ||
&n.data[start..end] | ||
}) | ||
.ok() |
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.
Unfortunately it is
error[E0515]: cannot return value referencing local data `n.data`
--> src/utils.rs:175:17
|
175 | &n.data[start..end]
| ^------^^^^^^^^^^^^
| ||
| |`n.data` is borrowed here
| returns a value referencing data owned by the current function
I've moved slicing the bitstream to a separate commit, however before that commit this slicing had to be handled separately for Cow::Owned
, like it is now.
src/codec/h264/nalu.rs
Outdated
offset: nalu_offset, | ||
sc_offset: start_code_offset, | ||
offset: nalu_offset - start_code_offset, | ||
sc_offset: 0, |
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.
Yeah, It it was related to the comment below. But I've moved to the next commit.
So unfortunately I am getting test failures on AMD when
Possibly AMD doesn't like slice arrays? That would be quite an issue... |
Pushed the first 3 commits (and an update to cros-libva so build passes on the PR) - let's see if we can figure out the AMD issue... |
This changes is necessary for the next change, that will require picture to contain copies of slices.
With this commit the chromeos#44 is fixed. It is achieved by submitting multiple slices of one picture using a single slice data buffer and all slice parameters using a single buffer with multiple elements.
Yeah, I can confirm the AMD does not like slice arrays (source). Assert fails on debug mesa. |
I'm wondering the reason for this limitation - tried to look at related issues on Gitlab, but could not find a matching one. Maybe we should open a bug? |
When I briefly looked at the code it seemed if I understand it correctly, the slice data is submitted to the hw on vaRenderBuffer, so I think it's just a design choice. I wonder how other users approaches this issue and if it is an Intel driver issue. I tried running ToT ccdec with video generated using
Nevertheless I think it could be worth it |
Fixes #44
Partially address #49
Relies on chromeos/cros-libva#10