HAM modes suffer from fringing artefacts when transition between colors using traditional hold and modify. This proposal trades some colour resolution to improve the overall image quality by allowing more than one component of each pixels color to be modified. The E-HAM8 mode may be planar or chunky, instead of the initial byte for a pixel using two control bits it uses up to three. If the most significant two bits are 00 a color register lookup is performed using the 6 remaining bits to obtain a 24bit color from one of 64 color registers. If either or both of the two most significant bits are set the next bit becomes a control bit the remaining 5 bits are used to set the high bits of one of the 3 color components of the pixel (R, G or B) as determined by the pair of most significant control bits. The third control bit (0) determines if the next byte is treated as a normal HAM pixel or (1) an extended mode pixel pair. In extended mode the second byte of the pixel pair contains only one control bit, the most significant bit. This control bit determines which of the two remaining color components is modified by the 7 data bits in the byte. The highest 7 bits of that color component are set for both pixels and the other color component bits from the first pixel are all copied to the second pixel. In extended mode the third byte of the sequence uses two control bits and six data bits if the two most significant bits are 00 a color register look-up is performed using the remaining six bits and the previous pixels are not changed by this byte, extended mode is exited. If the control bits are 01 the six data bits are used to modify the most significant bits of the final color component but only for this (third) pixel all other color bits for the third pixel are carried over from the second pixel, the second and first pixel colors are not altered by the third byte. If the control bits are 10 the data bits are used in the final color component of both the third and second pixel, the final color component of the first pixel is not altered by the third byte. If the control bits are 11 all three pixels have their final color component altered by the data bits in the third byte. If either or both control bits were set it remains in extended mode and the next (fourth) byte behaves like the second byte (1 control bit choosing between the two components not modified by the previous byte and seven data bits). This sequence continues until the end of the scanline or a normal color register look-up leaves extened mode (two non-display dummy pixels may be needed at the end of each scanline to allow the look ahead for the final displayed pixel of the line. A pixel can't be output until any look ahead is complete, max two pixel delay). I haven't tested this in software yet or worked out any algorithms for converting a raw 24bit image to 64 base color pallet and processing to an E-HAM compressed image. If somebody has the time to test it in software on a 24bit display that would be great.
|