ImageContentDecoder class
#include <Jazz2/Compatibility/JJ2Anims.h>
Incremental decoder for the image content written by WriteImageContent.
Keeps the decoder state between calls, so an image can be read a band of rows at a time into separate buffers instead of one allocation the size of the whole sheet - which for the larger tilesets is close to a megabyte, the single biggest block the game asks for, and the first one to fail on a console heap that a previous level has already fragmented. The bands have to be decoded in order and together cover exactly width * height pixels.
Constructors, destructors, conversion operators
Public functions
-
void Decode(Stream& s,
std::
uint8_t* data, std:: int32_t pixelCount, std:: int32_t channelCount) - Decodes the next
pixelCountpixels of the image intodata. -
void Decode(const std::
uint8_t*& src, const std:: uint8_t* end, std:: uint8_t* data, std:: int32_t pixelCount, std:: int32_t channelCount) - Decodes the next
pixelCountpixels from an in-memory copy of the content, advancingsrc.
Function documentation
void Jazz2:: Compatibility:: JJ2Anims:: ImageContentDecoder:: Decode(const std:: uint8_t*& src,
const std:: uint8_t* end,
std:: uint8_t* data,
std:: int32_t pixelCount,
std:: int32_t channelCount)
Decodes the next pixelCount pixels from an in-memory copy of the content, advancing src.
Reading past end yields zero bytes. A byte read from memory is a load; through a stream it is a virtual call per byte, which on the consoles' in-order CPUs was most of the decode.