Vikas Arora | a241572 | 2012-08-09 16:18:58 -0700 | [diff] [blame] | 1 | // Copyright 2011 Google Inc. All Rights Reserved. |
| 2 | // |
Vikas Arora | 0406ce1 | 2013-08-09 15:57:12 -0700 | [diff] [blame] | 3 | // Use of this source code is governed by a BSD-style license |
| 4 | // that can be found in the COPYING file in the root of the source |
| 5 | // tree. An additional intellectual property rights grant can be found |
| 6 | // in the file PATENTS. All contributing project authors may |
| 7 | // be found in the AUTHORS file in the root of the source tree. |
Vikas Arora | a241572 | 2012-08-09 16:18:58 -0700 | [diff] [blame] | 8 | // ----------------------------------------------------------------------------- |
| 9 | // |
| 10 | // Alpha plane quantization utility |
| 11 | // |
| 12 | // Author: Vikas Arora (vikasa@google.com) |
| 13 | |
| 14 | #ifndef WEBP_UTILS_QUANT_LEVELS_H_ |
| 15 | #define WEBP_UTILS_QUANT_LEVELS_H_ |
| 16 | |
| 17 | #include <stdlib.h> |
| 18 | |
James Zern | 9e80ee9 | 2015-03-17 18:54:21 -0700 | [diff] [blame] | 19 | #include "../webp/types.h" |
Vikas Arora | a241572 | 2012-08-09 16:18:58 -0700 | [diff] [blame] | 20 | |
Vikas Arora | 8b72022 | 2014-01-02 16:48:02 -0800 | [diff] [blame] | 21 | #ifdef __cplusplus |
Vikas Arora | a241572 | 2012-08-09 16:18:58 -0700 | [diff] [blame] | 22 | extern "C" { |
| 23 | #endif |
| 24 | |
| 25 | // Replace the input 'data' of size 'width'x'height' with 'num-levels' |
| 26 | // quantized values. If not NULL, 'sse' will contain the sum of squared error. |
| 27 | // Valid range for 'num_levels' is [2, 256]. |
| 28 | // Returns false in case of error (data is NULL, or parameters are invalid). |
| 29 | int QuantizeLevels(uint8_t* const data, int width, int height, int num_levels, |
| 30 | uint64_t* const sse); |
| 31 | |
Vikas Arora | 8b72022 | 2014-01-02 16:48:02 -0800 | [diff] [blame] | 32 | #ifdef __cplusplus |
Vikas Arora | a241572 | 2012-08-09 16:18:58 -0700 | [diff] [blame] | 33 | } // extern "C" |
| 34 | #endif |
| 35 | |
| 36 | #endif /* WEBP_UTILS_QUANT_LEVELS_H_ */ |