diff --git a/src/dec/alpha.c b/src/dec/alpha.c index 752ea665..d91345db 100644 --- a/src/dec/alpha.c +++ b/src/dec/alpha.c @@ -78,7 +78,7 @@ static int DecodeAlpha(const uint8_t* data, size_t data_size, unfilter_func(width, height, width, 0, height, output); } if (pre_processing == ALPHA_PREPROCESSED_LEVELS) { - ok = DequantizeLevels(output, width, height); + ok = DequantizeLevels(output, width, height, 0, height); } } diff --git a/src/utils/quant_levels_dec.c b/src/utils/quant_levels_dec.c index d93594b3..2574e08e 100644 --- a/src/utils/quant_levels_dec.c +++ b/src/utils/quant_levels_dec.c @@ -17,11 +17,12 @@ extern "C" { #endif -int DequantizeLevels(uint8_t* const data, int width, int height) { - if (data == NULL || width <= 0 || height <= 0) return 0; - (void)data; - (void)width; - (void)height; +int DequantizeLevels(uint8_t* const data, int width, int height, + int row, int num_rows) { + if (data == NULL || width <= 0 || height <= 0 || row < 0 || num_rows < 0 || + row + num_rows > height) { + return 0; + } return 1; } diff --git a/src/utils/quant_levels_dec.h b/src/utils/quant_levels_dec.h index 58910676..a707224d 100644 --- a/src/utils/quant_levels_dec.h +++ b/src/utils/quant_levels_dec.h @@ -20,10 +20,12 @@ extern "C" { #endif -// Apply post-processing to input 'data' of size 'width'x'height' assuming -// that the source was quantized to a reduced number of levels. +// Apply post-processing to input 'data' of size 'width'x'height' assuming that +// the source was quantized to a reduced number of levels. The post-processing +// will be applied to 'num_rows' rows of 'data' starting from 'row'. // Returns false in case of error (data is NULL, invalid parameters, ...). -int DequantizeLevels(uint8_t* const data, int width, int height); +int DequantizeLevels(uint8_t* const data, int width, int height, + int row, int num_rows); #if defined(__cplusplus) || defined(c_plusplus) } // extern "C"