ubb-vga version 2, more image sources and better color mapping

Werner Almesberger werner at almesberger.net
Thu Apr 28 10:37:47 EDT 2011

David Kuehling wrote:
> Werner, you're a genious.  Zooming into the image, I can't see see any
> dithering.  How did you manage that many colors?

Here's the circuit:

Each color channel gets a signal level that has about 2/3 from the
respective binary color channel plus a shared binary luminance value
that contributes 1/3 of the level.

The board isn't very difficult to make. If you look at
R5-R7 are soldered SMT-style to the UBB contacts. I placed R8-R10
directly underneat the board, soldered in the same way. (They just
need a bit more heat, because they're soldered to the ground plane.)

R3 crosses from "blue" all the way to Y. I then soldered R1 and R2
to the long leg of R3. Last but not least, R4 is soldered SMT-style

To minimize mechanical strain during assembly, I combined the three
resistor triplets by twisting their VGA-side wires together. Then I
soldered them to UBB and finally added solder on the VGA side, too.
I did this last so that I would still have some wiggle room when
working on the UBB side.

> You might want to have a look at the color lookup code used in the
> allegro game library (alleg.sf.net).  They used a 2^5 x 2^5 x 2^5 lookup
> table for RGB -> palette color mapping,

Ah, very good. Yes, that sounds useful. Right now, I iterate
through all 16 possible values and compute the (squared) distance
within the RGB cube. It doesn't really take all that much time,
but it can't hurt to make this more efficient.

> Plus you already have code for loading files into bitmaps (bmp, tga or
> pcx).

Oh, implementing the few simple things I need for my tests probably
takes less time than even matching APIs and sorting out library
dependencies would :-) Besides, I had the PPM loader already.

- Werner

More information about the discussion mailing list