实验5:JPEG原理分析及JPEG解码器的调试

JPEG原理分析及JPEG解码器的调试

1.JPEG编解码原理
jpeg
JPEG编码的过程如上图所示。解码是编码的逆过程。
2.JPEG文件格式介绍
jpeg格式
实验要求:
1.将输出文件保存为可供YUV Viewer观看的yuv文件
修改loadjpeg.c中的wrire_yuv

static void write_yuv(const char *filename, int width, int height, unsigned char **components)
{
   
  //将输出文件保存为可供YUVViewer观看的YUV文件
  FILE *F;
  char temp[1024];
  snprintf(temp, 1024, "%s.yuv", filename);
  F = fopen(temp, "wb");
  fwrite(components[0], width, height, F);
  fwrite(components[1], width*height/4, 1, F);
  fwrite(components[2], width*height/4, 1, F);
  fclose(F);
}

输出文件
yuv
2.理解程序设计的整体框架,三个结构体的设计目的 、TRACE的目的和含义
在tinyjpeg-internal.h中定义了三个结构体,分别是huffman_table、component 和jdec_private,三个结构体呈现递进关系,component 代表一个块包含huffman_table,jdec_private代表一个MCU包含component

// Huffman码表结构体
struct huffman_table
{
   
  /* Fast look up table, using HUFFMAN_HASH_NBITS bits we can have directly the symbol,
   * if the symbol is <0, then we need to look into the tree table */
  short int lookup[HUFFMAN_HASH_SIZE];//快速查找权值对应的码字
  /* code size: give the number of bits of a symbol is encoded */
  unsigned char code_size[HUFFMAN_HASH_SIZE];//码长对应的权值,每个符号编码后的码字
  
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值