Closed wn2000 closed 2 months ago
See if fixing the casting helps between uint16_t and uint32_t
Hmmm so the pallete has 32770 colors it seems. It's as if some pixel has a color out of that range.
I've seen instances like that before, could try size_t.
While referencing mame2010, I found this. Seems like this is a known and accepted loss in the conversion?
// the accumulation buffer is always 8888
//
// the standard format for the framebuffer appears to be 565
// yes, this means colour data is lost in the conversion
While referencing mame2010, I found this. Seems like this is a known and accepted loss in the conversion?
// the accumulation buffer is always 8888 // // the standard format for the framebuffer appears to be 565 // yes, this means colour data is lost in the conversion
You are mixing up the concepts of color value and color index.
The palette in this case has 32770 (32768 + 2) color indices. Each color index corresponds to a full 8888 color value.
The process seems to be: For each pixel in the frame, get its color index, then look up the pallete to get the 8888 color, then convert that to 565 color (with an acceptable loss of fidelity).
The issue identified by ASAN, is that one pixel has a color index of 32771, when it should be within [0, 32769].
we could raise the palette length. Though it doesn't explain the extra 2.
RK3328 arm32 Linux, built with gcc 11.4.
ASAN log: