免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3002 | 回复: 1
打印 上一主题 下一主题

[C] 做过jpeg解压的大侠帮个忙啊 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-12-03 15:07 |只看该作者 |倒序浏览
  1.   FILE * infile;        /* source file */
  2.   JSAMPARRAY buffer;        /* Output row buffer,typedef unsigned char **  JSAMPARRAY   */
  3.   int row_stride;        /* physical row width in output buffer */

  4. row_stride = cinfo.output_width * cinfo.output_components;
  5.   /* Make a one-row-high sample array that will go away when done with image */
  6.   buffer = (*cinfo.mem->alloc_sarray)
  7.         ((j_common_ptr) &cinfo, JPOOL_IMAGE, row_stride, 1);

  8.   /* Step 6: while (scan lines remain to be read) */
  9.   /*           jpeg_read_scanlines(...); */

  10.   /* Here we use the library's state variable cinfo.output_scanline as the
  11.    * loop counter, so that we don't have to keep track ourselves.
  12.    */
  13.   while (cinfo.output_scanline < cinfo.output_height) {
  14.     /* jpeg_read_scanlines expects an array of pointers to scanlines.
  15.      * Here the array is only one element long, but you could ask for
  16.      * more than one scanline at a time if that's more convenient.
  17.      */
  18.     (void) jpeg_read_scanlines(&cinfo, buffer, 1);
  19.     /* Assume put_scanline_someplace wants a pointer and sample count. */
  20.     put_scanline_someplace(buffer[0], row_stride);
  21.   }
复制代码
请问如何输出代码中buffer的内容呢?

论坛徽章:
0
2 [报告]
发表于 2011-04-25 15:11 |只看该作者
//put_scanline_someplace(buffer[0], row_stride);

write(1,buffer[0], row_stride);
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP