gpt4 book ai didi

image - 我应该在数据流的最开始期待 JPEG SOI 标记吗?

转载 作者:行者123 更新时间:2023-12-04 15:23:22 24 4
gpt4 key购买 nike

... 或者我应该深入到数据流中寻找 0xFF 0xD8序列?

来自 this Q ,我已经了解到什么 APPn 不必立即遵循 SOI。是否存在符合规范的 JPEG 情况,其中 SOI 位置 != 流的开头?

规范中的引用(附件 B,第 1.1.2 节):

Markers serve to identify the various structural parts of the compressed data formats. Most markers start marker segments containing a related group of parameters; some markers stand alone. All markers are assigned two-byte codes: an X’FF’ byte followed by a byte which is not equal to 0 or X’FF’ (see Table B.1). Any marker may optionally be preceded by any number of fill bytes, which are bytes assigned code X’FF’.

最佳答案

libjpeg在 SOI 之前不允许垃圾:

/* Like next_marker, but used to obtain the initial SOI marker. */
/* For this marker, we do not allow preceding garbage or fill; otherwise,
* we might well scan an entire input file before realizing it ain't JPEG.
* If an application wants to process non-JFIF files, it must seek to the
* SOI before calling the JPEG library.
*/

发件人: Random libjpeg mirror .

例如。 go implementation也不允许前面的垃圾。

但是,如果有疑问,请坚持 Postel 定律:

Be liberal in what you accept, and conservative in what you send



虽然,您不想太自由,否则您最终可能不是从流中提取实际的 JPEG,而是提取嵌入的 EXIF 缩略图或类似的东西。

关于image - 我应该在数据流的最开始期待 JPEG SOI 标记吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18582423/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com