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

使用st官网的硬件 解码 jpg,只能解码一次是神马情况?

[复制链接]
hpdell 提问时间:2017-5-20 16:41 /
本帖最后由 hpdell 于 2017-5-20 16:43 编辑

使用st官网的硬件 解码 jpg,只能解码一次是神马情况?
使用的是st官网提供的中断模式 解码 jpg

具体如下:

uint8_t  JPEG_Display(char  *_path)
{
  uint32_t TimeBegin, TimeEnd;
  uint32_t xPos = 0, yPos = 0;
  FRESULT  res;
  FATFS    * _jpeg_fs = 0;
  DIR picdir;                                     //图片目录
  TimeBegin = HAL_GetTick();

  _jpeg_fs  = (FATFS *)mymalloc(SRAMIN, sizeof(FATFS));

  if( (!_jpeg_fs) )
    return 0xff;  

  /*##-4- Register the file system object to the FatFs module ##############*/
  res = f_mount(_jpeg_fs, (TCHAR const*)"0:", 0); // == FR_OK)  

  if(res == FR_OK )
  {
    res = f_opendir(&picdir,(const TCHAR*)"0icture");         //打开目录
    if(res != FR_OK)
      return 3;

    /*##-5- Open the JPG file with read access #############################*/
    res = f_open(&JPEG_File, (TCHAR const*)_path, FA_READ);
    if(res == FR_OK )
    {
      /*##-6- JPEG decoding with IT (Not Blocking ) Method ################*/
      JPEG_Decode_IT(&JPEG_Handle, &JPEG_File, JPEG_OUTPUT_DATA_BUFFER);

      /*##-7- Wait till end of JPEG decoding and perfom Input/Output Processing in BackGround  #*/
      do
      {
        JPEG_InputHandler(&JPEG_Handle);
        JpegProcessing_End = JPEG_OutputHandler(&JPEG_Handle);

      }while(JpegProcessing_End == 0);                                                  // 程序解码第二次时,会死在这个地方 ???

      /*##-8- Get JPEG Info  ###############################################*/
      HAL_JPEG_GetInfo(&JPEG_Handle, &JPEG_Info);

      printf("JPEG_Info.ImageWidth = %d\r\n", JPEG_Info.ImageWidth);
      printf("JPEG_Info.ImageHeight = %d\r\n", JPEG_Info.ImageHeight);      

      /*##-9- Copy RGB decoded Data to the display FrameBuffer  ############*/

      if(( g_LcdDirection == 0) || (g_LcdDirection == 2))  // 竖屏,竖屏180
      {
        xPos = (BSP_LCD_GetXSize() - JPEG_Info.ImageWidth)  / 2;
        yPos = (BSP_LCD_GetYSize() - JPEG_Info.ImageHeight) / 2;
      }
      else  // 横屏,横屏180
      {
        xPos = (BSP_LCD_GetYSize() - JPEG_Info.ImageWidth)  / 2;
        yPos = (BSP_LCD_GetXSize() - JPEG_Info.ImageHeight) / 2;      
      }


      JPEG_DMA2D_CopyBuffer((uint32_t *)JPEG_OUTPUT_DATA_BUFFER, (uint32_t *)JPEG_LCD_FRAME_BUFFER,
                            xPos , yPos,
                            JPEG_Info.ImageWidth, JPEG_Info.ImageHeight);




      /*##-10- Close the JPG file ##########################################*/
//     f_close(&JPEG_File);      
    }
    else
    {
      printf("JPEG_Display f_open Error \r\n");
    }  
  }
  else
  {
    printf("JPEG_Display f_mount Error \r\n");
  }

  TimeEnd = HAL_GetTick();
  printf("JPEG  Display  End   ... ... %dms\r\n" ,  TimeEnd - TimeBegin);


  f_mount(NULL, (TCHAR const*)"0:", 0);

  // 显示文件名
  BSP_LTDC_DispStringAt(240, 1280/2-230, LCD_COLOR_BLUE,  // 显示的文本颜色
                      LCD_COLOR_TRANSPARENT,     // 显示的背景颜色
                      &FontAscii16x24,
                      (uint8_t *)_path);         //
  return 0;
}



int main(void)
{

  ... ...

  JPEG_Display("0:dfdfd.jpg");   // 第一次能够正常解码并显示
JPEG_Display("0:dfdfd.jpg");   // 第二次就死在了上面的 do while里面了  这是为何啊 ????
}


收藏 2 评论0 发布时间:2017-5-20 16:41

举报

0个回答

所属标签

相似问题

关于
我们是谁
投资者关系
意法半导体可持续发展举措
创新与技术
意法半导体官网
联系我们
联系ST分支机构
寻找销售人员和分销渠道
社区
媒体中心
活动与培训
隐私策略
隐私策略
Cookies管理
行使您的权利
官方最新发布
STM32N6 AI生态系统
STM32MCU,MPU高性能GUI
ST ACEPACK电源模块
意法半导体生物传感器
STM32Cube扩展软件包
关注我们
微信公众号二维码 微信公众号
手机版二维码 手机版