cancel
Showing results for 
Search instead for 
Did you mean: 

TJpgDec + DMA2D

Chuev.Vladimir
Associate III
Posted on October 06, 2015 at 12:58

Hi.

I'm trying to combine TJpgDec and DMA2D. However, the display shows white square.

UINT output_func(JDEC *jd, 
void
*bitmap, JRECT *rect){
static
DMA2D_HandleTypeDef hdma2d_eval;
WORD h = rect->right - rect->left + 1;
WORD w = rect->bottom - rect->top + 1;
/* Configure the DMA2D Mode, Color Mode and output offset */
hdma2d_eval.Init.Mode = DMA2D_M2M_PFC;
hdma2d_eval.Init.ColorMode = DMA2D_ARGB8888;
hdma2d_eval.Init.OutputOffset = 0;
/* Foreground Configuration */
hdma2d_eval.LayerCfg[1].AlphaMode = DMA2D_NO_MODIF_ALPHA;
hdma2d_eval.LayerCfg[1].InputAlpha = 0xFF;
hdma2d_eval.LayerCfg[1].InputColorMode = CM_RGB888;
hdma2d_eval.LayerCfg[1].InputOffset = 0;
hdma2d_eval.Instance = DMA2D;
/* DMA2D Initialization */
if
(HAL_DMA2D_Init(&hdma2d_eval) == HAL_OK){
if
(HAL_DMA2D_ConfigLayer(&hdma2d_eval, 1) == HAL_OK){
if
(HAL_DMA2D_Start(&hdma2d_eval, (uint32_t)bitmap, 0, w, h) == HAL_OK){
HAL_DMA2D_PollForTransfer(&hdma2d_eval, 10);
}
}
}
return
1; 
// Continue to decompress
}
UINT input_func(JDEC *jd, BYTE *buff, UINT ndata){
IODEV *dev = (IODEV *)jd->device;
ndata = dev->jsize - dev->joffset > ndata ? ndata : dev->jsize - dev->joffset;
if
(buff){
memcpy(buff, dev->jpic + dev->joffset, ndata);
}
dev->joffset += ndata;
return
ndata;
}

BSP_LCD_Clear(LCD_COLOR_WHITE);
rc = jd_prepare(&jd, input_func, jdwork, 
sizeof
(jdwork), &iodev);
if
(rc){
BSP_LCD_Clear(LCD_COLOR_BLACK);
while
(1);
}
rc = jd_decomp(&jd, output_func, SCALE);
if
(rc){
BSP_LCD_Clear(LCD_COLOR_BLACK);
while
(1);
}

0 REPLIES 0