Refactor GetColorPalette method.

This was defined (slightly differently) at two places. Created a common
method and moved to utils/utils.[hc].

Change-Id: I19adc9c48f2a4e2ec9d995e78add6f25172774c2
This commit is contained in:
Urvang Joshi
2016-05-18 14:27:15 -07:00
parent e15afbce5d
commit 169004b1d5
4 changed files with 85 additions and 104 deletions

View File

@ -160,6 +160,19 @@ WEBP_EXTERN(void) WebPCopyPlane(const uint8_t* src, int src_stride,
WEBP_EXTERN(void) WebPCopyPixels(const struct WebPPicture* const src,
struct WebPPicture* const dst);
//------------------------------------------------------------------------------
// Unique colors.
// Returns count of unique colors in 'pic', assuming pic->use_argb is true.
// If the unique color count is more than MAX_COLOR_COUNT, returns
// MAX_COLOR_COUNT+1.
// If 'palette' is not NULL and number of unique colors is less than or equal to
// MAX_COLOR_COUNT, also outputs the actual unique colors into 'palette'.
// Note: 'palette' is assumed to be an array already allocated with at least
// MAX_COLOR_COUNT elements.
WEBP_EXTERN(int) WebPGetColorPalette(const struct WebPPicture* const pic,
uint32_t* const palette);
//------------------------------------------------------------------------------
#ifdef __cplusplus