你的浏览器版本过低,可能导致网站不能正常访问!
为了你能正常使用网站功能,请使用这些浏览器。

请教下,使用 stm32f7x的硬件 jpeg 解码功能,图片不能够横...

[复制链接]
hpdell 提问时间:2017-5-20 14:45 /
本帖最后由 hpdell 于 2017-5-21 15:42 编辑

请教下,使用 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;
}



显示效果图片如下:

正常的竖屏显示,
竖屏.png



竖屏 180 度 显示图片如下:
竖屏180.png


这个竖屏 180度显示,字符汉字都已经正常显示了,唯独图片没有 ??

旋转180度显示图片的地址计算我是参考我的 图形显示参数修改的,显示图形任意方向显示是没有问题的

// 使用rgb565模式,地址设置貌似就在此处,但是如果按照显示画图形的方法来设置地址的话,那这个 x, y又该如何获取啊 ???



























下半部分显示字符.png
下半部分不显示字符.png
收藏 评论5 发布时间:2017-5-20 14:45

举报

5个回答
MrJiu 回答时间:2017-5-20 15:25:35
F7没搞过,帮顶!!!!!!!!
hpdell 回答时间:2017-5-20 16:34:18
MrJiu 发表于 2017-5-20 15:25
F7没搞过,帮顶!!!!!!!!


creep 回答时间:2017-5-21 10:26:43
好大的LCD,1280*720 分辨率?是MIPI接口吗?
hpdell 回答时间:2017-5-21 15:30:33
creep 发表于 2017-5-21 10:26
好大的LCD,1280*720 分辨率?是MIPI接口吗?

我的是 800*1280的 lvds 屏,

请教有没有关于 这个硬件解码 jpg 进行 横竖屏显示的历程啊 ??
peter001 回答时间:2017-5-22 23:13:41
不懂 帮顶

所属标签

相似问题

关于意法半导体
我们是谁
投资者关系
意法半导体可持续发展举措
创新和工艺
招聘信息
联系我们
联系ST分支机构
寻找销售人员和分销渠道
社区
媒体中心
活动与培训
隐私策略
隐私策略
Cookies管理
行使您的权利
关注我们
st-img 微信公众号
st-img 手机版