重新编码JPEG图像是幂等操作吗? [英] Is re-encoding JPEG images an idempotent operation?

查看:76
本文介绍了重新编码JPEG图像是幂等操作吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道JPEG压缩是有损的。
我有2个问题:

I am aware that JPEG compression is lossy. I have 2 questions:

给出一个操作T:

1.拍摄JPEG-80图像

2.将其解码为字节缓冲区

3.将给定的字节缓冲区编码为JPEG-80

Given an operation T:
1. Take a JPEG-80 image
2. Decode it to a byte buffer
3. Encode given byte buffer as JPEG-80

从视觉上讲,这是幂等运算质量?
还是在我重复T时图像质量会继续下降?
JPEG-XR编解码器是否也一样?

Is T an idempotent operation in terms of visual quality? Or will the quality of the image keep degrading as I repeat T? Does the same hold true for the JPEG-XR codec?

谢谢!

编辑
既然存在冲突的答案,那么您可以提供引用将非常有用!

Edit: Since there have been conflicting answers, it would be great if you could provide references!

推荐答案

不能保证,但是可能会发生。尤其是,如果您重复执行编码->解码->编码->解码过程足够多次,它最终将落在一个固定点上,并不再进一步降低质量(只要您坚持使用相同质量和相同编码器即可)。

It's not guaranteed, but it may happen. Especially if you repeat the encode -> decode -> encode -> decode process enough times, it will eventually settle on a fixpoint and stop losing quality further (as long as you stick to the same quality and same encoder).

JPEG编码分几个步骤完成:

JPEG encoding is done in several steps:


  1. RGB到YUV的转换

  2. DCT(更改为频域)

  3. 量化(丢弃DCT的比特)

  4. 无损压缩

  1. RGB to YUV conversion
  2. DCT (change into frequency domain)
  3. Quantization (throwing away bits of the DCT)
  4. Lossless compression

和解码的过程相同。

第1步和第2步存在舍入误差(尤其是在使用整数数学的速度优化编码器中),因此对于幂等重新编码,您需要幸运地获得编码和解码舍入误差很小或彼此抵消。

Steps 1 and 2 have rounding errors (especially in speed-optimized encoders using integer math), so for idempotent re-encoding you need to be lucky to get encoding and decoding rounding errors to be small or cancel each other out.

第3步是主要的有损步骤,实际上是幂等的。如果您解码的像素转换为足够相似的DCT,它将再次量化为相同的数据!

The step 3, which is the major lossy step, is actually idempotent. If your decoded pixels convert to similar-enough DCT it will quantize to the same data again!

JPEG XR也使用YUV,因此可能会遇到一些舍入误差,但是OTOH代替DCT,它使用可以计算而不会舍入误差的不同变换,因此与其他格式相比,往返JPEG-XR应该更容易。

JPEG XR also uses YUV, so it may suffer some rounding errors, but OTOH instead of DCT it uses a different transform that can be computed without rounding errors, so it should be easier to round-trip JPEG-XR than other formats.

这篇关于重新编码JPEG图像是幂等操作吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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