JPEG-SOS之后,EOI标记能否出现在图像数据内? [英] JPEG - Can EOI Marker appear inside image data after SOS?

查看:320
本文介绍了JPEG-SOS之后,EOI标记能否出现在图像数据内?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我了解到JPEG文件以0xFFD8(SOI)开头,随后是保存元数据的多个0xFFE n 段,然后是保存压缩相关数据的许多段(DQT,DHT等) ),最后一个是0xFFDA(SOS);然后是以0xFFD9(EOI)结尾的实际图像数据.这些段中的每个段都在JPEG标记后的两个字节中声明其长度,因此计算段的末尾/下一个段的开始是很简单的执行,并且可以根据SOS段的长度来计算图像数据的开始

I understand that a JPEG file starts with 0xFFD8 (SOI), followed by a number of 0xFFEn segments holding metadata, then a number of segments holding the compression relate data (DQT, DHT, etc) of which the final one is 0xFFDA (SOS); then comes the actual image data which ends with 0xFFD9 (EOI). Each of those segments states its length in the two bytes following the JPEG marker so it is a trivial execise to calculate the end of a segment/start of next segment and the start of the image data can be calculated from the length of the SOS segment.

到那时,0xFFD9(EOI)的出现与 1 无关,因为这些段是通过长度来标识的.据我所知,除了找到在SOS段之后的0xFFD9(EOI)标记外,没有其他方法可以确定图像数据的长度.为了确保这一点,这意味着0xFFD9一定不能出现在实际的图像数据本身内. JPEG算法中是否内置某些功能来确保还是我在这里丢失了某些内容?

Up to that point, the appearance of 0xFFD9 (EOI) is irrelevant 1, because the segments are identified by the length. As far as I can see, however, there is no way of determining the length of the image data other than finding the 0xFFD9(EOI) marker following the SOS segment. In order for that to be assured, it would mean that 0xFFD9 must not appear inside the actual image data itself. Is there something built into the JPEG algorithm to ensure that or am I missing something here?

1 如果图像中包含缩略图,则第二个0xFFD8和0xFFD9会出现,但是要通过包含段的长度来照顾-通常我是0xFFE1(APP1)段看到.在到目前为止我检查过的图像中,即使不赞成使用,缩略图图像数据的开始和大小仍在IFD1中的0x0201(JPEGInterchangeFormat-偏移到JPEG SOI)和0x202(JPEGInterchangeFormatLength-JPEG数据的字节)字段中给出在技​​术说明2中.

1 A second 0xFFD8 and 0xFFD9 can appear if a thumbnail is included in the image but that is taken care of by the length of the containing segment - usually a 0xFFE1 (APP1) segment from what I have seen. In images I have checked so far, the start and size of the thumbnail image data is still given in the 0x0201 (JPEGInterchangeFormat - Offset to JPEG SOI)and 0x202 (JPEGInterchangeFormatLength - Bytes of JPEG data) fields in IFD1, even though these were deprecated in Tech Note #2.

推荐答案

在JPEG中,压缩值FF被编码为FF00.

In JPEG, the Compressed value FF is encoded as FF00.

压缩后的值FFD9将被编码为FF00D9.

The compressed value FFD9 would be encoded as FF00D9.

这篇关于JPEG-SOS之后,EOI标记能否出现在图像数据内?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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