.TH LIBLSS16_OPTIMISE 3 LIBLSS16 .SH NAME liblss16_optimise \- Optimise an image for best compression with LSS16 .SH SYNOPSIS .nf #include struct liblss16_colour { uint8_t \fIr\fP; uint8_t \fIg\fP; uint8_t \fIb\fP; }; struct liblss16_header { uint16_t \fIwidth\fP; uint16_t \fIheight\fP; struct liblss16_colour \fIcolour_map\fP[16]; }; void liblss16_optimise(struct liblss16_header *\fIheader\fP, uint8_t *\fIpixels\fP); .fi .PP Link with .IR -llss16 . .SH DESCRIPTION The .BR liblss16_optimise () function reorders and deduplicates the colour palette for an image so that it will compress optimally with LSS16. .PP .I header->width shall be the width, in pixels, of the image. .PP .I header->height shall be the height, in pixels, of the image. .PP .I header->colour_map shall be the image's colour palette. .PP .I pixels shall be a buffer of the colour index for .I header->width*header->height pixels. Ordered primarily from the top down and secondarily from left to right. The colour of a pixel encoded with the value .I P is determined by .IR header->colour_map[P] . Each .B struct liblss16_colour is encoded in sRGB with either 6 bits per channel or 8 bits per channel .RI ( .r for the red channel, .I .g for the green channel, and .I .b for the blue channel). .PP Values in .I pixels must be 15 or less. The function will not validate the input. .PP The function will rewrite .I header->colour_map and .IR pixels . .SH RETURN VALUE None. .SH ERRORS The .BR liblss16_optimise () function cannot fail. .SH SEE ALSO .BR liblss16 (7)