Re: Stateless Encoding uAPI Discussion and Proposal

From: Hsia-Jun Li
Date: Thu Aug 31 2023 - 05:32:45 EST




On 8/30/23 23:18, Nicolas Dufresne wrote:
CAUTION: Email originated externally, do not click links or open attachments unless you recognize the sender and know the content is safe.


Le mercredi 23 août 2023 à 11:04 +0800, Hsia-Jun Li a écrit :
It was suggested so far to leave h264 slice headers writing to the driver. This
is motivated by H264 slice header not being byte aligned in size, so the
H.264, H.265 has the byte_alignment() in nalu. You don't need skip bits
feature which could be found in H1.

As you said so, I rechecked the H.264 grammar.

...
slice_header( )
slice_data( )
...

There is lot of variable size items in the slice_header() syntax and no padding
bits. And no padding at the start of any of the slice_data types. So no, the
slice_header() syntax in H.264 is not byte aligned like you are claiming here.
Its important to be super accurate about these things, as it will cause errors
to be made. Please always double check.
To make a summary of the IRC.
H.264 and VP8 have no such alignment to byte padding bits.
While H.265 has that in 7.3.6.1 General slice segment header syntax.
Also, from 6.1 Frame syntax of AV1, I think frame_header_obu contains all the thing that software should prepare for a stateless encoder.
VP9 also has the trailing_bits() after uncompressed_header() (6.1
Frame syntax) would meet the byte alignment.

We may suggest we could use the hardware write-back or write offset bit functions which could be widely existed due the non-alignment bitstream syntax of the H.264 and VP8.

With such a hardware capability, we could save a cache operation than doing that in the kernel.

Nicolas

--
Hsia-Jun(Randy) Li