Augmenting perceived color depth with simple hardware logic. “ART001” By Laxer3A
1
Why we need more colors ? P Processing 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$) $ $
“Middl “Middle-end” d” (500$ (500$~1000$) 1000$)
Most of the time RGB111, 323, 333, etc... 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
MSB
LSB
We simply take the MSB 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. A B Thus RGB555 : 10010 (A (A=18) 18) (2A+2B)/4 ÆA+B/2 But we can also use A+1 : 10011 (B=19) B A 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”. Why y 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 0 1
0
1
0
1
1
0
Frame 0 X LSB 0 1
0
1
1
0
0
1
X LSB
Y LSB
Y LSB
(X xor Y) gives “Frame 1” pattern, ((X xor Y)) == Frame)) for all cases. thus,, ((
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
+
B6 B5 B4 B3 B2 B1
0 Add
+
B6 B5 B4 B3 B2 B1
1
1 or 0 B6-B1 : Do not change. OK. 1 or 0 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
Overflow detector.
9
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 S’6 S’5 S’4 S’3 S’2 S’1
If overflow, S t to Set t “max” “ ” legal l l value. l (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 RGB 333 : 512 colors 444 : 4,096 4 096 colors 555 : 32,768 colors. 666 : 262,144 colors.
With this basic component post process (15^3) 3,375 colors. (31^3) (31 3) 29,791 29 791 colors. colors (63^3) 250,047 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.
p ] hotmail dot com laxer3a [[at-no-spam] Please put “[BLOG]” [BLOG] at the beginning of the
mail title.
14
References Dithering (for further interest)
15