chromeos / cros-codecs

BSD 3-Clause "New" or "Revised" License
30 stars 11 forks source link

Remove the BackendData generic argument of VaapiBackend #41

Closed Gnurou closed 12 months ago

Gnurou commented 1 year ago

The BackendData generic argument of VaapiBackend has been introduced by the H.265 code, and is used exclusively by it.

It would be preferable (and more readable) to keep VaapiBackend codec-agnostic and remove that argumment. The H.265 BackendData has two members:

last_slice set and used in submit_last_slice and replace_last_slice. va_references set in handle_picture and used in decode_slice.

It should be possible to replace them by generic associated types of the H265 stateless backend, and have the H.265 decoder manage and pass them to the needed functions.

Gnurou commented 1 year ago

Hi @dwlsalmeida, keeping this small technical debt in mind so we can think about removing it once the H.265 code stabilizes a bit.

dwlsalmeida commented 1 year ago

At a first glance, I don't think V4L2 stateless actually uses these. Don't you think it's advantageous to have some space to save backend-specific data for a given codec?

Gnurou commented 1 year ago

If this can be avoided without complicating the API too much, then I think we should avoid it and keep the backend code simple. V4L2 could just ignore the information it doesn't need. But let me reconsider now that the H.265 code is in a more complete state.