Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JPEG utils not setting ConvertedDataCount variable in YCbCr to RGB functions #294

Open
luismeruje opened this issue Jun 25, 2024 · 1 comment
Assignees
Labels
bug Something isn't working internal bug tracker Issue confirmed and reported into a ticket in the internal bug tracking system jpeg JPEG-related issue or pull-request utils Utilities-related issue or pull-request

Comments

@luismeruje
Copy link

luismeruje commented Jun 25, 2024

System info

Board: Nucleo-STM32H743
IDE: STM32CubeIDE

Bug

In the jpeg_utils.c file, which can be found under Utilities/JPEG, the ConvertedDataCount variable is not being set in the following functions:

static uint32_t JPEG_MCU_YCbCr420_ARGB_ConvertBlocks(uint8_t *pInBuffer, 
                                      uint8_t *pOutBuffer, 
                                      uint32_t BlockIndex,
                                      uint32_t DataCount,
                                      uint32_t *ConvertedDataCount);

static uint32_t JPEG_MCU_YCbCr422_ARGB_ConvertBlocks(uint8_t *pInBuffer, 
                                      uint8_t *pOutBuffer, 
                                      uint32_t BlockIndex,
                                      uint32_t DataCount,
                                      uint32_t *ConvertedDataCount);

static uint32_t JPEG_MCU_YCbCr444_ARGB_ConvertBlocks(uint8_t *pInBuffer, 
                                      uint8_t *pOutBuffer, 
                                      uint32_t BlockIndex,
                                      uint32_t DataCount,
                                      uint32_t *ConvertedDataCount);


static uint32_t JPEG_MCU_Gray_ARGB_ConvertBlocks(uint8_t *pInBuffer, 
                                      uint8_t *pOutBuffer, 
                                      uint32_t BlockIndex,
                                      uint32_t DataCount,
                                      uint32_t *ConvertedDataCount);

static uint32_t JPEG_MCU_YCCK_ARGB_ConvertBlocks(uint8_t *pInBuffer, 
                                      uint8_t *pOutBuffer, 
                                      uint32_t BlockIndex,
                                      uint32_t DataCount,
                                      uint32_t *ConvertedDataCount);

Reproducing the error

  1. A simple code inspection is sufficient to see that the variable is not being set at any point in these functions.

Solution

Just set the value accordingly. I believe the following lines of code could work for the case of JPEG_ARGB8888, but I'm not entirely sure how to handle the remaining RGB data formats:

#if (JPEG_RGB_FORMAT == JPEG_ARGB8888)
  *ConvertedDataCount = numberMCU * 8 * 8 * 4; //I.e., numberMCUS * 8 * 8 block size * 4 color components
#elif(JPEG_RGB_FORMAT == JPEG_RGB888)
  *ConvertedDataCount = numberMCU * 8 * 8 * 3 (?); //I.e., numberMCUS * 8 * 8 block size * 3 color components
#elif (JPEG_RGB_FORMAT == JPEG_RGB565)
  *ConvertedDataCount = ?
#endif
     
@ALABSTM ALABSTM added bug Something isn't working utils Utilities-related issue or pull-request jpeg JPEG-related issue or pull-request labels Jun 26, 2024
@ALABSTM ALABSTM added this to To do in stm32cube-mcu-fw-dashboard via automation Jun 26, 2024
@KRASTM
Copy link

KRASTM commented Jun 27, 2024

ST Internal Reference: 185221

@KRASTM KRASTM added the internal bug tracker Issue confirmed and reported into a ticket in the internal bug tracking system label Jun 27, 2024
@KRASTM KRASTM moved this from To do to Analyzed in stm32cube-mcu-fw-dashboard Jun 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working internal bug tracker Issue confirmed and reported into a ticket in the internal bug tracking system jpeg JPEG-related issue or pull-request utils Utilities-related issue or pull-request
Projects
Development

No branches or pull requests

3 participants