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

David Reyes Samblas Martinez david at tuxbrain.com
Thu Apr 28 10:30:38 EDT 2011


Werner? it reach 640x480?? amazing :) , just free some cpu cicles to
be able to load some bitmaps in secuence and we have another cool use
as really portable presenter... wow
Clap clap clap , once sharped is a really cool addon for Ben to produce :)


2011/4/28 David Kuehling <dvdkhlng at gmx.de>:
>>>>>> "Werner" == Werner Almesberger <werner at almesberger.net> writes:
>
>> ubb-vga2 has learned a few new tricks: First of all, it can now
>> generate a test image (ubb-vga2 -t), which looks like this:
>
>> http://downloads.qi-hardware.com/people/werner/ubb/vga/ubb-vga2-tstimg.jpg
>
> Werner, you're a genious.  Zooming into the image, I can't see see any
> dithering.  How did you manage that many colors?
>
>> The test image reveals a number of bugs:
>
>> The diagonal lines should cross exactly at the edge of the display
>> area. We can see that a few pixels are missing on the left and at the
>> bottom. The top is good but hard to see in this picture. The smears on
>> the right are just stale data.
>
>> This test image also shows that the new board has twice the number of
>> colors: a lavish 16 of them !
>
>> The horizontal timing jitters by about one pixel time, which makes the
>> small text on the color bar difficult to read. There is also a
>> distortion at the top, which indicates that the beginning of the frame
>> is not exactly synchronized with the rest.
>
>> The next improvement is better color mapping. I originally used a
>> simple threshold-based algorithm that would only consider one channel
>> a time and that didn't know of the new luminance channel.
>
>> The new algorithm assigns a position in the RGB color cube for each
>> screen color and then searches for the closest color for every
>> pixel. I'll let the result speak for itself:
>
> 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, quickly precumputed by using a
> 3-dimensional floodfill algorithm [1].  Allegro gives you a bitmap data
> type [2] that allows lowlevel access to bitmap memory, so maybe you could
> directly use that.
>
> Allegro's blit() [3] routine can copy between bitmaps of diffferent color
> depth, optionally doing dithering.  There's also stretch_blit() for
> scaling (albeit without interpolation?).  Allegro only supports
> 8-bit-per-pixel in paletted modes, but if you just set 256-16 colors to
> black, there shouldn't be a problem.  All of this is pretty optimized
> code.
>
> Plus you already have code for loading files into bitmaps (bmp, tga or
> pcx).
>
> cheers,
>
> David
>
> [1] http://alleg.sourceforge.net/latestdocs/en/alleg021.html#bestfit_color
> [2] http://alleg.sourceforge.net/latestdocs/en/alleg001.html#BITMAP
> [3] http://alleg.sourceforge.net/latestdocs/en/alleg014.html#blit
> --
> GnuPG public key: http://user.cs.tu-berlin.de/~dvdkhlng/dk.gpg
> Fingerprint: B17A DC95 D293 657B 4205  D016 7DEF 5323 C174 7D40
>
> _______________________________________________
> Qi Hardware Discussion List
> Mail to list (members only): discussion at lists.en.qi-hardware.com
> Subscribe or Unsubscribe: http://lists.en.qi-hardware.com/mailman/listinfo/discussion
>



-- 
David Reyes Samblas Martinez
http://www.tuxbrain.com
Open ultraportable & embedded solutions
Ben NanoNote, Arduino, Openmoko
Hey, watch out!!! There's a linux in your pocket!!!




More information about the discussion mailing list


interactive