If we only can replace cca. 8 colour per scanline, then we have to quantize by the following algorithm: we have to quantize to maximum 32 colours per line and pair up the two palettes of the current and previous line by searching the closest colour in the previous scanline colours for all current scanline colours. After this, we have to find the 8 most distant pairs and those colours will be replaced, the rest will be untouched. Unless we're not quantizing a picture which will have entirely different palettes per line, then it will be okay. By this method, we can get 32 + (height - 1) * 8 colours, for example 1624 colour in a 200 pixel tall image. But still, if the colours which fallen out from the list of 8 most distant are also very distant, then the image will be completely ruined.
Or we can do a little different thing. We quantize per line, but we quantize two lines at once. (Except for the last line of course.) Like this: quantize(image, 0, 0, 319, 1) quantize(image, 0, 1, 319, 2) quantize(image, 0, 2, 319, 3) ... quantize(image, 0, 198, 319, 199) quantize(image, 0, 199, 319, 199)
With this method we can do dithering too.
However, what viewers or programs actually support PCHG?
Last edited by jsr; 03 May 2015 at 11:47.
Reason: aa PCHG