Overview Features Coding ApolloOS Performance Forum Downloads Products Order Contact

Welcome to the Apollo Forum

This forum is for people interested in the APOLLO CPU.
Please read the forum usage manual.
Please visit our Apollo-Discord Server for support.



All TopicsNewsPerformanceGamesDemosApolloVampireAROSWorkbenchATARIReleases
Information about the Apollo CPU and FPU.

Proposal for Extended HAM8 Mode

Ian Parsons

Posts 230
25 Sep 2016 19:48


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.


Gunnar von Boehn
(Apollo Team Member)
Posts 6214
26 Sep 2016 09:48


Hi,

Can you explain what is the main goal of such mode would be?
a) Save DMA bandwidth
b) Save main memory
c) Save Disk space

If you compare this mode for example with 24bit YUV in 4:2:0
or with 18bit YUV in 4:2:0  - where would you see its advantages /disadvantages?



Nixus Minimax

Posts 416
26 Sep 2016 10:28


HAM was great in its day but has been superseded for a long time. There are nice 16 bit chunky YUV modes where two pixels share red and blue chroma. These modes half the data volume while maintaining excellent image quality. HAM8 requires half that much space but has severe limitations. Extending HAM will make its memory footprint get closer to that of the aforementioned YUV mode. At what cost?

The biggest problem I see with your proposal is that you can't access pixels individually according to their coordinates because you can't know how many extended pixels there were infront of them. You would always have to scan through the entire image data from the beginning to find your pixel.



Enrique Martos

Posts 27
27 Sep 2016 18:10


Ian Parsons wrote:

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.
  ....

Someone similar to DCTV or Ham-E emulator, it's sound good for use this libraries with some old graphic and render apps. DVTV and HamE are supported by lot of classic apps.

posts 4