解码一个JPEG霍夫曼块(表) [英] Decoding a JPEG Huffman block (table)

查看:804
本文介绍了解码一个JPEG霍夫曼块(表)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下块由霍夫曼块标记嵌套

The following block is nested by Huffman block markers

-HUFF---------------------------------------------------------------------0084-
  10    0    1    2    4    3    4    6    5    6    8    a    9    4    2    3
   0    1    2   11    0    3    4   21    5   12   31    6   41   51   61   13
  22   71   81   91   a1   14   32   b1   d1   f0   15   23   35   42   b2   c1
   7   16   24   33   52   72   73   e1   25   34   43   53   62   74   82   94
  a2   f1   26   44   54   63   64   92   93   c2   d2   55   56   84   b3   45
  83   46   a3   e2
-------------------------------------------------------------------------------

0084是表作为整数的长度,不包含在该块此处

0084 is the length of the table as an integer and is not included in the block here

,第一地址aparently使得它的AC表在目的地0(0×10)

according to the JPEG standard, the first address aparently makes it an AC table at destination 0 (0x10)

和aparently从那里开始它是一个哈夫曼表。

and aparently from there onwards it's a huffman table.

那么,它是如何去codeD?

So, how is it decoded?

推荐答案

后,接下来的16字节为0x10告诉你每个长度有多少codeS。在你的榜样,有长度为1位的0 codeS,长度为2位的$ C $ 1℃,2 $ C $长度为3位的CS,4 codeS长度为4位,3 $ C $长度为5比特的CS,等

The next 16 bytes after the 0x10 tell you how many codes of each length. In your example, there are 0 codes of length 1 bit, 1 code of length 2 bits, 2 codes of length 3 bits, 4 codes of length 4 bits, 3 codes of length 5 bits, and so on.

这些都是再接着是连接这些codeS codeD,以便值。再从你的例子:

These are then followed by the values that are encoded by those codes, in order. Again from your example:

Code length | Number | Symbol(s)
------------+--------+----------
1 bit       | 0      |
2 bits      | 1      | 0x01
3 bits      | 2      | 0x02 0x11
4 bits      | 4      | 0x00 0x03 0x04 0x21
5 bits      | 3      | 0x05 0x12 0x31
... etc

您然后建立自上而下二叉树,为了分配的符号。在这个例子中,您可以:

You then build a binary tree from the top down, assigning the symbols in order. In this example, you get:

Symbol | Code 
-------+------
0x01   | 00
0x02   | 010
0x11   | 011
0x00   | 1000
0x03   | 1001
0x04   | 1010
0x21   | 1011
...etc

这篇关于解码一个JPEG霍夫曼块(表)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆