diff --git a/modules/cvtt/image_compress_cvtt.cpp b/modules/cvtt/image_compress_cvtt.cpp index ad707722703..e9a7009d7ca 100644 --- a/modules/cvtt/image_compress_cvtt.cpp +++ b/modules/cvtt/image_compress_cvtt.cpp @@ -302,8 +302,6 @@ void image_decompress_cvtt(Image *p_image) { int y_end = y_start + 4; for (int x_start = 0; x_start < w; x_start += 4 * cvtt::NumParallelBlocks) { - int x_end = x_start + 4 * cvtt::NumParallelBlocks; - uint8_t input_blocks[16 * cvtt::NumParallelBlocks]; memset(input_blocks, 0, sizeof(input_blocks)); @@ -315,6 +313,8 @@ void image_decompress_cvtt(Image *p_image) { memcpy(input_blocks, in_bytes, 16 * num_real_blocks); in_bytes += 16 * num_real_blocks; + int x_end = x_start + 4 * num_real_blocks; + if (is_hdr) { if (is_signed) { cvtt::Kernels::DecodeBC6HS(output_blocks_hdr, input_blocks);