util: improve SMPTE color LUT accuracy

Fill in the LSB when converting color components from 8-bit to 16-bit.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
v5:
  - Add Reviewed-by,

v4:
  - No changes,

v3:
  - Add Acked-by,

v2:
  - New.
main
Geert Uytterhoeven 2022-06-30 15:16:23 +02:00
parent 5254fd1146
commit eb06a81e42
1 changed files with 3 additions and 3 deletions

View File

@ -646,9 +646,9 @@ void util_smpte_c8_gamma(unsigned size, struct drm_color_lut *lut)
memset(lut, 0, size * sizeof(struct drm_color_lut)); memset(lut, 0, size * sizeof(struct drm_color_lut));
#define FILL_COLOR(idx, r, g, b) \ #define FILL_COLOR(idx, r, g, b) \
lut[idx].red = (r) << 8; \ lut[idx].red = (r) * 0x101; \
lut[idx].green = (g) << 8; \ lut[idx].green = (g) * 0x101; \
lut[idx].blue = (b) << 8 lut[idx].blue = (b) * 0x101
FILL_COLOR( 0, 192, 192, 192); /* grey */ FILL_COLOR( 0, 192, 192, 192); /* grey */
FILL_COLOR( 1, 192, 192, 0 ); /* yellow */ FILL_COLOR( 1, 192, 192, 0 ); /* yellow */