quant_levels.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. // Copyright 2011 Google Inc. All Rights Reserved.
  2. //
  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.
  8. // -----------------------------------------------------------------------------
  9. //
  10. // Alpha plane quantization utility
  11. //
  12. // Author: Vikas Arora (vikasa@google.com)
  13. #ifndef WEBP_UTILS_QUANT_LEVELS_H_
  14. #define WEBP_UTILS_QUANT_LEVELS_H_
  15. #include <stdlib.h>
  16. #include "../webp/types.h"
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. // Replace the input 'data' of size 'width'x'height' with 'num-levels'
  21. // quantized values. If not NULL, 'sse' will contain the sum of squared error.
  22. // Valid range for 'num_levels' is [2, 256].
  23. // Returns false in case of error (data is NULL, or parameters are invalid).
  24. int QuantizeLevels(uint8_t* const data, int width, int height, int num_levels,
  25. uint64_t* const sse);
  26. #ifdef __cplusplus
  27. } // extern "C"
  28. #endif
  29. #endif /* WEBP_UTILS_QUANT_LEVELS_H_ */