硬汉嵌入式论坛

 找回密码
 立即注册
查看: 4457|回复: 1
收起左侧

[LibJPEG] 【LibJPEG专题系列十三】无损JPEG

[复制链接]

740

主题

1326

回帖

3546

积分

管理员

春暖花开

Rank: 9Rank: 9Rank: 9

积分
3546
QQ
发表于 2015-5-5 18:00:07 | 显示全部楼层 |阅读模式
                                           Section 13—无损JPEG

    关于无损JPEG,各说纷纭,但这并不奇怪,在于有好几种压缩方式都被称为“JPEG”。常用的方法是基线JPEG
baseline JPEG),又或者是它的变体—渐进式JPEGprogressive JPEG)。相同的ISO标准还定义了一个非常不
同的方法被称为“无损JPEG”。如果这还不够混乱,一个新的被称为“JPEG-LS”的无损标准即将传遍大街小巷。


    当我们说“无损”时,这指的是数学上的无损:无损压缩的算法是一种保证解压缩输出与原始输入是位对位完全
相同的算法。这可比“视觉上无差别”更强好多。对于大部分照片般的图像,基线JPEG可以达到视觉不可分辨的能力,
但是它不可能是真正无损的。


    无损JPEG是一种完全不同且真正无损的方法。然而,它几乎不会像基线JPEG压缩地那样好,通常,无损JPEG
将全彩数据压缩到大约2:1。而且无损JPEG只会对连续色调的图像处理的效果好。它不会提供调色板颜色图像或低位
深度图像的有用压缩。


    无损JPEG从未流行开来,而且现在已经过时——事实上,它并没有常见的应用程序支持。认识到这一点,最近ISO
JPEG委员会完成了一个全新的无损压缩标准——JPEG-LS(或许你也在LOCO的名字下听说过它。)JPEG-LS提供了
比原来无损JPEG更好的压缩,但仍远不及你用有损方法获得的效果这种新的标准是否会得到普及,任何人都可以猜想。


    值得重申的是,起动一个常规的JPEG应用到其最大的质量设置并不会使你得到无损存储,甚至在可能的最高设置时,
基线JPEG会在各种计算中受舍入误差的影响变为有损的。舍入误差通常太小以至于几乎看不到,但是如果你将图像进行
多个周期的压缩,它们会累积(见Section 10)。


许多应用将不会允许你得到最大可能的设置,这是因为使用常规的JPEG是一个低效率的方法。举例来说,使用IJG JPEG
软件时,为了减少信息的丢失,你不仅要选择“quality 100”而且还要关闭色度的向下采样。这样产生的文件将会非常非
常大,而且相较于更合理设置下产生的文件,其质量才更好那么一丢丢。同时,它们仍是轻微有损的。如果你真的需要无
损存储,不要尝试用常规JPEG实现。
努力打造安富莱高质量微信公众号:点击扫描图片关注
回复

使用道具 举报

740

主题

1326

回帖

3546

积分

管理员

春暖花开

Rank: 9Rank: 9Rank: 9

积分
3546
QQ
 楼主| 发表于 2015-5-5 18:02:57 | 显示全部楼层
                         Section - [13] Isn't there a lossless JPEG?


There's a great deal of confusion on this subject, which is not surprising because there are several different
compression methods all known as "JPEG". The commonly used method is "baseline JPEG" (or its variant "
progressive JPEG").  The same ISO standard also defines a very different method called "lossless JPEG".  
And if that's not confusing enough, a new lossless standard called "JPEG-LS" is about to hit the streets.


When I say "lossless", I mean mathematically lossless: a lossless compression algorithm is one that guaran-
tees its decompressed output is bit-for-bit identical to the original input.  This is a much stronger claim than "
visually indistinguishable from the original".  Baseline JPEG can reach visual indistinguishability for most
photo-like images, but it can never be truly lossless.


Lossless JPEG is a completely different method that really is lossless. However, it doesn't compress nearly
as well as baseline JPEG; it typically can compress full-color data by around 2:1.  And lossless JPEG works
well only on continuous-tone images.  It does not provide useful compression of palette-color images or
low-bit-depth images.


Lossless JPEG has never been popular --- in fact, no common applications support it --- and it is now largely
obsolete.  (For example, the new PNG standard outcompresses lossless JPEG on most images.)  Recognizing
this, the ISO JPEG committee recently finished an all-new lossless compression standard called JPEG-LS
(you may have also heard of it under the name LOCO). JPEG-LS gives better compression than original
lossless JPEG, but still nowhere near what you can get with a lossy method.  It's anybody's guess whether
this new standard will achieve any popularity.


It's worth repeating that cranking a regular JPEG implementation up to its maximum quality setting *does
not* get you lossless storage; even at the highest possible quality setting, baseline JPEG is lossy because it
is subject to roundoff errors in various calculations.  Roundoff errors alone are nearly always too small to be
seen, but they will accumulate if you put the image through multiple cycles of compression (see section 10).


Many implementations won't even let you get to the maximum possible setting, because it's such an inefficient
way to use regular JPEG.  With the IJG JPEG software, for example, you have to not only select "quality 100"
but also turn off chroma downsampling to minimize loss of information.  The resulting files are far larger and
of only fractionally better quality than files generated at more reasonable settings.  And they're still slightly
lossy! If you really need lossless storage, don't try to approximate it with regular JPEG.
努力打造安富莱高质量微信公众号:点击扫描图片关注
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|Archiver|手机版|硬汉嵌入式论坛

GMT+8, 2024-5-11 14:29 , Processed in 0.278916 second(s), 25 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表