From d73e63a7263c04e1c66b17c4276ed2dfb7e906cb Mon Sep 17 00:00:00 2001 From: Pascal Massimino Date: Tue, 22 May 2012 02:28:19 -0700 Subject: [PATCH] add DequantizeLevels() placeholder will be called by alpha post-processing, although doing nothing for now. Gradient smoothing would be nice-to-have here. Patch welcome! Change-Id: I534cde866bdc75da22d0f0a6d1373c90e21366f3 --- src/utils/quant_levels.c | 11 ++++++++++- src/utils/quant_levels.h | 5 +++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/utils/quant_levels.c b/src/utils/quant_levels.c index 9bf1f870..8623d97d 100644 --- a/src/utils/quant_levels.c +++ b/src/utils/quant_levels.c @@ -142,13 +142,22 @@ int QuantizeLevels(uint8_t* data, int width, int height, } // Compute final mean squared error if needed. - if (mse) { + if (mse != NULL) { *mse = (float)sqrt(err); } return 1; } +int DequantizeLevels(uint8_t* data, int width, int height) { + if (data == NULL || width <= 0 || height <= 0) return 0; + // TODO(skal): implement gradient smoothing. + (void)data; + (void)width; + (void)height; + return 1; +} + #if defined(__cplusplus) || defined(c_plusplus) } // extern "C" #endif diff --git a/src/utils/quant_levels.h b/src/utils/quant_levels.h index 2523d16e..b3e804b5 100644 --- a/src/utils/quant_levels.h +++ b/src/utils/quant_levels.h @@ -27,6 +27,11 @@ extern "C" { int QuantizeLevels(uint8_t* data, int width, int height, int num_levels, float* mse); +// Apply post-processing to input 'data' of size 'width'x'height' assuming +// source what quantized to a reduced number of levels. +// Returns false in case of error (data is NULL, invalid parameters, ...). +int DequantizeLevels(uint8_t* data, int width, int height); + #if defined(__cplusplus) || defined(c_plusplus) } // extern "C" #endif