jpeg: reconstruct baseline bitstream for NVDEC#422
Conversation
|
There's a lot of code to go through there. The first issue I can see is the JPEG context handling. I realise you need to keep track of things and we don't really have a good place to store them (we had this issue with one of the other codecs). I think we can add a void* codecData to the NVContext struct. That should be specific to just this decoder instance, and you can put your JPEGContext in there. The other issue is the mixed usage of 'uintxx_t' style declarations and 'int/unsigned int' style. We should stick to just uintxx_t style for new code. |
|
I've reviewed this again (with the help of AI), and the one thing it's thrown up that should probably be fixed is the JPEGContext isn't reset between images. So values set in say validQuantTablesMask one image, would be carried over to the next image. We should probably just memset the whole context to 0 for each image. |
Rebuild a minimal JFIF stream from VA-API JPEG buffers (PicParam/IQMatrix/DHT/Slice) and submit it to NVDEC as a single slice. Validate slice bounds and fall back to standard Huffman tables when VA tables are missing/invalid.
|
Ok, I think we can merge this in now. Thanks for the patch. |
Description
Previously, the JPEG codec was essentially unusable due to a structural mismatch: VA-API provides JPEG data as separate buffers (picture params, quant tables, Huffman tables, slice params/data), whereas NVDEC expects a fully formed JPEG bitstream.
To fix this, this implementation reconstructs a minimal JFIF stream directly from the VA-API buffers (SOI/APP0/DQT/SOF0/DHT/[optional DRI]/SOS + entropy data + EOI) before handing it off to NVDEC.
Implementation Details
VA_SLICE_DATA_FLAG_ALL.Testing
Known Limitations
restart_intervalis provided, it doesn't currently insert RST markers into the entropy stream.