From f164ae776466c8a099f45faefa5c58049b9d90a3 Mon Sep 17 00:00:00 2001 From: karim Date: Wed, 24 Jul 2024 09:40:50 +0100 Subject: [PATCH] [Utilities] Add the calculation of ConvertedDataCount in the JPEG decode functions --- Utilities/JPEG/jpeg_utils.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Utilities/JPEG/jpeg_utils.c b/Utilities/JPEG/jpeg_utils.c index 72f88451b..2989f9923 100644 --- a/Utilities/JPEG/jpeg_utils.c +++ b/Utilities/JPEG/jpeg_utils.c @@ -1134,7 +1134,8 @@ static uint32_t JPEG_MCU_YCbCr420_ARGB_ConvertBlocks(uint8_t *pInBuffer, numberMCU = DataCount / YCBCR_420_BLOCK_SIZE; currentMCU = BlockIndex; - + + *ConvertedDataCount = numberMCU * JPEG_ConvertorParams.BlockSize; while(currentMCU < (numberMCU + BlockIndex)) { @@ -1319,6 +1320,7 @@ static uint32_t JPEG_MCU_YCbCr422_ARGB_ConvertBlocks(uint8_t *pInBuffer, numberMCU = DataCount / YCBCR_422_BLOCK_SIZE; currentMCU = BlockIndex; + *ConvertedDataCount = numberMCU * JPEG_ConvertorParams.BlockSize; while(currentMCU < (numberMCU + BlockIndex)) { @@ -1450,6 +1452,7 @@ static uint32_t JPEG_MCU_YCbCr444_ARGB_ConvertBlocks(uint8_t *pInBuffer, numberMCU = DataCount / YCBCR_444_BLOCK_SIZE; currentMCU = BlockIndex; + *ConvertedDataCount = numberMCU * JPEG_ConvertorParams.BlockSize; while(currentMCU < (numberMCU + BlockIndex)) { @@ -1553,6 +1556,8 @@ static uint32_t JPEG_MCU_Gray_ARGB_ConvertBlocks(uint8_t *pInBuffer, numberMCU = DataCount / GRAY_444_BLOCK_SIZE; currentMCU = BlockIndex; + *ConvertedDataCount = numberMCU * JPEG_ConvertorParams.BlockSize; + while(currentMCU < (numberMCU + BlockIndex)) { xRef = ((currentMCU *8) / JPEG_ConvertorParams.WidthExtend)*8; @@ -1631,6 +1636,7 @@ static uint32_t JPEG_MCU_YCCK_ARGB_ConvertBlocks(uint8_t *pInBuffer, numberMCU = DataCount / CMYK_444_BLOCK_SIZE; currentMCU = BlockIndex; + *ConvertedDataCount = numberMCU * JPEG_ConvertorParams.BlockSize; while(currentMCU < (numberMCU + BlockIndex)) {