Skip to main content
Kim KyungTack
Associate III
July 19, 2021
Solved

We found a bug while using Hardware JPEG.

  • July 19, 2021
  • 2 replies
  • 898 views

The environment I tested is as follows.

IDE: STM32CubeIDE​ 1.5.1

Package: STM32F767II

Package software version: 1.16.1

JPEG settings are as below.

0693W00000Czw4kQAB.png

However, there is a typo in the config file that is actually generated.

[ jpeg_utils_conf.h ]

#ifndef __JPEG_UTILS_CONF_H__
#define __JPEG_UTILS_CONF_H__
 
/* Includes ------------------------------------------------------------------*/
 
#include "stm32f7xx_hal.h"
#include "stm32f7xx_hal_jpeg.h"
 
/* Private define ------------------------------------------------------------*/
/** @addtogroup JPEG_Private_Defines
 * @{
 */
/* RGB Color format definition for JPEG encoding/Decoding : Should not be modified*/
#define JPEG_ARGB8888 0 /* ARGB8888 Color Format */
#define JPEG_RGB888 1 /* RGB888 Color Format */
#define JPEG_RGB565 2 /* RGB565 Color Format */
 
/*
 * Define USE_JPEG_DECODER
 */
 
#define USE_JPEG_DECODER 1 /* 1 or 0 ********* Value different from default value : 1 ********** */
/*
 * Define USE_JPEG_ENCODER
 */
 
#define USE_JPEG_ENCODER 0 /* 1 or 0 */
 
/*
 * Define JPEG_RGB_FORMAT
 */
#define JPEG_RGB_FORMAT JPEG_RGB888 /* JPEG_ARGB8888, JPEG_RGB888, JPEG_RGB565 ********* Value different from default value : 0 ********** */
 
/* This is the problem.
 * Define JPEG_SWAP_RG
 */
#define JPEG_SWAP_RG 1 /* 0 or 1 */
 
/* Exported macro ------------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */
 
#endif /* __JPEG_UTILS_CONF_H__ */

JPEG_SWAP_RB is correct, not JPEG_SWAP_RG.

For this reason, Red and Blue are not swapable.

This topic has been closed for replies.
Best answer by mƎALLEm

Hello,

Issue has been fixed in CubeMx 6.16.

2 replies

Technical Moderator
July 28, 2021

Hello @Kim KyungTack ,

Swap RED, and Blue offsets if needs to change the color order by setting: * #define JPEG_SWAP_RB 1

This is mentioned in the AN4996 Application note Hardware JPEG codec peripheral:

Optionally red and blue swap can be selected using the #define JPEG_SWAP_RB (set to 1 to swap red and blue order in pixels)

Imen

"When your question is answered, please close this topic by clicking ""Accept as Solution"".ThanksImen"
mƎALLEm
mƎALLEmBest answer
Technical Moderator
November 21, 2025

Hello,

Issue has been fixed in CubeMx 6.16.

"To give better visibility on the answered topics, please click on ""Accept as Solution"" on the reply which solved your issue or answered your question."