#ifndef WEBP_UTILS_PALETTE_H_
#define WEBP_UTILS_PALETTE_H_
#include "src/utils/bounds_safety.h"
#include "src/webp/format_constants.h"
#include "src/webp/types.h"
WEBP_ASSUME_UNSAFE_INDEXABLE_ABI
struct WebPPicture;
typedef enum PaletteSorting {
kSortedDefault = 0,
kMinimizeDelta = 1,
kModifiedZeng = 2,
kUnusedPalette = 3,
kPaletteSortingNum = 4
} PaletteSorting;
int SearchColorNoIdx(const uint32_t WEBP_COUNTED_BY(num_colors) sorted[],
uint32_t color, int num_colors);
void PrepareMapToPalette(const uint32_t WEBP_COUNTED_BY(num_colors) palette[],
uint32_t num_colors,
uint32_t WEBP_COUNTED_BY(num_colors) sorted[],
uint32_t WEBP_COUNTED_BY(num_colors) idx_map[]);
int GetColorPalette(const struct WebPPicture* const pic,
uint32_t* const WEBP_COUNTED_BY_OR_NULL(MAX_PALETTE_SIZE)
palette);
int PaletteSort(PaletteSorting method, const struct WebPPicture* const pic,
const uint32_t* const WEBP_COUNTED_BY(num_colors)
palette_sorted,
uint32_t num_colors,
uint32_t* const WEBP_COUNTED_BY(num_colors) palette);
#endif