硬汉嵌入式论坛

 找回密码
 立即注册
查看: 7259|回复: 4
收起左侧

[有问必答] 请教下,使用st提供的历程,libjpeg 库解码 ??

[复制链接]

692

主题

3576

回帖

5677

积分

论坛元老

积分
5677
发表于 2016-1-11 15:48:18 | 显示全部楼层 |阅读模式
各位大侠们,使用st官网提供的libjpeg解码库时,程序运行到

typedef unsigned char JOCTET;

GLOBAL(void)
jpeg_stdio_src (j_decompress_ptr cinfo, FILE * infile)
{
  my_src_ptr src;

  /* The source object and input buffer are made permanent so that a series
   * of JPEG images can be read from the same file by calling jpeg_stdio_src
   * only before the first one.  (If we discarded the buffer at the end of
   * one image, we'd likely lose the start of the next one.)
   * This makes it unsafe to use this manager and a different source
   * manager serially with the same JPEG object.  Caveat programmer.
   */
  if (cinfo->src == NULL) {        /* first time for this JPEG object? */
    cinfo->src = (struct jpeg_source_mgr *)
      (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
                                  SIZEOF(my_source_mgr));
    src = (my_src_ptr) cinfo->src;
    src->buffer = (JOCTET *)                      // 程序运行此处时,程序跑飞了,不知是为何  ???????????????
      (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
                                  INPUT_BUF_SIZE * SIZEOF(JOCTET));
  }

  src = (my_src_ptr) cinfo->src;
  src->pub.init_source = init_source;
  src->pub.fill_input_buffer = fill_input_buffer;
  src->pub.skip_input_data = skip_input_data;
  src->pub.resync_to_restart = jpeg_resync_to_restart; /* use default method */
  src->pub.term_source = term_source;
  src->infile = infile;
  src->pub.bytes_in_buffer = 0; /* forces fill_input_buffer on first read */
  src->pub.next_input_byte = NULL; /* until buffer loaded */
}
回复

使用道具 举报

1万

主题

7万

回帖

11万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
117530
QQ
发表于 2016-1-11 15:59:39 | 显示全部楼层
有例子的,直接运行官方的那个解码或者编码的例子。

另外要加大堆空间,也就是启动代码里面的HEAP_SIZE。
回复

使用道具 举报

692

主题

3576

回帖

5677

积分

论坛元老

积分
5677
 楼主| 发表于 2016-1-11 16:35:44 | 显示全部楼层

回 eric2013 的帖子

eric2013:
有例子的,直接运行官方的那个解码或者编码的例子。

另外要加大堆空间,也就是启动代码里面的HEAP_SIZE。
估计就是你所的问题了,

刚刚看了官网的配置如下:
官网的配置.jpg

自己的设置如下:
自己的设置.png


相差太大了,那如果这样的话,使用 libjpeg 库解码是不是很浪费资源了啊 ????
回复

使用道具 举报

7

主题

16

回帖

37

积分

新手上路

积分
37
发表于 2016-1-11 16:56:46 | 显示全部楼层
用emwin显示个一寸大的jpeg的图片需要近50k的内存用来解压缩,在运行个Falshfs又占了40k+,407一共128k的ram,在嵌入个系统应用都没内存了快,难道大家都愿意mollco?手册里面那一片公用内存也不知道怎么使用
回复

使用道具 举报

692

主题

3576

回帖

5677

积分

论坛元老

积分
5677
 楼主| 发表于 2016-1-12 09:23:51 | 显示全部楼层

回 raulyourhero 的帖子

raulyourhero:用emwin显示个一寸大的jpeg的图片需要近50k的内存用来解压缩,在运行个Falshfs又占了40k+,407一共128k的ram,在嵌入个系统应用都没内存了快,难道大家都愿意mollco?手册里面那一片公用内存也不知道怎么使用
 (2016-01-11 16:56) 
这个传说的libjpeg库解码,看来使用不了啊,
只能想别的办法了哟
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|Archiver|手机版|硬汉嵌入式论坛

GMT+8, 2025-8-13 06:15 , Processed in 0.043898 second(s), 27 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表