Jpeg压缩原理 翻译
合集下载
相关主题
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Discrete Cosine Transform
Transform each block of 8× 8 samples into 64 DCT coefficients系数 – energy tends to be concentrated into a few significant coefficients 能量主要集中在几个重要的系数当中
附加位
The Extra Bits can be expressed in the following form:附加位可以用下面形式来表示
Extra Bits = Sign bit + Amplitude符号位+ 振幅
When DIFFf > 0, Sign bit = 1 When DIFFf < 0, Sign bit = 0
振幅等于差分函数绝对值的低阶位的1的补码
Example
If DIFFf = 5 ,then it is represented as被表示 为
The DIFFf差分函数values are classified into 12 classes (Table1).分为12个等级 表一
Class
0 1 2 3 4 5 6 7 8 9 10 11
DIFFf value
0 -1,1 -3,-2,2,3 -7,…,-4,4,…,7 -15,…,-8,8,…,15 -31,…,-16,16,…,31 -63,…,-32,32,…,63 -127,…,-64,64,…,127 -255,..,-128,128,…,255 -511,…,-256,256,…,511 -1023,…,-512,512,…,1023 -2047,..,-1024,1024,…,2047
624 24 14 0 0 0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
Reconstructed 重建后image block
74
77 78 74 69
75
77 77 74 69
77
78 77 74 70
80
79 77 74 72
85
82 78 76 75
91
86 81 78 78
95
89 83 81 82
TABLE 2
When DIFFf差分函数 class 0,DIFFf is represented by codeword 00. When DIFFf classes 1-11 ,the representation of DIFFf consists of two parts由两部分组成:
DC coefficient
The encoding of the DC coefficient is based on the DIFFf value, DC系数的编码是基于差分函数的值defined as DIFFf = Xqf(0,0)-Xqf-1(0,0) where Xqf(0,0) = The DC coefficient of the current block.当前块DC系数 Xqf-1(0,0) = The DC coefficient of the previous block. 前一块DC系数
Before performing the Huffman coding, all the quantized coefficients are separated into two groups: (1)DC coefficient: Xq(0,0) (2)AC coefficients: Xq(u,v), u≠0 or v≠ 0 These two groups are encoded independently 相互独立.
14
18 24 49 72
17
22 35 64 92
22
37 55 78 95
29
56 64 87 98
51
68 81 103 112
87
109 104 121 100
80
103 113 120 103
62
77 92 101 99
39 2 1 0 0
Quantized量化后 DCT coefficients Xq(u,v)
JPEG
Introduction
JPEG (Joint Photographic Experts Group)联合图像专家组 Basic Concept
Data compression is performed in the frequency domain. Low frequency components are retained.
98
91 84 82 84
68
73 78
68
73 77
69
72 76
71
73 75
75
75 74
79
77 75
82
80 76
85
81 77
Error block错误块
5 -1 -6 0 4 0 1 -2 2 1 2 -2 -10 1 5 2 3 1 1 -5 -3 1 2 10 3 -5 0 -3 2 0 -1 -4 -9 0 -3 -4 1 -2 -3 1
is the quantization table.量化表
Note注意 that Q should be the same at the encoder and decoder. Q在编码和解码中是相同的
Given Xq(u,v) and Q(u,v), 0≦ u,v≦ 7,the dequantized反量化 DCT coefficients Xr(u,v), 0≦ u,v≦ 7, are then obtained by Xr(u,v) = Xq(u,v) Q(u,v)
Discrete Cosine离散 余弦 Transform Quantization 量化 Bitstream Formation 比特流形成
Color Transform
Color Transform
Process the data in blocks of 8× 8 samples样本 Convert RGB into Luminance (Y) and Chrominance (Cr and Cb).将RGB转换为 Use half resolution半分变率 for Chrominance (because eye is more sensitive to Luminance)
Quantization (II)
DCT Transform
The JPEG is based on the 8 × 8 DCT. To use the DCT ,we first divide an image into non-overlapping 无重叠8 × 8 blocks. Let 设x(n,m), 0≦n,m≦7, be the pixel values in the block.是块中的像素值 Let X(u,v), 0≦u,v≦7, be the DCT coefficients.
619 22 11 2
6
1 -8 -3
2
2 -2 1
-1
1 -4 5
-1
2 1 -2
-3
0 2 1
0
2 1 -1
0
-2 -1 1
8
-2 1 -3
Quantization table 量化表Q(u,v)
16 12 14 11 12 13 10 14 16 16 19 24 24 26 40 40 58 57 51 60 69 61 55 56
-3 -1 0 -1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0
0 0
0
0 0
0
0 0
0
0 0
0
0 0
0
0 0
0
0 0
0
0 0
Dequantized反量化 DCT coefficients Xr(u,v)
-33 -12 0 -17 0 0 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1
3 -6
-5
3 0
-1
-1 2
-2
-2 -6
0
-8 1
-1
2 0
0
0 2
-5
2 1
Bitstream Formation比特流的形成
. Here we use the Huffman code to form bitstream representing the quantized DCT coefficients在这里,我们使用赫夫曼码来形成 表示量化DCT系数的比特流
TABLE 1
The Huffman code representing each class is shown in Table2. 在表2中 表示每个等级的霍夫曼编码
Class
0 1 2 3 4 5 6 7 8 9 10 11
Codeword码字
00 010 011 100 101 110 1110 11110 111110 1111110 11111110 111111110
Hale Waihona Puke Baidu67 69 71 69
86
78 75 67 75
80
78 78 79 75
81
79 82 80 78
79
85 80 83 78
DCT coefficients of the image block X(u,v)
-29 -6 0 -10 8 -4 5 5 2 0 -4 0 1 7 -3 0 -3 0 4 7 0 -2 0 3 1 -3 -3 2
u 0 v 0
N 1 N 1
(2n 1)u (2m 1)v cos 2 N 2 N
2 , n0 N
where
Cn
1 , n0 N
Cn
and N=8
Quantization量化
In the JPEG,each of the 64 resulting DCT coefficients is quantized by an uniform scalar quantizer according to the following equation:
在JPEG中,根据下面的等式,得到的64个DCT系数中每一个 系数都被一个均匀标量的量化器量化
X (u , v) X q (u , v) Nearest Integer ( ) Q (u , v)
where Xq(u,v) is the quantized coefficient and
这里的Xq(U,V)是量化后的系数
The X(u,v) and x(n,m) are related by通过
X (u , v) Cu Cv x(n, m) cos
n 0 m 0 N 1 N 1
(2n 1)u (2m 1)v cos 2 N 2 N
x(n, m) Cu Cv X (u , v) cos
When DIFFf > 0: Amplitude=Lower-order bit of DIFFf
振幅等于差分函数的低阶位
(MSB is not include.)
When DIFFf < 0: Amplitude = 1’s complement of lower-order bits of |DIFFf |
Example
Original Image block图像块 x(m,n)
75 78 75 79 76 67 82 82 78 82 83 80 86 86 78 94 85 74 94 94 82
79 76 72
74
73 69 76 72
76
70 63 76 77
75
75 68 71 78
75
Quantization量化 (I)
Divide each DCT coefficient by an integer, discard remainder将每个DCT系数除以一个整数,丢弃余数。 Typically, a few non-zero coefficients are left. 通常,少数非零系数被留下
High frequency components are truncated
数据压缩是在频域中执行。 保留低频分量。
高频分量被截断。
JPEG System Overview
The JPEG is a transform coding scheme.编码转换方式 Its encoding process can be separated into 3 stages: