You are on page 1of 15

Augmenting perceived

color depth with simple


hardware logic.

“ART001”
By Laxer3A

1
Why we need more colors ?
„PProcessing
i power, pin i count,t memory…
„ Everything increase, even in hobby electronic.
„ But most of the FPGA boards out there just
plain sucks to do nice 888 output.
„ “low end” (100$~500$)
$ $
„ Most of the time RGB111, 323, 333, etc...
„ “Middl
“Middle-end”
d” (500$
(500$~1000$)
1000$)
„ RGB 555 / 565, some 888 but not the other
feature you want.
want
„ “High-end” (>1000$)
„ RGB888 10-10-10
RGB888,10 10 10 and DVI
DVI, but
but… 2500$ ?
2
How do we simply display high colors
data on poor color depth displays.
MSB LSB
7 6 5 4 3 2 1 0

We simply take the MSB


MSB LSB
And ignore the LSB.
7 6 5 4 3 2 1 0

555 Bit display

3
Ok now what ?
Ok,
„ Well we could average a color value by
the neighbor pixels (known as “dithering”)
7 6 5 4 3 2 1 0 Use the unused LSB, if “1”, the color
can be “averaged”.

555 Bit display

Ex. Value is 37 (100101) for a group of 4 pixels.


Thus RGB555 : 10010 (A (A=18)
18) A B (2A+2B)/4
But we can also use A+1 : 10011 (B=19) B A ÆA+B/2
And display them in the following fashion.
Basically we physically makes the average color of the surface
match the color in higher depth resolution.
4
Improvement.
Improvement
„ What we have done is a called “1 bit” matrix
dithering.
„ We could imagine pattern for “2,3… bits”.
„ Any imaging software does that AND it is
static : the image is processed ONCE.

„ But here, we have HARDWARE and can


perform per pixel operation
operation…
„ Something better ?

5
Ok now what ?
Ok,
„ Previously,
Previously we have always the same pixel lit “up”
and lit “down”.
„ Whyy not switch at each frame ?

A B B A
B A A B

Even Frame Odd Frame

„ ÆGoing from “spatial” dithering to “temporal”


dithering. (Surface based to time based)
„ Do NOT need surface of same color.
„ Can work with a single pixel ! The previous method
does not.(was
not (was using surface to make average value)
6
Physical result
result.
„ By
B switching
it hi alternatively
lt ti l values
l we gett
AVERAGE value.

TIME Average Color.

„ The eye will “integrate” the signal and look


like the two colors are merged.
„ Yes, but it may flick…
„ Correct ! But we still use “closest” colors.
„ Cheap LCD slow latency will help us !
7
Let’ss get dirty baby : implementation
Let implementation.

„ Frame 1 Frame 0
0 1 X LSB 0 1 X LSB

0 0 1 0 1 0
1 1
1 0 0 1
Y LSB Y LSB
(X xor Y) gives “Frame 1” pattern,
thus,, ((
((X xor Y)) == Frame)) for all cases.

„ Color Computation (7Æ6 bit).


Add
For each
component + B6 B5 B4 B3 B2 B1 B0

To display. 8
No problem ? Part 1.
1
Add 1 or 0

+ B6 B5 B4 B3 B2 B1 0 B6-B1 : Do not change. OK.

Add 1 or 0

+ B6 B5 B4 B3 B2 B1 1 B6-B1 : Original or Original + 1. OK.


Except…

When B6-B1
Wh B6 B1 iis 111111 already,
l d overflow
fl occurs, result
lt is
i 000000 !
Let’s fix it by detecting the overflow case first.
Add

+ 0 B6 B5 B4 B3 B2 B1 B0

9
Overflow detector.
No problem ? Part 2.
2
„ We detect overflow, now fix the value.
Add

+ 0 B6 B5 B4 B3 B2 B1 B0

S7 S6 S5 S4 S3 S2 S1

OR S7 S7 S7 S7 S7 S7 If overflow,
S t to
Set t “max”
“ ” legal
l l value.
l
S’6 S’5 S’4 S’3 S’2 S’1 (111111) else do nothing
(OR with 000000)

Now one more thing : we do NOT multiply the precision by 2 !


We do increase range from n to (n*2)-1 !

Because original 1111111 does overflow and as no equivalent.


10
Cheap isn’t
isn t it ?
Per component.
P t
„ Adder of the size of the output component + 2 bit.
„ Value to add is only 0 or 1 Æ Logic can be optimized.
optimized
„ OR stage of the size of the output component.

Per pixel.
„ A ge
general
e a ADD b bitt co
computed
puted o
once
ce pe
per coo
coordinate.
d ate
(x xor y) == frame.

Globally.
„ A frame register bit inversed at each frame.

11
Results fpga ARE fun !
Results,
Original With this basic
RGB component post process
333 : 512 colors (15^3) 3,375 colors.

444 : 4,096
4 096 colors (31^3)
(31 3) 29,791
29 791 colors.
colors

555 : 32,768 colors. (63^3) 250,047 colors.

666 : 262,144 colors. (127^3) 2,048,383 colors.

That is already quite a progress with only


a “basic”
basic pixel color processing logic.
12
Are we finished ? Not really
really…
„ We could
W ld perform
f th
the same ttechnique
h i and
d use 4
4,8,16
8 16 fframes
instead of 2 for switching pixels.
„ Allowing ¼, 1/8, 1/16 precision.
„ At the price of HUGE flickering.(ex : 0001 pattern ?)
„ Or you must be able to multiply x2,x4,x8 the screen refresh
rate.(most likely impossible, we have cheap devices right ?)
„ Add a “spatial” dithering stage before.
„ Take the bit n+1 for temporal.
„ Take the bit n+2
n+2..n+m
n+m for spatial dithering
dithering.
„ Spatial dithering as no issue like flickering.
Æ Transform a n+m value into n+1 dithered.
„ Could use more “advanced” dithering technique for spatial
dithering.
„ Example : Floyd-Steinberg dithering…

13
Comments
„ Any comments are welcome.
laxer3a [[at-no-spam]
p ] hotmail dot com

„ Please put “[BLOG]”


[BLOG] at the beginning of the
mail title.

14
References
„ Dithering (for further interest)

15

You might also like