JPEG 编码 - DHT 分段问题 ->信息字节
我正在将 DHT 段写入 jpeg 文件中。我将字节写入字节数组。
byte[] huffman_Info = {
//Mark as DHT Segment
(byte)0xff, (byte) 0xc4,
//length (has to be calculated later)
(byte)0x00, (byte) 0x15,
/*
* Info Byte:
* - HT information (1 byte):
bit 0..3: number of HT (0..3, otherwise error)
bit 4 : type of HT, 0 = DC table, 1 = AC table
bit 5..7: not used, must be 0
*/
(byte)0x08
};
我在信息字节中写入(用于测试)0x08。 前 4 位为 0000。这是我的第一个问题:这个“位 0..3:HT 数量(0..3,否则错误)”是什么意思?我用谷歌搜索了它,但我发现的只是一遍又一遍相同的规格。 对于 DC 表,第 5 位为 1,最后 3 位必须为 0 0x08 = 00001000。
但是,解码工具 JPEGSnoop 说我的目标 ID 是 15,这是错误的,因此它中止了进度。为什么我的信息字节错误?
一如既往,预先非常感谢您的帮助
问候,丹尼尔
im writing the DHT Segment in a jpeg file. I write Bytes into a Byte Array.
byte[] huffman_Info = {
//Mark as DHT Segment
(byte)0xff, (byte) 0xc4,
//length (has to be calculated later)
(byte)0x00, (byte) 0x15,
/*
* Info Byte:
* - HT information (1 byte):
bit 0..3: number of HT (0..3, otherwise error)
bit 4 : type of HT, 0 = DC table, 1 = AC table
bit 5..7: not used, must be 0
*/
(byte)0x08
};
Im writing (for testing) a 0x08 in the Info Byte.
This is 0000 for the first 4 Bits. Here my first questions: What does this "bit 0..3: number of HT (0..3, otherwise error)" mean? I googled it but all I find is the same specification over and over again.
the 5th Bit is a 1 for a DC table and the the 3 last bits have to be 0
0x08 = 00001000.
However, JPEGSnoop, a decoding tool, says my Destination ID is 15, this is wrong, so its aborting the progress. Why is my Info Byte wrong?
As Always, thanks a lot in advance for your help
regards, Daniel
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
第一个半字节应该是 0 或 1,第二个半字节应该是 0 到 3 之间的数字。任何其他值都是非法的。所以该字节的唯一合法值是:
0x00 0x01 0x02 0x03 0x10 0x11 0x12 0x13
学习 JPEG 的最好方法是阅读标准,它实际上并不难理解。谷歌搜索“itu-1150.pdf”,您就会找到它。
The first nibble should be either 0 or 1, the second should be a number between 0 and 3. Any other values are illegal. So the only legal values for that byte would be:
0x00 0x01 0x02 0x03 0x10 0x11 0x12 0x13
The best way to learn JPEG is to read the standard, it's actually not that hard to understand. Google for "itu-1150.pdf" and you'll find it.