请教下,使用 STM32f7x的硬件 jpeg 解码功能,图片不能够横屏显示??
但是 显示字符,画图等完全可以横屏显示(四个方向可以任意显示),
还有在图片上显示字符,具体见下面程序的描述
貌似设置横竖屏显示的函数就在下面这个函数里面,但是不知道该如果修改 ????
static uint32_t JPEG_MCU_YCbCr420_ARGB_ConvertBlocks(uint8_t *pInBuffer,
uint8_t *pOutBuffer,
uint32_t BlockIndex,
uint32_t DataCount,
uint32_t *ConvertedDataCount)
{
uint32_t numberMCU;
uint32_t i,j,k, currentMCU, xRef,yRef;
uint32_t refline;
int32_t ycomp, crcomp, cbcomp;
int32_t c_red, c_blue, c_green;
uint8_t *pOutAddr, *pOutAddr2;
uint8_t *pChrom, *pLum;
numberMCU = DataCount / YCBCR_420_BLOCK_SIZE;
currentMCU = BlockIndex;
while(currentMCU < (numberMCU + BlockIndex))
{
xRef = ((currentMCU *16) / JPEG_ConvertorParams.WidthExtend)*16;
yRef = ((currentMCU *16) % JPEG_ConvertorParams.WidthExtend);
refline = JPEG_ConvertorParams.ScaledWidth * xRef + (JPEG_BYTES_PER_PIXEL*yRef);
currentMCU++;
pChrom = pInBuffer + 256; /* pChroma = pInBuffer + 4*64 */
pLum = pInBuffer;
for(i= 0; i < 16; i+=2)
{
if(i == 8)
{
pLum = pInBuffer + 128;
}
if(refline < JPEG_ConvertorParams.ImageSize_Bytes)
{
pOutAddr = pOutBuffer + refline;
pOutAddr2 = pOutAddr + JPEG_ConvertorParams.ScaledWidth;
for(k= 0; k<2; k++)
{
for(j=0; j < 8; j+=2)
{
cbcomp = (int32_t)(*(pChrom));
c_blue = (int32_t)(*(CB_BLUE_LUT + cbcomp));
crcomp = (int32_t)(*(pChrom + 64));
c_red = (int32_t)(*(CR_RED_LUT + crcomp));
c_green = ((int32_t)(*(CR_GREEN_LUT + crcomp)) + (int32_t)(*(CB_GREEN_LUT + cbcomp))) >> 16;
#if (JPEG_RGB_FORMAT == JPEG_ARGB8888)
ycomp = (int32_t)(*(pLum +j));
*(__IO uint32_t *)pOutAddr =
(CLAMP(ycomp + c_red) << JPEG_RED_OFFSET) |
(CLAMP( ycomp + c_green) << JPEG_GREEN_OFFSET) |
(CLAMP(ycomp + c_blue) << JPEG_BLUE_OFFSET);
/**********/
ycomp = (int32_t)(*(pLum +j +1));
*((__IO uint32_t *)(pOutAddr + 4)) =
(CLAMP(ycomp + c_red) << JPEG_RED_OFFSET) |
(CLAMP( ycomp + c_green) << JPEG_GREEN_OFFSET) |
(CLAMP(ycomp + c_blue) << JPEG_BLUE_OFFSET);
/**********/
ycomp = (int32_t)(*(pLum +j +8));
*(__IO uint32_t *)pOutAddr2 =
(CLAMP(ycomp + c_red) << JPEG_RED_OFFSET) |
(CLAMP( ycomp + c_green) << JPEG_GREEN_OFFSET) |
(CLAMP(ycomp + c_blue) << JPEG_BLUE_OFFSET);
/**********/
ycomp = (int32_t)(*(pLum +j +8 +1));
*((__IO uint32_t *)(pOutAddr2 +4)) =
(CLAMP(ycomp + c_red) << JPEG_RED_OFFSET) |
(CLAMP( ycomp + c_green) << JPEG_GREEN_OFFSET) |
(CLAMP(ycomp + c_blue) << JPEG_BLUE_OFFSET);
#elif (JPEG_RGB_FORMAT == JPEG_RGB888)
ycomp = (int32_t)(*(pLum +j));
pOutAddr[JPEG_RED_OFFSET/8] = CLAMP(ycomp + c_red);
pOutAddr[JPEG_GREEN_OFFSET/8] = CLAMP(ycomp + c_green);
pOutAddr[JPEG_BLUE_OFFSET/8] = CLAMP(ycomp + c_blue);
/**********/
ycomp = (int32_t)(*(pLum +j +1));
pOutAddr[3 + JPEG_RED_OFFSET/8] = CLAMP(ycomp + c_red);
pOutAddr[3 + JPEG_GREEN_OFFSET/8] = CLAMP(ycomp + c_green);
pOutAddr[3 + JPEG_BLUE_OFFSET/8] = CLAMP(ycomp + c_blue);
/**********/
ycomp = (int32_t)(*(pLum +j +8));
pOutAddr2[JPEG_RED_OFFSET/8] = CLAMP(ycomp + c_red);
pOutAddr2[JPEG_GREEN_OFFSET/8] = CLAMP(ycomp + c_green);
pOutAddr2[JPEG_BLUE_OFFSET/8] = CLAMP(ycomp + c_blue);
/**********/
ycomp = (int32_t)(*(pLum +j +8 +1));
pOutAddr2[3+ JPEG_RED_OFFSET/8] = CLAMP(ycomp + c_red);
pOutAddr2[3 + JPEG_GREEN_OFFSET/8] = CLAMP(ycomp + c_green);
pOutAddr2[3 + JPEG_BLUE_OFFSET/8] = CLAMP(ycomp + c_blue);
#elif (JPEG_RGB_FORMAT == JPEG_RGB565) // 使用rgb565模式,地址设置貌似就在此处,但是如果按照显示画图形的方法来设置地址的话,那这个 x, y又该如何获取啊 ???
ycomp = (int32_t)(*(pLum +j));
*(__IO uint16_t *)pOutAddr =
((CLAMP(ycomp + c_red) >> 3) << JPEG_RED_OFFSET) |
((CLAMP( ycomp + c_green) >> 2) << JPEG_GREEN_OFFSET) |
((CLAMP(ycomp + c_blue) >> 3) << JPEG_BLUE_OFFSET);
/**********/
ycomp = (int32_t)(*(pLum +j +1));
*((__IO uint16_t *)(pOutAddr + 2)) =
((CLAMP(ycomp + c_red) >> 3) << JPEG_RED_OFFSET) |
((CLAMP( ycomp + c_green) >> 2) << JPEG_GREEN_OFFSET) |
((CLAMP(ycomp + c_blue) >> 3) << JPEG_BLUE_OFFSET);
/**********/
ycomp = (int32_t)(*(pLum +j +8));
*(__IO uint16_t *)pOutAddr2 =
((CLAMP(ycomp + c_red) >> 3) << JPEG_RED_OFFSET) |
((CLAMP( ycomp + c_green) >> 2) << JPEG_GREEN_OFFSET) |
((CLAMP(ycomp + c_blue) >> 3) << JPEG_BLUE_OFFSET);
/**********/
ycomp = (int32_t)(*(pLum +j +8 +1));
*((__IO uint16_t *)(pOutAddr2 +2)) =
((CLAMP(ycomp + c_red) >> 3) << JPEG_RED_OFFSET) |
((CLAMP( ycomp + c_green) >> 2) << JPEG_GREEN_OFFSET) |
((CLAMP(ycomp + c_blue) >> 3) << JPEG_BLUE_OFFSET);
#endif /* JPEG_RGB_FORMAT */
pOutAddr += JPEG_BYTES_PER_PIXEL * 2;
pOutAddr2 += JPEG_BYTES_PER_PIXEL * 2;
pChrom++;
}
pLum += 64;
}
pLum = pLum - 128 + 16;
refline += 2*JPEG_ConvertorParams.ScaledWidth;
}
}
pInBuffer += YCBCR_420_BLOCK_SIZE;
}
return numberMCU;
}
显示效果图片如下:
正常的竖屏显示,
竖屏 180 度 显示图片如下:
这个竖屏 180度显示,字符汉字都已经正常显示了,唯独图片没有 ??
旋转180度显示图片的地址计算我是参考我的 图形显示参数修改的,显示图形任意方向显示是没有问题的
// 使用rgb565模式,地址设置貌似就在此处,但是如果按照显示画图形的方法来设置地址的话,那这个 x, y又该如何获取啊 ???
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
我的是 800*1280的 lvds 屏,
请教有没有关于 这个硬件解码 jpg 进行 横竖屏显示的历程啊 ??
一周热门 更多>