1 // Copyright 2011 Google Inc. All Rights Reserved.
3 // This code is licensed under the same terms as WebM:
4 // Software License Agreement: http://www.webmproject.org/license/software/
5 // Additional IP Rights Grant: http://www.webmproject.org/license/additional/
6 // -----------------------------------------------------------------------------
8 // Alpha plane quantization utility
10 // Author: Vikas Arora (vikasa@google.com)
12 #ifndef WEBP_UTILS_QUANT_LEVELS_H_
13 #define WEBP_UTILS_QUANT_LEVELS_H_
17 #include "../webp/types.h"
19 #if defined(__cplusplus) || defined(c_plusplus)
23 // Replace the input 'data' of size 'width'x'height' with 'num-levels'
24 // quantized values. If not NULL, 'sse' will contain the sum of squared error.
25 // Valid range for 'num_levels' is [2, 256].
26 // Returns false in case of error (data is NULL, or parameters are invalid).
27 int QuantizeLevels(uint8_t* const data, int width, int height, int num_levels,
30 #if defined(__cplusplus) || defined(c_plusplus)
34 #endif /* WEBP_UTILS_QUANT_LEVELS_H_ */