STM32H7 JPEG encode for grayscale inputs
Hello
I am trying to encode an image of (160*120) in grayscale format - i.e a bmp file of 1bpp color depth.
Unfortunately, the encoder would not finish its conversion. and the `HAL_JPEG_EncodeCpltCallback` is not called.
My setup is based on the `JPEG_EncodingUsingFs_DMA` from ST, while this example is designed for 24bits pixel depth, I tried to modify it for my application - with changing the `ReadBmpRgbLines`to read only 1 color:
static void ReadBmpRgbLines(FIL *file, JPEG_ConfTypeDef Conf, uint8_t * pDataBuffer, uint32_t *BufferSize)
{
uint32_t bytesReadfile = 1;
uint32_t CurrentBlockLine = 1;
*BufferSize = 0;
while((CurrentLine <= Conf.ImageHeight) && (CurrentBlockLine <= MAX_INPUT_LINES))
{
f_lseek (file,BMP_HEADER_SIZE + Conf.ImageWidth *(Conf.ImageHeight - CurrentLine)*1);
f_read (file, pDataBuffer , Conf.ImageWidth*1 , (UINT*)(&bytesReadfile));
pDataBuffer += bytesReadfile;
*BufferSize += bytesReadfile;
CurrentLine +=1 ;
CurrentBlockLine += 1;
}
}My encoder values are as follow:
#define JPEG_RGB_FORMAT JPEG_RGB888
#define JPEG_CHROMA_SAMPLING JPEG_444_SUBSAMPLING
#define JPEG_COLOR_SPACE JPEG_YCBCR_COLORSPACE\
#define JPEG_IMAGE_QUALITY 100
#define MAX_INPUT_WIDTH 800
#define MAX_INPUT_LINES 8 I have noticed the function that is called to generate a new MCU block is 'stuck` on the same bmp image line.
Can anyone send a hint about this problem? Do I have to set different parameters for the encoder?
Sincerely
Dan
