util: factor out and optimize C8 SMPTE color LUT
authorGeert Uytterhoeven <geert@linux-m68k.org>
Thu, 3 Mar 2022 17:03:50 +0000 (18:03 +0100)
committerGeert Uytterhoeven <geert@linux-m68k.org>
Tue, 24 Oct 2023 07:44:04 +0000 (09:44 +0200)
commit6d9645bb3b7b6fa206aaa6e7bf4c8fe86efccb83
tree1b18e8a9389266ca8e94cfbbbceb262012c4978f
parenteb06a81e42195ef57dab4b567f646b5b7596ca90
util: factor out and optimize C8 SMPTE color LUT

The color LUT for the SMPTE pattern in indexed mode contains 22 entries,
although only 13 are non-unique.

Reduce the size of the color LUT by dropping duplicate entries, so it
can be reused for formats supporting e.g. 16 colors.  Rename the
function util_smpte_c8_gamma() to util_smpte_fill_lut(), and its first
parameter size to ncolors, to match their actual use.

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:
  - Rename util_smpte_index_gamma() to util_smpte_fill_lut(), and its
    first parameter from size to ncolors,
  - Move smpte_color_lut[] down,
  - Kill FILL_COLOR() macro,
  - Add and use EXPAND_COLOR() macro,

v3:
  - Add Acked-by,

v2:
  - Factor out smpte color LUT.
tests/modetest/modetest.c
tests/util/pattern.c
tests/util/pattern.h