ceteras
Posts: 239
Joined: Fri Jan 27, 2012 1:42 pm
Location: Romania

Is 8bit to 6bit dithering possible?

Tue May 28, 2013 10:48 am

I've been working with some laptop LCD's and RPi, these screens are usually 6bit per primary colour, while the outputs from HDMI or DVI receivers are 8bit.
If you connect the most significant 6bits from the receiver to the lcd's 6bits, you lose 2bits, and you get colour banding on your screen. 6bit is not enough.
Of course, in the original set-up in the laptop where the LCD came from, the image was dithered from whatever colour depth is set, down to 18bit per pixel. Also there are LCD monitors that use 6bit panels, and their image processors do scaling to the LCD native resolution and dithering for the colour depth.
I would use one of those chips, but they don't have public documentation.

So the question is: can the Pi do the dithering? That means outputting 8bits of data where the least significant 2bits would be zeros, and the 6 MSB would be dithered from the original 8.

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5664
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Is 8bit to 6bit dithering possible?

Tue May 28, 2013 11:06 am

Can you clarify. Do you have a laptop LCD screen that is currently working with the Pi and exhibits banding? How are you connected to it?

ceteras
Posts: 239
Joined: Fri Jan 27, 2012 1:42 pm
Location: Romania

Re: Is 8bit to 6bit dithering possible?

Tue May 28, 2013 11:24 am

The chain is: Raspi HDMI -> TFP401 DVI receiver on a board -> 6bit LVDS transmitter -> 6bit LCD panel.
TFP401 is configured to output 24bit data (8bit), one pixel per clock.
From those 24bit, only 18 are connected to the LVDS transmitter (6 most significant bits on each primary colour).
TFP401 cannot perform 8bit to 6bit dithering.
I also have a different setup (17" lcd monitor) where I get color banding for the exact same reason. It has an LCD panel that ignores the 2 LSB on each primary colour, using only 18 of the 24 sent, and it looks the same as on the laptop panel.
So actually I need the OS on the Pi to know it has an 6bit lcd panel attached and perform the required dithering.

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5664
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Is 8bit to 6bit dithering possible?

Tue May 28, 2013 6:34 pm

ceteras wrote:The chain is: Raspi HDMI -> TFP401 DVI receiver on a board -> 6bit LVDS transmitter -> 6bit LCD panel.
TFP401 is configured to output 24bit data (8bit), one pixel per clock.
From those 24bit, only 18 are connected to the LVDS transmitter (6 most significant bits on each primary colour).
TFP401 cannot perform 8bit to 6bit dithering.
I also have a different setup (17" lcd monitor) where I get color banding for the exact same reason. It has an LCD panel that ignores the 2 LSB on each primary colour, using only 18 of the 24 sent, and it looks the same as on the laptop panel.
So actually I need the OS on the Pi to know it has an 6bit lcd panel attached and perform the required dithering.
We have some control over the dithering. I'll check if it's suitable add a config.txt option to dither more bits if it is possible.

ceteras
Posts: 239
Joined: Fri Jan 27, 2012 1:42 pm
Location: Romania

Re: Is 8bit to 6bit dithering possible?

Tue May 28, 2013 7:31 pm

That would be great!

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5664
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Is 8bit to 6bit dithering possible?

Tue Jun 04, 2013 2:40 pm

ceteras wrote:That would be great!
I've added a setting to control the dithering into latest rpi-update firmware. It's not tested.

Add:
hvs_set_dither=0x00000xyz

where x=dither type, y=depth, z=channel.

Dither Type
This field sets the type of dithering to be applied. All colour components with less than 8 bits of precision will also have horizontal error accumulation applied.
0 = No dithering
1 = Accumulate rounding error horizontally.
2 = As 1, but also apply pseudo-random noise. The noise generator is reset at the start of each frame.
3 = As 2, but the noise generator is free-running. This setting will produce a shimmering effect on static images that may be distracting.

Destination Display Bit Depth
Sets the number of bits being used by the destination display. This determines where the LSBs are in the 24-bit RGB values coming from the display FIFO.
0 = 24-bit RGB888. No error accumulation is required.
1 = 18-bit RGB666.
2 = 16-bit RGB565.
3 = 15-bit RGB555.

Channel is HVS channel number. I think you want 1.

So, I'd try:
hvs_set_dither=0x211

rjdunwoody91
Posts: 2
Joined: Wed Apr 16, 2014 2:26 pm

Re: Is 8bit to 6bit dithering possible?

Wed Apr 16, 2014 2:40 pm

I have the exact same set up (using the same ICs I believe), here is an image of the problem I have:

Image

The screen seems to be repeated at the bottom (as shown my the mouse pointer) and then between the screen view repetition and the normal screen there is a zone of pixels smeared horizontally on the right side of the screen (shown by the folders) and vertically at the bottom of the screen (shown by the grey of the taskbar).

Any idea what this could be? I've tried the dithering with no success (although it did help the screen quality I think so thanks for that!).

Cheers
Ryan

ceteras
Posts: 239
Joined: Fri Jan 27, 2012 1:42 pm
Location: Romania

Re: Is 8bit to 6bit dithering possible?

Mon Apr 21, 2014 9:18 pm

Your problem is a different one.
Your LCD panel's native resolution is higher than the one the Pi is sending out, that's all.
Give the panel make/model and the resolution settings in config.txt, and we'll see.

My guess is that your panel is an 1280x800 and your Pi is configured at 1024x768.
That's how it looks like.

coding
Posts: 40
Joined: Sun Jul 20, 2014 7:23 am

Re: Is 8bit to 6bit dithering possible?

Thu Sep 24, 2015 7:11 am

Hello,

I would like to be sure to completely disable any temporal dithering that might be sent from the Raspberry Pi. Is the config option hvs_set_dither=0x00000xyz still implemented?
Without that option, would temporal dithering never be used under any circumstances or is there a check that, for example, looks at the monitor's reported color depth (bits per channel) and then decides what to do?

I have a few questions about the option:
  • What does "HVS" stand for? Will the option work with just a regular desktop monitor that's connected to the Raspberry Pi's HDMI output, or is "HVS" a special case?
  • The first 5 leading zeros after "0x" can be safely omitted, as seen in the example "0x211"?
  • What is "HVS channel number"? And how would I know which number to use if just 1 regular HDMI cable is connected?
  • Would the option work for the Raspberry Pi 2, too?

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5664
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Is 8bit to 6bit dithering possible?

Thu Sep 24, 2015 3:15 pm

coding wrote:
  • What does "HVS" stand for? Will the option work with just a regular desktop monitor that's connected to the Raspberry Pi's HDMI output, or is "HVS" a special case?
    [*]The first 5 leading zeros after "0x" can be safely omitted, as seen in the example "0x211"?
    [*]What is "HVS channel number"? And how would I know which number to use if just 1 regular HDMI cable is connected?
    [*]Would the option work for the Raspberry Pi 2, too?
1. Hardware video scaler. It is used for HDMI, composite, various LCDs and offline composition to memory.
2. Yes
3. HDMI is channel 1
4. Yes (Pi1 and Pi2 have identical GPUs)

Note: HDMI output is always 24bit, so dither is not done. This setting is only useful if you know the number of bits of the display is less than 24 and want to force dither. It won't happen without this setting.

stryder57
Posts: 2
Joined: Wed Aug 28, 2019 4:19 pm

Re: Is 8bit to 6bit dithering possible?

Wed Aug 28, 2019 4:23 pm

I add hvs_set_dither=0x211 to my config.txt but It doesn't seem to work.

I have a 18bit screeen I am trying to get a good image on.

Is this setting still work with the current version of rasbian?

Is there as setting to turn this on?

Thanks

stryder57
Posts: 2
Joined: Wed Aug 28, 2019 4:19 pm

Re: Is 8bit to 6bit dithering possible?

Wed Aug 28, 2019 4:26 pm

Is this setting still active in the current version of raspbian?
I am trying to dither my color for an 18bit color screen.

Thanks

Return to “Other projects”