diff options
author | Mattias Andrée <m@maandree.se> | 2025-03-02 22:28:41 +0100 |
---|---|---|
committer | Mattias Andrée <m@maandree.se> | 2025-03-02 22:28:41 +0100 |
commit | 20c4ea930afa93a8c4a27739c8a137801d16328f (patch) | |
tree | 7a3a33a6185249cf452f8a739b13981e855c0978 | |
parent | Add some functions needed fore encoding LSS16 files (diff) | |
download | liblss16-20c4ea930afa93a8c4a27739c8a137801d16328f.tar.gz liblss16-20c4ea930afa93a8c4a27739c8a137801d16328f.tar.bz2 liblss16-20c4ea930afa93a8c4a27739c8a137801d16328f.tar.xz |
liblss16_optimise: check if it is preferrable to assign an unused colour index 0
Signed-off-by: Mattias Andrée <m@maandree.se>
-rw-r--r-- | liblss16_optimise.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/liblss16_optimise.c b/liblss16_optimise.c index 911fcd2..7cb3b5d 100644 --- a/liblss16_optimise.c +++ b/liblss16_optimise.c @@ -51,6 +51,8 @@ liblss16_optimise(struct liblss16_header *header, uint8_t *pixels) least = zero[0] - nonzero[0]; preferred = 0U; + if (ncolours < 16U) + ncolours++; for (x = 1U; x < (unsigned)ncolours; x++) { zero_penalty = zero[x] - nonzero[x]; if (zero_penalty < least) { |