[go: up one dir, main page]

CN102497557B - Image compression and decompression method and system based on 2x2 coding unit - Google Patents

Image compression and decompression method and system based on 2x2 coding unit Download PDF

Info

Publication number
CN102497557B
CN102497557B CN201110455138.7A CN201110455138A CN102497557B CN 102497557 B CN102497557 B CN 102497557B CN 201110455138 A CN201110455138 A CN 201110455138A CN 102497557 B CN102497557 B CN 102497557B
Authority
CN
China
Prior art keywords
abs
pixel
value
colourity
frequency domain
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201110455138.7A
Other languages
Chinese (zh)
Other versions
CN102497557A (en
Inventor
张智凯
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
FocalTech Systems Co Ltd
Original Assignee
FocalTech Systems Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by FocalTech Systems Co Ltd filed Critical FocalTech Systems Co Ltd
Priority to CN201110455138.7A priority Critical patent/CN102497557B/en
Publication of CN102497557A publication Critical patent/CN102497557A/en
Application granted granted Critical
Publication of CN102497557B publication Critical patent/CN102497557B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Color Television Systems (AREA)

Abstract

The invention provides a fixed compression ratio image compression method based on a 2x2 coding unit, which is used for coding a 2x2 coding unit in an image, the compression method firstly judges whether the 2x2 coding unit is one of a first artificial type, a second artificial type and a third artificial type, if so, the coding unit is judged to be the 2x2 coding unit of the artificial type, otherwise, the coding unit is judged to be the 2x2 coding unit of the natural type, then the 2x2 coding unit of the artificial type is subjected to differential error coding, quantization and table look-up coding to generate first coding data, or the 2x2 coding unit of the natural type is subjected to color gamut conversion to obtain a 2x2 color gamut conversion unit, then the 2x2 color gamut conversion unit is subjected to discrete cosine conversion to generate a 2x2 frequency domain unit, and finally the 2x2 frequency domain unit is subjected to quantization and table look-up coding to generate second coding data.

Description

基于2x2编码单元的影像压缩、解压缩方法及系统Image compression and decompression method and system based on 2x2 coding unit

技术领域 technical field

本发明属于影像压缩、解压缩技术领域,特别指一种基于2x2编码单元的固定压缩率影像压缩、解压缩方法和系统。The invention belongs to the technical field of image compression and decompression, in particular to a fixed compression rate image compression and decompression method and system based on 2x2 coding units.

背景技术 Background technique

众所周知,无损影像压缩技术可分为:运行长度(Run Length)编码、霍夫曼编码(Huffman Coding)、Lempel-Ziv-Weich编码、算数编码(ArithmeticCoding)、差分编码(Differential Coding)及无损JPEG编码(Lossless JPEG)等。其中,Run Length编码是将一连串相同的数据改为两个字节(Byte)来表示,前一个字节(Byte)为该串数据的长度(亦即重复次数),后面一个字节(Byte)则用于记录数据。例如一数据为“555555AA”,经由Run Length编码后变为“652A”,其中,表示有6个“5”、2个“A”,此压缩方式就节省了4个字节的空间了。然而,Run Length编码需要统计输入数据的重复率,当数据的重复率低时,压缩比也降低。As we all know, lossless image compression technology can be divided into: run length (Run Length) coding, Huffman coding (Huffman Coding), Lempel-Ziv-Weich coding, arithmetic coding (Arithmetic Coding), differential coding (Differential Coding) and lossless JPEG coding (Lossless JPEG), etc. Among them, Run Length encoding is to change a series of the same data into two bytes (Byte) to represent, the previous byte (Byte) is the length of the string of data (that is, the number of repetitions), and the next byte (Byte) are used to record data. For example, a piece of data is "555555AA", which becomes "652A" after being encoded by Run Length, which means that there are 6 "5" and 2 "A", and this compression method saves 4 bytes of space. However, Run Length encoding needs to count the repetition rate of the input data. When the repetition rate of the data is low, the compression ratio is also reduced.

霍夫曼编码是将输入数据按照出现机率使用二叉树方式(Binary Tree)编码,出现机率大的符号使用长度较短的码来表示,出现机率小的符号使用长度较长的码表示,因而其平均使用的数据量较小,然而,它与Run Length编码一样,要统计输入资料出现的机率。Huffman coding is to encode the input data according to the probability of occurrence using a binary tree (Binary Tree). Symbols with a high probability of occurrence are represented by a code with a shorter length, and symbols with a small probability of occurrence are represented by a code with a longer length. Therefore, the average The amount of data used is small, however, it is the same as the Run Length encoding, and it needs to count the probability of the input data appearing.

Lempel-Ziv-Weich编码使用已出现的字符串作为索引查表比对的依据,并且建立索引的方式作为数据压缩串流。然而,Lempel-Ziv-Weich编码方法需要使用大的内存空间,以暂存所建立的表格。Lempel-Ziv-Weich encoding uses the existing strings as the basis for index lookup table comparison, and the way of indexing is used as a data compression stream. However, the Lempel-Ziv-Weich encoding method needs to use a large memory space to temporarily store the created table.

算数编码(Arithmetic Coding)最大的特点在于它不是以一符号代表一位,而是以一实数来表示压缩字符串。这种方法需将原始字符串先读一遍,统计每一相异字码出现机率,将0至1实数区间按照此机率分割成原始编码区间表,接着将原始字符串的字符一一读入,每读入一个字符,便将其所占区间用原始编码区间表再进行分割,如此到最后一个字符读完后,就会产生一个最后区间,再从此区间挑一实数代表原始字符串的压缩文件。算数编码所得到的编码只需要一个存储浮点数的空间即可存入,无需像霍夫曼编码一样需要大量空间来储存,然而,其缺点在于需要统计输入数据出现的机率及算法非常复杂。The biggest feature of Arithmetic Coding is that it does not use a symbol to represent a bit, but a real number to represent a compressed string. This method needs to read the original string first, count the occurrence probability of each different character code, divide the 0 to 1 real number interval into the original code interval table according to this probability, and then read the characters of the original string one by one, Every time a character is read, the interval occupied by it will be divided by the original encoding interval table, so that after the last character is read, a final interval will be generated, and then a real number will be selected from this interval to represent the compressed file of the original string . The code obtained by arithmetic coding only needs a space to store floating-point numbers, and does not need a large amount of space to store like Huffman coding. However, its disadvantage is that it needs to count the probability of occurrence of input data and the algorithm is very complicated.

而差分编码则使用预估值与实际值之间的差值作为压缩的依据,而其单独运用时压缩率低。无损JPEG编码则使用离散余弦转换与预估误差值作为压缩的依据。Differential encoding uses the difference between the estimated value and the actual value as the basis for compression, and the compression rate is low when it is used alone. Lossless JPEG encoding uses discrete cosine transform and estimated error value as the basis for compression.

前述压缩方法中,其压缩率并非固定,在解压缩时常常需要更多的计算资源,以正确地获得数据长度,同时在一嵌入式系统或手持式装置中,由于其仅具备有限的计算能力及有限的内存容量,上述的影像压缩技术均难以在嵌入式系统或手持式装置中使用。由此可知,影像压缩及解压缩功能在嵌入式系统或手持式装置上仍有改善的空间。In the aforementioned compression methods, the compression rate is not fixed, and more computing resources are often required during decompression to obtain the data length correctly. At the same time, in an embedded system or handheld device, due to its limited computing power And limited memory capacity, the above image compression techniques are difficult to use in embedded systems or handheld devices. It can be seen that there is still room for improvement in the image compression and decompression functions on embedded systems or handheld devices.

发明内容 Contents of the invention

本发明的目的主要在于提供一种基于2x2编码单元的固定压缩率影像压缩、解压缩的方法及系统,以产生固定压缩率的影像,并且同时降低硬件需求及维持影像质量。The purpose of the present invention is to provide a method and system for image compression and decompression with a fixed compression rate based on 2x2 coding units, so as to generate an image with a fixed compression rate, reduce hardware requirements and maintain image quality at the same time.

根据本发明的一特色,本发明提出一种基于2x2编码单元的固定压缩率影像压缩方法,其将一张影像的一个2x2编码单元进行编码,该影像具有至少一个2x2编码单元,该影像压缩方法包括下列步骤:(A)接收一个2x2编码单元,其包括呈矩阵排列的左上角像素、右上角像素、左下角像素和右下角像素;(B)判断该2x2编码单元是否为第一人造类型至第七人造类型中的一个,若是,则判定该2x2编码单元为人造类型的2x2编码单元,否则,定该2x 2编码单元为自然类型的2x 2编码单元,其中第一人造类型为该四个像素呈水平方向的两横条纹,第二人造类型为该四个像素而呈竖直方向的两纵条纹,第三人造类型为该四个像素呈45度角方向的两斜条纹交叉,第四至第七人造类型为该四个像素呈三角形与单点的组合;(C)对判定为人造类型的2x2编码单元进行差分误差编码、量化及查表编码,以产生第一编码数据;(D)对判定为自然类型的2x2编码单元进行色域转换,以得到2x2色域转换单元;(E)对所述2x2色域转换单元进行离散余弦转换,以产生2x2频率域单元;以及(F)对所述2x2频率域单元进行量化及查表编码,以产生第二编码数据。According to a characteristic of the present invention, the present invention proposes a fixed compression rate image compression method based on 2x2 coding units, which encodes a 2x2 coding unit of an image, the image has at least one 2x2 coding unit, and the image compression method The method comprises the following steps: (A) receiving a 2x2 coding unit, which includes upper left corner pixels, upper right corner pixels, lower left corner pixels and lower right corner pixels arranged in a matrix; (B) judging whether the 2x2 coding unit is the first artificial type to One of the seventh artificial types, if so, then determine that the 2x2 coding unit is a 2x2 coding unit of an artificial type, otherwise, determine that this 2x2 coding unit is a 2x2 coding unit of a natural type, wherein the first artificial type is the four The pixels are two horizontal stripes in the horizontal direction, the second artificial type is two vertical stripes in the vertical direction for the four pixels, the third artificial type is the intersection of two oblique stripes in the direction of the four pixels at an angle of 45 degrees, and the fourth To the seventh artificial type, the four pixels are a combination of a triangle and a single point; (C) differential error encoding, quantization, and table look-up encoding are performed on the 2x2 coding unit determined to be an artificial type to generate the first encoded data; (D ) performing color gamut conversion on a 2x2 coding unit determined to be a natural type to obtain a 2x2 color gamut conversion unit; (E) performing discrete cosine transform on the 2x2 color gamut conversion unit to generate a 2x2 frequency domain unit; and (F) Quantization and table look-up coding are performed on the 2x2 frequency domain unit to generate second coded data.

根据本发明的另一特色,本发明提出一种基于2x2编码单元的固定压缩率影像解压缩方法,该方法是对一固定位大小的编码封包进行解码,以产生一张影像的一个2x2解码单元,该2x2解码单元包含呈矩阵排列的四个像素,该影像具有至少一个2x2解码单元,该影像解压缩方法包含下列步骤:(A)接收一个编码封包;(B)根据该编码封包的主封包标头(1 bit,1位)判断该编码封包是否为人造类型,若是,则判定该编码封包为人造类型的编码封包,否则,判定该编码封包为自然类型的编码封包;(C)对该人造类型的编码封包进行反量化、反查表解码和反差分误差解码,以产生第一解码数据;(D)对该自然类型的编码封包进行反量化及反查表解码,以产生第二解码数据;(E)对该第二解码数据进行离散余弦转换,以产生第三解码数据;(F)对该第三解码数据进行色域转换,以得到第四解码数据;以及(G)接收所述第一解码数据或者第四解码数据,并对第一解码数据或者第四解码数据进行重建,以产生2x2解码单元。According to another characteristic of the present invention, the present invention proposes a fixed compression rate image decompression method based on 2x2 coding units, the method is to decode a coded packet of a fixed bit size to generate a 2x2 decoding unit of an image , the 2x2 decoding unit includes four pixels arranged in a matrix, the image has at least one 2x2 decoding unit, and the image decompression method includes the following steps: (A) receiving an encoded packet; (B) a main packet according to the encoded packet Header (1 bit, 1 bit) judges whether this coding packet is artificial type, if so, then judges that this coding packet is the coding packet of artificial type, otherwise, judges that this coding packet is the coding packet of natural type; (C) Carrying out dequantization, anti-lookup table decoding and anti-differential error decoding on the artificial type encoded packet to generate the first decoded data; (D) dequantizing and anti-lookup table decoded on the natural type encoded packet to generate the second decoding data; (E) performing discrete cosine transform on the second decoded data to generate third decoded data; (F) performing color gamut conversion on the third decoded data to obtain fourth decoded data; and (G) receiving the the first decoded data or the fourth decoded data, and reconstruct the first decoded data or the fourth decoded data to generate a 2x2 decoding unit.

根据本发明的又一特色,本发明提出一种基于2x2编码单元的固定压缩率的显示系统,其是对一显示影像进行压缩及解压缩,该显示系统包含一显示模块、一影像输入设备、一基于2x2编码单元的固定压缩率影像压缩装置、一暂存装置、一基于2x2编码单元的固定压缩率影像解压缩装置、及一时序控制器,连接至该基于2x2编码单元的固定压缩率影像解压缩装置,接收该2x2解码单元,以产生该显示模块的时序驱动信号及显示数据。该显示模块用于显示一影像。该影像输入设备用于输入一显示影像。该基于2x2编码单元的固定压缩率影像压缩装置连接至该影像输入设备,将该显示影像的2x2编码单元进行编码,以产生与该2x2编码单元对应的编码封包,其中,所述影像具有至少一个2x2编码单元。所述暂存装置连接至基于2x2编码单元的固定压缩率影像压缩装置,以暂存该基于2x2编码单元的固定压缩率影像压缩装置输出的编码封包。所述基于2x2编码单元的固定压缩率影像解压缩装置连接至暂存装置,接收所述编码封包,并对该编码封包解压缩,以产生与该2x2编码单元对应的2x2解码单元。所述时序控制器连接至基于2x2解码单元的固定压缩率影像解压缩装置,接收所述2x2解码单元,以产生该显示模块的时序驱动信号及显示数据。其中,所述固定压缩率影像压缩装置先判断该2x2编码单元为人造类型或自然类型,以对人造类型的2x2编码单元进行差分误差编码、量化及查表编码,而产生一第一编码数据,以及对自然类型的2x2编码单元进行色域转换、离散余弦转换、量化及查表编码,进而产生第二编码数据,再对该第一编码数据或该第二编码数据进行封装,以产生固定压缩率的编码封包。According to another characteristic of the present invention, the present invention proposes a display system with a fixed compression rate based on 2x2 coding units, which compresses and decompresses a display image. The display system includes a display module, an image input device, A fixed compression rate image compression device based on 2x2 coding units, a temporary storage device, a fixed compression rate image decompression device based on 2x2 coding units, and a timing controller connected to the fixed compression rate image based on 2x2 coding units The decompression device receives the 2x2 decoding unit to generate the timing driving signal and display data of the display module. The display module is used for displaying an image. The image input device is used for inputting a display image. The fixed compression rate image compression device based on 2x2 coding units is connected to the image input device, and encodes the 2x2 coding units of the display image to generate a coded packet corresponding to the 2x2 coding units, wherein the image has at least one 2x2 coding unit. The temporary storage device is connected to the fixed compression rate image compression device based on 2x2 coding units to temporarily store the encoded packets output by the fixed compression rate image compression device based on 2x2 coding units. The fixed compression rate image decompression device based on 2x2 coding unit is connected to the temporary storage device, receives the coded packet, and decompresses the coded packet to generate a 2x2 decoding unit corresponding to the 2x2 coding unit. The timing controller is connected to a fixed compression ratio image decompression device based on a 2x2 decoding unit, receives the 2x2 decoding unit, and generates timing driving signals and display data of the display module. Wherein, the fixed compression rate image compression device first judges whether the 2x2 coding unit is artificial or natural, so as to perform differential error coding, quantization and table look-up coding on the artificial 2x2 coding unit to generate a first coded data, and perform color gamut conversion, discrete cosine transform, quantization and look-up table encoding on the 2x2 coding unit of natural type, and then generate second encoded data, and then encapsulate the first encoded data or the second encoded data to generate fixed compression Rate encoded packets.

附图说明 Description of drawings

图1是本发明一种基于2x2编码单元的固定压缩率影像压缩方法的流程图;Fig. 1 is a flow chart of a fixed compression rate image compression method based on 2x2 coding units of the present invention;

图2是所述影像和2x2编码单元的示意图;FIG. 2 is a schematic diagram of the image and 2x2 coding units;

图3是本发明中人造类型和自然类型的示意图;Fig. 3 is the schematic diagram of man-made type and natural type among the present invention;

图4是本发明的实施例一中2x2编码单元的差分误差编码、量化及查表编码的示意图;4 is a schematic diagram of differential error coding, quantization and table look-up coding of a 2x2 coding unit in Embodiment 1 of the present invention;

图5是本发明的实施例一中2x2编码单元为第一、第二及第三人造类型时的编码示意图;Fig. 5 is a schematic diagram of coding when the 2x2 coding unit is the first, second and third artificial types in Embodiment 1 of the present invention;

图6是本发明的实施例一中2x2编码单元为第四、第五、第六及第七人造类型时的编码示意图;Fig. 6 is a schematic diagram of coding when the 2x2 coding unit is the fourth, fifth, sixth and seventh artificial types in Embodiment 1 of the present invention;

图7是本发明中色域转换和离散余弦转换的示意图;Fig. 7 is a schematic diagram of color gamut conversion and discrete cosine conversion in the present invention;

图8本发明中扩展人造类型示意图;Fig. 8 is a schematic diagram of the extended man-made type in the present invention;

图9是实施例一中扩展人造类型的差分误差编码、量化及查表编码的示意图;Fig. 9 is a schematic diagram of the differential error coding, quantization and table look-up coding of the extended artificial type in the first embodiment;

图10是实施例一中扩展人造类型的2x2编码单元为第一、第二及第三人造类型时的编码示意图;Fig. 10 is a schematic diagram of encoding when the 2x2 coding unit of the extended artificial type is the first, second and third artificial types in the first embodiment;

图11是实施例一中扩展人造类型的2x2编码单元为第四至第七人造类型时的编码示意图;Fig. 11 is a schematic diagram of encoding when the 2x2 coding unit of the extended artificial type is the fourth to seventh artificial types in the first embodiment;

图12是实施例一中扩展人造类型的2x2编码单元为第八至第十三人造类型时的编码示意图;Fig. 12 is a schematic diagram of encoding when the 2x2 coding unit of the extended artificial type is the eighth to the thirteenth artificial type in the first embodiment;

图13是实施例一中自然类型的编码的示意图;FIG. 13 is a schematic diagram of natural type encoding in Embodiment 1;

图14是实施例一中自然类型的查表操作示意图;Fig. 14 is a schematic diagram of a table lookup operation of a natural type in Embodiment 1;

图15是实施例二中扩展人造类型的差分误差编码、量化及查表编码的示意图;Fig. 15 is a schematic diagram of differential error coding, quantization and table look-up coding of the extended artificial type in the second embodiment;

图16是实施例二中扩展人造类型的2x2编码单元为第一、第二及第三人造类型时的编码示意图;Fig. 16 is a schematic diagram of encoding when the 2x2 coding unit of the extended artificial type is the first, second and third artificial types in the second embodiment;

图17是实施例二中扩展人造类型的2x2编码单元为第四至第七人造类型时的编码示意图;Fig. 17 is a schematic diagram of encoding when the 2x2 coding unit of the extended artificial type is the fourth to seventh artificial types in the second embodiment;

图18是实施例二中扩展人造类型的2x2编码单元为第八至第十三人造类型时的编码示意图;Fig. 18 is a schematic diagram of encoding when the 2x2 coding unit of the extended artificial type is the eighth to the thirteenth artificial type in the second embodiment;

图19是实施例二中自然类型的编码的示意图;Fig. 19 is a schematic diagram of the encoding of the natural type in the second embodiment;

图20是实施例二中自然类型的查表操作示意图;Fig. 20 is a schematic diagram of a table lookup operation of a natural type in Embodiment 2;

图21是本发明一种基于2x2编码单元的固定压缩率影像解压缩方法的流程图;Fig. 21 is a flowchart of an image decompression method with a fixed compression rate based on 2x2 coding units of the present invention;

图22是本发明一种应用基于2x2编码单元的固定压缩率的显示系统的结构图。FIG. 22 is a structural diagram of a display system applying a fixed compression rate based on 2x2 coding units according to the present invention.

附图中,各标号所代表的部件如下:In the accompanying drawings, the parts represented by each label are as follows:

S110~S180、步骤,S110~S180, steps,

210、影像,220、2x2编码单元,210, image, 220, 2x2 coding unit,

310、第一人造类型,320、第二人造类型,330、第三人造类型,340、第四人造类型,350、第五人造类型,360、第六人造类型,370、第七人造类型,380、第一自然类型,390、第二自然类型,310, the first artificial type, 320, the second artificial type, 330, the third artificial type, 340, the fourth artificial type, 350, the fifth artificial type, 360, the sixth artificial type, 370, the seventh artificial type, 380 , first natural type, 390, second natural type,

700、2x2色域转换单元,710、明亮度2x2色域转换单元,720、第一色度2x2色域转换单元,730、第二色度2x2色域转换单元,750、2x2频率域单元,760、明亮度2x2频率域单元,770、第一色度2x2频率域单元,780、第二色度2x2频率域单元,700, 2x2 color gamut conversion unit, 710, brightness 2x2 color gamut conversion unit, 720, first chroma 2x2 color gamut conversion unit, 730, second chroma 2x2 color gamut conversion unit, 750, 2x2 frequency domain unit, 760 , Brightness 2x2 frequency domain unit, 770, first chroma 2x2 frequency domain unit, 780, second chroma 2x2 frequency domain unit,

S805~S850、步骤,S805~S850, steps,

900、显示系统,910、显示模块,920、影像输入设备,930、基于2x2编码单元的固定压缩率影像压缩装置,940、暂存装置,950、基于2x2编码单元的固定压缩率影像解压缩装置,960、时序控制器,970、源极驱动器,980、栅极驱动器900. Display system, 910. Display module, 920. Image input device, 930. Fixed compression rate image compression device based on 2x2 coding unit, 940. Temporary storage device, 950. Fixed compression rate image decompression device based on 2x2 coding unit , 960, timing controller, 970, source driver, 980, gate driver

具体实施方式 Detailed ways

为使本发明的目的、技术方案及优点更加清楚明白,以下参照附图并举实施例,对本发明作进一步详细说明。In order to make the object, technical solution and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings and examples.

图1是本发明一种基于2x2编码单元的固定压缩率影像压缩方法的流程图,其是将一张影像中的一个2x2编码单元进行编码。FIG. 1 is a flow chart of a fixed compression rate image compression method based on 2x2 CUs according to the present invention, which encodes one 2x2 CU in an image.

首先,在步骤S110中,该影像压缩方法接收一个2x2编码单元,该2x2编码单元包含呈矩阵排列的左上角像素、右上角像素、左下角像素和右下角像素。First, in step S110, the image compression method receives a 2x2 coding unit, and the 2x2 coding unit includes upper-left pixels, upper-right pixels, lower-left pixels, and lower-right pixels arranged in a matrix.

图2是该影像及该2x2编码单元的示意图,如图2所示,该影像210具有至少一个2x2编码单元220,每一个2x2编码单元220具有四个像素A、B、C、D,其中,A为左上角像素,B为右上角像素,C为左下角像素,D为右下角像素。每一个像素具有红(r)、蓝(g)、绿(b)三种颜色,其中Ar、Ag、Ab为像素A的红色数值、绿色数值、蓝色数值,Br、Bg、Bb为像素B的红色数值、绿色数值、蓝色数值,Cr、Cg、Cb为像素C的红色数值、绿色数值、蓝色数值,Dr、Dg、Db为像素D的红色数值、绿色数值、蓝色数值。可以选择每种颜色数值为8位,故该2x2编码单元220为96(=4×3×8)位。也可以选择每种颜色数值为6位,故该2x2编码单元220为72(=6×3×4)位。FIG. 2 is a schematic diagram of the image and the 2x2 coding unit. As shown in FIG. 2, the image 210 has at least one 2x2 coding unit 220, and each 2x2 coding unit 220 has four pixels A, B, C, and D, wherein, A is the upper left pixel, B is the upper right pixel, C is the lower left pixel, and D is the lower right pixel. Each pixel has three colors: red (r), blue (g), and green (b), where A r , A g , and A b are the red, green, and blue values of pixel A, and B r , B g , B b is the red value, green value, and blue value of pixel B; C r , C g , C b are the red value, green value, and blue value of pixel C; D r , D g , D b are pixel D Red value, green value, blue value of . Each color value can be selected to be 8 bits, so the 2x2 coding unit 220 has 96 (=4*3*8) bits. It is also possible to select 6 bits for each color value, so the 2x2 coding unit 220 has 72 (=6*3*4) bits.

在步骤S120中,判断该2x2编码单元220是否为人造类型,若是,则判定该2x2编码单元为人造类型的2x2编码单元,否则,判定该2x2编码单元为自然类型的2x2编码单元,其中,人造造型具有七种,包括:第一人造类型:四个像素呈水平方向的两横条纹;第二人造类型:四个像素呈竖直方向的两纵条纹;第三人造类型:四个像素呈45度角方向的两斜条纹交叉;第四至第七人造类型:四个像素呈三角形与单点的组合。In step S120, it is judged whether the 2x2 coding unit 220 is a man-made type, if so, it is determined that the 2x2 coding unit is a 2x2 coding unit of a man-made type, otherwise, it is judged that the 2x2 coding unit is a 2x2 coding unit of a natural type, wherein the man-made There are seven types of shapes, including: the first man-made type: four pixels form two horizontal stripes in the horizontal direction; the second man-made type: four pixels form two vertical stripes in the vertical direction; the third man-made type: four pixels form a 45 The two oblique stripes cross in the direction of the degree angle; the fourth to seventh man-made types: the four pixels are a combination of triangles and single points.

更进一步说明,在步骤S120中,是先判断该2x2编码单元220是否为第一人造类型至第三人造类型中的一个,再判断该2x2编码单元220是否为第四人造类型至第七人造类型中的一个。To further illustrate, in step S120, it is first judged whether the 2x2 encoding unit 220 is one of the first artificial type to the third artificial type, and then it is judged whether the 2x2 encoding unit 220 is the fourth artificial type to the seventh artificial type one of the.

图3是本发明人造类型及自然类型的示意图。本发明第一人造类型至第七人造类型的分类有助于处理如字体边缘、灰阶变化、锯齿、棋盘格等特定图样,配合本发明的封包记录方式,可使该些编码单元达成无失真。Fig. 3 is a schematic diagram of the artificial type and the natural type of the present invention. The classification of the first artificial type to the seventh artificial type in the present invention helps to deal with specific patterns such as font edges, grayscale changes, jagged, checkerboard, etc., and the packet recording method of the present invention can make these coding units achieve distortion-free .

如图3所示,第一人造类型310为所述四个像素呈水平方向的两横条纹,即像素A的颜色数值(X)与像素B的颜色数值(X)相同或近似,像素C的颜色数值(Y)与像素D的颜色数值(Y)相同或近似。同理,第二人造类型320为所述四个像素呈竖直方向的两纵条纹,第三人造类型330为所述四个像素呈45度角方向的两斜条纹交叉,第四人造类型340、第五人造类型350、第六人造类型360和第七人造类型370为所述四个像素呈三角形与单点的组合。即:第一人造类型310为所述左上角像素及右上角像素近似(X)且左下角像素及右下角像素近似(Y);第二人造类型320为所述左上角像素及左下角像素近似(X)且右上角像素及右下角像素近似(Y);第三人造类型330为所述左上角像素及右下角像素近似(X)且左下角像素及右上角像素近似(Y);第四人造类型340为所述左下角像素、右上角像素和右下角像素近似(Y);第五人造类型350为所述左上角像素、右上角像素和右下角像素近似(Y);第六人造类型360为所述左上角像素、左下角像素和右上角像素近似(Y);第七人造类型370为所述左上角像素、左下角像素和右下角像素近似(Y)。As shown in FIG. 3 , the first artificial type 310 is two horizontal stripes in the horizontal direction of the four pixels, that is, the color value (X) of pixel A is the same or similar to the color value (X) of pixel B, and the color value (X) of pixel C is the same as or similar to that of pixel B. The color value (Y) is the same or similar to the color value (Y) of the pixel D. Similarly, the second artificial type 320 is two vertical stripes in the vertical direction of the four pixels, the third artificial type 330 is the intersection of two oblique stripes in the direction of the four pixels at an angle of 45 degrees, and the fourth artificial type 340 , the fifth artificial type 350 , the sixth artificial type 360 and the seventh artificial type 370 are combinations of the four pixels in a triangle shape and a single point. That is: the first artificial type 310 is the approximation (X) of the upper left pixel and the upper right pixel and the approximation (Y) of the lower left pixel and the lower right pixel; the second artificial type 320 is the approximation of the upper left pixel and the lower left pixel (X) and the upper right pixel and the lower right pixel are approximate (Y); the third artificial type 330 is that the upper left pixel and the lower right pixel are approximate (X) and the lower left pixel and the upper right pixel are approximate (Y); the fourth The artificial type 340 is the approximate (Y) of the lower left pixel, the upper right pixel and the lower right pixel; the fifth artificial type 350 is the approximate (Y) of the upper left pixel, the upper right pixel and the lower right pixel; the sixth artificial type 360 is the approximation (Y) of the upper left pixel, lower left pixel and upper right pixel; the seventh artificial type 370 is the approximation (Y) of the upper left pixel, lower left pixel and lower right pixel.

在步骤S120中,当满足下列公式时,判定该2x2编码单元220为第一人造类型310:In step S120, when the following formula is satisfied, it is determined that the 2x2 encoding unit 220 is the first artificial type 310:

ABS(Ar,Br)<THD1,ABS(Cr,Dr)<THD1,ABS(A r , B r )<THD1, ABS(C r , D r )<THD1,

ABS(Ag,Bg)<THD1,ABS(Cg,Dg)<THD1,ABS(A g , B g )<THD1, ABS(C g , D g )<THD1,

ABS(Ab,Bb)<THD1,ABS(Cb,Db)<THD1,ABS(A b , B b )<THD1, ABS(C b , D b )<THD1,

ABS(Ar,Br)+ABS(Ag,Bg)+ABS(Ab,Bb)≤ABS(A r ,B r )+ABS(A g ,B g )+ABS(A b ,B b )≤

ABS(Ar,Cr)+ABS(Ag,Cg)+ABS(Ab,Cb),ABS(A r ,C r )+ABS(A g ,C g )+ABS(A b ,C b ),

ABS(Ar,Br)+ABS(Ag,Bg)+ABS(Ab,Bb)≤ABS(A r ,B r )+ABS(A g ,B g )+ABS(A b ,B b )≤

ABS(Dr,Br)+ABS(Dg,Bg)+ABS(Db,Bb),ABS(D r ,B r )+ABS(D g ,B g )+ABS(D b ,B b ),

ABS(Cr,Dr)+ABS(Cg,Dg)+ABS(Cb,Db)≤ABS(C r ,D r )+ABS(C g ,D g )+ABS(C b ,D b )≤

ABS(Dr,Br)+ABS(Dg,Bg)+ABS(Db,Bb),ABS(D r ,B r )+ABS(D g ,B g )+ABS(D b ,B b ),

ABS(Cr,Dr)+ABS(Cg,Dg)+ABS(Cb,Db)≤ABS(C r ,D r )+ABS(C g ,D g )+ABS(C b ,D b )≤

ABS(Ar,Cr)+ABS(Ag,Cg)+ABS(Ab,Cb),ABS(A r ,C r )+ABS(A g ,C g )+ABS(A b ,C b ),

其中,THD1为第一门限值(其取值由本领域技术人员根据经验选取),A为所述左上角像素,B为所述右上角像素,C为所述左下角像素,D为所述右下角像素,Ar、Ag、Ab分别为像素A的红色数值、绿色数值和蓝色数值,Br、Bg、Bb分别为像素B的红色数值、绿色数值和蓝色数值,Cr、Cg、Cb分别为像素C的红色数值、绿色数值和蓝色数值,Dr、Dg、Db分别为像素D的红色数值、绿色数值和蓝色数值。其中ABS为括号中两元素差的绝对值函数,亦即当a≥b时,ABS(a,b)=a-b,当a<b时,ABS(b,a)=b-a。Wherein, THD1 is the first threshold value (its value is selected by those skilled in the art based on experience), A is the pixel in the upper left corner, B is the pixel in the upper right corner, C is the pixel in the lower left corner, and D is the pixel in the upper left corner. For the lower right pixel, Ar r , A g , A b are the red value, green value and blue value of pixel A respectively, B r , B g , B b are the red value, green value and blue value of pixel B respectively, Cr , C g , and C b are red, green, and blue values of pixel C, respectively, and D r , D g , and D b are red, green, and blue values of pixel D, respectively. Wherein ABS is the absolute value function of the difference between the two elements in the brackets, that is, when a≥b, ABS(a, b)=ab, when a<b, ABS(b, a)=ba.

在步骤S120中,当满足下列公式时,判定该2x2编码单元220为第二人造类型320:In step S120, when the following formula is met, it is determined that the 2x2 encoding unit 220 is the second artificial type 320:

ABS(Ar,Cr)<THD1,ABS(Br,Dr)<THD1,ABS(A r , C r )<THD1, ABS(B r , D r )<THD1,

ABS(Ag,Cg)<THD1,ABS(Bg,Dg)<THD1,ABS(A g , C g )<THD1, ABS(B g , D g )<THD1,

ABS(Ab,Cb)<THD1,ABS(Bb,Db)<THD1,ABS(A b , C b )<THD1, ABS(B b , D b )<THD1,

ABS(Ar,Cr)+ABS(Ag,Cg)+ABS(Ab,Cb)≤ABS(A r ,C r )+ABS(A g ,C g )+ABS(A b ,C b )≤

ABS(Ar,Br)+ABS(Ag,Bg)+ABS(Ab,Bb),ABS(A r ,B r )+ABS(A g ,B g )+ABS(A b ,B b ),

ABS(Ar,Cr)+ABS(Ag,Cg)+ABS(Ab,Cb)≤ABS(A r ,C r )+ABS(A g ,C g )+ABS(A b ,C b )≤

ABS(Dr,Cr)+ABS(Dg,Cg)+ABS(Db,Cb),ABS(D r ,C r )+ABS(D g ,C g )+ABS(D b ,C b ),

ABS(Br,Dr)+ABS(Bg,Dg)+ABS(Bb,Db)≤ABS(B r ,D r )+ABS(B g ,D g )+ABS(B b ,D b )≤

ABS(Dr,Cr)+ABS(Dg,Cg)+ABS(Db,Cb),ABS(D r ,C r )+ABS(D g ,C g )+ABS(D b ,C b ),

ABS(Br,Dr)+ABS(Bg,Dg)+ABS(Bb,Db)≤ABS(B r ,D r )+ABS(B g ,D g )+ABS(B b ,D b )≤

ABS(Ar,Br)+ABS(Ag,Bg)+ABS(Ab,Bb)。ABS(A r , B r )+ABS(A g , B g )+ABS(A b ,B b ).

在步骤S120中,当满足下列公式时,判定该2x2编码单元220为第三人造类型330:In step S120, when the following formula is met, it is determined that the 2x2 encoding unit 220 is the third artificial type 330:

ABS(Ar,Dr)<THD1,ABS(Cr,Br)<THD1,ABS(A r , D r )<THD1, ABS(C r , B r )<THD1,

ABS(Ag,Dg)<THD1,ABS(Cg,Bg)<THD1,ABS(A g , D g )<THD1, ABS(C g , B g )<THD1,

ABS(Ab,Db)<THD1,ABS(Cb,Bb)<THD1,ABS(A b , D b )<THD1, ABS(C b , B b )<THD1,

ABS(Ar,Dr)+ABS(Ag,Dg)+ABS(Ab,Db)≤ABS(A r ,D r )+ABS(A g ,D g )+ABS(A b ,D b )≤

ABS(Ar,Br)+ABS(Ag,Bg)+ABS(Ab,Bb),ABS(A r ,B r )+ABS(A g ,B g )+ABS(A b ,B b ),

ABS(Ar,Dr)+ABS(Ag,Dg)+ABS(Ab,Db)≤ABS(A r ,D r )+ABS(A g ,D g )+ABS(A b ,D b )≤

ABS(Dr,Cr)+ABS(Dg,Cg)+ABS(Db,Cb),ABS(D r ,C r )+ABS(D g ,C g )+ABS(D b ,C b ),

ABS(Cr,Br)+ABS(Cg,Bg)+ABS(Cb,Bb)≤ABS(C r ,B r )+ABS(C g ,B g )+ABS(C b ,B b )≤

ABS(Dr,Cr)+ABS(Dg,Cg)+ABS(Db,Cb),ABS(D r ,C r )+ABS(D g ,C g )+ABS(D b ,C b ),

ABS(Cr,Br)+ABS(Cg,Bg)+ABS(Cb,Bb)≤ABS(C r ,B r )+ABS(C g ,B g )+ABS(C b ,B b )≤

ABS(Ar,Br)+ABS(Ag,Bg)+ABS(Ab,Bb)。ABS(A r , B r )+ABS(A g , B g )+ABS(A b ,B b ).

在步骤S120中,当满足下列公式时,判定该2x2编码单元220为第四人造类型340:In step S120, when the following formula is satisfied, it is determined that the 2x2 encoding unit 220 is the fourth artificial type 340:

ABS(Br,Dr)<THD2,ABS(Cr,Dr)<THD2,ABS(B r , D r )<THD2, ABS(C r , D r )<THD2,

ABS(Bg,Dg)<THD2,ABS(Cg,Dg)<THD2,ABS(B g , D g )<THD2, ABS(C g , D g )<THD2,

ABS(Bb,Db)<THD2,ABS(Cb,Db)<THD2,ABS(B b , D b )<THD2, ABS(C b , D b )<THD2,

ABS(Br,Dr)+ABS(Bg,Dg)+ABS(Bb,Db)≤ABS(B r ,D r )+ABS(B g ,D g )+ABS(B b ,D b )≤

ABS(Ar,Cr)+ABS(Ag,Cg)+ABS(Ab,Cb),ABS(A r ,C r )+ABS(A g ,C g )+ABS(A b ,C b ),

ABS(Br,Dr)+ABS(Bg,Dg)+ABS(Bb,Db)≤ABS(B r ,D r )+ABS(B g ,D g )+ABS(B b ,D b )≤

ABS(Ar,Br)+ABS(Ag,Bg)+ABS(Ab,Bb),ABS(A r ,B r )+ABS(A g ,B g )+ABS(A b ,B b ),

ABS(Cr,Dr)+ABS(Cg,Dg)+ABS(Cb,Db)≤ABS(C r ,D r )+ABS(C g ,D g )+ABS(C b ,D b )≤

ABS(Ar,Br)+ABS(Ag,Bg)+ABS(Ab,Bb),ABS(A r ,B r )+ABS(A g ,B g )+ABS(A b ,B b ),

ABS(Cr,Dr)+ABS(Cg,Dg)+ABS(Cb,Db)≤ABS(C r ,D r )+ABS(C g ,D g )+ABS(C b ,D b )≤

ABS(Ar,Cr)+ABS(Ag,Cg)+ABS(Ab,Cb)。ABS(A r , C r )+ABS(A g , C g )+ABS(A b ,C b ).

其中,THD2为第二门限值(其取值由本领域技术人员根据经验选取),Wherein, THD2 is the second threshold value (its value is selected by those skilled in the art based on experience),

在步骤S120中,当满足下列公式时,判定该2x2编码单元220为第五人造类型350:In step S120, when the following formula is satisfied, it is determined that the 2x2 encoding unit 220 is the fifth artificial type 350:

ABS(Br,Dr)<THD2,ABS(Ar,Br)<THD2,ABS(B r , D r )<THD2, ABS(A r , B r )<THD2,

ABS(Bg,Dg)<THD2,ABS(Ag,Bg)<THD2,ABS(B g , D g )<THD2, ABS(A g , B g )<THD2,

ABS(Bb,Db)<THD2,ABS(Ab,Bb)<THD2,ABS(B b , D b )<THD2, ABS(A b , B b )<THD2,

ABS(Br,Dr)+ABS(Bg,Dg)+ABS(Bb,Db)≤ABS(B r ,D r )+ABS(B g ,D g )+ABS(B b ,D b )≤

ABS(Ar,Cr)+ABS(Ag,Cg)+ABS(Ab,Cb),ABS(A r ,C r )+ABS(A g ,C g )+ABS(A b ,C b ),

ABS(Br,Dr)+ABS(Bg,Dg)+ABS(Bb,Db)≤ABS(B r ,D r )+ABS(B g ,D g )+ABS(B b ,D b )≤

ABS(Cr,Dr)+ABS(Cg,Dg)+ABS(Cb,Db),ABS(C r ,D r )+ABS(C g ,D g )+ABS(C b ,D b ),

ABS(Ar,Br)+ABS(Ag,Bg)+ABS(Ab,Bb)≤ABS(A r ,B r )+ABS(A g ,B g )+ABS(A b ,B b )≤

ABS(Cr,Dr)+ABS(Cg,Dg)+ABS(Cb,Db),ABS(C r ,D r )+ABS(C g ,D g )+ABS(C b ,D b ),

ABS(Ar,Br)+ABS(Ag,Bg)+ABS(Ab,Bb)≤ABS(A r ,B r )+ABS(A g ,B g )+ABS(A b ,B b )≤

ABS(Ar,Cr)+ABS(Ag,Cg)+ABS(Ab,Cb)。ABS(A r , C r )+ABS(A g , C g )+ABS(A b ,C b ).

在步骤S120中,当满足下列公式时,判定该2x2编码单元220为第六人造类型360:In step S120, when the following formula is met, it is determined that the 2x2 encoding unit 220 is the sixth artificial type 360:

ABS(Ar,Cr)<THD2,ABS(Ar,Br)<THD2,ABS(A r , C r )<THD2, ABS(A r , B r )<THD2,

ABS(Ag,Cg)<THD2,ABS(Ag,Bg)<THD2,ABS(A g , C g )<THD2, ABS(A g , B g )<THD2,

ABS(Ab,Cb)<THD2,ABS(Ab,Bb)<THD2,ABS(A b , C b )<THD2, ABS(A b , B b )<THD2,

ABS(Ar,Cr)+ABS(Ag,Cg)+ABS(Ab,Cb)≤ABS(A r ,C r )+ABS(A g ,C g )+ABS(A b ,C b )≤

ABS(Br,Dr)+ABS(Bg,Dg)+ABS(Bb,Db),ABS(B r ,D r )+ABS(B g ,D g )+ABS(B b ,D b ),

ABS(Ar,Cr)+ABS(Ag,Cg)+ABS(Ab,Cb)≤ABS(A r ,C r )+ABS(A g ,C g )+ABS(A b ,C b )≤

ABS(Cr,Dr)+ABS(Cg,Dg)+ABS(Cb,Db),ABS(C r ,D r )+ABS(C g ,D g )+ABS(C b ,D b ),

ABS(Ar,Br)+ABS(Ag,Bg)+ABS(Ab,Bb)≤ABS(A r ,B r )+ABS(A g ,B g )+ABS(A b ,B b )≤

ABS(Cr,Dr)+ABS(Cg,Dg)+ABS(Cb,Db),ABS(C r ,D r )+ABS(C g ,D g )+ABS(C b ,D b ),

ABS(Ar,Br)+ABS(Ag,Bg)+ABS(Ab,Bb)≤ABS(A r ,B r )+ABS(A g ,B g )+ABS(A b ,B b )≤

ABS(Br,Dr)+ABS(Bg,Dg)+ABS(Bb,Db)。ABS(B r , D r )+ABS(B g , D g )+ABS(B b ,D b ).

在步骤S120中,当满足下列公式时,判定该2x2编码单元220为第七人造类型370:In step S120, when the following formula is satisfied, it is determined that the 2x2 encoding unit 220 is the seventh artificial type 370:

ABS(Ar,Cr)<THD2,ABS(Cr,Dr)<THD2,ABS(A r , C r )<THD2, ABS(C r , D r )<THD2,

ABS(Ag,Cg)<THD2,ABS(Cg,Dg)<THD2,ABS(A g , C g )<THD2, ABS(C g , D g )<THD2,

ABS(Ab,Cb)<THD2,ABS(Cb,Db)<THD2,ABS(A b , C b )<THD2, ABS(C b , D b )<THD2,

ABS(Ar,Cr)+ABS(Ag,Cg)+ABS(Ab,Cb)≤ABS(A r ,C r )+ABS(A g ,C g )+ABS(A b ,C b )≤

ABS(Br,Dr)+ABS(Bg,Dg)+ABS(Bb,Db),ABS(B r ,D r )+ABS(B g ,D g )+ABS(B b ,D b ),

ABS(Ar,Cr)+ABS(Ag,Cg)+ABS(Ab,Cb)≤ABS(A r ,C r )+ABS(A g ,C g )+ABS(A b ,C b )≤

ABS(Ar,Br)+ABS(Ag,Bg)+ABS(Ab,Bb),ABS(A r ,B r )+ABS(A g ,B g )+ABS(A b ,B b ),

ABS(Cr,Dr)+ABS(Cg,Dy)+ABS(Cb,Db)≤ABS(C r ,D r )+ABS(C g ,D y )+ABS(C b ,D b )≤

ABS(Ar,Br)+ABS(Ag,Bg)+ABS(Ab,Bb),ABS(A r ,B r )+ABS(A g ,B g )+ABS(A b ,B b ),

ABS(Cr,Dr)+ABS(Cg,Dy)+ABS(Cb,Db)≤ABS(C r ,D r )+ABS(C g ,D y )+ABS(C b ,D b )≤

ABS(Br,Dr)+ABS(Bg,Dg)+ABS(Bb,Db)。ABS(B r , D r )+ABS(B g , D g )+ABS(B b ,D b ).

在步骤S130中,对该人造类型的2x2编码单元进行差分误差编码、量化及查表编码,以产生第一编码数据。In step S130 , differential error coding, quantization and table look-up coding are performed on the artificial type 2×2 coding unit to generate first coded data.

以下分别就2x2编码单元中,每个像素的红(r)、蓝(g)、绿(b)三种颜色均分别采用8位和6位进行记录的两个具体实施例对本发明的影像压缩方法进行具体介绍。In the 2x2 encoding unit, the three colors of red (r), blue (g) and green (b) of each pixel are respectively recorded in two specific embodiments using 8 bits and 6 bits to compress the image of the present invention. The method is described in detail.

实施例一:2x2编码单元中每个像素的红(r)、蓝(g)、绿(b)三种颜色均采用8位进行记录,故该2x2编码单元220为96(=4×3×8)位。Embodiment 1: the three colors of red (r), blue (g) and green (b) of each pixel in the 2x2 encoding unit are all recorded in 8 bits, so the 2x2 encoding unit 220 is 96 (=4×3× 8) bit.

图4是本发明的实施例一的2x2编码单元的差分误差编码、量化及查表编码的示意图,该实施例一为图2中的2x2编码单元220中每一种颜色数值采用8位表示的实施例,该2x2编码单元220为96(=4×3×8)位。在图4中,数字表示位数,例如8、7分别表示8位及7位。斜线表示查表操作,反斜线表示量化操作。Fig. 4 is a schematic diagram of differential error coding, quantization and table look-up coding of the 2x2 coding unit in Embodiment 1 of the present invention. In the first embodiment, each color value in the 2x2 coding unit 220 in Fig. 2 is represented by 8 bits In an embodiment, the 2x2 encoding unit 220 is 96 (=4×3×8) bits. In FIG. 4 , numbers represent the number of digits, for example, 8 and 7 represent 8 digits and 7 digits, respectively. A slash indicates a table lookup operation, and a backslash indicates a quantization operation.

在步骤S130中,当该2x2编码单元220为第一人造类型310、第二人造类型320和第三人造类型330中的一个时,使用8位记录其中两像素的平均值,使用7位记录一7位表格位置,该7位表格位置的记录内容为:该7位表格的所有记录内容中,与该2x2编码单元中另外两像素的平均值和前述的使用8位所记录的两像素的平均值的差值相差最小者。此表格为一可变动的表格,随时可调整。一共有四个表格:7位表格、4位表格、3位表格、2位表格,基本的精神:出现机率大的数值建立在表格中,因此容易被选出来。反之出现机率小的数值舍弃,不建立在表格中,因为储存的资源有限(表格的大小有限)。本发明所提供的实施例,仅是其中某表格的设定法之一。实际上调教此表格与产品实际表格的内容,为后续最佳化的动作。In step S130, when the 2x2 encoding unit 220 is one of the first artificial type 310, the second artificial type 320 and the third artificial type 330, use 8 bits to record the average value of two pixels, and use 7 bits to record one The position of the 7-bit table, the record content of the 7-bit table position is: among all the recorded contents of the 7-bit table, the average value of the other two pixels in the 2x2 coding unit and the average value of the aforementioned two pixels recorded using 8 bits The value with the smallest difference. This form is a variable form and can be adjusted at any time. There are four tables in total: 7-digit table, 4-digit table, 3-digit table, and 2-digit table. The basic spirit: the value with a high probability of occurrence is built in the table, so it is easy to be selected. On the contrary, values with a small probability of occurrence are discarded and not created in the table, because the storage resources are limited (the size of the table is limited). The embodiment provided by the present invention is only one of the setting methods of a certain table. In fact, adjust the content of this form and the actual form of the product for subsequent optimization actions.

第一人造类型310、第二人造类型320和第三人造类型330均为线条形式,故以第一人造类型310作为说明,第二人造类型320和第三人造类型330是为熟知该技术的人员基于本发明技术所能完成的,不再赘述。The first artificial type 310, the second artificial type 320 and the third artificial type 330 are all in the form of lines, so the first artificial type 310 is used as an illustration, and the second artificial type 320 and the third artificial type 330 are for those who are familiar with the technology What can be accomplished based on the technology of the present invention will not be repeated here.

图5是本发明的实施例一的2x2编码单元为第一人造类型、第二人造类型及第三人造类型时的编码示意图,该实施例一为图2中的2x2编码单元220中每一种颜色数值采用8位表示的实施例,该2x2编码单元220为96(=4×3×8)位。其可以为红色、蓝色或者绿色,是先将像素A的颜色数值(127)与像素B的颜色数值(126)相加再除以2(126.5),再四舍五入获得127,使用8位记录数值127。Fig. 5 is a schematic diagram of encoding when the 2x2 encoding unit of Embodiment 1 of the present invention is the first artificial type, the second artificial type and the third artificial type, and the first embodiment is each of the 2x2 encoding units 220 in Fig. 2 In an embodiment where the color value is represented by 8 bits, the 2x2 coding unit 220 has 96 (=4*3*8) bits. It can be red, blue or green. First add the color value of pixel A (127) to the color value of pixel B (126), divide by 2 (126.5), and then round to get 127. Use 8 bits to record the value 127.

将像素C的颜色数值(34)与像素D的颜色数值(32)相加再除以2(33),再四舍五入获得33,减去先前计算所得的数值127,以获得-94,虽然相减的结果为9位,但本发明使用一7位表格以进行查表,可减少编码后所产生的数据量。根据-94对一7位表格进行查表。-94是位于-95与-90之间,且靠近-95,故经由查表后得到-95的位置,使用7位记录-95的位置。Add the color value of pixel C (34) to the color value of pixel D (32) and divide by 2 (33), round up to get 33, subtract the previously calculated value of 127 to get -94, although subtracting The result is 9 bits, but the present invention uses a 7-bit table for table lookup, which can reduce the amount of data generated after encoding. A 7-digit table is looked up according to -94. -94 is located between -95 and -90, and close to -95, so the position of -95 is obtained after looking up the table, and 7 bits are used to record the position of -95.

该7位的表格内共记录128个值。若-95最接近表格的第j个值,则记录“j”。“j”值可依下列公式计算:A total of 128 values are recorded in this 7-bit table. If -95 is closest to the jth value of the table, record "j". The "j" value can be calculated according to the following formula:

[a1,a2,a3,...,ak-2,ak-1,ak],[a 1 , a 2 , a 3 ,..., a k-2 , a k-1 , a k ],

sign[α-aj]×sign[aj+1-α]≥0,                    (1)sign[α-a j ]×sign[a j+1 -α]≥0, (1)

其中a1~ak为该7位的表格内共记录的128个值,其由小至大依序排列。sign为输出该值的正负号的函数,α为欲查表的值,一旦满足公式(1)时,即储存j值。Wherein, a 1 to a k are 128 values recorded in the 7-bit table, which are arranged in order from small to large. sign is a function that outputs the sign of the value, α is the value to be looked up in the table, once the formula (1) is satisfied, the j value is stored.

在步骤S130中,当该2x2编码单元220为第四人造类型340、第五人造类型350、第六人造类型360和第七人造类型370中的一个时,使用8位记录其中三个像素的平均值,使用7位或者6位记录该2x2编码单元220另外一个像素的量化值。In step S130, when the 2x2 encoding unit 220 is one of the fourth artificial type 340, the fifth artificial type 350, the sixth artificial type 360 and the seventh artificial type 370, use 8 bits to record the average value, using 7 bits or 6 bits to record the quantized value of another pixel of the 2x2 coding unit 220.

第四人造类型340、第五人造类型350、第六人造类型360和第七人造类型370均为三角形与单点的组合,故以第四人造类型340为例进行说明,第五人造类型350、第六人造类型360和第七人造类型370是为熟知该技术的人员基于本发明技术所能完成的,不再赘述。The fourth artificial type 340, the fifth artificial type 350, the sixth artificial type 360, and the seventh artificial type 370 are all combinations of triangles and single points, so the fourth artificial type 340 is used as an example for illustration. The fifth artificial type 350, The sixth man-made type 360 and the seventh man-made type 370 can be accomplished by those who are familiar with the technology based on the technology of the present invention, and will not be repeated here.

图6是本发明的实施例一的2x2编码单元为第四人造类型340、第五人造类型350、第六人造类型360和第七人造类型370时的编码示意图,该实施例一为图2中的2x2编码单元220中每一种颜色数值采用8位表示的实施例,该2x2编码单元220为96(=4×3×8)位。其可为红色、蓝色、或绿色。其先将像素B的颜色数值(100)、像素C的颜色数值(100)和像素D的颜色数值(100)相加再除以3得到100,再四舍五入获得100,使用8位记录数值100。Fig. 6 is a schematic diagram of encoding when the 2x2 coding unit of the first embodiment of the present invention is the fourth artificial type 340, the fifth artificial type 350, the sixth artificial type 360 and the seventh artificial type 370. In the embodiment in which each color value in the 2x2 encoding unit 220 is represented by 8 bits, the 2x2 encoding unit 220 has 96 (=4×3×8) bits. It can be red, blue, or green. It first adds the color value of pixel B (100), the color value of pixel C (100) and the color value of pixel D (100), divides by 3 to get 100, and then rounds to get 100, using 8 bits to record the value 100.

将像素A的颜色数值(34)进行量化运算,再四舍五入小数部分获得数值9,使用6位记录数值9。当像素A的颜色为绿色时,使用7位记录数值9。该量化运算通过下列公式计算:Quantize the color value (34) of pixel A, and then round off the decimal part to obtain the value 9, and use 6 bits to record the value 9. When the color of pixel A is green, the value 9 is recorded using 7 bits. This quantized operation is calculated by the following formula:

xx QQ == RoundRound (( xx QQ ))

其中Q为一量化因子,Round为四舍五入函数。当使用6位记录时,量化因子Q为4,当使用7位记录时,量化因子Q为2。Among them, Q is a quantization factor, and Round is a rounding function. The quantization factor Q is 4 when 6-bit recording is used, and 2 when 7-bit recording is used.

当在步骤S120中,判定该2x2编码单元220不为第一人造类型至第七人造类型中的一个时,表示该2x2编码单元220为自然类型,故在步骤S140中,对该自然类型的2x2编码单元220进行色域转换,以得到一2x2色域转换单元。When in step S120, it is determined that the 2x2 encoding unit 220 is not one of the first artificial type to the seventh artificial type, it means that the 2x2 encoding unit 220 is a natural type, so in step S140, the 2x2 encoding unit of the natural type The encoding unit 220 performs color gamut conversion to obtain a 2x2 color gamut conversion unit.

在步骤S140中,通过进行RGB至YUV色域转换,以得到2x2色域转换单元,该RGB至YUV色域转换通过下列公式进行:In step S140, a 2x2 color gamut conversion unit is obtained by performing RGB to YUV color gamut conversion, and the RGB to YUV color gamut conversion is performed by the following formula:

YY Uu VV == 0.250.25 0.50.5 0.250.25 -- 0.50.5 11 .. .. -- 0.50.5 -- 1.01.0 00 1.01.0 rr gg bb ,,

其中,r表示一像素的红色值,g为该像素的绿色值,b为该像素的蓝色值,Y为该像素的明亮度(Luminance、Luma),U和V为该像素的色度(Chrominance)。图7是本发明色域转换和离散余弦转换的示意图,如图7所示,该2x2色域转换单元700是分别为明亮度2x2色域转换单元710、第一色度2x2色域转换单元720、及第二色度2x2色域转换单元730。Among them, r represents the red value of a pixel, g is the green value of the pixel, b is the blue value of the pixel, Y is the brightness (Luminance, Luma) of the pixel, U and V are the chromaticity ( Chrominance). Fig. 7 is a schematic diagram of color gamut conversion and discrete cosine conversion of the present invention. As shown in Fig. 7, the 2x2 color gamut conversion unit 700 is respectively a brightness 2x2 color gamut conversion unit 710 and a first chroma 2x2 color gamut conversion unit 720 , and a second chroma 2×2 color gamut conversion unit 730 .

该明亮度2x2色域转换单元710中的元素的值的范围为0~255,该第一色度2x2色域转换单元720和第二色度2x2色域转换单元730的元素的值的范围为-255~255,故该明亮度2x2色域转换单元710的元素为8位,该第一色度2x2色域转换单元720和第二色度2x2色域转换单元730的元素为9位,而此仅为计算过程,并不影响最后编码的位计数。在进行下一步骤S150前,需先将该明亮度2x2色域转换单元710的元素的值由0~255移位至-128~127。The values of the elements in the brightness 2x2 color gamut conversion unit 710 range from 0 to 255, and the values of the elements in the first chroma 2x2 color gamut conversion unit 720 and the second chroma 2x2 color gamut conversion unit 730 range from 0 to 255. -255~255, so the elements of the brightness 2x2 color gamut conversion unit 710 are 8 bits, the elements of the first chroma 2x2 color gamut conversion unit 720 and the second chroma 2x2 color gamut conversion unit 730 are 9 bits, and This is a calculation only and does not affect the final encoded bit count. Before proceeding to the next step S150 , the values of the elements of the brightness 2×2 color gamut conversion unit 710 need to be shifted from 0˜255 to −128˜127.

在步骤S150中,对该2x2色域转换单元700进行离散余弦转换,以产生一2x2频率域单元。In step S150 , a discrete cosine transform is performed on the 2x2 color gamut conversion unit 700 to generate a 2x2 frequency domain unit.

在步骤S150中,该离散余弦转换通过下列公式进行:In step S150, the discrete cosine transform is performed by the following formula:

EE. Ff GG Hh == 0.250.25 &times;&times; 11 11 11 11 11 -- 11 11 -- 11 11 11 -- 11 -- 11 11 -- 11 -- 11 11 AA &OverBar;&OverBar; BB &OverBar;&OverBar; CC &OverBar;&OverBar; DD. &OverBar;&OverBar; ,, -- -- -- (( 22 ))

其中,为该2x2色域转换单元700的左上角值,为该2x2色域转换单元700的右上角值,为该2x2色域转换单元700的左下角值,为该2x2色域转换单元700的右下角值,E元素为该2x2频率域单元750的左上角值,F元素为该2x2频率域单元750的右上角值,G元素为该2x2频率域单元750的左下角值,H元素为该2x2频率域单元750的右下角值,该2x2频率域单元750分为明亮度2x2频率域单元760、第一色度2x2频率域单元770和第二色度2x2频率域单元780。in, is the upper left corner value of the 2x2 color gamut conversion unit 700, is the upper right corner value of the 2x2 color gamut conversion unit 700, is the lower left corner value of the 2x2 color gamut conversion unit 700, is the lower right corner value of the 2x2 color gamut conversion unit 700, the E element is the upper left corner value of the 2x2 frequency domain unit 750, the F element is the upper right corner value of the 2x2 frequency domain unit 750, and the G element is the 2x2 frequency domain unit 750 The value of the lower left corner of the H element is the lower right corner value of the 2x2 frequency domain unit 750, the 2x2 frequency domain unit 750 is divided into a brightness 2x2 frequency domain unit 760, a first chrominance 2x2 frequency domain unit 770 and a second chrominance 2x2 frequency domain unit 780 .

该明亮度2x2频率域单元760中的各元素的值的范围为-128~127,该第一色度2x2频率域单元770和第二色度2x2频率域单元780的各元素的值的范围为-255~255,故该明亮度2x2频率域单元760的各元素为8位,该第一色度2x2频率域单元770和第二色度2x2频率域单元780的各元素为9位,而此仅为计算过程,并不影响最后编码的位计数。The value range of each element in the brightness 2x2 frequency domain unit 760 is -128 to 127, and the value range of each element in the first chroma 2x2 frequency domain unit 770 and the second chroma 2x2 frequency domain unit 780 is -255~255, so each element of the brightness 2x2 frequency domain unit 760 is 8 bits, each element of the first chroma 2x2 frequency domain unit 770 and the second chroma 2x2 frequency domain unit 780 is 9 bits, and this Computational only and does not affect the final encoded bit count.

公式(2)中的转换矩阵可由二维离散余弦转换获得,公式(3)是一二维离散余弦转换公式:The conversion matrix in formula (2) can be obtained by two-dimensional discrete cosine transformation, and formula (3) is a two-dimensional discrete cosine transformation formula:

Ff (( uu ,, vv )) == 11 22 NN cc (( uu )) cc (( vv )) &Sigma;&Sigma; xx == 00 NN -- 11 &Sigma;&Sigma; ythe y == 00 NN -- 11 ff (( xx ,, ythe y )) coscos (( (( 22 xx ++ 11 )) u&pi;u&pi; 22 NN )) coscos (( (( 22 ythe y ++ 11 )) v&pi;v&pi; 22 NN )) ,, -- -- -- (( 33 ))

其中, in,

其中,u、v为离散频率变量(discrete frequency variables),u、v的值为0,1,2,...,N-1,f(x,y)为N×N影像像素,F(u,v)为二维离散余弦转换的结果,在此实施例中,N为2,则可得到公式(2)中的转换矩阵。Among them, u, v are discrete frequency variables (discrete frequency variables), the values of u, v are 0, 1, 2, ..., N-1, f(x, y) is N×N image pixels, F( u, v) are the result of two-dimensional discrete cosine transformation, in this embodiment, N is 2, then the transformation matrix in formula (2) can be obtained.

在步骤S160中,将该2x2频率域单元750分类为第一自然类型380或者第二自然类型390,其中,当该第一色度2x2频率域单元770的F元素和G元素满足下列公式:In step S160, the 2x2 frequency domain unit 750 is classified into the first natural type 380 or the second natural type 390, wherein, when the F element and the G element of the first chroma 2x2 frequency domain unit 770 satisfy the following formula:

max(ABS(F,0),ABS(G,0))≤THD3,max(ABS(F,0),ABS(G,0))≤THD3,

且第二色度2x2频率域单元780的F元素和G元素满足下列公式:And the F element and the G element of the second chroma 2x2 frequency domain unit 780 satisfy the following formula:

max(ABS(F,0),ABS(G,0))≤THD4,max(ABS(F,0),ABS(G,0))≤THD4,

则判定该2x2频率域单元750为第一自然类型380,否则,判定该2x2频率域单元750为第二自然类型390,其中,THD3为第三门限值,THD4为第四门限值(第三门限值和第四门限值的取值由本领域技术人员根据经验选取),第四门限值THD4大于第三门限值THD3。Then determine that the 2x2 frequency domain unit 750 is the first natural type 380, otherwise, determine that the 2x2 frequency domain unit 750 is the second natural type 390, wherein THD3 is the third threshold value, and THD4 is the fourth threshold value (the first The values of the third threshold value and the fourth threshold value are selected by those skilled in the art based on experience), and the fourth threshold value THD4 is greater than the third threshold value THD3.

在步骤S170中,对该2x2频率域单元750进行量化及查表编码,以产生第二编码数据。In step S170, the 2x2 frequency domain unit 750 is quantized and coded by looking up a table to generate second coded data.

在步骤S170中,当该2x2频率域单元750为第一自然类型380时,使用7位记录该明亮度2x2频率域单元760的E元素、F元素、G元素;使用4位记录一4位表格位置,该4位表格位置的记录内容为:该4位表格的所有记录内容中,与该明亮度2x2频率域单元760的H元素的值的差值最小者。In step S170, when the 2x2 frequency domain unit 750 is the first natural type 380, use 7 bits to record the E element, F element, and G element of the brightness 2x2 frequency domain unit 760; use 4 bits to record a 4-bit table position, the record content of the position of the 4-bit table is: among all the record contents of the 4-bit table, the value of the H element of the brightness 2×2 frequency domain unit 760 has the smallest difference.

该明亮度2x2频率域单元760的元素的值为-128~127,故需先进行移位运算,以将该明亮度2x2频率域单元760的元素的值由-128~127移位至0~255。在步骤S170中,是将E元素、F元素、G元素的数值进行量化运算,针对小数部分四舍五入,再使用7位记录。由于该明亮度2x2频率域单元760的E元素、F元素、G元素的数值为8位,当使用7位记录时,因此量化因子Q为2。该明亮度2x2频率域单元760的H元素则使用一4位表格以进行查表操作,该查表操作的原理与前述7位表格查表相同,不再赘述。The values of the elements of the brightness 2x2 frequency domain unit 760 are -128~127, so a shift operation needs to be performed first to shift the values of the elements of the brightness 2x2 frequency domain unit 760 from -128~127 to 0~ 255. In step S170, the numerical values of the E element, the F element, and the G element are quantized, and the decimal part is rounded off, and then recorded in 7 bits. Since the value of the E element, F element, and G element of the brightness 2x2 frequency domain unit 760 is 8 bits, when 7 bits are used for recording, the quantization factor Q is 2. The H element of the brightness 2x2 frequency domain unit 760 uses a 4-bit table for table lookup operation. The principle of the table lookup operation is the same as that of the aforementioned 7-bit table lookup table, and will not be repeated here.

在步骤S170中,当该2x2频率域单元750为第一自然类型380时,使用7位记录该第一色度2x2频率域单元770的E元素;使用2位记录一2位表格位置,该2位表格位置的记录内容为:该2位表格的所有记录内容中,与该第一色度2x2频率域单元770的F元素和G元素的平均值的差值中的最小者;不记录该第一色度2x2频率域单元770的H元素。In step S170, when the 2x2 frequency domain unit 750 is the first natural type 380, use 7 bits to record the E element of the first chroma 2x2 frequency domain unit 770; use 2 bits to record a 2-bit table position, the 2 The record content of the bit table position is: among all the record contents of the 2-bit table, the smallest difference between the average value of the F element and the G element of the first chroma 2x2 frequency domain unit 770; An H element of the chroma 2x2 frequency domain unit 770 .

该第一色度2x2频率域单元770的元素的值为-255~255,故需先进行一移位运算,以将该第一色度2x2频率域单元770的元素的值由-255~255移位至0~510。因此该第一色度2x2频率域单元770的元素为9位,当使用7位记录该第一色度2x2频率域单元770的E元素时,需先进行量化运算,其中,量化因子Q为4。The value of the elements of the first chroma 2x2 frequency domain unit 770 is -255 to 255, so a shift operation needs to be performed first to change the value of the elements of the first chroma 2x2 frequency domain unit 770 from -255 to 255 Shift to 0~510. Therefore, the element of the first chroma 2x2 frequency domain unit 770 is 9 bits. When using 7 bits to record the E element of the first chroma 2x2 frequency domain unit 770, a quantization operation must be performed first, wherein the quantization factor Q is 4 .

其是将该第一色度2x2频率域单元770的F元素和G元素先取平均值,再用该平均值对一2位表格查表,该查表操作的原理与前述7位表格查表相同,不再赘述。It is to take the average value of the F element and G element of the first chroma 2x2 frequency domain unit 770, and then use the average value to look up a 2-bit table. The principle of the table lookup operation is the same as the aforementioned 7-bit table lookup ,No longer.

在步骤S170中,当该2x2频率域单元750为第一自然类型380时,使用7位记录该第二色度2x2频率域单元780的E元素的值;使用2位记录一2位表格位置,该2位表格位置的记录内容为:该2位表格的所有记录内容中,与该第二色度2x2频率域单元780中的F元素和G元素的平均值的差值中的最小者;使用3位纪录一3位表格位置,该3位表格位置的记录内容为:该3位表格的所有记录内容中,与该第二色度2x2频率域单元780的H元素的值的差值中的最小者。In step S170, when the 2x2 frequency domain unit 750 is the first natural type 380, use 7 bits to record the value of the E element of the second chroma 2x2 frequency domain unit 780; use 2 bits to record a 2-bit table position, The record content of the 2-bit table position is: among all the record contents of the 2-bit table, the smallest difference between the average value of the F element and the G element in the second chroma 2x2 frequency domain unit 780; 3 bits record a 3-bit table position, and the record content of the 3-bit table position is: among all the recorded contents of the 3-bit table, the difference between the value of the H element of the second chroma 2x2 frequency domain unit 780 the smallest.

该第二色度2x2频率域单元780的元素的值为-255~255,故需先进行一移位运算,以将该第二色度2x2频率域单元780的元素的值由-255~255移位至0~510。因此该第二色度2x2频率域单元780的元素为9位,当使用7位记录该第二色度2x2频率域单元780的E元素时,需先进行量化运算,其中,量化因子Q为4。The values of the elements of the second chroma 2x2 frequency domain unit 780 are -255 to 255, so a shift operation needs to be performed first to change the values of the elements of the second chroma 2x2 frequency domain unit 780 from -255 to 255 Shift to 0~510. Therefore, the elements of the second chroma 2x2 frequency domain unit 780 are 9 bits. When using 7 bits to record the E element of the second chroma 2x2 frequency domain unit 780, a quantization operation must be performed first, wherein the quantization factor Q is 4 .

其是将该第二色度2x2频率域单元780的F元素和G元素先取平均值,再用该平均值对一2位表格查表。该2位表格查表的原理与前述7位表格查表相同,不再赘述。It first takes the average value of the F element and the G element of the second chroma 2x2 frequency domain unit 780, and then uses the average value to look up a 2-bit table. The principle of the 2-digit table look-up is the same as that of the aforementioned 7-digit table look-up, and will not be repeated here.

在步骤S170中,当该2x2频率域单元750为第二自然类型390时,使用6位记录明亮度2x2频率域单元760的E元素的量化值,使用5位记录该明亮度2x2频率域单元760的F元素的量化值,使用5位记录明亮度2x2频率域单元760的G元素的量化值;使用3位记录一3位表格位置,该3位表格位置的记录内容为:该3位表格的所有记录内容中,与该明亮度2x2频率域单元760的H元素的值的差值中的最小者。该等量化因子Q及查表操作为熟悉该技术人员根据本发明技术所能得知的,不再赘述。In step S170, when the 2x2 frequency domain unit 750 is the second natural type 390, use 6 bits to record the quantized value of the E element of the brightness 2x2 frequency domain unit 760, and use 5 bits to record the brightness 2x2 frequency domain unit 760 The quantized value of the F element of 5 bits is used to record the quantized value of the G element of the brightness 2x2 frequency domain unit 760; 3 bits are used to record a 3-bit table position, and the record content of the 3-bit table position is: Among all the recorded contents, the smallest difference from the value of the H element of the brightness 2×2 frequency domain unit 760 . The quantization factor Q and the table lookup operation are known by those skilled in the art according to the technology of the present invention, and will not be repeated here.

在步骤S170中,当该2x2频率域单元750为第二自然类型390时,使用5位记录该第一色度2x2频率域单元770的E元素的量化值;使用3位记录一3位表格位置,该3位表格位置的记录内容为:该3位表格的所有记录内容中,与该第一色度2x2频率域单元770的F元素的值的差值中的最小者;使用3位记录一3位表格位置,该3位表格位置的记录内容为:该3位表格的所有记录内容中,与该第一色度2x2频率域单元770的G元素的值的差值中的最小者;不记录该第一色度2x2频率域单元770的H元素。In step S170, when the 2x2 frequency domain unit 750 is the second natural type 390, use 5 bits to record the quantized value of the E element of the first chroma 2x2 frequency domain unit 770; use 3 bits to record a 3-bit table position , the record content of the position of the 3-bit table is: among all the record contents of the 3-bit table, the minimum value difference with the value of the F element of the first chroma 2x2 frequency domain unit 770; use 3 bits to record a 3-bit table position, the record content of the 3-bit table position is: among all the record contents of the 3-bit table, the smallest difference between the value of the G element of the first chroma 2x2 frequency domain unit 770; The H element of the first chroma 2x2 frequency domain unit 770 is recorded.

在步骤S170中,当该2x2频率域单元750为第二自然类型390时,使用5位记录该第二色度2x2频率域单元780的E元素的量化值;使用4位记录一4位表格位置,该4位表格位置的记录内容为:该4位表格的所有记录内容中,与该第二色度2x2频率域单元780的F元素的值的差值中的最小者;使用4位记录一4位表格位置,该4位表格位置的记录内容为:该4位表格的所有记录内容中,与该第二色度2x2频率域单元780的G元素的值的差值中的最小者;使用3位记录一3位表格位置,该3位表格位置的记录内容为:该3位表格的所有记录内容中,与该第二色度2x2频率域单元780的H元素的值的差值中的最小者。In step S170, when the 2x2 frequency domain unit 750 is the second natural type 390, use 5 bits to record the quantized value of the E element of the second chroma 2x2 frequency domain unit 780; use 4 bits to record a 4-bit table position , the record content of the 4-bit table position is: among all the record contents of the 4-bit table, the minimum value of the difference with the value of the F element of the second chroma 2x2 frequency domain unit 780; use 4 bits to record a 4-bit table position, the record content of the 4-bit table position is: among all the record contents of the 4-bit table, the minimum value of the difference with the value of the G element of the second chroma 2x2 frequency domain unit 780; use 3-bit records a 3-bit table position, and the record content of the 3-bit table position is: among all the recorded contents of the 3-bit table, the difference between the value of the H element of the second chroma 2x2 frequency domain unit 780 the smallest.

在步骤S180中,接收该第一编码数据或者该第二编码数据,并对该第一编码数据或者该第二编码数据进行封装(packaging),进而生成具有固定位大小的编码封包。In step S180, the first coded data or the second coded data is received, and the first coded data or the second coded data is packaged to generate a coded packet with a fixed bit size.

由图4所示,步骤S180使用1位(主封包标头)以记录该2x2编码单元220是否为人造类型或是自然类型,再使用2位(第一子封包标头)以记录该2x2编码单元220是否为第一人造类型、第二人造类型、第三人造类型或者第四至第七人造类型中的一个,最后使用2位(次子封包标头)以记录该2x2编码单元220是否为第四至第七人造类型中的一个。因此,当该2x2编码单元220为第一人造类型、第二人造类型、第三人造类型中的一个时,其编码及封装后的位计数为48位(=1+2+8+7+8+7+8+7),当该2x2编码单元220为第四至第七人造类型中的一个时,其编码及封装后的位计数仍为48位(=1+2+2+8+7+8+6+8+6)。当该2x2编码单元220为自然类型时,再使用1位(第二子封包标头)以记录该2x2编码单元220是否为第一自然类型或者第二自然类型中的一个,当该2x2编码单元220为第一自然类型时,其编码及封装后的位计数仍为48位(=1+1+3×7+4+7+2+7+2+3),当该2x2编码单元220为第二自然类型时,其编码及封装后的位计数仍为48位(=1+1+6+5+5+3+5+3+3+5+4+4+3)。As shown in FIG. 4, step S180 uses 1 bit (main packet header) to record whether the 2x2 encoding unit 220 is a man-made type or a natural type, and then uses 2 bits (first sub-packet header) to record the 2x2 encoding Whether the unit 220 is one of the first artificial type, the second artificial type, the third artificial type, or the fourth to seventh artificial types, and finally use 2 bits (the second sub-packet header) to record whether the 2x2 encoding unit 220 is One of the fourth through seventh man-made types. Therefore, when the 2x2 encoding unit 220 is one of the first artificial type, the second artificial type, and the third artificial type, the bit count after its encoding and packaging is 48 bits (=1+2+8+7+8 +7+8+7), when the 2x2 encoding unit 220 is one of the fourth to seventh artificial types, the bit count after its encoding and packaging is still 48 bits (=1+2+2+8+7 +8+6+8+6). When the 2x2 coding unit 220 is a natural type, then use 1 bit (the second subpacket header) to record whether the 2x2 coding unit 220 is one of the first natural type or the second natural type, when the 2x2 coding unit When 220 is the first natural type, the bit count after its encoding and packaging is still 48 bits (=1+1+3×7+4+7+2+7+2+3), when the 2x2 encoding unit 220 is For the second natural type, the bit count after encoding and packaging is still 48 bits (=1+1+6+5+5+3+5+3+3+5+4+4+3).

图8所示为图3中的人造类型的扩展,该扩展在上述的七种人造类型的基础上扩展到十七种。其中,第一人造类型至第七人造类型与上述一致;第八、第九人造类型,表示该四个像素呈水平方向的一横条纹与两个单点的组合;第十、第十一人造类型,表示该四个像素呈竖直方向的一纵条纹与两个单点的组合;第十二、第十三人造类型,表示该四个像素呈45度角方向的一斜条纹与两个单点的组合;第十四至第十七人造类型为单通道类型,详见后续公式表述。Fig. 8 shows the extension of the man-made types in Fig. 3, which extends to seventeen types on the basis of the above-mentioned seven man-made types. Among them, the first artificial type to the seventh artificial type are consistent with the above; the eighth and ninth artificial types indicate that the four pixels are a combination of a horizontal stripe in the horizontal direction and two single points; the tenth and eleventh artificial type, indicating that the four pixels are a combination of a vertical stripe in the vertical direction and two single points; the twelfth and thirteenth man-made types, indicating that the four pixels are in a diagonal stripe at a 45-degree angle and two Single-point combination; the fourteenth to seventeenth man-made types are single-channel types, see the subsequent formula for details.

对应上述十七种人造类型,步骤120中的判断顺序有所调整:先判断所述2x2编码单元是否为第十四至第十七人造类型中的一个,再判断是否为第一人造类型至第三人造类型中的一个,再判断是否为第四人造类型至第七人造类型中的一个,再判断是否为第八人造类型至第十三人造类型中的一个。Corresponding to the above seventeen artificial types, the judgment order in step 120 is adjusted: first judge whether the 2x2 coding unit is one of the fourteenth to seventeenth artificial types, and then judge whether it is the first artificial type to the first artificial type One of the three man-made types is judged whether it is one of the fourth man-made type to the seventh man-made type, and then judged whether it is one of the eighth man-made man-made type to the thirteenth man-made man-made type.

所述第八人造类型,表示所述左上角像素和右上角像素近似(L);所述第九人造类型,表示所述左下角像素和右下角像素近似(L);所述第十人造类型,表示所述左上角像素和左下角像素近似(L);所述第十一人造类型,表示所述右上角像素和右下角像素近似(L);所述第十二人造类型,表示所述左上角像素和右下角像素近似(L);所述第十三人造类型,表示所述左下角像素和右上角像素近似(L)。The eighth artificial type represents the approximate (L) of the upper left pixel and the upper right pixel; the ninth artificial type represents the approximate (L) of the lower left pixel and the lower right pixel; the tenth artificial type , indicating that the upper left pixel and the lower left pixel are approximate (L); the eleventh artificial type indicates that the upper right pixel and the lower right pixel are approximate (L); the twelfth artificial type indicates that the The pixels in the upper left corner and the pixels in the lower right corner are approximate (L); the thirteenth artificial type represents the pixels in the lower left corner and the upper right corner are approximate (L).

根据上述新扩展的十七种人造类型,在步骤120中,当满足下列公式时,判定该2x2编码单元为第十四人造类型:According to the seventeen newly expanded artificial types, in step 120, when the following formula is met, it is determined that the 2x2 coding unit is the fourteenth artificial type:

Ar=Ag,Ag=Ab A r =A g , A g =A b

Br=Bg,Bg=Bb B r =B g , B g =B b

Cr=Cg,Cg=Cb C r =C g , C g =C b

Dr=Dg,Dg=Db D r = D g , D g = D b

其中,A为所述左上角像素,B为所述右上角像素,C为所述左下角像素,D为所述右下角像素,Ar、Ag、Ab分别为像素A的红色数值、绿色数值和蓝色数值,Br、Bg、Bb分别为像素B的红色数值、绿色数值和蓝色数值,Cr、Cg、Cb分别为像素C的红色数值、绿色数值和蓝色数值,Dr、Dg、Db分别为像素D的红色数值、绿色数值和蓝色数值。Wherein, A is the pixel in the upper left corner, B is the pixel in the upper right corner, C is the pixel in the lower left corner, D is the pixel in the lower right corner, Ar , Ag , A b are the red value of pixel A, Green value and blue value, B r , B g , B b are red value, green value and blue value of pixel B respectively, C r , C g , C b are red value, green value and blue value of pixel C respectively Color values, D r , D g , and D b are the red value, green value, and blue value of the pixel D, respectively.

在步骤120中,当满足下列公式时,判定该2x2编码单元为第十五人造类型:In step 120, when the following formula is met, it is determined that the 2x2 coding unit is the fifteenth artificial type:

Ag=0,Ab=0A g =0, A b =0

Bg=0,Bb=0B g =0, B b =0

Cg=0,Cb=0C g =0, C b =0

Dg=0,Db=0D g =0, D b =0

在步骤120中,当满足下列公式时,判定该2x2编码单元为第十六人造类型:In step 120, when the following formula is satisfied, it is determined that the 2x2 coding unit is the sixteenth artificial type:

Ar=0,Ab=0A r =0, A b =0

Br=0,Bb=0B r =0, B b =0

Cr=0,Cb=0C r =0, C b =0

Dr=0,Db=0D r =0, D b =0

在步骤120中,当满足下列公式时,判定该2x2编码单元为第十七人造类型:In step 120, when the following formula is met, it is determined that the 2x2 coding unit is the seventeenth artificial type:

Ag=0,Ar=0A g =0, A r =0

Bg=0,Br=0B g =0, B r =0

Cg=0,Cr=0C g =0, C r =0

Dg=0,Dr=0D g =0, D r =0

在步骤120中,当满足下列公式时,判定该2x2编码单元为第一人造类型:In step 120, when the following formula is satisfied, it is determined that the 2x2 coding unit is the first artificial type:

ABS(Ay,By)<THDY1,ABS(Cy,Dy)<THDY1ABS(A y , B y )<THDY1, ABS(C y ,D y )<THDY1

ABS(Au,Bu)<THDU1,ABS(Cu,Du)<THDU1ABS(A u , B u )<THDU1, ABS(C u ,D u )<THDU1

ABS(Av,Bv)<THDV1,ABS(Cv,Dv)<THDV1ABS (A v , B v ) < THDV1, ABS (C v , D v ) < THDV1

ABS(Ay,By)+ABS(Av,Bv)+ABS(Au,Bu)≤ABS(Ay,Cy)+ABS(Av,Cv)+ABS(Au,Cu)ABS(A y ,B y )+ABS(A v ,B v )+ABS(A u ,B u )≤ABS(A y ,C y )+ABS(A v ,C v )+ABS(A u , C u )

ABS(Ay,By)+ABS(Av,Bv)+ABS(Au,Bu)≤ABS(Dy,By)+ABS(Dv,Bv)+ABS(DuBu)ABS(A y ,B y )+ABS(A v ,B v )+ABS(A u ,B u )≤ABS(D y ,B y )+ABS(D v ,B v )+ABS(D u , Bu )

ABS(Cy,Dy)+ABS(Cv,Dv)+ABS(Cu,Du)≤ABS(Dy,By)+ABS(Dv,Bv)+ABS(Du,Bu)ABS(C y , D y )+ABS(C v ,D v )+ABS(C u ,D u )≤ABS(D y ,B y )+ABS(D v ,B v )+ABS(D u , B u )

ABS(Cy,Dy)+ABS(Cv,Dv)+ABS(Cu,Du)≤ABS(Ay,Cy)+ABS(Av,Cv)+ABS(Au,Cu)ABS(C y , D y )+ABS(C v ,D v )+ABS(C u ,D u )≤ABS(A y ,C y )+ABS(A v ,C v )+ABS(A u , C u )

其中,ABS为括号中两元素差的绝对值函数,THDY1为明亮度门限值1,THDU1为第一色度门限值1,THDV1为第二色度门限值1(各个门限值的取值由本领域技术人员根据经验选取),A为所述左上角像素,B为所述右上角像素,C为所述左下角像素,D为所述右下角像素,Ay、Au、Av分别为像素A的明亮度、第一色度和第二色度值,By、Bu、Bv分别为像素B的明亮度、第一色度和第二色度值,Cy、Cu、Cv分别为像素C的明亮度、第一色度和第二色度值,Dy、Du、Dv分别为像素D的明亮度、第一色度和第二色度值;Among them, ABS is the absolute value function of the difference between the two elements in the brackets, THDY1 is the brightness threshold value 1, THDU1 is the first chroma threshold value 1, and THDV1 is the second chroma threshold value 1 (each threshold value Values are selected by those skilled in the art based on experience), A is the upper left pixel, B is the upper right pixel, C is the lower left pixel, D is the lower right pixel, A y , A u , A v are the brightness, first chroma and second chroma values of pixel A respectively; By y , Bu , B v are respectively the brightness, first chroma and second chroma values of pixel B; Cy , C u , C v are brightness, first chroma and second chroma values of pixel C respectively, D y , Du , D v are brightness, first chroma and second chroma values of pixel D respectively ;

其中,所述明亮度、第一色度和第二色度值通过上述步骤S140中的RGB至YUV的色域转换公式获得:Wherein, the brightness, the first chromaticity and the second chromaticity value are obtained by the color gamut conversion formula from RGB to YUV in the above step S140:

YY Uu VV == 0.250.25 0.50.5 0.250.25 -- 0.50.5 1.01.0 -- 0.50.5 -- 1.01.0 00 1.01.0 rr gg bb ,,

其中,r为一像素的红色值,g为该像素的绿色值,b为该像素的蓝色值,Y为该像素的明亮度,U和V分别为该像素的第一色度和第二色度。Among them, r is the red value of a pixel, g is the green value of the pixel, b is the blue value of the pixel, Y is the brightness of the pixel, U and V are the first chromaticity and second chromaticity of the pixel respectively. chroma.

在步骤120中,当满足下列公式时,判定该2x2编码单元为第二人造类型:In step 120, when the following formula is met, it is determined that the 2x2 coding unit is the second artificial type:

ABS(Ay,Cy)<THDY1,ABS(By,Dy)<THDY1ABS(A y ,C y )<THDY1, ABS(B y ,D y )<THDY1

ABS(Au,Cu)<THDU1,ABS(Bu,Du)<THDU1ABS(A u ,C u )<THDU1, ABS(B u ,D u )<THDU1

ABS(Av,Cv)<THDV1,ABS(Bv,Dv)<THDV1ABS(A v ,C v )<THDV1, ABS(B v ,D v )<THDV1

ABS(Ay,Cy)+ABS(Av,Cv)+ABS(Au,Cu)≤ABS(Ay,By)+ABS(Av,Bv)+ABS(Au,Bu)ABS(A y , C y )+ABS(A v ,C v )+ABS(A u ,C u )≤ABS(A y ,B y )+ABS(A v ,B v )+ABS(A u , B u )

ABS(Ay,Cy)+ABS(Av,Cv)+ABS(Au,Cu)≤ABS(Cy,Dy)+ABS(Cv,Dv)+ABS(Cu,Du)ABS(A y ,C y )+ABS(A v ,C v )+ABS(A u ,C u )≤ABS(C y ,D y )+ABS(C v ,D v )+ABS(C u , D u )

ABS(By,Dy)+ABS(Bv,Dv)+ABS(Bu,Du)≤ABS(Ay,By)+ABS(Av,Bv)+ABS(Au,Bu)ABS(B y , D y )+ABS(B v ,D v )+ABS(B u ,D u )≤ABS(A y ,B y )+ABS(A v ,B v )+ABS(A u , B u )

ABS(By,Dy)+ABS(Bv,Dv)+ABS(Bu,Du)≤ABS(Dy,Cy)+ABS(Dv,Cv)+ABS(Du,Cu)ABS(B y , D y )+ABS(B v ,D v )+ABS(B u ,D u )≤ABS(D y ,C y )+ABS(D v ,C v )+ABS(D u , C u )

在步骤120中,当满足下列公式时,判定该2x2编码单元为第三人造类型:In step 120, when the following formula is met, it is determined that the 2x2 coding unit is the third artificial type:

ABS(Cy,By)<THDY1,ABS(Ay,Dy)<THDY1ABS(C y , B y )<THDY1, ABS(A y ,D y )<THDY1

ABS(Cu,Bu)<THDU1,ABS(Au,Du)<THDU1ABS(C u , B u )<THDU1, ABS(A u ,D u )<THDU1

ABS(Cv,Bv)<THDV1,ABS(Av,Dv)<THDV1ABS (C v , B v ) < THDV1, ABS (A v , D v ) < THDV1

ABS(Cy,By)+ABS(Cv,Bv)+ABS(Cu,Bu)≤ABS(Ay,By)+ABS(Av,Bv)+ABS(Au,Bu)ABS(C y ,B y )+ABS(C v ,B v )+ABS(C u ,B u )≤ABS(A y ,B y )+ABS(A v ,B v )+ABS(A u , B u )

ABS(Cy,By)+ABS(Cv,Bv)+ABS(Cu,Bu)≤ABS(Dy,Cy)+ABS(Dv,Cv)+ABS(Du,Cu)ABS(C y ,B y )+ABS(C v ,B v )+ABS(C u ,B u )≤ABS(D y ,C y )+ABS(D v ,C v )+ABS(D u , C u )

ABS(Ay,Dy)+ABS(Av,Dv)+ABS(Au,Du)≤ABS(Ay,By)+ABS(Av,Bv)+ABS(Au,Bu)ABS(A y , D y )+ABS(A v ,D v )+ABS(A u ,D u )≤ABS(A y ,B y )+ABS(A v ,B v )+ABS(A u , B u )

ABS(Ay,Dy)+ABS(Av,Dv)+ABS(Au,Du)≤ABS(Dy,Cy)+ABS(Dv,Cv)+ABS(Du,Cu)ABS(A y , D y )+ABS(A v ,D v )+ABS(A u ,D u )≤ABS(D y ,C y )+ABS(D v ,C v )+ABS(D u , C u )

在步骤120中,当满足下列公式时,判定该2x2编码单元为第四人造类型:In step 120, when the following formula is satisfied, it is determined that the 2x2 coding unit is the fourth artificial type:

ABS(Dy,By)<THDY2,ABS(Cy,Dy)<THDY2ABS(D y , B y )<THDY2, ABS(C y ,D y )<THDY2

ABS(Du,Bu)<THDU2,ABS(Cu,Du)<THDU2ABS(D u , B u )<THDU2, ABS(C u ,D u )<THDU2

ABS(Dv,Bv)<THDV2,ABS(Cv,Dv)<THDV2ABS(D v , B v )<THDV2, ABS(C v ,D v )<THDV2

ABS(Dy,By)+ABS(Dv,Bv)+ABS(Du,Bu)≤ABS(Ay,Cy)+ABS(Av,Cv)+ABS(Au,Cu)ABS(D y ,B y )+ABS(D v ,B v )+ABS(D u ,B u )≤ABS(A y ,C y )+ABS(A v ,C v )+ABS(A u , C u )

ABS(Dy,By)+ABS(Dv,Bv)+ABS(Du,Bu)≤ABS(Ay,By)+ABS(Av,Bv)+ABS(Au,Bu)ABS(D y ,B y )+ABS(D v ,B v )+ABS(D u ,B u )≤ABS(A y ,B y )+ABS(A v ,B v )+ABS(A u , B u )

ABS(Dy,Cy)+ABS(Dv,Cv)+ABS(Du,Cu)≤ABS(Ay,Cy)+ABS(Av,Cv)+ABS(Au,Cu)ABS(D y , C y )+ABS(D v ,C v )+ABS(D u ,C u )≤ABS(A y ,C y )+ABS(A v ,C v )+ABS(A u , C u )

ABS(Dy,Cy)+ABS(Dv,Cv)+ABS(Du,Cu)≤ABS(Ay,By)+ABS(Av,Bv)+ABS(Au,Bu)ABS(D y , C y )+ABS(D v ,C v )+ABS(D u ,C u )≤ABS(A y ,B y )+ABS(A v ,B v )+ABS(A u , B u )

其中,ABS为括号中两元素差的绝对值函数,THDY2为明亮度门限值2,THDU2为第一色度门限值2,THDV2为第二色度门限值2(各个门限值的取值由本领域技术人员根据经验选取)。Among them, ABS is the absolute value function of the difference between the two elements in the brackets, THDY2 is the brightness threshold value 2, THDU2 is the first chromaticity threshold value 2, and THDV2 is the second chromaticity threshold value 2 (each threshold value The value is selected by those skilled in the art based on experience).

在步骤120中,当满足下列公式时,判定该2x2编码单元为第五人造类型:In step 120, when the following formula is satisfied, it is determined that the 2x2 coding unit is the fifth artificial type:

ABS(Dy,By)<THDY2,ABS(Ay,By)<THDY2ABS(D y , B y )<THDY2, ABS(A y ,B y )<THDY2

ABS(Du,Bu)<THDU2,ABS(Au,Bu)<THDU2ABS(D u ,B u )<THDU2,ABS(A u ,B u )<THDU2

ABS(Dv,Bv)<THDV2,ABS(Av,Bv)<THDV2ABS(D v , B v )<THDV2, ABS(A v ,B v )<THDV2

ABS(Dy,By)+ABS(Dv,Bv)+ABS(Du,Bu)≤ABS(Ay,Cy)+ABS(Av,Cv)+ABS(Au,Cu)ABS(D y ,B y )+ABS(D v ,B v )+ABS(D u ,B u )≤ABS(A y ,C y )+ABS(A v ,C v )+ABS(A u , C u )

ABS(Dy,By)+ABS(Dv,Bv)+ABS(Du,Bu)≤ABS(Cy,Dy)+ABS(Cv,Dv)+ABS(Cu,Du)ABS(D y ,B y )+ABS(D v ,B v )+ABS(D u ,B u )≤ABS(C y ,D y )+ABS(C v ,D v )+ABS(C u , D u )

ABS(Ay,By)+ABS(Av,Bv)+ABS(Au,Bu)≤ABS(Ay,Cy)+ABS(Av,Cv)+ABS(Au,Cu)ABS(A y ,B y )+ABS(A v ,B v )+ABS(A u ,B u )≤ABS(A y ,C y )+ABS(A v ,C v )+ABS(A u , C u )

ABS(Ay,By)+ABS(Av,Bv)+ABS(Au,Bu)≤ABS(Cy,Dy)+ABS(Cv,Dv)+ABS(Cu,Du)ABS(A y ,B y )+ABS(A v ,B v )+ABS(A u ,B u )≤ABS(C y ,D y )+ABS(C v ,D v )+ABS(C u , D u )

在步骤120中,当满足下列公式时,判定该2x2编码单元为第六人造类型:In step 120, when the following formula is met, it is determined that the 2x2 coding unit is the sixth artificial type:

ABS(Ay,By)<THDY2,ABS(Cy,Ay)<THDY2ABS(A y , B y )<THDY2, ABS(C y ,A y )<THDY2

ABS(Au,Bu)<THDU2,ABS(Cu,Au)<THDU2ABS(A u ,B u )<THDU2,ABS(C u ,A u )<THDU2

ABS(Av,Bv)<THDV2,ABS(Cv,Av)<THDV2ABS(A v , B v )<THDV2, ABS(C v ,A v )<THDV2

ABS(Ay,By)+ABS(Av,Bv)+ABS(Au,Bu)≤ABS(Dy,Cy)+ABS(Dv,Cv)+ABS(Du,Cu)ABS(A y ,B y )+ABS(A v ,B v )+ABS(A u ,B u )≤ABS(D y ,C y )+ABS(D v ,C v )+ABS(D u , C u )

ABS(Ay,By)+ABS(Av,Bv)+ABS(Au,Bu)≤ABS(Dy,By)+ABS(Dv,Bv)+ABS(Du,Bu)ABS(A y ,B y )+ABS(A v ,B v )+ABS(A u ,B u )≤ABS(D y ,B y )+ABS(D v ,B v )+ABS(D u , B u )

ABS(Ay,Cy)+ABS(Av,Cv)+ABS(Au,Cu)≤ABS(Dy,Cy)+ABS(Dv,Cv)+ABS(Du,Cu)ABS(A y , C y )+ABS(A v ,C v )+ABS(A u ,C u )≤ABS(D y ,C y )+ABS(D v ,C v )+ABS(D u , C u )

ABS(Ay,Cy)+ABS(Av,Cv)+ABS(Au,Cu)≤ABS(Dy,By)+ABS(Dv,Bv)+ABS(Du,Bu)ABS(A y , C y )+ABS(A v ,C v )+ABS(A u ,C u )≤ABS(D y ,B y )+ABS(D v ,B v )+ABS(D u , B u )

在步骤120中,当满足下列公式时,判定该2x2编码单元为第七人造类型:In step 120, when the following formula is satisfied, it is determined that the 2x2 coding unit is the seventh artificial type:

ABS(Ay,Cy)<THDY2,ABS(Cy,Dy)<THDY2ABS(A y ,C y )<THDY2, ABS(C y ,D y )<THDY2

ABS(Au,Cu)<THDU2,ABS(Cu,Du)<THDU2ABS(A u ,C u )<THDU2, ABS(C u ,D u )<THDU2

ABS(Av,Cv)<THDV2,ABS(Cv,Dv)<THDV2ABS(A v ,C v )<THDV2, ABS(C v ,D v )<THDV2

ABS(Ay,Cy)+ABS(Av,Cv)+ABS(Au,Cu)≤ABS(By,Dy)+ABS(Bv,Dv)+ABS(Bu,Du)ABS(A y , C y )+ABS(A v ,C v )+ABS(A u ,C u )≤ABS(B y ,D y )+ABS(B v ,D v )+ABS(B u , D u )

ABS(Ay,Cy)+ABS(Av,Cv)+ABS(Au,Cu)≤ABS(Ay,By)+ABS(Av,Bv)+ABS(Au,Bu)ABS(A y , C y )+ABS(A v ,C v )+ABS(A u ,C u )≤ABS(A y ,B y )+ABS(A v ,B v )+ABS(A u , B u )

ABS(Dy,Cy)+ABS(Dv,Cv)+ABS(Du,Cu)≤ABS(By,Dy)+ABS(Bv,Dv)+ABS(Bu,Du)ABS(D y ,C y )+ABS(D v ,C v )+ABS(D u ,C u )≤ABS(B y ,D y )+ABS(B v ,D v )+ABS(B u , D u )

ABS(Dy,Cy)+ABS(Dv,Cv)+ABS(Du,Cu)≤ABS(Ay,By)+ABS(Av,Bv)+ABS(Au,Bu)ABS(D y , C y )+ABS(D v ,C v )+ABS(D u ,C u )≤ABS(A y ,B y )+ABS(A v ,B v )+ABS(A u , B u )

在步骤120中,当满足下列公式时,判定该2x2编码单元为第八人造类型:In step 120, when the following formula is satisfied, it is determined that the 2x2 coding unit is the eighth artificial type:

temp1=ABS(Ay,By)+ABS(Av,Bv)+ABS(Au,Bu)temp1=ABS(A y , B y )+ABS(A v , B v )+ABS(A u , B u )

temp2=ABS(Ay,Cy)+ABS(Av,Cy)+ABS(Au,Cu)temp2=ABS(A y , C y )+ABS(A v ,C y )+ABS(A u ,C u )

temp3=ABS(Ay,Dy)+ABS(Av,Dv)+ABS(Au,Du)temp3=ABS(A y , D y )+ABS(A v ,D v )+ABS(A u ,D u )

temp4=ABS(Dy,By)+ABS(Dv,Bv)+ABS(Du,Bu)temp4=ABS(D y , B y )+ABS(D v , B v )+ABS(D u , B u )

temp5=ABS(Cy,By)+ABS(Cv,Bv)+ABS(Cu,Bu)temp5=ABS(C y , B y )+ABS(C v , B v )+ABS(C u , B u )

temp6=ABS(Cy,Dy)+ABS(Cv,Dv)+ABS(Cu,Du)temp6=ABS(C y , D y )+ABS(C v , D v )+ABS(C u , D u )

MIN(temp1,temp2,temp3,temp4,temp5,temp6)=temp1MIN(temp1, temp2, temp3, temp4, temp5, temp6) = temp1

ABS(Ay,By)<THDY4ABS(A y , B y )<THDY4

ABS(Av,Bv)<THDV4ABS( Av , Bv )<THDV4

ABS(Au,Bu)<THDU4ABS(A u ,B u )<THDU4

或者ABS(Cy,Dy)>THDY3Or ABS(C y , D y )>THDY3

或者ABS(Cv,Dv)>THDV3Or ABS(C v , D v )>THDV3

或者ABS(Cu,Du)>THDU3Or ABS(C u , D u )>THDU3

其中,ABS为括号中两元素差的绝对值函数,THDY3为明亮度门限值3,THDU3为第一色度门限值3,THDV3为第二色度门限值3,THDY4为明亮度门限值4,THDU4为第一色度门限值4,THDV4为第二色度门限值4(各个门限值的取值由本领域技术人员根据经验选取)。Among them, ABS is the absolute value function of the difference between the two elements in the brackets, THDY3 is the brightness threshold value 3, THDU3 is the first chromaticity threshold value 3, THDV3 is the second chromaticity threshold value 3, and THDY4 is the brightness threshold value Threshold 4, THDU4 is the first chroma threshold 4, THDV4 is the second chroma threshold 4 (values of each threshold are selected by those skilled in the art based on experience).

在步骤120中,当满足下列公式时,判定该2x2编码单元为第九人造类型:In step 120, when the following formula is satisfied, it is determined that the 2x2 coding unit is the ninth artificial type:

temp1=ABS(Ay,By)+ABS(Av,Bv)+ABS(Au,Bu)temp1=ABS(A y , B y )+ABS(A v , B v )+ABS(A u , B u )

temp2=ABS(Ay,Cy)+ABS(Av,Cv)+ABS(Au,Cu)temp2=ABS(A y , C y )+ABS(A v , C v )+ABS(A u , C u )

temp3=ABS(Ay,Dy)+ABS(Av,Dv)+ABS(Au,Du)temp3=ABS(A y , D y )+ABS(A v ,D v )+ABS(A u ,D u )

temp4=ABS(Dy,By)+ABS(Dv,Bv)+ABS(Du,Bu)temp4=ABS(D y , B y )+ABS(D v , B v )+ABS(D u , B u )

temp5=ABS(Cy,By)+ABS(Cv,Bv)+ABS(Cu,Bu)temp5=ABS(C y , B y )+ABS(C v , B v )+ABS(C u , B u )

temp6=ABS(Cy,Dy)+ABS(Cv,Dv)+ABS(Cu,Du)temp6=ABS(C y , D y )+ABS(C v , D v )+ABS(C u , D u )

MIN(temp1,temp2,temp3,temp4,temp5,temp6)=temp6MIN(temp1, temp2, temp3, temp4, temp5, temp6) = temp6

ABS(Cy,Dy)<THDY4ABS(C y , D y )<THDY4

ABS(Cv,Dv)<THDV4ABS(C v , D v )<THDV4

ABS(Cu,Du)<THDU4ABS(C u ,D u )<THDU4

或者ABS(Ay,By)>THDY3Or ABS(A y , B y )>THDY3

或者ABS(Av,Bv)>THDV3Or ABS(A v , B v )>THDV3

或者ABS(Au,Bu)>THDU3Or ABS(A u , B u )>THDU3

在步骤120中,当满足下列公式时,判定该2x2编码单元为第十人造类型:In step 120, when the following formula is met, it is determined that the 2x2 coding unit is the tenth artificial type:

temp1=ABS(Ay,By)+ABS(Av,Bv)+ABS(Au,Bu)temp1=ABS(A y , B y )+ABS(A v , B v )+ABS(A u , B u )

temp2=ABS(Ay,Cy)+ABS(Av,Cv)+ABS(Au,Cu)temp2=ABS(A y , C y )+ABS(A v , C v )+ABS(A u , C u )

temp3=ABS(Ay,Dy)+ABS(Av,Dv)+ABS(Au,Du)temp3=ABS(A y , D y )+ABS(A v ,D v )+ABS(A u ,D u )

temp4=ABS(Dy,By)+ABS(Dv,Bv)+ABS(Du,Bu)temp4=ABS(D y , B y )+ABS(D v , B v )+ABS(D u , B u )

temp5=ABS(Cy,By)+ABS(Cv,Bv)+ABS(Cu,Bu)temp5=ABS(C y , B y )+ABS(C v , B v )+ABS(C u , B u )

temp6=ABS(Cy,Dy)+ABS(Cv,Dv)+ABS(Cu,Du)temp6=ABS(C y , D y )+ABS(C v , D v )+ABS(C u , D u )

MIN(temp1,temp2,temp3,temp4,temp5,temp6)=temp2MIN(temp1, temp2, temp3, temp4, temp5, temp6) = temp2

ABS(Ay,Cy)<THDY4ABS(A y , C y )<THDY4

ABS(Av,Cv)<THDV4ABS(A v , C v )<THDV4

ABS(Au,Cu)<THDU4ABS(A u ,C u )<THDU4

或者ABS(By,Dy)>THDY3Or ABS(B y , D y )>THDY3

或者ABS(Bv,Dv)>THDV3Or ABS(B v , D v )>THDV3

或者ABS(Bu,Du)>THDU3Or ABS(B u , D u )>THDU3

在步骤120中,当满足下列公式时,判定该2x2编码单元为第十一人造类型:In step 120, when the following formula is satisfied, it is determined that the 2x2 coding unit is the eleventh artificial type:

temp1=ABS(Ay,By)+ABS(Av,Bv)+ABS(Au,Bu)temp1=ABS(A y , B y )+ABS(A v , B v )+ABS(A u , B u )

temp2=ABS(Ay,Cy)+ABS(Av,Cv)+ABS(Au,Cu)temp2=ABS(A y , C y )+ABS(A v , C v )+ABS(A u , C u )

temp3=ABS(Ay,Dy)+ABS(Av,Dv)+ABS(Au,Du)temp3=ABS(A y , D y )+ABS(A v ,D v )+ABS(A u ,D u )

temp4=ABS(Dy,By)+ABS(Dv,Bv)+ABS(Du,Bu)temp4=ABS(D y , B y )+ABS(D v , B v )+ABS(D u , B u )

temp5=ABS(Cy,By)+ABS(Cv,Bv)+ABS(Cu,Bu)temp5=ABS(C y , B y )+ABS(C v , B v )+ABS(C u , B u )

temp6=ABS(Cy,Dy)+ABS(Cv,Dv)+ABS(Cu,Du)temp6=ABS(C y , D y )+ABS(C v , D v )+ABS(C u , D u )

MIN(temp1,temp2,temp3,temp4,temp5,temp6)=temp4MIN(temp1, temp2, temp3, temp4, temp5, temp6) = temp4

ABS(By,By)<THDY4ABS(B y ,B y )<THDY4

ABS(Dv,Bv)<THDV4ABS(D v ,B v )<THDV4

ABS(Du,Bu)<THDU4ABS(D u ,B u )<THDU4

或者ABS(Cy,Ay)>THDY3Or ABS(C y , A y )>THDY3

或者ABS(Cv,Av)>THDV3Or ABS(C v , A v )>THDV3

或者ABS(Cu,Au)>THDU3Or ABS(C u , A u )>THDU3

在步骤120中,当满足下列公式时,判定该2x2编码单元为第十二人造类型:In step 120, when the following formula is satisfied, it is determined that the 2x2 coding unit is the twelfth artificial type:

temp1=ABS(Ay,By)+ABS(Av,Bv)+ABS(Au,Bu)temp1=ABS(A y , B y )+ABS(A v , B v )+ABS(A u , B u )

temp2=ABS(Ay,Cy)+ABS(Av,Cv)+ABS(Au,Cu)temp2=ABS(A y , C y )+ABS(A v , C v )+ABS(A u , C u )

temp3=ABS(Ay,Dy)+ABS(Av,Dv)+ABS(Au,Du)temp3=ABS(A y , D y )+ABS(A v ,D v )+ABS(A u ,D u )

temp4=ABS(Dy,By)+ABS(Dv,Bv)+ABS(Du,Bu)temp4=ABS(D y , B y )+ABS(D v , B v )+ABS(D u , B u )

temp5=ABS(Cy,By)+ABS(Cv,Bv)+ABS(Cu,Bu)temp5=ABS(C y , B y )+ABS(C v , B v )+ABS(C u , B u )

temp6=ABS(Cy,Dy)+ABS(Cv,Dv)+ABS(Cu,Du)temp6=ABS(C y , D y )+ABS(C v , D v )+ABS(C u , D u )

MIN(temp1,temp2,temp3,temp4,temp5,temp6)=temp3MIN(temp1, temp2, temp3, temp4, temp5, temp6) = temp3

ABS(Ay,Dy)<THDY4ABS(A y , D y )<THDY4

ABS(Av,Dv)<THDV4ABS(A v , D v )<THDV4

ABS(Au,Du)<THDU4ABS(A u ,D u )<THDU4

或者ABS(Cy,By)>THDY3Or ABS(C y , B y )>THDY3

或者ABS(Cv,Bv)>THDV3Or ABS(C v , B v )>THDV3

或者ABS(Cu,Bu)>THDU3Or ABS(C u , B u )>THDU3

在步骤120中,当满足下列公式时,判定该2x2编码单元为第十三人造类型:In step 120, when the following formula is satisfied, it is determined that the 2x2 coding unit is the thirteenth artificial type:

temp1=ABS(Ay,By)+ABS(Av,Bv)+ABS(Au,Bu)temp1=ABS(A y , B y )+ABS(A v , B v )+ABS(A u , B u )

temp2=ABS(Ay,Cy)+ABS(Av,Cv)+ABS(Au,Cu)temp2=ABS(A y , C y )+ABS(A v , C v )+ABS(A u , C u )

temp3=ABS(Ay,Dy)+ABS(Av,Dv)+ABS(Au,Du)temp3=ABS(A y , D y )+ABS(A v ,D v )+ABS(A u ,D u )

temp4=ABS(Dy,By)+ABS(Dv,Bv)+ABS(Du,Bu)temp4=ABS(D y , B y )+ABS(D v , B v )+ABS(D u , B u )

temp5=ABS(Cy,By)+ABS(Cv,Bv)+ABS(Cu,Bu)temp5=ABS(C y , B y )+ABS(C v , B v )+ABS(C u , B u )

temp6=ABS(Cy,Dy)+ABS(Cv,Dv)+ABS(Cu,Du)temp6=ABS(C y , D y )+ABS(C v , D v )+ABS(C u , D u )

MIN(temp1,temp2,temp3,temp4,temp5,temp6)=temp5MIN(temp1, temp2, temp3, temp4, temp5, temp6) = temp5

ABS(Cy,By)<THDY4ABS(C y ,B y )<THDY4

ABS(Cv,Bv)<THDV4ABS( Cv , Bv )<THDV4

ABS(Cu,Bu)<THDU4ABS(C u ,B u )<THDU4

或者ABS(Ay,Dy)>THDY3Or ABS(A y , D y )>THDY3

或者ABS(Av,Dv)>THDV3Or ABS(A v , D v )>THDV3

或者ABS(Au,Du)>THDU3Or ABS(A u ,D u )>THDU3

在步骤S160中,出上述自然类型分类方法外,还可以对自然类型进行如下划分:将2x2频率域单元分为第一自然类型、第二自然类型或者第三自然类型,其中:In step S160, in addition to the above natural type classification method, the natural type can also be divided as follows: the 2x2 frequency domain unit is divided into the first natural type, the second natural type or the third natural type, wherein:

当第一色度2x2频率域单元的H元素满足下列公式,When the H element of the first chroma 2x2 frequency domain unit satisfies the following formula,

H>THD1H>THD1

则判定所述2x2编码单元为第一自然类型;Then determine that the 2x2 coding unit is the first natural type;

当第一色度2x2频率域单元中的F元素和G元素满足下列公式,When the F element and the G element in the first chroma 2x2 frequency domain unit satisfy the following formula,

MAX(ABS(F,0),ABS(G,0))≤THD2MAX(ABS(F,0),ABS(G,0))≤THD2

并且第二色度2x2频率域单元中的F元素和G元素满足下列公式,And the F element and the G element in the second chroma 2x2 frequency domain unit satisfy the following formula,

MAX(ABS(F,0),ABS(G,0))≤THD3MAX(ABS(F,0),ABS(G,0))≤THD3

则判定所述2x2编码单元为第二自然类型;Then determine that the 2x2 coding unit is the second natural type;

不符合第一自然类型和第二自然类型条件的,则判定所述2x2编码单元为第三自然类型;If the conditions of the first natural type and the second natural type are not met, the 2x2 coding unit is determined to be the third natural type;

其中,THD1为第一门限值,THD2为第二门限值,THD3为第三门限值(各个门限值的取值由本领域技术人员根据经验选取)。Wherein, THD1 is the first threshold value, THD2 is the second threshold value, and THD3 is the third threshold value (values of each threshold value are selected by those skilled in the art based on experience).

图9是采用上述扩展后17种人造类型的2x2编码单元的差分误差编码、量化及查表编码的示意图。在图9中,数字表示位数,例如8、7分别表示8位及7位,斜线表示查表操作,反斜线表示量化操作。FIG. 9 is a schematic diagram of differential error coding, quantization and table look-up coding using the above-mentioned 17 artificial types of 2×2 coding units after extension. In FIG. 9 , numbers indicate the number of digits, for example, 8 and 7 respectively indicate 8 bits and 7 bits, slashes indicate table lookup operations, and backslashes indicate quantization operations.

在步骤S130中,当该2x2编码单元220为第一人造类型、第二人造类型和第三人造类型中的一个时,使用8位记录其中两像素的平均值,使用6位或者7位记录一6位或者7位表格位置,该6位或者7位表格位置的记录内容为:该6位或者7位表格的所有记录内容中,与该2x2编码单元中另外两像素的平均值和前述的使用8位所记录的两像素的平均值的差值相差最小者。例如,如图10所示的2x2编码单元,仅记录:(128+128)/2=128(使用8位记录)与差值(127+127)/2-(128+128)/2=-1(使用一7位表格记录)。In step S130, when the 2x2 encoding unit 220 is one of the first artificial type, the second artificial type and the third artificial type, use 8 bits to record the average value of two pixels, use 6 bits or 7 bits to record a 6-bit or 7-bit table position, the record content of the 6-bit or 7-bit table position is: among all the record content of the 6-bit or 7-bit table, the average value of the other two pixels in the 2x2 coding unit and the aforementioned use The difference between the average values of two pixels recorded by 8 bits is the smallest. For example, the 2x2 coding unit shown in Figure 10 only records: (128+128)/2=128 (using 8-bit recording) and the difference (127+127)/2-(128+128)/2=- 1 (recorded using a 7-digit table).

在步骤S130中,当该2x2编码单元220为第四人造类型至第七人造类型中的一个时,使用8位记录其中三个像素的平均值,使用7位或者6位记录该2x2编码单元中另外一个像素的量化值。例如,参照图11先将像素B的颜色数值(127)、像素C的颜色数值(129)和像素D的颜色数值(128)相加再除以3得到128,再四舍五入获得128,使用8位记录数值128。将像素A的颜色数值(28)进行量化运算,再四舍五入小数部分获得数值7,使用6位记录数值7。当像素A的颜色为绿色时,使用7位记录数值14。该量化运算通过前述的量化公式计算,此处不再赘述。In step S130, when the 2x2 encoding unit 220 is one of the fourth artificial type to the seventh artificial type, use 8 bits to record the average value of three pixels, and use 7 bits or 6 bits to record the average value of the 2x2 encoding unit. The quantized value of another pixel. For example, referring to Figure 11, first add the color value of pixel B (127), the color value of pixel C (129) and the color value of pixel D (128), then divide by 3 to get 128, and then round up to get 128, using 8 bits Record the value 128. Quantize the color value (28) of pixel A, and then round off the decimal part to obtain the value 7, and use 6 bits to record the value 7. When the color of pixel A is green, the value 14 is recorded using 7 bits. The quantization operation is calculated by the aforementioned quantization formula, which will not be repeated here.

在步骤S130中,当该2x2编码单元220为第八人造类型至第十三人造类型中的一个时,使用5位记录其中两像素平均值的量化值,使用4位分别记录其余两像素的量化值;或者使用7位记录其中两像素平均值的量化值,使用5位记录其余两像素的量化值。即将两个相近似像素颜色数值取平均值,并进行量化运算,并使用7位(或者5位)进行记录,其余两个像素颜色数值分别直接进行量化运算并分别使用5位(或者4位)进行记录。例如,参照图12先将像素B的颜色数值(21)和像素D的颜色数值(23)相加再除以2得到22,对22进行量化运算得到round(22/2)=11,使用7位记录数值11;将像素A的颜色数值(7)进行量化运算,再四舍五入小数部分获得数值1,使用5位记录数值1;将像素C的颜色数值(40)进行量化运算,再四舍五入小数部分获得数值5,使用5位记录数值5。In step S130, when the 2x2 encoding unit 220 is one of the eighth artificial type to the thirteenth artificial type, use 5 bits to record the quantized value of the average value of two pixels, and use 4 bits to record the quantized values of the remaining two pixels respectively value; or use 7 bits to record the quantized value of the average value of two pixels, and use 5 bits to record the quantized value of the remaining two pixels. That is to take the average value of two similar pixel color values, perform quantization operation, and use 7 bits (or 5 bits) for recording, and the remaining two pixel color values are directly quantized and use 5 bits (or 4 bits) respectively Make a note. For example, with reference to Figure 12, first add the color value (21) of pixel B and the color value (23) of pixel D and then divide by 2 to obtain 22, perform quantization operation on 22 to obtain round(22/2)=11, use 7 Record the value 11 in bits; quantize the color value (7) of pixel A, and then round the decimal part to obtain the value 1, use 5 bits to record the value 1; perform quantization operation on the color value (40) of pixel C, and then round the decimal part To get the value 5, use 5 bits to record the value 5.

在步骤S130中,当该2x2编码单元220为第十四人造类型至第十七人造类型中的一个时,从上述关于第十四人造类型至第十七人造类型的公式可知,所谓单通道即像素仅有红(R)、绿(G)、蓝(B)或者灰度(gray level)数据,所以该数据仅有RGB的24位三通道数据的1/3,因此可以使用8位对该数据进行完整的记录。In step S130, when the 2x2 encoding unit 220 is one of the fourteenth artificial type to the seventeenth artificial type, it can be known from the above formulas about the fourteenth artificial type to the seventeenth artificial type that the so-called single channel is Pixels only have red (R), green (G), blue (B) or gray level (gray level) data, so this data is only 1/3 of the 24-bit three-channel data of RGB, so 8 bits can be used for this The data is fully recorded.

对于上述3种自然类型的划分方式,请参照图13,其中反斜杠表示量化操作,斜杠表示查表操作。For the division methods of the above three natural types, please refer to Figure 13, where a backslash indicates a quantization operation, and a slash indicates a table lookup operation.

其中,量化操作采用公式:Among them, the quantization operation adopts the formula:

xx QQ == RoundRound (( xx QQ ))

其中Q为已知的量化因子,Round为四舍五入函数,记录量化后的值xQWhere Q is a known quantization factor, Round is a rounding function, and the quantized value x Q is recorded.

例如,用7位记录0~255,则Q=256/(27)=2。For example, if 7 bits are used to record 0 to 255, then Q=256/(2 7 )=2.

关于查表操作,例如参照图14,4位表格内共有24=16个记录值,若该元素值最接近表格里的第j个值,则记录“j”,“j”值可依下列公式计算:Regarding the table look-up operation, for example, with reference to Fig. 14, there are 2 4 = 16 record values in the 4-bit table, if the element value is the closest to the jth value in the table, then record "j", and the value of "j" can be as follows Formula calculation:

[a1,a2,a3,...,ak-2,ak-1,ak],[a 1 , a 2 , a 3 ,..., a k-2 , a k-1 , a k ],

sign[F-aj]·sign[aj+1-F]≥0,                    (2)sign[ Faj ]·sign[aj +1 -F]≥0, (2)

其中a1~ak为该4位的表格内共记录的16个值,其由小至大依序排列。sign为输出该值的正负号的函数,F为欲查表的值,一旦满足公式(2)时,即储存j值。Wherein, a 1 to a k are 16 values recorded in the 4-bit table, which are arranged in order from small to large. sign is a function that outputs the sign of the value, and F is the value to be looked up in the table. Once the formula (2) is satisfied, the j value is stored.

在步骤S170中,对该2x2频率域单元进行量化及查表编码,以产生第二编码数据。In step S170, quantization and table look-up encoding are performed on the 2x2 frequency domain unit to generate second encoded data.

在步骤S170中,当该2x2频率域单元为第一自然类型时,使用5位记录该明亮度2x2频率域单元的E元素、F元素、G元素的量化值;使用3位记录一3位表格位置,该3位表格位置的记录内容为:该3位表格的所有记录内容中,与该明亮度2x2频率域单元的H元素的值的差值最小者。In step S170, when the 2x2 frequency domain unit is the first natural type, use 5 bits to record the quantized values of the E element, F element, and G element of the brightness 2x2 frequency domain unit; use 3 bits to record a 3-bit table Position, the record content of the position of the 3-bit table is: among all the record content of the 3-bit table, the value of the H element of the brightness 2x2 frequency domain unit has the smallest difference.

该明亮度2x2频率域单元的元素的值为-128~127,故需先进行移位运算,以将该明亮度2x2频率域单元的元素的值由-128~127移位至0~255。在步骤S170中,是将E元素、F元素、G元素的数值进行量化运算,针对小数部分四舍五入,再使用5位记录。由于该明亮度2x2频率域单元的E元素、F元素、G元素的数值为8位,当使用5位记录时,因此量化因子Q为8。该明亮度2x2频率域单元的H元素则使用一3位表格以进行查表操作,该查表操作的原理与前述5位表格查表相同,不再赘述。The values of the elements of the brightness 2x2 frequency domain unit are -128~127, so a shift operation is required to shift the values of the elements of the brightness 2x2 frequency domain unit from -128~127 to 0~255. In step S170, quantize the values of the E element, F element, and G element, round off the decimal part, and then use 5 bits to record. Since the value of the E element, F element, and G element of the brightness 2x2 frequency domain unit is 8 bits, when 5 bits are used for recording, the quantization factor Q is 8. The H element of the luminance 2x2 frequency domain unit uses a 3-bit table for table lookup operation. The principle of the table lookup operation is the same as that of the aforementioned 5-bit table lookup table, and will not be repeated here.

在步骤S170中,当该2x2频率域单元为第一自然类型时,使用5位记录该第一色度2x2频率域单元的E元素的量化值;使用3位记录一3位表格位置,该3位表格位置的记录内容为:该3位表格的所有记录内容中,与该第一色度2x2频率域单元的F元素的值的差值最小者;使用3位记录一3位表格位置,该3位表格位置的记录内容为:该3位表格的所有记录内容中,与该第一色度2x2频率域单元的G元素的值的差值最小者;使用3位记录一3位表格位置,该3位表格位置的记录内容为:该3位表格的所有记录内容中,与该第一色度2x2频率域单元770的H元素的值的差值最小者。In step S170, when the 2x2 frequency domain unit is the first natural type, use 5 bits to record the quantized value of the E element of the first chroma 2x2 frequency domain unit; use 3 bits to record a 3-bit table position, the 3 The record content of the bit table position is: among all the record contents of the 3-bit table, the one with the smallest value difference with the value of the F element of the first chroma 2x2 frequency domain unit; use 3 bits to record a 3-bit table position, the The record content of the 3-bit table position is: among all the record contents of the 3-bit table, the one with the smallest value difference with the value of the G element of the first chroma 2x2 frequency domain unit; use 3-bit record-3-bit table position, The record content of the position of the 3-bit table is: among all the record contents of the 3-bit table, the value of the H element of the first chroma 2×2 frequency domain unit 770 has the smallest difference.

在步骤S170中,当该2x2频率域单元为第一自然类型时,使用5位记录该第二色度2x2频率域单元的E元素的量化值;使用3位记录一3位表格位置,该3位表格位置的记录内容为:该3位表格的所有记录内容中,与该第二色度2x2频率域单元的F元素的值的差值最小者;使用3位记录一3位表格位置,该3位表格位置的记录内容为:该3位表格的所有记录内容中,与该第二色度2x2频率域单元的G元素的值的差值最小者;使用3位记录一3位表格位置,该3位表格位置的记录内容为:该3位表格的所有记录内容中,与该第二色度2x2频率域单元的H元素的值的差值最小者。In step S170, when the 2x2 frequency domain unit is the first natural type, use 5 bits to record the quantized value of the E element of the second chroma 2x2 frequency domain unit; use 3 bits to record a 3-bit table position, the 3 The record content of the bit table position is: among all the recorded contents of the 3-bit table, the one with the smallest value difference with the value of the F element of the second chroma 2x2 frequency domain unit; use 3 bits to record a 3-bit table position, the The record content of the 3-bit table position is: among all the record contents of the 3-bit table, the one with the smallest value difference with the value of the G element of the second chroma 2x2 frequency domain unit; use 3-bit record-3-bit table position, The record content of the position of the 3-bit table is: among all the record contents of the 3-bit table, the value of the H element of the second chroma 2×2 frequency domain unit has the smallest difference.

在步骤S170中,当该2x2频率域单元为第二自然类型时,使用7位记录该明亮度2x2频率域单元的E元素、F元素、G元素的量化值;使用4位记录一4位表格位置,该4位表格位置的记录内容为:该4位表格的所有记录内容中,与该明亮度2x2频率域单元的H元素的值的差值最小者。In step S170, when the 2x2 frequency domain unit is the second natural type, use 7 bits to record the quantized values of the E element, F element, and G element of the brightness 2x2 frequency domain unit; use 4 bits to record a 4-bit table Position, the record content of the position of the 4-bit table is: among all the record content of the 4-bit table, the value of the H element of the brightness 2x2 frequency domain unit has the smallest difference.

该明亮度2x2频率域单元的元素的值为-128~127,故需先进行移位运算,以将该明亮度2x2频率域单元的元素的值由-128~127移位至0~255。在步骤S170中,是将E元素、F元素、G元素的数值进行量化运算,针对小数部分四舍五入,再使用7位记录。由于该明亮度2x2频率域单元的E元素、F元素、G元素的数值为8位,当使用7位记录时,因此量化因子Q为2。该明亮度2x2频率域单元的H元素则使用一4位表格以进行查表操作,该查表操作的原理与前述7位表格查表相同,不再赘述。The values of the elements of the brightness 2x2 frequency domain unit are -128~127, so a shift operation is required to shift the values of the elements of the brightness 2x2 frequency domain unit from -128~127 to 0~255. In step S170, the numerical values of the E element, the F element, and the G element are quantized, and the decimal part is rounded off, and then recorded in 7 bits. Since the value of the E element, F element, and G element of the brightness 2x2 frequency domain unit is 8 bits, when 7 bits are used for recording, the quantization factor Q is 2. The H element of the luminance 2x2 frequency domain unit uses a 4-bit table for table lookup operation. The principle of the table lookup operation is the same as the aforementioned 7-bit table lookup table, and will not be repeated here.

在步骤S170中,当该2x2频率域单元为第二自然类型时,使用6位记录该第一色度2x2频率域单元的E元素的量化值;使用2位记录一2位表格位置,该2位表格位置的记录内容为:该2位表格的所有记录内容中,与该第一色度2x2频率域单元的F元素和G元素的平均值的差值中的最小者;不记录该第一色度2x2频率域单元的H元素。In step S170, when the 2x2 frequency domain unit is the second natural type, use 6 bits to record the quantized value of the E element of the first chroma 2x2 frequency domain unit; use 2 bits to record a 2-bit table position, the 2 The record content of the bit table position is: among all the record contents of the 2-bit table, the smallest difference between the average value of the F element and the G element of the first chroma 2x2 frequency domain unit; the first chroma 2x2 frequency domain unit is not recorded H element of the chroma 2x2 frequency domain unit.

该第一色度2x2频率域单元的元素的值为-255~255,故需先进行一移位运算,以将该第一色度2x2频率域单元的元素的值由-255~255移位至0~510。因此该第一色度2x2频率域单元770的元素为9位,当使用6位记录该第一色度2x2频率域单元770的E元素时,需先进行量化运算,其中,量化因子Q为8。The values of the elements of the first chroma 2x2 frequency domain unit are -255 to 255, so a shift operation needs to be performed first to shift the values of the elements of the first chroma 2x2 frequency domain unit from -255 to 255 to 0~510. Therefore, the element of the first chroma 2x2 frequency domain unit 770 is 9 bits. When using 6 bits to record the E element of the first chroma 2x2 frequency domain unit 770, a quantization operation needs to be performed first, wherein the quantization factor Q is 8 .

其是将该第一色度2x2频率域单元的F元素和G元素先取平均值,再用该平均值对一2位表格查表,该查表操作的原理与前述7位表格查表相同,不再赘述。It is to take the average value of the F element and the G element of the first chroma 2x2 frequency domain unit, and then use the average value to look up a 2-bit table. The principle of the table lookup operation is the same as the aforementioned 7-bit table lookup. No longer.

在步骤S170中,当该2x2频率域单元为第二自然类型时,使用7位记录该第二色度2x2频率域单元的E元素的量化值;使用2位记录一2位表格位置,该2位表格位置的记录内容为:该2位表格的所有记录内容中,与该第二色度2x2频率域单元中的F元素和G元素的平均值的差值中的最小者;使用3位纪录一3位表格位置,该3位表格位置的记录内容为:该3位表格的所有记录内容中,与该第二色度2x2频率域单元的H元素的值的差值中的最小者。In step S170, when the 2x2 frequency domain unit is the second natural type, use 7 bits to record the quantized value of the E element of the second chroma 2x2 frequency domain unit; use 2 bits to record a 2-bit table position, the 2 The record content of the bit table position is: among all the record contents of the 2-bit table, the smallest difference between the average value of the F element and the G element in the second chroma 2x2 frequency domain unit; use 3-bit records A 3-bit table location, the record content of the 3-bit table location is: the smallest difference between all the record contents of the 3-bit table and the value of the H element of the second chroma 2x2 frequency domain unit.

该第二色度2x2频率域单元的元素的值为-255~255,故需先进行一移位运算,以将该第二色度2x2频率域单元的元素的值由-255~255移位至0~510。因此该第二色度2x2频率域单元780的元素为9位,当使用7位记录该第二色度2x2频率域单元的E元素时,需先进行量化运算,其中,量化因子Q为4。The values of the elements of the second chroma 2x2 frequency domain unit are -255 to 255, so a shift operation needs to be performed first to shift the values of the elements of the second chroma 2x2 frequency domain unit from -255 to 255 to 0~510. Therefore, the element of the second chroma 2x2 frequency domain unit 780 is 9 bits. When using 7 bits to record the E element of the second chroma 2x2 frequency domain unit, a quantization operation needs to be performed first, wherein the quantization factor Q is 4.

其是将该第二色度2x2频率域单元的F元素和G元素先取平均值,再用该平均值对一2位表格查表。该2位表格查表的原理与前述7位表格查表相同,不再赘述。It is to take the average value of the F element and the G element of the second chroma 2x2 frequency domain unit first, and then use the average value to look up a 2-bit table. The principle of the 2-digit table look-up is the same as that of the aforementioned 7-digit table look-up, and will not be repeated here.

在步骤S170中,当该2x2频率域单元为第三自然类型时,使用5位记录该明亮度2x2频率域单元的E元素的量化值;使用3位记录一3位表格位置,该3位表格位置的记录内容为:该3位表格的所有记录内容中,与该明亮度2x2频率域单元的F元素的值的差值中的最小者;使用3位记录一3位表格位置,该3位表格位置的记录内容为:该3位表格的所有记录内容中,与该明亮度2x2频率域单元的G元素的值的差值中的最小者;使用2位记录一2位表格位置,该2位表格位置的记录内容为:该2位表格的所有记录内容中,与该明亮度2x2频率域单元的H元素的值的差值中的最小者。In step S170, when the 2x2 frequency domain unit is the third natural type, use 5 bits to record the quantized value of the E element of the brightness 2x2 frequency domain unit; use 3 bits to record a 3-bit table position, the 3-bit table The record content of the position is: among all the record contents of the 3-bit table, the minimum value difference with the value of the F element of the brightness 2x2 frequency domain unit; use 3 bits to record a 3-bit table position, the 3-bit The record content of the table position is: among all the record contents of the 3-bit table, the minimum value difference with the value of the G element of the brightness 2x2 frequency domain unit; use 2 bits to record a 2-bit table position, the 2 The record content of the position of the bit table is: among all the record contents of the 2-bit table, the smallest difference between the value of the H element of the brightness 2x2 frequency domain unit.

在步骤S170中,当该2x2频率域单元为第三自然类型时,使用4位记录该第一色度2x2频率域单元的E元素的量化值;使用4位记录一4位表格位置,该4位表格位置的记录内容为:该4位表格的所有记录内容中,与该第一色度2x2频率域单元的F元素的值的差值中的最小者;使用4位记录一4位表格位置,该4位表格位置的记录内容为:该4位表格的所有记录内容中,与该第一色度2x2频率域单元的G元素的值的差值中的最小者;使用4位记录一4位表格位置,该4位表格位置的记录内容为:该4位表格的所有记录内容中,与该第一色度2x2频率域单元的H元素的值的差值中的最小者。In step S170, when the 2x2 frequency domain unit is the third natural type, use 4 bits to record the quantized value of the E element of the first chroma 2x2 frequency domain unit; use 4 bits to record a 4-bit table position, the 4 bits The record content of the bit table position is: among all the record contents of the 4-bit table, the minimum value difference with the value of the F element of the first chroma 2x2 frequency domain unit; use 4 bits to record a 4-bit table position , the record content of the 4-bit table position is: among all the record contents of the 4-bit table, the minimum value difference with the value of the G element of the first chroma 2×2 frequency domain unit; use 4 bits to record—4 Bit table position, the record content of the 4-bit table position is: the smallest difference between all the record contents of the 4-bit table and the value of the H element of the first chroma 2x2 frequency domain unit.

在步骤S170中,当该2x2频率域单元为第三自然类型时,使用4位记录该第二色度2x2频率域单元的E元素的量化值;使用4位记录一4位表格位置,该4位表格位置的记录内容为:该4位表格的所有记录内容中,与该第二色度2x2频率域单元的F元素的值的差值中的最小者;使用4位记录一4位表格位置,该4位表格位置的记录内容为:该4位表格的所有记录内容中,与该第二色度2x2频率域单元的G元素的值的差值中的最小者;使用4位记录一4位表格位置,该4位表格位置的记录内容为:该4位表格的所有记录内容中,与该第二色度2x2频率域单元的H元素的值的差值中的最小者。In step S170, when the 2x2 frequency domain unit is the third natural type, use 4 bits to record the quantized value of the E element of the second chroma 2x2 frequency domain unit; use 4 bits to record a 4-bit table position, the 4 bits The record content of the bit table position is: among all the record contents of the 4-bit table, the minimum value difference with the value of the F element of the second chroma 2x2 frequency domain unit; use 4 bits to record a 4-bit table position , the record content of the 4-bit table position is: among all the record contents of the 4-bit table, the minimum value difference with the value of the G element of the second chroma 2×2 frequency domain unit; use 4 bits to record—4 Bit table position, the record content of the 4-bit table position is: the smallest difference between all the record contents of the 4-bit table and the value of the H element of the second chroma 2x2 frequency domain unit.

在硬件架构中,可以用OTP(One Time Programable,一次性可编程芯片)、ROM(Read-Only Memory,只读内存)或NVM(Nonvolatile memory,非易失性存储器)记录表格内容。In the hardware architecture, OTP (One Time Programmable, one-time programmable chip), ROM (Read-Only Memory, read-only memory) or NVM (Nonvolatile memory, non-volatile memory) can be used to record the table content.

在步骤S180中,接收该第一编码数据或者该第二编码数据,并对该第一编码数据或者该第二编码数据进行封装(packaging),进而生成具有固定位大小的编码封包。In step S180, the first coded data or the second coded data is received, and the first coded data or the second coded data is packaged to generate a coded packet with a fixed bit size.

如图9和图13所示,步骤S180使用1位(主封包标头)以记录该2x2编码单元220是否为人造类型或是自然类型,再使用4位(第一子封包标头)以记录该2x2编码单元220是否为第一人造类型至第十七人造类型中的一个。因此,当该2x2编码单元220为第一人造类型、第二人造类型、第三人造类型中的一个时,其编码及封装后的位计数为48位(=1+4+8+7+8+6+8+6),当该2x2编码单元220为第四至第七人造类型中的一个时,其编码及封装后的位计数仍为48位(=1+4+8+7+8+6+8+6),当该2x2编码单元220为第八至第十三人造类型中的一个时,其编码及封装后的位计数为48位(=1+4+5+4+4+7+5+5+5+4+4),当该2x2编码单元220为第十四至第十七人造类型中的一个时,其编码及封装后的位计数为39位(=1+4+2+8+8+8+8)。当该2x2编码单元220为自然类型时,再使用1位(第二子封包标头)以记录该2x2编码单元220是否为第一自然类型或者第二、第三自然类型,当该2x2编码单元220为第一自然类型时,其编码及封装后的位计数仍为48位(=1+1+5+5+5+3+5+3+3+3+5+3+3+3),当该2x2编码单元220为第二自然类型或者第三自然类型时,再使用1位(次封包标头)以记录该2x2编码单元220是否为第二自然类型或者第三自然类型,当该2x2编码单元220为第二自然类型时,其编码及封装后的位计数仍为48位(=1+1+1+7+7+7+4+6+2+7+2+3),当该2x2编码单元220为第三自然类型时,其编码及封装后的位计数仍为48位(=1+1+1+5+3+3+2+4+4+4+4+4+4+4+4)。As shown in Figures 9 and 13, step S180 uses 1 bit (the main packet header) to record whether the 2x2 encoding unit 220 is a man-made type or a natural type, and then uses 4 bits (the first sub-packet header) to record Whether the 2x2 encoding unit 220 is one of the first artificial type to the seventeenth artificial type. Therefore, when the 2x2 encoding unit 220 is one of the first artificial type, the second artificial type, and the third artificial type, the bit count after its encoding and packaging is 48 bits (=1+4+8+7+8 +6+8+6), when the 2x2 encoding unit 220 is one of the fourth to seventh artificial types, the bit count after encoding and packaging is still 48 bits (=1+4+8+7+8 +6+8+6), when the 2x2 encoding unit 220 is one of the eighth to the thirteenth man-made types, the bit count after its encoding and packaging is 48 bits (=1+4+5+4+4 +7+5+5+5+4+4), when the 2x2 coding unit 220 is one of the fourteenth to seventeenth man-made types, the bit count after its coding and packaging is 39 bits (=1+ 4+2+8+8+8+8). When the 2x2 coding unit 220 is a natural type, then use 1 bit (the second subpacket header) to record whether the 2x2 coding unit 220 is the first natural type or the second or third natural type, when the 2x2 coding unit When 220 is the first natural type, the bit count after its encoding and packaging is still 48 bits (=1+1+5+5+5+3+5+3+3+3+5+3+3+3) , when the 2x2 coding unit 220 is the second natural type or the third natural type, then use 1 bit (secondary packet header) to record whether the 2x2 coding unit 220 is the second natural type or the third natural type, when the When the 2x2 encoding unit 220 is the second natural type, the bit count after encoding and packaging is still 48 bits (=1+1+1+7+7+7+4+6+2+7+2+3), When the 2x2 encoding unit 220 is the third natural type, the bit count after encoding and packing is still 48 bits (=1+1+1+5+3+3+2+4+4+4+4+4 +4+4+4).

实施例二:2x2编码单元中每个像素的红(r)、蓝(g)、绿(b)三种颜色均采用6位进行记录,故该2x2编码单元220为72(=6×3×4)位。Embodiment 2: the three colors of red (r), blue (g) and green (b) of each pixel in the 2x2 encoding unit are all recorded in 6 bits, so the 2x2 encoding unit 220 is 72 (=6×3× 4 bit.

在实施例二中,人造类型参考图8的十七种。其中,第一人造类型至第七人造类型以及第十四人造类型至第十七人造类型与前述实施例一中的规则相同,第八人造类型至第十三人造类型调整如下。In the second embodiment, the artificial types refer to the seventeen types in Fig. 8 . Among them, the first artificial type to the seventh artificial type and the fourteenth artificial type to the seventeenth artificial type are the same as the rules in the first embodiment, and the eighth artificial type to the thirteenth artificial type are adjusted as follows.

在步骤120中,当满足下列公式时,判定该2x2编码单元为第八人造类型:In step 120, when the following formula is satisfied, it is determined that the 2x2 coding unit is the eighth artificial type:

temp1=ABS(Ay,By)+ABS(Av,Bv)+ABS(Au,Bu)temp1=ABS(A y , B y )+ABS(A v , B v )+ABS(A u , B u )

temp2=ABS(Ay,Cy)+ABS(Av,Cv)+ABS(Au,Cu)temp2=ABS(A y , C y )+ABS(A v , C v )+ABS(A u , C u )

temp3=ABS(Ay,Dy)+ABS(Av,Dv)+ABS(Au,Du)temp3=ABS(A y , D y )+ABS(A v ,D v )+ABS(A u ,D u )

temp4=ABS(Dy,By)+ABS(Dv,Bv)+ABS(Du,Bu)temp4=ABS(D y , B y )+ABS(D v , B v )+ABS(D u , B u )

temp5=ABS(Cy,By)+ABS(Cv,Bv)+ABS(Cu,Bu)temp5=ABS(C y , B y )+ABS(C v , B v )+ABS(C u , B u )

temp6=ABS(Cy,Dy)+ABS(Cv,Dv)+ABS(Cu,Du)temp6=ABS(C y , D y )+ABS(C v , D v )+ABS(C u , D u )

MIN(temp1,temp2,temp3,temp4,temp5,temp6)=temp1MIN(temp1, temp2, temp3, temp4, temp5, temp6) = temp1

ABS(Ay,By)<THDY4ABS(A y , B y )<THDY4

ABS(Av,Bv)<THDV4ABS( Av , Bv )<THDV4

ABS(Au,Bu)<THDU4ABS(A u ,B u )<THDU4

在步骤120中,当满足下列公式时,判定该2x2编码单元为第九人造类型:In step 120, when the following formula is satisfied, it is determined that the 2x2 coding unit is the ninth artificial type:

temp1=ABS(Ay,By)+ABS(Av,Bv)+ABS(Au,Bu)temp1=ABS(A y , B y )+ABS(A v , B v )+ABS(A u , B u )

temp2=ABS(Ay,Cy)+ABS(Av,Cv)+ABS(Au,Cu)temp2=ABS(A y , C y )+ABS(A v , C v )+ABS(A u , C u )

temp3=ABS(Ay,Dy)+ABS(Av,Dv)+ABS(Au,Du)temp3=ABS(A y , D y )+ABS(A v ,D v )+ABS(A u ,D u )

temp4=ABS(Dy,By)+ABS(Dv,Bv)+ABS(Du,Bu)temp4=ABS(D y , B y )+ABS(D v , B v )+ABS(D u , B u )

temp5=ABS(Cy,By)+ABS(Cv,Bv)+ABS(Cu,Bu)temp5=ABS(C y , B y )+ABS(C v , B v )+ABS(C u , B u )

temp6=ABS(Cy,Dy)+ABS(Cv,Dv)+ABS(Cu,Du)temp6=ABS(C y , D y )+ABS(C v , D v )+ABS(C u , D u )

MIN(temp1,temp2,temp3,temp4,temp5,temp6)=temp6MIN(temp1, temp2, temp3, temp4, temp5, temp6) = temp6

ABS(Cy,Dy)<THDY4ABS(C y , D y )<THDY4

ABS(Cv,Dv)<THDV4ABS(C v , D v )<THDV4

ABS(Cu,Du)<THDU4ABS(C u ,D u )<THDU4

在步骤120中,当满足下列公式时,判定该2x2编码单元为第十人造类型:In step 120, when the following formula is met, it is determined that the 2x2 coding unit is the tenth artificial type:

temp1=ABS(Ay,By)+ABS(Av,Bv)+ABS(Au,Bu)temp1=ABS(A y , B y )+ABS(A v , B v )+ABS(A u , B u )

temp2=ABS(Ay,Cy)+ABS(Av,Cv)+ABS(Au,Cu)temp2=ABS(A y , C y )+ABS(A v , C v )+ABS(A u , C u )

temp3=ABS(Ay,Dy)+ABS(Av,Dv)+ABS(Au,Du)temp3=ABS(A y , D y )+ABS(A v ,D v )+ABS(A u ,D u )

temp4=ABS(Dy,By)+ABS(Dv,Bv)+ABS(Du,Bu)temp4=ABS(D y , B y )+ABS(D v , B v )+ABS(D u , B u )

temp5=ABS(Cy,By)+ABS(Cv,Bv)+ABS(Cu,Bu)temp5=ABS(C y , B y )+ABS(C v , B v )+ABS(C u , B u )

temp6=ABS(Cy,Dy)+ABS(Cv,Dv)+ABS(Cu,Du)temp6=ABS(C y , D y )+ABS(C v , D v )+ABS(C u , D u )

MIN(temp1,temp2,temp3,temp4,temp5,temp6)=temp2MIN(temp1, temp2, temp3, temp4, temp5, temp6) = temp2

ABS(Ay,Cy)<THDY4ABS(A y , C y )<THDY4

ABS(Av,Cv)<THDV4ABS(A v , C v )<THDV4

ABS(Au,Cu)<THDU4ABS(A u ,C u )<THDU4

在步骤120中,当满足下列公式时,判定该2x2编码单元为第十一人造类型:In step 120, when the following formula is satisfied, it is determined that the 2x2 coding unit is the eleventh artificial type:

temp1=ABS(Ay,By)+ABS(Av,Bv)+ABS(Au,Bu)temp1=ABS(A y , B y )+ABS(A v , B v )+ABS(A u , B u )

temp2=ABS(Ay,Cy)+ABS(Av,Cv)+ABS(Au,Cu)temp2=ABS(A y , C y )+ABS(A v , C v )+ABS(A u , C u )

temp3=ABS(Ay,Dy)+ABS(Av,Dv)+ABS(Au,Du)temp3=ABS(A y , D y )+ABS(A v ,D v )+ABS(A u ,D u )

temp4=ABS(Dy,By)+ABS(Dv,Bv)+ABS(Du,Bu)temp4=ABS(D y , B y )+ABS(D v , B v )+ABS(D u , B u )

temp5=ABS(Cy,By)+ABS(Cv,Bv)+ABS(Cu,Bu)temp5=ABS(C y , B y )+ABS(C v , B v )+ABS(C u , B u )

temp6=ABS(Cy,Dy)+ABS(Cv,Dv)+ABS(Cu,Du)temp6=ABS(C y , D y )+ABS(C v , D v )+ABS(C u , D u )

MIN(temp1,temp2,temp3,temp4,temp5,temp6)=temp4MIN(temp1, temp2, temp3, temp4, temp5, temp6) = temp4

ABS(Dy,By)<THDY4ABS(D y ,B y )<THDY4

ABS(Dv,Bv)<THDV4ABS(D v ,B v )<THDV4

ABS(Du,Bu)<THDU4ABS(D u ,B u )<THDU4

在步骤120中,当满足下列公式时,判定该2x2编码单元为第十二人造类型:In step 120, when the following formula is satisfied, it is determined that the 2x2 coding unit is the twelfth artificial type:

temp1=ABS(Ay,By)+ABS(Av,Bv)+ABS(Au,Bu)temp1=ABS(A y , B y )+ABS(A v , B v )+ABS(A u , B u )

temp2=ABS(Ay,Cy)+ABS(Av,Cv)+ABS(Au,Cu)temp2=ABS(A y , C y )+ABS(A v , C v )+ABS(A u , C u )

temp3=ABS(Ay,Dy)+ABS(Av,Dv)+ABS(Au,Du)temp3=ABS(A y , D y )+ABS(A v ,D v )+ABS(A u ,D u )

temp4=ABS(Dy,By)+ABS(Dv,Bv)+ABS(Du,Bu)temp4=ABS(D y , B y )+ABS(D v , B v )+ABS(D u , B u )

temp5=ABS(Cy,By)+ABS(Cv,Bv)+ABS(Cu,Bu)temp5=ABS(C y , B y )+ABS(C v , B v )+ABS(C u , B u )

temp6=ABS(Cy,Dy)+ABS(Cv,Dv)+ABS(Cu,Du)temp6=ABS(C y , D y )+ABS(C v , D v )+ABS(C u , D u )

MIN(temp1,temp2,temp3,temp4,temp5,temp6)=temp3MIN(temp1, temp2, temp3, temp4, temp5, temp6) = temp3

ABS(Ay,Dy)<THDY4ABS(A y , D y )<THDY4

ABS(Av,Dv)<THDV4ABS(A v , D v )<THDV4

ABS(Au,Du)<THDU4ABS(A u ,D u )<THDU4

在步骤120中,当满足下列公式时,判定该2x2编码单元为第十三人造类型:In step 120, when the following formula is satisfied, it is determined that the 2x2 coding unit is the thirteenth artificial type:

temp1=ABS(Ay,By)+ABS(Av,Bv)+ABS(Au,Bu)temp1=ABS(A y , B y )+ABS(A v , B v )+ABS(A u , B u )

temp2=ABS(Ay,Cy)+ABS(Av,Cv)+ABS(Au,Cu)temp2=ABS(A y , C y )+ABS(A v , C v )+ABS(A u , C u )

temp3=ABS(Ay,Dy)+ABS(Av,Dv)+ABS(Au,Du)temp3=ABS(A y , D y )+ABS(A v ,D v )+ABS(A u ,D u )

temp4=ABS(Dy,By)+ABS(Dv,Bv)+ABS(Du,Bu)temp4=ABS(D y , B y )+ABS(D v , B v )+ABS(D u , B u )

temp5=ABS(Cy,By)+ABS(Cv,Bv)+ABS(Cu,Bu)temp5=ABS(C y , B y )+ABS(C v , B v )+ABS(C u , B u )

temp6=ABS(Cy,Dy)+ABS(Cv,Dv)+ABS(Cu,Du)temp6=ABS(C y , D y )+ABS(C v , D v )+ABS(C u , D u )

MIN(temp1,temp2,temp3,temp4,temp5,temp6)=temp5MIN(temp1, temp2, temp3, temp4, temp5, temp6) = temp5

ABS(Cy,By)<THDY4ABS(C y ,B y )<THDY4

ABS(Cv,Bv)<THDV4ABS( Cv , Bv )<THDV4

ABS(Cu,Bu)<THDU4ABS(C u ,B u )<THDU4

对于实施例2的自然类型,还可以进行如下划分:将2x 2频率域单元分为第一自然类型或者第二自然类型。For the natural type in Embodiment 2, the following division can also be performed: divide the 2×2 frequency domain unit into the first natural type or the second natural type.

当第一色度2x2频率域单元中的F元素和G元素满足下列公式,When the F element and the G element in the first chroma 2x2 frequency domain unit satisfy the following formula,

MAX(ABS(F,0),ABS(G,0))≤THD1MAX(ABS(F,0),ABS(G,0))≤THD1

并且第二色度2x2频率域单元中的F元素和G元素满足下列公式,And the F element and the G element in the second chroma 2x2 frequency domain unit satisfy the following formula,

MAX(ABS(F,0),ABS(G,0))≤THD2MAX(ABS(F,0),ABS(G,0))≤THD2

则判定所述2x2编码单元为第一自然类型,否则判定所述2x2编码单元为第二自然类型。其中,如前所述,EFGH为YUV经过离散余弦转换后的值,THD1和THD2为门限值。Then it is determined that the 2x2 coding unit is of the first natural type, otherwise it is determined that the 2x2 coding unit is of the second natural type. Wherein, as mentioned above, EFGH is the value of YUV after discrete cosine transformation, and THD1 and THD2 are threshold values.

图15是实施例2采用上述扩展后17种人造类型的2x2编码单元的差分误差编码、量化及查表编码的示意图。Fig. 15 is a schematic diagram of differential error coding, quantization and table look-up coding using the above-mentioned 17 artificial types of 2x2 coding units after the expansion in Embodiment 2.

在步骤S130中,当该2x2编码单元220为第一人造类型、第二人造类型和第三人造类型中的一个时,空白方块表示的像素并且有双箭头符号表示两像素取平均值,仅记录一次平均值,斜杠表示的像素(未满6位的像素,如4位、5位),仅记录与其余像素的差值,使用前述中的查表方法,即使用5位记录一5位表格位置,该5位表格位置的记录内容为:该5位表格的所有记录内容中,与该2x2编码单元中另外两像素的平均值和前述的使用6位所记录的两像素的平均值的差值相差最小者。例如,如图16所示的2x2编码单元,仅记录:(63+63)/2=63(使用6位记录)与差值(62+62)/2-(63+63)/2=-1(使用一5位表格记录)。In step S130, when the 2x2 coding unit 220 is one of the first man-made type, the second man-made type and the third man-made type, the pixel represented by a blank square and the double arrow symbol indicates that two pixels are averaged, and only the For an average value, the pixels indicated by the slash (pixels less than 6 bits, such as 4 bits, 5 bits), only record the difference with the rest of the pixels, use the aforementioned table lookup method, that is, use 5 bits to record one 5 bits Table position, the record content of the 5-bit table position is: among all the record contents of the 5-bit table, the average value of the other two pixels in the 2x2 coding unit and the average value of the aforementioned two pixels recorded using 6 bits The one with the smallest difference. For example, the 2x2 coding unit shown in Figure 16 only records: (63+63)/2=63 (using 6-bit recording) and the difference (62+62)/2-(63+63)/2=- 1 (recorded using a 5-digit form).

在步骤S130中,当该2x2编码单元220为第四人造类型至第七人造类型中的一个时,将三个相近似的像素颜色数值取平均值,并使用6位进行记录,将不相似的像素的颜色数值进行量化运算(图中反斜杠表示量化运算)。例如,参照图17先将像素B的颜色数值(23)、像素C的颜色数值(25)和像素D的颜色数值(24)相加再除以3得到24,再四舍五入获得24,使用6位记录数值24。将像素A的颜色数值(7)进行量化运算,再四舍五入小数部分获得数值2,使用4位记录数值2。当像素A的颜色为绿色时,使用5位记录数值4。该量化运算通过前述的量化公式计算,此处不再赘述。In step S130, when the 2x2 encoding unit 220 is one of the fourth artificial type to the seventh artificial type, average the three similar pixel color values, and use 6 bits for recording, and dissimilar The color value of the pixel is quantized (the backslash in the figure indicates the quantized operation). For example, referring to Figure 17, first add the color value of pixel B (23), the color value of pixel C (25) and the color value of pixel D (24), divide by 3 to get 24, and then round up to get 24, using 6 bits Record the value 24. Quantize the color value (7) of pixel A, and then round off the decimal part to obtain the value 2, and use 4 bits to record the value 2. When the color of pixel A is green, the value 4 is recorded using 5 bits. The quantization operation is calculated by the aforementioned quantization formula, which will not be repeated here.

在步骤S130中,当该2x2编码单元220为第八人造类型至第十三人造类型中的一个时,将两个相近似像素颜色数值取平均值,并进行量化运算,并使用5位(或者4位)进行记录,其余两个像素颜色数值分别直接进行量化运算并分别使用3位进行记录。例如,参照图18先将像素B的颜色数值(21)和像素D的颜色数值(23)相加再除以2得到22,对22进行量化运算得到round(22/2)=11,使用5位(或者4位)记录数值11;将像素A的颜色数值(7)进行量化运算,再四舍五入小数部分获得数值1,使用3位记录数值1;将像素C的颜色数值(40)进行量化运算,再四舍五入小数部分获得数值5,使用3位记录数值5。In step S130, when the 2x2 encoding unit 220 is one of the eighth artificial type to the thirteenth artificial type, two similar pixel color values are averaged, and quantized, and use 5 bits (or 4 bits) for recording, and the other two pixel color values are directly quantized and recorded using 3 bits respectively. For example, with reference to Figure 18, the color value (21) of pixel B and the color value (23) of pixel D are added together and then divided by 2 to obtain 22, and the quantization operation is performed on 22 to obtain round(22/2)=11, use 5 1 bit (or 4 bits) to record the value 11; quantize the color value (7) of pixel A, and then round the decimal part to obtain the value 1, use 3 bits to record the value 1; quantize the color value (40) of pixel C , and then round the decimal part to obtain the value 5, and use 3 digits to record the value 5.

在步骤S130中,当该2x2编码单元220为第十四人造类型至第十七人造类型中的一个时,从上述关于第十四人造类型至第十七人造类型的公式可知,所谓单通道即像素仅有红(R)、绿(G)、蓝(B)或者灰度(grayl evel)数据,所以该数据仅有RGB的24位三通道数据的1/3,因此可以使用6位对该数据进行完整的记录。In step S130, when the 2x2 encoding unit 220 is one of the fourteenth artificial type to the seventeenth artificial type, it can be known from the above formulas about the fourteenth artificial type to the seventeenth artificial type that the so-called single channel is Pixels only have red (R), green (G), blue (B) or grayscale (grayle level) data, so this data is only 1/3 of the 24-bit three-channel data of RGB, so 6 bits can be used for this The data is fully recorded.

对于上述2种自然类型的划分方式,请参照图19,其中反斜杠表示量化操作,斜杠表示查表操作。For the division methods of the above two natural types, please refer to Figure 19, where a backslash indicates a quantization operation, and a slash indicates a table lookup operation.

其中,量化操作采用公式:Among them, the quantization operation adopts the formula:

xx QQ == RoundRound (( xx QQ ))

其中Q为已知的量化因子,Round为四舍五入函数,记录量化后的值xQWhere Q is a known quantization factor, Round is a rounding function, and the quantized value x Q is recorded.

例如,用5位记录0~63,则Q=64/(25)=2。For example, if 5 bits are used to record 0 to 63, then Q=64/(2 5 )=2.

关于查表操作,例如参照图20,3位表格内共有23=8个记录值,若该元素值最接近表格里的第j个值,则记录“j”,“j”值可依下列公式计算:Regarding the look-up table operation, for example, with reference to Fig. 20, there are 2 3 =8 record values in the 3-bit table, if the element value is the closest to the jth value in the table, then record "j", and the value of "j" can be as follows Formula calculation:

[a1,a2,a3,...,ak-2,ak-1,ak],[a 1 , a 2 , a 3 ,..., a k-2 , a k-1 , a k ],

sign[F-aj]·sign[aj+1-F]≥0,            (2)sign[ Faj ]·sign[aj +1 -F]≥0, (2)

其中a1~ak为该3位的表格内共记录的8个值,其由小至大依序排列。sign为输出该值的正负号的函数,F为欲查表的值,一旦满足公式(2)时,即储存j值。Wherein, a 1 to a k are 8 values recorded in the 3-digit table, which are arranged in order from small to large. sign is a function that outputs the sign of the value, and F is the value to be looked up in the table. Once the formula (2) is satisfied, the j value is stored.

当在步骤S120中,判定该2x2编码单元220不为第一人造类型至第十七人造类型中的一个时,表示该2x2编码单元220为自然类型,故在步骤S140中,对该自然类型的2x2编码单元220进行色域转换,以得到一2x2色域转换单元。When in step S120, it is determined that the 2x2 encoding unit 220 is not one of the first artificial type to the seventeenth artificial type, it means that the 2x2 encoding unit 220 is a natural type, so in step S140, the natural type The 2x2 encoding unit 220 performs color gamut conversion to obtain a 2x2 color gamut conversion unit.

在步骤S140中,该明亮度2x2色域转换单元710中的元素的值的范围为0~63,该第一色度2x2色域转换单元720和第二色度2x2色域转换单元730的元素的值的范围为-63~63,故该明亮度2x2色域转换单元710的元素为6位,该第一色度2x2色域转换单元720和第二色度2x2色域转换单元730的元素为7位,而此仅为计算过程,并不影响最后编码的位计数。在进行下一步骤S150前,需先将该明亮度2x2色域转换单元710的元素的值由0~63移位至-32~31。In step S140, the values of the elements in the brightness 2x2 color gamut conversion unit 710 range from 0 to 63, and the elements of the first chroma 2x2 color gamut conversion unit 720 and the second chroma 2x2 color gamut conversion unit 730 The range of values is -63 to 63, so the elements of the brightness 2x2 color gamut conversion unit 710 are 6 bits, and the elements of the first chroma 2x2 color gamut conversion unit 720 and the second chroma 2x2 color gamut conversion unit 730 is 7 bits, and this is only a calculation process, which does not affect the final coded bit count. Before proceeding to the next step S150 , the values of the elements of the brightness 2×2 color gamut conversion unit 710 need to be shifted from 0˜63 to −32˜31.

在步骤S150中,该明亮度2x2频率域单元760中的各元素的值的范围为-32~31,该第一色度2x2频率域单元770和第二色度2x2频率域单元780的各元素的值的范围为-63~63,故该明亮度2x2频率域单元760的各元素为6位,该第一色度2x2频率域单元770和第二色度2x2频率域单元780的各元素为7位,而此仅为计算过程,并不影响最后编码的位计数。In step S150, the value of each element in the brightness 2x2 frequency domain unit 760 ranges from -32 to 31, each element of the first chroma 2x2 frequency domain unit 770 and the second chroma 2x2 frequency domain unit 780 The range of values is -63 to 63, so each element of the brightness 2x2 frequency domain unit 760 is 6 bits, each element of the first chroma 2x2 frequency domain unit 770 and the second chroma 2x2 frequency domain unit 780 is 7 bits, and this is only a calculation process and does not affect the final encoded bit count.

在步骤S170中,当该2x2频率域单元750为第一自然类型380时,使用5位记录该明亮度2x2频率域单元760的E元素、F元素、G元素;使用3位记录一3位表格位置,该3位表格位置的记录内容为:该3位表格的所有记录内容中,与该明亮度2x2频率域单元760的H元素的值的差值最小者。In step S170, when the 2x2 frequency domain unit 750 is the first natural type 380, use 5 bits to record the E element, F element, and G element of the brightness 2x2 frequency domain unit 760; use 3 bits to record a 3-bit table position, the record content of the position of the 3-bit table is: among all the record contents of the 3-bit table, the value of the H element of the brightness 2×2 frequency domain unit 760 has the smallest difference.

该明亮度2x2频率域单元760的元素的值为-32~31,故需先进行移位运算,以将该明亮度2x2频率域单元760的元素的值由-32~31移位至0~63。在步骤S170中,是将E元素、F元素、G元素的数值进行量化运算,针对小数部分四舍五入,再使用5位记录。由于该明亮度2x2频率域单元760的E元素、F元素、G元素的数值为6位,当使用5位记录时,因此量化因子Q为2。该明亮度2x2频率域单元760的H元素则使用一3位表格以进行查表操作,该查表操作的原理与前述5位表格查表相同,不再赘述。The values of the elements of the brightness 2x2 frequency domain unit 760 are -32~31, so a shift operation needs to be performed first to shift the values of the elements of the brightness 2x2 frequency domain unit 760 from -32~31 to 0~ 63. In step S170, quantize the values of the E element, F element, and G element, round off the decimal part, and then use 5 bits to record. Since the value of the E element, F element, and G element of the brightness 2x2 frequency domain unit 760 is 6 bits, when 5 bits are used for recording, the quantization factor Q is 2. The H element of the brightness 2×2 frequency domain unit 760 uses a 3-bit table for table lookup operation. The principle of the table lookup operation is the same as that of the aforementioned 5-bit table lookup table, and will not be repeated here.

在步骤S170中,当该2x2频率域单元750为第一自然类型380时,使用5位记录该第一色度2x2频率域单元770的E元素;使用2位记录一2位表格位置,该2位表格位置的记录内容为:该2位表格的所有记录内容中,与该第一色度2x2频率域单元770的F元素和G元素的平均值的差值中的最小者;不记录该第一色度2x2频率域单元770的H元素。In step S170, when the 2x2 frequency domain unit 750 is the first natural type 380, use 5 bits to record the E element of the first chroma 2x2 frequency domain unit 770; use 2 bits to record a 2-bit table position, the 2 The record content of the bit table position is: among all the record contents of the 2-bit table, the smallest difference between the average value of the F element and the G element of the first chroma 2x2 frequency domain unit 770; An H element of the chroma 2x2 frequency domain unit 770 .

该第一色度2x2频率域单元770的元素的值为-63~63,故需先进行一移位运算,以将该第一色度2x2频率域单元770的元素的值由-63~63移位至0~126。因此该第一色度2x2频率域单元770的元素为7位,当使用5位记录该第一色度2x2频率域单元770的E元素时,需先进行量化运算,其中,量化因子Q为4。The value of the elements of the first chroma 2x2 frequency domain unit 770 is -63 to 63, so a shift operation needs to be performed first to change the value of the elements of the first chroma 2x2 frequency domain unit 770 from -63 to 63 Shift to 0~126. Therefore, the element of the first chroma 2x2 frequency domain unit 770 is 7 bits. When using 5 bits to record the E element of the first chroma 2x2 frequency domain unit 770, a quantization operation must be performed first, wherein the quantization factor Q is 4 .

其是将该第一色度2x2频率域单元770的F元素和G元素先取平均值,再用该平均值对一2位表格查表,该查表操作的原理与前述5位表格查表相同,不再赘述。It is to take the average value of the F element and G element of the first chroma 2x2 frequency domain unit 770, and then use the average value to look up a 2-bit table. The principle of the table lookup operation is the same as the aforementioned 5-bit table lookup. ,No longer.

在步骤S170中,当该2x2频率域单元750为第一自然类型380时,使用5位记录该第二色度2x2频率域单元780的E元素的量化值;使用2位记录一2位表格位置,该2位表格位置的记录内容为:该2位表格的所有记录内容中,与该第二色度2x2频率域单元780中的F元素和G元素的平均值的差值中的最小者;使用2位记录一2位表格位置,该2位表格位置的记录内容为:该2位表格的所有记录内容中,与该第二色度2x2频率域单元780的H元素的值的差值中的最小者。In step S170, when the 2x2 frequency domain unit 750 is the first natural type 380, use 5 bits to record the quantized value of the E element of the second chroma 2x2 frequency domain unit 780; use 2 bits to record a 2-bit table position , the record content of the position of the 2-bit table is: among all the record contents of the 2-bit table, the smallest difference between the average value of the F element and the G element in the second chroma 2x2 frequency domain unit 780; Use 2 bits to record a 2-bit table position, the record content of the 2-bit table position is: among all the recorded contents of the 2-bit table, and the difference between the value of the H element of the second chroma 2x2 frequency domain unit 780 the smallest.

该第二色度2x2频率域单元780的元素的值为-63~63,故需先进行一移位运算,以将该第二色度2x2频率域单元780的元素的值由-63~63移位至0~126。因此该第二色度2x2频率域单元780的元素为7位,当使用5位记录该第二色度2x2频率域单元780的E元素时,需先进行量化运算,其中,量化因子Q为4。The values of the elements of the second chroma 2x2 frequency domain unit 780 are -63 to 63, so a shift operation needs to be performed first to change the values of the elements of the second chroma 2x2 frequency domain unit 780 from -63 to 63 Shift to 0~126. Therefore, the element of the second chroma 2x2 frequency domain unit 780 is 7 bits. When using 5 bits to record the E element of the second chroma 2x2 frequency domain unit 780, a quantization operation must be performed first, wherein the quantization factor Q is 4 .

其是将该第二色度2x2频率域单元780的F元素和G元素先取平均值,再用该平均值对一2位表格查表。该2位表格查表的原理与前述5位表格查表相同,不再赘述。It first takes the average value of the F element and the G element of the second chroma 2x2 frequency domain unit 780, and then uses the average value to look up a 2-bit table. The principle of the 2-digit table lookup is the same as that of the aforementioned 5-digit table lookup, and will not be repeated here.

在步骤S170中,当该2x2频率域单元750为第二自然类型390时,使用4位记录明亮度2x2频率域单元760的E元素的量化值;使用3位记录一3位表格位置,该3位表格位置的记录内容为:该3位表格的所有记录内容中,与该明亮度2x2频率域单元760的F元素的值的差值中的最小者;使用3位记录一3位表格位置,该3位表格位置的记录内容为:该3位表格的所有记录内容中,与该明亮度2x2频率域单元760的G元素的值的差值中的最小者;使用2位记录一2位表格位置,该2位表格位置的记录内容为:该2位表格的所有记录内容中,与该明亮度2x2频率域单元760的H元素的值的差值中的最小者。该等量化因子Q及查表操作为熟悉该技术人员根据本发明技术所能得知的,不再赘述。In step S170, when the 2x2 frequency domain unit 750 is the second natural type 390, use 4 bits to record the quantized value of the E element of the brightness 2x2 frequency domain unit 760; use 3 bits to record a 3-bit table position, the 3 The record content of the bit table position is: among all the record contents of the 3-bit table, the minimum value of the difference with the value of the F element of the brightness 2x2 frequency domain unit 760; use 3-bit record-3-bit table position, The record content of the position of the 3-bit table is: among all the recorded contents of the 3-bit table, the minimum value difference with the value of the G element of the brightness 2x2 frequency domain unit 760; use 2 bits to record a 2-bit table position, the record content of the position of the 2-bit table is: among all the record contents of the 2-bit table, the smallest difference between the value of the H element of the brightness 2x2 frequency domain unit 760 . The quantization factor Q and the table lookup operation are known by those skilled in the art according to the technology of the present invention, and will not be repeated here.

在步骤S170中,当该2x2频率域单元750为第二自然类型390时,使用3位记录该第一色度2x2频率域单元770的E元素的量化值;使用3位记录一3位表格位置,该3位表格位置的记录内容为:该3位表格的所有记录内容中,与该第一色度2x2频率域单元770的F元素的值的差值中的最小者;使用3位记录一3位表格位置,该3位表格位置的记录内容为:该3位表格的所有记录内容中,与该第一色度2x2频率域单元770的G元素的值的差值中的最小者;使用2位记录一2位表格位置,该2位表格位置的记录内容为:该2位表格的所有记录内容中,与该第一色度2x2频率域单元760的H元素的值的差值中的最小者。In step S170, when the 2x2 frequency domain unit 750 is the second natural type 390, use 3 bits to record the quantized value of the E element of the first chroma 2x2 frequency domain unit 770; use 3 bits to record a 3-bit table position , the record content of the position of the 3-bit table is: among all the record contents of the 3-bit table, the minimum value difference with the value of the F element of the first chroma 2x2 frequency domain unit 770; use 3 bits to record a 3-bit table position, the record content of the 3-bit table position is: among all the record contents of the 3-bit table, the smallest difference with the value of the G element of the first chroma 2x2 frequency domain unit 770; use 2-bit records a 2-bit table position, and the record content of the 2-bit table position is: among all the recorded contents of the 2-bit table, the difference between the value of the H element of the first chroma 2x2 frequency domain unit 760 the smallest.

在步骤S170中,当该2x2频率域单元750为第二自然类型390时,使用3位记录该第二色度2x2频率域单元780的E元素的量化值;使用3位记录一3位表格位置,该3位表格位置的记录内容为:该3位表格的所有记录内容中,与该第二色度2x2频率域单元780的F元素的值的差值中的最小者;使用3位记录一3位表格位置,该3位表格位置的记录内容为:该3位表格的所有记录内容中,与该第二色度2x2频率域单元780的G元素的值的差值中的最小者;使用2记录一2位表格位置,该2位表格位置的记录内容为:该2位表格的所有记录内容中,与该第二色度2x2频率域单元780的H元素的值的差值中的最小者。In step S170, when the 2x2 frequency domain unit 750 is the second natural type 390, use 3 bits to record the quantized value of the E element of the second chroma 2x2 frequency domain unit 780; use 3 bits to record a 3-bit table position , the record content of the position of the 3-bit table is: among all the record contents of the 3-bit table, the smallest difference between the value of the F element of the second chroma 2x2 frequency domain unit 780; use 3 bits to record a 3-bit table position, the record content of the 3-bit table position is: among all the record contents of the 3-bit table, the minimum value of the difference with the value of the G element of the second chroma 2x2 frequency domain unit 780; use 2 Record a 2-bit table position, the record content of the 2-bit table position is: among all the recorded contents of the 2-bit table, the minimum value of the difference with the value of the H element of the second chroma 2x2 frequency domain unit 780 By.

在硬件架构中,可以用OTP(One Time Programable,一次性可编程芯片)、ROM(Read-Only Memory,只读内存)或NVM(Nonvolatile memory,非易失性存储器)记录表格内容。In the hardware architecture, OTP (One Time Programmable, one-time programmable chip), ROM (Read-Only Memory, read-only memory) or NVM (Nonvolatile memory, non-volatile memory) can be used to record the table content.

如图15和图19所示,步骤S180使用1位(主封包标头)以记录该2x2编码单元220是否为人造类型或是自然类型,再使用4位(第一子封包标头)以记录该2x2编码单元220是否为第一人造类型至第十七人造类型中的一个。因此,当该2x2编码单元220为第一人造类型、第二人造类型、第三人造类型中的一个时,其编码及封装后的位计数为36位(=1+4+6+4+6+5+6+4),当该2x2编码单元220为第四至第七人造类型中的一个时,其编码及封装后的位计数仍为36位(=1+4+6+4+6+5+6+4),当该2x2编码单元220为第八至第十三人造类型中的一个时,其编码及封装后的位计数为36位(=1+4+4+3+3+5+3+3+4+3+3),当该2x2编码单元220为第十四至第十七人造类型中的一个时,其编码及封装后的位计数为31位(=1+4+2+6+6+6+6)。当该2x2编码单元220为自然类型时,再使用1位(第二子封包标头)以记录该2x2编码单元220是否为第一自然类型或者第二自然类型,当该2x2编码单元220为第一自然类型时,其编码及封装后的位计数仍为36位(=1+1+5+5+5+3+5+2+2+5+2),当该2x2编码单元220为第二自然类型时,其编码及封装后的位计数仍为36位(=1+1+4+3+3+2+3+3+3+2+3+3+3+2)。As shown in Figures 15 and 19, step S180 uses 1 bit (the main packet header) to record whether the 2x2 encoding unit 220 is a man-made type or a natural type, and then uses 4 bits (the first sub-packet header) to record Whether the 2x2 encoding unit 220 is one of the first artificial type to the seventeenth artificial type. Therefore, when the 2x2 encoding unit 220 is one of the first artificial type, the second artificial type, and the third artificial type, the bit count after its encoding and packaging is 36 bits (=1+4+6+4+6 +5+6+4), when the 2x2 encoding unit 220 is one of the fourth to seventh artificial types, the bit count after its encoding and packaging is still 36 bits (=1+4+6+4+6 +5+6+4), when the 2x2 encoding unit 220 is one of the eighth to the thirteenth man-made types, the bit count after its encoding and packaging is 36 bits (=1+4+4+3+3 +5+3+3+4+3+3), when the 2x2 coding unit 220 is one of the fourteenth to seventeenth man-made types, the bit count after its coding and packaging is 31 bits (=1+ 4+2+6+6+6+6). When the 2x2 encoding unit 220 is a natural type, then use 1 bit (the second subpacket header) to record whether the 2x2 encoding unit 220 is the first natural type or the second natural type, when the 2x2 encoding unit 220 is the second natural type When a natural type, the bit count after its encoding and packaging is still 36 bits (=1+1+5+5+5+3+5+2+2+5+2), when the 2x2 encoding unit 220 is the first In the case of two natural types, the bit count after encoding and packaging is still 36 bits (=1+1+4+3+3+2+3+3+3+2+3+3+3+2).

图21是本发明一种基于2x2编码单元的固定压缩率影像解压缩方法的流程图,其是对一固定位大小的编码封包进行解码,以产生一张影像中的一个2x2解码单元,该2x2解码单元包含呈矩阵排列的四个像素,该影像有至少一个2x2解码单元。Fig. 21 is a flow chart of a fixed compression rate image decompression method based on 2x2 coding units according to the present invention, which decodes a fixed-bit-size coded packet to generate a 2x2 decoding unit in an image, the 2x2 The decoding unit includes four pixels arranged in a matrix, and the image has at least one 2×2 decoding unit.

首先,在步骤S805中,接收一个编码封包。First, in step S805, an encoded packet is received.

在步骤S810中,根据该编码封包的主封包标头(1 bit)判断该编码封包是否为人造类型,若是,则判定该编码封包为人造类型的编码封包,否则,判定该编码封包为自然类型的编码封包。In step S810, judge whether this coded packet is artificial type according to the main packet header (1 bit) of this encoded packet, if so, then determine that this encoded packet is an artificial type encoded packet, otherwise, determine that this encoded packet is a natural type encoded packets.

在步骤S815中,对判定为人造类型的编码封包,再根据该编码封包的第一子封包标头(2 bit)判断其是否为第一人造类型至第三人造类型中的一个,其中,第一人造类型为四个像素呈水平方向的两横条纹,第二人造类型为四个像素呈竖直方向的两纵条纹,第三人造类型为四个像素呈45度角方向的两斜条纹交叉。In step S815, judge whether it is one of the first artificial type to the third artificial type according to the first sub-packet header (2 bit) of the encoded packet for the encoded packet determined to be an artificial type, wherein, the first artificial type One artificial type is two horizontal stripes with four pixels in the horizontal direction, the second artificial type is two vertical stripes with four pixels in the vertical direction, and the third artificial type is two oblique stripes with four pixels in the direction of 45 degrees. .

在步骤S820中,对判定为人造类型而且并非为第一人造类型至第三人造类型的编码封包,再根据该编码封包的子封包标头(2 bit)及次子封包标头(2bit)判断其是否为第四人造类型至第七人造类型中的一个。其中,第四人造类型至第七人造类型为四个像素呈三角形与单点的组合;第四人造类型为左下角像素、右上角像素和右下角像素近似;第五人造类型为左上角像素、右上角像素和右下角像素近似;第六人造类型为左上角像素、左下角像素和右上角像素近似;第七人造类型为左上角像素、左下角像素和右下角像素近似。In step S820, for the coded packets that are judged to be man-made types and are not the first man-made type to the third man-made type, judge according to the sub-packet header (2 bit) and the second sub-packet header (2 bit) of the coded pack Whether it is one of the fourth to seventh artificial types. Among them, the fourth artificial type to the seventh artificial type is a combination of four pixels in a triangle and a single point; the fourth artificial type is a pixel in the lower left corner, a pixel in the upper right corner, and a pixel in the lower right corner; the fifth artificial type is a pixel in the upper left corner, The upper right pixel and the lower right pixel are approximated; the sixth artificial type is the upper left pixel, the lower left pixel and the upper right pixel are approximated; the seventh artificial type is the upper left pixel, the lower left pixel and the lower right pixel are approximated.

在步骤S825中,对该人造类型的编码封包进行反量化、反查表解码及反差分误差解码,以产生一第一解码数据。In step S825, inverse quantization, inverse look-up table decoding, and inverse differential error decoding are performed on the artificial type encoded packet to generate a first decoded data.

在步骤S830中,对自然类型的编码封包,再根据该编码封包的第二子封包标头(1 bit),判断其为第一自然类型或者第二自然类型。In step S830, for the encoded packet of the natural type, it is judged to be the first natural type or the second natural type according to the second subpacket header (1 bit) of the encoded packet.

在步骤S835中,对该自然类型的编码封包进行反量化及反查表解码,以产生一第二解码数据;In step S835, inverse quantization and inverse table lookup decoding are performed on the encoded packet of the natural type to generate a second decoded data;

在步骤S840中,对该第二解码数据进行离散余弦转换,以产生一第三解码数据。在步骤S840中,该离散余弦转换的转换矩阵系数为:In step S840, a discrete cosine transform is performed on the second decoded data to generate a third decoded data. In step S840, the transformation matrix coefficients of the discrete cosine transformation are:

AA &OverBar;&OverBar; BB &OverBar;&OverBar; CC &OverBar;&OverBar; DD. &OverBar;&OverBar; 11 11 11 11 11 -- 11 11 -- 11 11 11 -- 11 -- 11 11 -- 11 -- 11 11 EE. Ff GG Hh ..

其中,E、F、G、H为该第二解码数据,为该第三解码数据。Wherein, E, F, G, H are the second decoded data, for the third decoded data.

在步骤S845中,对该第三解码数据进行色域转换,以得到一第四解码数据。在步骤S845中,进行YUV至RGB色域转换,该YUV至RGB色域转换的转换矩阵系数为:In step S845, color gamut conversion is performed on the third decoded data to obtain a fourth decoded data. In step S845, YUV to RGB color gamut conversion is carried out, and the conversion matrix coefficient of this YUV to RGB color gamut conversion is:

rr gg bb == 1.01.0 -- 0.50.5 -- 0.50.5 1.01.0 0.50.5 00 1.01.0 -- 0.50.5 0.50.5 YY Uu VV ,,

其中,Y为该第三解码数据中的像素的明亮度,U和V为该像素的色度,r为该第四解码数据中的像素的红色值,g为该像素的绿色值,b为该像素的蓝色值。Wherein, Y is the brightness of the pixel in the third decoded data, U and V are the chroma of the pixel, r is the red value of the pixel in the fourth decoded data, g is the green value of the pixel, and b is The blue value of this pixel.

在步骤S850中,接收该第一解码数据或者该第四解码数据,并对该第一解码数据或者第四解码数据进行重建,以产生一个2x2解码单元。In step S850, the first decoded data or the fourth decoded data is received, and the first decoded data or the fourth decoded data is reconstructed to generate a 2x2 decoding unit.

图22是本发明一种应用基于2x2编码单元的固定压缩率的显示系统的结构图,其用于对显示影像进行压缩及解压缩,该显示系统900包含一显示模块910、一影像输入设备920、一基于2x2编码单元的固定压缩率影像压缩装置930、一暂存装置940、一基于2x2编码单元的固定压缩率影像解压缩装置950、一时序控制器960、多个源极驱动器970和多个栅极驱动器980。FIG. 22 is a structural diagram of a display system applying a fixed compression rate based on 2x2 coding units according to the present invention, which is used to compress and decompress display images. The display system 900 includes a display module 910 and an image input device 920 , a fixed compression rate image compression device 930 based on 2x2 coding units, a temporary storage device 940, a fixed compression rate image decompression device 950 based on 2x2 coding units, a timing controller 960, multiple source drivers 970 and multiple A gate driver 980.

显示模块910用于显示影像。影像输入设备920用于输入显示影像。基于2x2编码单元的固定压缩率影像压缩装置930连接至影像输入设备920,用于将显示影像的一个2x2编码单元进行编码,以产生与该2x2编码单元对应的编码封包,其中,该影像具有至少一个2x2编码单元。The display module 910 is used for displaying images. The image input device 920 is used for inputting and displaying images. The fixed compression rate image compression device 930 based on a 2x2 coding unit is connected to the image input device 920, and is used for encoding a 2x2 coding unit of a display image to generate a coded packet corresponding to the 2x2 coding unit, wherein the image has at least A 2x2 code unit.

暂存装置940连接至基于2x2编码单元的固定压缩率影像压缩装置930,以暂存基于2x2编码单元的固定压缩率影像压缩装置930输出的编码封包。The temporary storage device 940 is connected to the 2x2 CU-based fixed compression rate image compression device 930 to temporarily store the encoded packets output by the 2x2 CU-based fixed compression rate image compression device 930 .

基于2x2编码单元的固定压缩率影像解压缩装置950连接至暂存装置940,以接收编码封包,并对该编码封包解压缩,以产生与2x2编码单元对应的2x2解码单元。The fixed compression ratio image decompression device 950 based on 2x2 coding units is connected to the temporary storage device 940 to receive the encoded packets and decompress the encoded packets to generate 2x2 decoding units corresponding to the 2x2 coding units.

时序控制器960连接至基于2x2编码单元的固定压缩率影像解压缩装置950,用于接收2x2解码单元,以产生显示模块910的时序驱动信号及显示数据。The timing controller 960 is connected to the fixed compression ratio image decompression device 950 based on 2x2 coding units, and is used for receiving 2x2 decoding units to generate timing driving signals and display data of the display module 910 .

多个源极驱动器970及多个栅极驱动器980连接至时序控制器960,用于接收该时序控制器960输出的时序驱动信号和显示数据,进而驱动显示模块910。A plurality of source drivers 970 and a plurality of gate drivers 980 are connected to the timing controller 960 for receiving timing driving signals and display data output by the timing controller 960 , and then driving the display module 910 .

固定压缩率影像压缩装置930是先判断2x2编码单元为人造类型或者自然类型,以对人造类型的2x2编码单元进行差分误差编码、量化及查表编码,进而产生第一编码数据,以及对自然类型的2x2编码单元进行色域转换、离散余弦转换、量化及查表编码,进而产生第二编码数据,再对该第一编码数据或者该第二编码数据进行封装,以产生固定压缩率的编码封包。其中,该2x2编码单元为96(24bit version)位或者72(18bit version)位,与该2x2编码单元对应的该编码封包为48(24bit version)位或者36位(18bitversion)。The fixed compression rate image compression device 930 first determines whether the 2x2 coding unit is artificial or natural, and performs differential error coding, quantization, and table look-up coding on the artificial 2x2 coding unit to generate the first coded data, and the natural type The 2x2 coding unit performs color gamut conversion, discrete cosine transformation, quantization and table look-up coding, and then generates the second coded data, and then encapsulates the first coded data or the second coded data to generate a coded packet with a fixed compression rate . Wherein, the 2x2 encoding unit is 96 (24bit version) bits or 72 (18bit version) bits, and the encoding packet corresponding to the 2x2 encoding unit is 48 (24bit version) bits or 36 bits (18bit version).

由前述说明可知,本发明以2x2的像素尺寸作为编码单元,借着适当的分类与位数量适当的分配,以人眼视觉响应为前提,适当地舍弃较不敏感的成分,来达成影像压缩与维持影像质量。It can be known from the foregoing description that the present invention uses a pixel size of 2x2 as a coding unit, and achieves image compression and Maintain image quality.

上述编码单元分类时,人造类型的分类有助于处理如字体边缘、灰阶变化、锯齿、棋盘格等特定图样,配合本发明的封包记录方法,可使特定人造类型的编码单元达成无损压缩。When the above encoding units are classified, the classification of artificial types helps to deal with specific patterns such as font edges, gray scale changes, jagged, checkerboard patterns, etc., and with the packet recording method of the present invention, lossless compression can be achieved for specific artificial types of encoding units.

在自然类型中,在步骤S140色域转换后的YUV,以UV成份对于人眼的响应敏感较低,故在封包记录时,舍弃或者以较少的位计数记录对应的频域元素。同时,离散余弦转换后的元素为频域,高频元素对于人眼的响应敏感较低,以较少的位计数记录高频元素,以保留对于人眼的响应较敏感的信息。In the natural type, the UV component of the YUV after the color gamut conversion in step S140 is less sensitive to human eyes, so the corresponding frequency domain elements are discarded or recorded with less bit count during packet recording. At the same time, the elements after discrete cosine transformation are in the frequency domain, and the high-frequency elements are less sensitive to the response of the human eye, and the high-frequency elements are recorded with fewer bit counts to retain information that is more sensitive to the response of the human eye.

同时,步骤S140、步骤S150、步骤S840、步骤S850中的色域转换或者离散余弦转换,其转换矩阵的系数为±1、0.25、±0.5在硬件实现时,可简易地使用移位器(shifter)以取代乘法器,以节省硬件成本。Simultaneously, step S140, step S150, step S840, step S850 color gamut conversion or discrete cosine conversion, the coefficient of its conversion matrix is ±1,0.25,±0.5 when hardware realizes, can use shifter (shifter ) to replace the multiplier to save hardware cost.

另外,本发明技术在针对手机应用时,手机的一般人造灰阶与棋盘格等测试图样可达无损压缩和解压缩效果,同时可节省手机上储存影像的内存需求量。且各2x2编码单元在压缩或解压缩时均独立操作,无需参考其他2x2编码单元,且每一个编码单元的压缩率均固定为0.5(=36/72)或者0.5(=48/96),无需参照任何先前封包、像素、图框(frame)等数据,可实时压缩与解压缩,即单笔编码单元进入,即可完成单笔编码封包。同理,单笔编码封包进入,即可解压缩还原成单笔解码单元,特别适合随机存取(randomaccess)的特殊应用,如手机显示用内存部份画面更新(partially update)。In addition, when the technology of the present invention is applied to mobile phones, test patterns such as general artificial gray scales and checkerboard patterns of mobile phones can achieve lossless compression and decompression effects, and at the same time can save memory requirements for storing images on mobile phones. And each 2x2 coding unit operates independently when compressing or decompressing, without referring to other 2x2 coding units, and the compression rate of each coding unit is fixed at 0.5 (=36/72) or 0.5 (=48/96), no need Real-time compression and decompression can be performed by referring to any previous packet, pixel, frame, etc., that is, a single encoding unit can be entered to complete a single encoding package. Similarly, once a single encoded packet enters, it can be decompressed and restored to a single decoding unit, which is especially suitable for special applications of random access, such as partial update of mobile phone display memory.

由上述可知,本发明无论就目的、手段及效果,均与现有技术特征所不同,极具实用价值。需要注意的是,上述各实施例仅是为了便于说明而举例而已,本发明所要求保护的权利范围应以权利要求书范围为准,而非仅限于上述实施例。From the above, it can be known that the present invention is different from the prior art in terms of purpose, means and effect, and has great practical value. It should be noted that the above-mentioned embodiments are only examples for the convenience of description, and the scope of rights claimed in the present invention should be based on the scope of the claims, rather than limited to the above-mentioned embodiments.

以上所述仅为本发明的较佳实施例而已,并不用以限制本发明,凡在本发明的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本发明保护的范围之内。The above descriptions are only preferred embodiments of the present invention, and are not intended to limit the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention shall be included in the present invention. within the scope of protection.

Claims (76)

1. the image compressing method with fixing compression ratio based on 2x2 coding unit, is characterized in that: the 2x2 coding unit in image is encoded, and described image is made up of at least one 2x2 coding unit, and described image compressing method comprises the following steps:
(A) receive 2x2 coding unit, described 2x2 coding unit comprises the top left corner pixel, upper right corner pixel, lower left corner pixel and the lower right corner pixel that are matrix arrangement, and the each pixel in described 2x2 coding unit has red value, green numerical value and blue values;
(B) judge whether described 2x2 coding unit is artificial type, if, judge that this 2x2 coding unit is as this artificial type, otherwise, judge that this 2x2 coding unit is natural type, wherein, described artificial type comprises: the first artificial type, represents these four pixels two horizontal stripes in horizontal direction; The second artificial type, represents that these four pixels are two vertical stripes of vertical direction; The 3rd artificial type, represents that these four pixels are two slanted bar lines intersections of miter angle direction; The artificial type of the 4th artificial type to the seven, represents the combination with single-point triangular in shape of these four pixels;
(C) to being judged to be the 2x2 coding unit of the artificial type coding that carries out differential errors coding, quantizes and table look-up, to produce first coding data;
(D) the 2x2 coding unit that is judged to be natural type is carried out to RGB to YUV color gamut conversion, to obtain 2x2 gamut conversion unit;
(E) described 2x2 gamut conversion unit is carried out to discrete cosine transform, to produce 2x2 frequency domain unit; And
(F) described 2x2 frequency domain unit is quantized and the coding of tabling look-up, to produce the second coded data;
Described the first artificial type, represents that described top left corner pixel and upper right corner pixel are approximate, and described lower left corner pixel and lower right corner pixel approximate; Described the second artificial type represents that described top left corner pixel and lower left corner pixel are approximate, and described upper right corner pixel and lower right corner pixel approximate; Described the 3rd artificial type, represents that described top left corner pixel and lower right corner pixel are approximate, and described lower left corner pixel and upper right corner pixel approximate; Described the 4th artificial type, represents that described lower left corner pixel, upper right corner pixel and lower right corner pixel are approximate; Described the 5th artificial type, represents that described top left corner pixel, upper right corner pixel and lower right corner pixel are approximate; Described Sixth Man is made type, represents that described top left corner pixel, lower left corner pixel and upper right corner pixel are approximate; Described the 7th artificial type, represents that described top left corner pixel, lower left corner pixel and lower right corner pixel are approximate;
(G) receive described first coding data or the second coded data, and this first coding data or this second coded data are encapsulated, to produce the coding package with fixing compression ratio.
2. image compressing method as claimed in claim 1, it is characterized in that, described artificial type also comprises the 8th artificial type in artificial type~17, wherein: eight, the 9th artificial type, represents these four pixels horizontal stripe in horizontal direction and the combination of two single-points; Ten, the 11 artificial type, represents that these four pixels are the combination of a vertical stripe and two single-points of vertical direction; The the 12, the 13 artificial type, represents that these four pixels are a slanted bar line of miter angle direction and the combination of two single-points;
Described the 8th artificial type, represents that described top left corner pixel and upper right corner pixel are approximate; Described the 9th artificial type, represents that described lower left corner pixel and lower right corner pixel are approximate; Described the tenth artificial type, represents that described top left corner pixel and lower left corner pixel are approximate; Described the 11 artificial type, represents that described upper right corner pixel and lower right corner pixel are approximate; Described the 12 artificial type, represents that described top left corner pixel and lower right corner pixel are approximate; Described the 13 artificial type, represents that described lower left corner pixel and upper right corner pixel are approximate;
In described step (B), in the time meeting following formula, judge that described 2x2 coding unit is as the 14 artificial type:
A r=A g,A g=A b
B r=B g,B g=B b
C r=C g,C g=C b
D r=D g,D g=D b
In described step (B), in the time meeting following formula, judge that described 2x2 coding unit is as the 15 artificial type:
A g=0,A b=0
B g=0,B b=0
C g=0,C b=0
D g=0,D b=0
In described step (B), in the time meeting following formula, judge that described 2x2 coding unit is as the 16 artificial type:
A r=0,A b=0
B r=0,B b=0
C r=0,C b=0
D r=0,D b=0
In described step (B), in the time meeting following formula, judge that described 2x2 coding unit is as the 17 artificial type:
A g=0,A r=0
B g=0,B r=0
C g=0,C r=0
D g=0,D r=0
Wherein, A is described top left corner pixel, and B is described upper right corner pixel, and C is described lower left corner pixel, and D is described lower right corner pixel, A r, A gbe respectively the red value of pixel A, green numerical value and blue values, B r, B gbe respectively the red value of pixel B, green numerical value and blue values, C r, C gbe respectively the red value of pixel C, green numerical value and blue values, D r, D gbe respectively the red value of pixel D, green numerical value and blue values.
3. image compressing method as claimed in claim 1, it is characterized in that: in described step (B), first judge whether described 2x2 coding unit is in the artificial type of the first artificial type to the three, then judge whether described 2x2 coding unit is in the artificial type of the 4th artificial type to the seven.
4. image compressing method as claimed in claim 2, it is characterized in that, in described step (B), first judge whether described 2x2 coding unit is in the 14 to the 17 artificial type, determine whether again in the artificial type of the first artificial type to the three, determine whether again in the artificial type of the 4th artificial type to the seven, then determine whether in the artificial type of the 8th artificial type to the 13.
5. image compressing method as claimed in claim 3, is characterized in that: in described 2x2 coding unit, every kind of color numerical value adopts 8 bit representations.
6. image compressing method as claimed in claim 5, is characterized in that: in described step (B), in the time meeting following formula, judge that described 2x2 coding unit is as the first artificial type:
ABS(A r,B r)<THD1,ABS(C r,D r)<THD1,
ABS(A g,B g)<THD1,ABS(C g,D g)<THD1,
ABS(A b,B b)<THD1,ABS(C b,D b)<THD1,
ABS(A r,B r)+ABS(A g,B g)+ABS(A b,B b)≤
ABS(A r,C r)+ABS(A g,C g)+ABS(A b,C b),
ABS(A r,B r)+ABS(A g,B g)+ABS(A b,B b)≤
ABS(D r,B r)+ABS(D g,B g)+ABS(D b,B b),
ABS(C r,D r)+ABS(C g,D g)+ABS(C b,D b)≤
ABS(D r,B r)+ABS(D g,B g)+ABS(D b,B b),
ABS(C r,D r)+ABS(C g,D g)+ABS(C b,D b)≤
ABS(A r,C r)+ABS(A g,C g)+ABS(A b,C b),
Wherein, THD1 is the first threshold value, and A is described top left corner pixel, and B is described upper right corner pixel, and C is described lower left corner pixel, and D is described lower right corner pixel, A r, A g, A bbe respectively the red value of pixel A, green numerical value and blue values, B r, B g, B bbe respectively the red value of pixel B, green numerical value and blue values, C r, C g, C bbe respectively the red value of pixel C, green numerical value and blue values, D r, D g, D bbe respectively the red value of pixel D, green numerical value and blue values, ABS is the poor absolute value of bracket moderate-element.
7. image compressing method as claimed in claim 5, is characterized in that: in described step (B), in the time meeting following formula, judge that described 2x2 coding unit is as the second artificial type:
ABS(A r,C r)<THD1,ABS(B r,D r)<THD1,
ABS(A g,C g)<THD1,ABS(B g,D g)<THD1,
ABS(A b,C b)<THD1,ABS(B b,D b)<THD1,
ABS(A r,C r)+ABS(A g,C g)+ABS(A b,C b)≤
ABS(A r,B r)+ABS(A g,B g)+ABS(A b,B b),
ABS(A r,C r)+ABS(A g,C g)+ABS(A b,C b)≤
ABS(D r,C r)+ABS(D g,C g)+ABS(D b,C b),
ABS(B r,D r)+ABS(B g,D g)+ABS(B b,D b)≤
ABS(D r,C r)+ABS(D g,C g)+ABS(D b,C b),
ABS(B r,D r)+ABS(B g,D g)+ABS(B b,D b)≤
ABS(A r,B r)+ABS(A g,B g)+ABS(A b,B b),
Wherein, THD1 is the first threshold value, and A is described top left corner pixel, and B is described upper right corner pixel, and C is described lower left corner pixel, and D is described lower right corner pixel, A r, A g, A bbe respectively the red value of pixel A, green numerical value and blue values, B r, B g, B bbe respectively the red value of pixel B, green numerical value and blue values, C r, C g, C bbe respectively the red value of pixel C, green numerical value and blue values, D r, D g, D bbe respectively the red value of pixel D, green numerical value and blue values, ABS is the poor absolute value of bracket moderate-element.
8. image compressing method as claimed in claim 5, is characterized in that: in described step (B), in the time meeting following formula, judge that described 2x2 coding unit is as the 3rd artificial type:
ABS(A r,D r)<THD1,ABS(C r,B r)<THD1,
ABS(A g,D g)<THD1,ABS(C g,B g)<THD1,
ABS(A b,D b)<THD1,ABS(C b,B b)<THD1,
ABS(A r,D r)+ABS(A g,D g)+ABS(A b,D b)≤
ABS(A r,B r)+ABS(A g,B g)+ABS(A b,B b),
ABS(A r,D r)+ABS(A g,D g)+ABS(A b,D b)≤
ABS(D r,C r)+ABS(D g,C g)+ABS(D b,C b),
ABS(C r,B r)+ABS(C g,B g)+ABS(C b,B b)≤
ABS(D r,C r)+ABS(D g,C g)+ABS(D b,C b),
ABS(C r,B r)+ABS(C g,B g)+ABS(C b,B b)≤
ABS(A r,B r)+ABS(A g,B g)+ABS(A b,B b),
Wherein, THD1 is the first threshold value, and A is described top left corner pixel, and B is described upper right corner pixel, and C is described lower left corner pixel, and D is described lower right corner pixel, Ar, A g, A bbe respectively the red value of pixel A, green numerical value and blue values, B r, B g, B bbe respectively the red value of pixel B, green numerical value and blue values, C r, C g, C bbe respectively the red value of pixel C, green numerical value and blue values, D r, D g, D bbe respectively the red value of pixel D, green numerical value and blue values, ABS is the poor absolute value of bracket moderate-element.
9. image compressing method as claimed in claim 5, is characterized in that: in described step (B), in the time meeting following formula, judge that described 2x2 coding unit is as the 4th artificial type:
ABS(B r,D r)<THD2,ABS(C r,D r)<THD2,
ABS(B g,D g)<THD2,ABS(C g,D g)<THD2,
ABS(B b,D b)<THD2,ABS(C b,D b)<THD2,
ABS(B r,D r)+ABS(B g,D g)+ABS(B b,D b)≤
ABS(A r,C r)+ABS(A g,C g)+ABS(A b,C b),
ABS(B r,D r)+ABS(B g,D g)+ABS(B b,D b)≤
ABS(A r,B r)+ABS(A g,B g)+ABS(A b,B b),
ABS(C r,D r)+ABS(C g,D g)+ABS(C b,D b)≤
ABS(A r,B r)+ABS(A g,B g)+ABS(A b,B b),
ABS(C r,D r)+ABS(C g,D g)+ABS(C b,D b)≤
ABS(A r,C r)+ABS(A g,C g)+ABS(A b,C b),
Wherein, THD2 is the second threshold value, and A is described top left corner pixel, and B is described upper right corner pixel, and C is described lower left corner pixel, and D is described lower right corner pixel, A r, A g, A bbe respectively the red value of pixel A, green numerical value and blue values, B r, B g, B bbe respectively the red value of pixel B, green numerical value and blue values, C r, C g, C bbe respectively the red value of pixel C, green numerical value and blue values, D r, D g, D bbe respectively the red value of pixel D, green numerical value and blue values, ABS is the poor absolute value of bracket moderate-element.
10. image compressing method as claimed in claim 5, is characterized in that: in described step (B), in the time meeting following formula, judge that described 2x2 coding unit is as the 5th artificial type:
ABS(B r,D r)<THD2,ABS(A r,B r)<THD2,
ABS(B g,D g)<THD2,ABS(A g,B g)<THD2,
ABS(B b,D b)<THD2,ABS(A b,B b)<THD2,
ABS(B r,D r)+ABS(B g,D g)+ABS(B b,D b)≤
ABS(A r,C r)+ABS(A g,C g)+ABS(A b,C b),
ABS(B r,D r)+ABS(B g,D g)+ABS(B b,D b)≤
ABS(C r,D r)+ABS(C g,D g)+ABS(C b,D b),
ABS(A r,B r)+ABS(A g,B g)+ABS(A b,B b)≤
ABS(C r,D r)+ABS(C g,D g)+ABS(C b,D b),
ABS(A r,B r)+ABS(A g,B g)+ABS(A b,B b)≤
ABS(A r,C r)+ABS(A g,C g)+ABS(A b,C b),
Wherein, THD2 is the second threshold value, and A is described top left corner pixel, and B is described upper right corner pixel, and C is described lower left corner pixel, and D is described lower right corner pixel, A r, A g, A bbe respectively the red value of pixel A, green numerical value and blue values, B r, B g, B bbe respectively the red value of pixel B, green numerical value and blue values, C r, C g, C bbe respectively the red value of pixel C, green numerical value and blue values, D r, D g, D bbe respectively the red value of pixel D, green numerical value and blue values, ABS is the poor absolute value of bracket moderate-element.
11. image compressing methods as claimed in claim 5, is characterized in that: in described step (B), in the time meeting following formula, judge that described 2x2 coding unit makes type as Sixth Man:
ABS(A r,C r)<THD2,ABS(A r,B r)<THD2,
ABS(A g,C g)<THD2,ABS(A g,B g)<THD2,
ABS(A b,C b)<THD2,ABS(A b,B b)<THD2,
ABS(A r,C r)+ABS(A g,C g)+ABS(A b,C b)≤
ABS(B r,D r)+ABS(B g,D g)+ABS(B b,D b),
ABS(A r,C r)+ABS(A g,C g)+ABS(A b,C b)≤
ABS(C r,D r)+ABS(C g,D g)+ABS(C b,D b),
ABS(A r,B r)+ABS(A g,B g)+ABS(A b,B b)≤
ABS(C r,D r)+ABS(C g,D g)+ABS(C b,D b),
ABS(A r,B r)+ABS(A g,B g)+ABS(A b,B b)≤
ABS(B r,D r)+ABS(B g,D g)+ABS(B b,D b),
Wherein, THD2 is the second threshold value, and A is described top left corner pixel, and B is described upper right corner pixel, and C is described lower left corner pixel, and D is described lower right corner pixel, A r, A g, A bbe respectively the red value of pixel A, green numerical value and blue values, B r, B g, B bbe respectively the red value of pixel B, green numerical value and blue values, C r, C g, C bbe respectively the red value of pixel C, green numerical value and blue values, D r, D g, D bbe respectively the red value of pixel D, green numerical value and blue values, ABS is the poor absolute value of bracket moderate-element.
12. image compressing methods as claimed in claim 5, is characterized in that: in described step (B), in the time meeting following formula, judge that described 2x2 coding unit is as the 7th artificial type:
ABS(A r,C r)<THD2,ABS(C r,D r)<THD2,
ABS(A g,C g)<THD2,ABS(C g,D g)<THD2,
ABS(A b,C b)<THD2,ABS(C b,D b)<THD2,
ABS(A r,C r)+ABS(A g,C g)+ABS(A b,C b)≤
ABS(B r,D r)+ABS(B g,D g)+ABS(B b,D b),
ABS(A r,C r)+ABS(A g,C g)+ABS(A b,C b)≤
ABS(A r,B r)+ABS(A g,B g)+ABS(A b,B b),
ABS(C r,D r)+ABS(C g,D g)+ABS(C b,D b)≤
ABS(A r,B r)+ABS(A g,B g)+ABS(A b,B b),
ABS(C r,D r)+ABS(C g,D g)+ABS(C b,D b)≤
ABS(B r,D r)+ABS(B g,D g)+ABS(B b,D b),
Wherein, THD2 is the second threshold value, and A is described top left corner pixel, and B is described upper right corner pixel, and C is described lower left corner pixel, and D is described lower right corner pixel, A r, A g, A bbe respectively the red value of pixel A, green numerical value and blue values, B r, B g, B bbe respectively the red value of pixel B, green numerical value and blue values, C r, C g, C bbe respectively the red value of pixel C, green numerical value and blue values, D r, D g, D bbe respectively the red value of pixel D, green numerical value and blue values, ABS is the poor absolute value of bracket moderate-element.
13. image compressing methods as claimed in claim 4, is characterized in that: in described 2x2 coding unit, every kind of color numerical value adopts 8 bit representations.
14. image compressing methods as claimed in claim 4, is characterized in that: in described 2x2 coding unit, every kind of color numerical value adopts 6 bit representations.
15. image compressing methods as described in claim 13 or 14, is characterized in that: in described step (B), in the time meeting following formula, judge that described 2x2 coding unit is as the first artificial type:
ABS(A y,B y)<THDY1,ABS(C y,D y)<THDY1
ABS(A u,B u)<THDU1,ABS(C u,D u)<THDU1
ABS(A v,B v)<THDV1,ABS(C v,D v)<THDV1
ABS(A y,B y)+ABS(A v,B v)+ABS(A u,B u)≤ABS(A y,C y)+ABS(A v,C v)+ABS(A u,C u)
ABS(A y,B y)+ABS(A v,B v)+ABS(A u,B u)≤ABS(D y,B y)+ABS(D v,B v)+ABS(D u,B u)
ABS(C y,D y)+ABS(C v,D v)+ABS(C u,D u)≤ABS(D y,B y)+ABS(D v,B v)+ABS(D u,B u)
ABS(C y,D y)+ABS(C v,D v)+ABS(C u,D u)≤ABS(A y,C y)+ABS(A v,C v)+ABS(A u,C u)
Wherein, ABS is the poor ABS function of two elements in bracket, and THDY1 is lightness threshold value 1, and THDU1 is the first colourity threshold value 1, THDV1 is the second colourity threshold value 1, and A is described top left corner pixel, and B is described upper right corner pixel, C is described lower left corner pixel, and D is described lower right corner pixel, A y, A u, A vbe respectively lightness, the first colourity and second chromatic value of pixel A, B y, B u, B vbe respectively lightness, the first colourity and second chromatic value of pixel B, C y, C u, C vbe respectively lightness, the first colourity and the second chromatic value of pixel C, D y, D u, D vbe respectively lightness, the first colourity and the second chromatic value of pixel D;
Wherein, described lightness, the first colourity and the second chromatic value carry out RGB to YUV color gamut conversion by following formula and obtain:
Y U V = 0.25 0.5 0.25 - 0.5 1.0 - 0.5 - 1.0 0 1.0 r g b ,
Wherein, r is the red value of a pixel, the green value that g is this pixel, the blue valve that b is this pixel, the lightness that Y is this pixel, the colourity that U and V are this pixel.
16. image compressing methods as described in claim 13 or 14, is characterized in that: in described step (B), in the time meeting following formula, judge that described 2x2 coding unit is as the second artificial type:
ABS(A y,C y)<THDY1,ABS(B y,D y)<THDY1
ABS(A u,C u)<THDU1,ABS(B u,D u)<THDU1
ABS(A v,C v)<THDV1,ABS(B v,D v)<THDV1
ABS(A y,C y)+ABS(A v,C v)+ABS(A u,C u)≤ABS(A y,B y)+ABS(A v,B v)+ABS(A u,B u)
ABS(A y,C y)+ABS(A v,C v)+ABS(A u,C u)≤ABS(C y,D y)+ABS(C v,D v)+ABS(C u,D u)
ABS(B y,D y)+ABS(B v,D v)+ABS(B u,D u)≤ABS(A y,B y)+ABS(A v,B v)+ABS(A u,B u)
ABS(B y,D y)+ABS(B v,D v)+ABS(B u,D u)≤ABS(D y,C y)+ABS(D v,C v)+ABS(D u,C u)
Wherein, ABS is the poor ABS function of two elements in bracket, and THDY1 is lightness threshold value 1, and THDU1 is the first colourity threshold value 1, THDV1 is the second colourity threshold value 1, and A is described top left corner pixel, and B is described upper right corner pixel, C is described lower left corner pixel, and D is described lower right corner pixel, A y, A u, A vbe respectively lightness, the first colourity and second chromatic value of pixel A, B y, B u, B vbe respectively lightness, the first colourity and second chromatic value of pixel B, C y, C u, C vbe respectively lightness, the first colourity and the second chromatic value of pixel C, D y, D u, D vbe respectively lightness, the first colourity and the second chromatic value of pixel D;
Wherein, described lightness, the first colourity and the second chromatic value carry out RGB to YUV color gamut conversion by following formula and obtain:
Y U V = 0.25 0.5 0.25 - 0.5 1.0 - 0.5 - 1.0 0 1.0 r g b ,
Wherein, r is the red value of a pixel, the green value that g is this pixel, the blue valve that b is this pixel, the lightness that Y is this pixel, the colourity that U and V are this pixel.
17. image compressing methods as described in claim 13 or 14, is characterized in that: in described step (B), in the time meeting following formula, judge that described 2x2 coding unit is as the 3rd artificial type:
ABS(C y,B y)<THDY1,ABS(A y,D y)<THDY1
ABS(C u,B u)<THDU1,ABS(A u,D u)<THDU1
ABS(C v,B v)<THDV1,ABS(A v,D v)<THDV1
ABS(C y,B y)+ABS(C v,B v)+ABS(C u,B u)≤ABS(A y,B y)+ABS(A v,B v)+ABS(A u,B u)
ABS(C y,B y)+ABS(C v,B v)+ABS(C u,B u)≤ABS(D y,C y)+ABS(D v,C v)+ABS(D u,C u)
ABS(A y,D y)+ABS(A v,D v)+ABS(A u,D u)≤ABS(A y,B y)+ABS(A v,B v)+ABS(A u,B u)
ABS(A y,D y)+ABS(A v,D v)+ABS(A u,D u)≤ABS(D y,C y)+ABS(D v,C v)+ABS(D u,C u)
Wherein, ABS is the poor ABS function of two elements in bracket, and THDY1 is lightness threshold value 1, and THDU1 is the first colourity threshold value 1, THDV1 is the second colourity threshold value 1, and A is described top left corner pixel, and B is described upper right corner pixel, C is described lower left corner pixel, and D is described lower right corner pixel, A y, A u, A vbe respectively lightness, the first colourity and second chromatic value of pixel A, B y, B u, B vbe respectively lightness, the first colourity and second chromatic value of pixel B, C y, C u, C vbe respectively lightness, the first colourity and the second chromatic value of pixel C, D y, D u, D vbe respectively lightness, the first colourity and the second chromatic value of pixel D;
Wherein, described lightness, the first colourity and the second chromatic value carry out RGB to YUV color gamut conversion by following formula and obtain:
Y U V = 0.25 0.5 0.25 - 0.5 1.0 - 0.5 - 1.0 0 1.0 r g b ,
Wherein, r is the red value of a pixel, the green value that g is this pixel, the blue valve that b is this pixel, the lightness that Y is this pixel, the colourity that U and V are this pixel.
18. image compressing methods as described in claim 13 or 14, is characterized in that: in described step (B), in the time meeting following formula, judge that described 2x2 coding unit is as the 4th artificial type:
ABS(D y,B y)<THDY2,ABS(C y,D y)<THDY2
ABS(D u,B u)<THDU2,ABS(C u,D u)<THDU2
ABS(D v,B v)<THDV2,ABS(C v,D v)<THDV2
ABS(D y,B y)+ABS(D v,B v)+ABS(D u,B u)≤ABS(A y,C y)+ABS(A v,C v)+ABS(A u,C u)
ABS(D y,B y)+ABS(D v,B v)+ABS(D u,B u)≤ABS(A y,B y)+ABS(A v,B v)+ABS(A u,B u)
ABS(D y,C y)+ABS(D v,C v)+ABS(D u,C u)≤ABS(A y,C y)+ABS(A v,C v)+ABS(A u,C u)
ABS(D y,C y)+ABS(D v,C v)+ABS(D u,C u)≤ABS(A y,B y)+ABS(A v,B v)+ABS(A u,B u)
Wherein, ABS is the poor ABS function of two elements in bracket, and THDY2 is lightness threshold value 2, and THDU2 is the first colourity threshold value 2, THDV2 is the second colourity threshold value 2, and A is described top left corner pixel, and B is described upper right corner pixel, C is described lower left corner pixel, and D is described lower right corner pixel, A y, A u, A vbe respectively lightness, the first colourity and second chromatic value of pixel A, B y, B u, B vbe respectively lightness, the first colourity and second chromatic value of pixel B, C y, C u, C vbe respectively lightness, the first colourity and the second chromatic value of pixel C, D y, D u, D vbe respectively lightness, the first colourity and the second chromatic value of pixel D;
Wherein, described lightness, the first colourity and the second chromatic value carry out RGB to YUV color gamut conversion by following formula and obtain:
Y U V = 0.25 0.5 0.25 - 0.5 1.0 - 0.5 - 1.0 0 1.0 r g b ,
Wherein, r is the red value of a pixel, the green value that g is this pixel, the blue valve that b is this pixel, the lightness that Y is this pixel, the colourity that U and V are this pixel.
19. image compressing methods as described in claim 13 or 14, is characterized in that: in described step (B), in the time meeting following formula, judge that described 2x2 coding unit is as the 5th artificial type:
ABS(D y,B y)<THDY2,ABS(A y,B y)<THDY2
ABS(D u,B u)<THDU2,ABS(A u,B u)<THDU2
ABS(D v,B v)<THDV2,ABS(A v,B v)<THDV2
ABS(D y,B y)+ABS(D v,B v)+ABS(D u,B u)≤ABS(A y,C y)+ABS(A v,C v)+ABS(A u,C u)
ABS(D y,B y)+ABS(D v,B v)+ABS(D u,B u)≤ABS(C y,D y)+ABS(C v,D v)+ABS(C u,D u)
ABS(A y,B y)+ABS(A v,B v)+ABS(A u,B u)≤ABS(A y,C y)+ABS(A v,C v)+ABS(A u,C u)
ABS(A y,B y)+ABS(A v,B v)+ABS(A u,B u)≤ABS(C y,D y)+ABS(C v,D v)+ABS(C u,D u)
Wherein, ABS is the poor ABS function of two elements in bracket, and THDY2 is lightness threshold value 2, and THDU2 is the first colourity threshold value 2, THDV2 is the second colourity threshold value 2, and A is described top left corner pixel, and B is described upper right corner pixel, C is described lower left corner pixel, and D is described lower right corner pixel, A y, A u, A vbe respectively lightness, the first colourity and second chromatic value of pixel A, B y, B u, B vbe respectively lightness, the first colourity and second chromatic value of pixel B, C y, C u, C vbe respectively lightness, the first colourity and the second chromatic value of pixel C, D y, D u, D vbe respectively lightness, the first colourity and the second chromatic value of pixel D;
Wherein, described lightness, the first colourity and the second chromatic value carry out RGB to YUV color gamut conversion by following formula and obtain:
Y U V = 0.25 0.5 0.25 - 0.5 1.0 - 0.5 - 1.0 0 1.0 r g b ,
Wherein, r is the red value of a pixel, the green value that g is this pixel, the blue valve that b is this pixel, the lightness that Y is this pixel, the colourity that U and V are this pixel.
20. image compressing methods as described in claim 13 or 14, is characterized in that: in described step (B), in the time meeting following formula, judge that described 2x2 coding unit makes type as Sixth Man:
ABS(A y,B y)<THDY2,ABS(C y,A y)<THDY2
ABS(A u,B u)<THDU2,ABS(C u,A u)<THDU2
ABS(A v,B v)<THDV2,ABS(C v,A v)<THDV2
ABS(A y,B y)+ABS(A v,B v)+ABS(A u,B u)≤ABS(D y,C y)+ABS(D v,C v)+ABS(D u,C u)
ABS(A y,B y)+ABS(A v,B v)+ABS(A u,B u)≤ABS(D y,B y)+ABS(D v,B v)+ABS(D u,B u)
ABS(A y,C y)+ABS(A v,C v)+ABS(A u,C u)≤ABS(D y,C y)+ABS(D v,C v)+ABS(D u,C u)
ABS(A y,C y)+ABS(A v,C v)+ABS(A u,C u)≤ABS(D y,B y)+ABS(D v,B v)+ABS(D u,B u)
Wherein, ABS is the poor ABS function of two elements in bracket, and THDY2 is lightness threshold value 2, and THDU2 is the first colourity threshold value 2, THDV2 is the second colourity threshold value 2, and A is described top left corner pixel, and B is described upper right corner pixel, C is described lower left corner pixel, and D is described lower right corner pixel, A y, A u, A vbe respectively lightness, the first colourity and second chromatic value of pixel A, B y, B u, B vbe respectively lightness, the first colourity and second chromatic value of pixel B, C y, C u, C vbe respectively lightness, the first colourity and the second chromatic value of pixel C, D y, D u, D vbe respectively lightness, the first colourity and the second chromatic value of pixel D;
Wherein, described lightness, the first colourity and the second chromatic value carry out RGB to YUV color gamut conversion by following formula and obtain:
Y U V = 0.25 0.5 0.25 - 0.5 1.0 - 0.5 - 1.0 0 1.0 r g b ,
Wherein, r is the red value of a pixel, the green value that g is this pixel, the blue valve that b is this pixel, the lightness that Y is this pixel, the colourity that U and V are this pixel.
21. image compressing methods as described in claim 13 or 14, is characterized in that: in described step (B), in the time meeting following formula, judge that described 2x2 coding unit is as the 7th artificial type:
ABS(A y,C y)<THDY2,ABS(C y,D y)<THDY2
ABS(A u,C u)<THDU2,ABS(C u,D u)<THDU2
ABS(A v,C v)<THDV2,ABS(C v,D v)<THDV2
ABS(A y,C y)+ABS(A v,C v)+ABS(A u,C u)≤ABS(B y,D y)+ABS(B v,D v)+ABS(B u,D u)
ABS(A y,C y)+ABS(A v,C v)+ABS(A u,C u)≤ABS(A y,B y)+ABS(A v,B v)+ABS(A u,B u)
ABS(D y,C y)+ABS(D v,C v)+ABS(D u,C u)≤ABS(B y,D y)+ABS(B v,D v)+ABS(B u,D u)
ABS(D y,C y)+ABS(D v,C v)+ABS(D u,C u)≤ABS(A y,B y)+ABS(A v,B v)+ABS(A u,B u)
Wherein, ABS is the poor ABS function of two elements in bracket, and THDY2 is lightness threshold value 2, and THDU2 is the first colourity threshold value 2, THDV2 is the second colourity threshold value 2, and A is described top left corner pixel, and B is described upper right corner pixel, C is described lower left corner pixel, and D is described lower right corner pixel, A y, A u, A vbe respectively lightness, the first colourity and second chromatic value of pixel A, B y, B u, B vbe respectively lightness, the first colourity and second chromatic value of pixel B, C y, C u, C vbe respectively lightness, the first colourity and the second chromatic value of pixel C, D y, D u, D vbe respectively lightness, the first colourity and the second chromatic value of pixel D;
Wherein, described lightness, the first colourity and the second chromatic value carry out RGB to YUV color gamut conversion by following formula and obtain:
Y U V = 0.25 0.5 0.25 - 0.5 1.0 - 0.5 - 1.0 0 1.0 r g b ,
Wherein, r is the red value of a pixel, the green value that g is this pixel, the blue valve that b is this pixel, the lightness that Y is this pixel, the colourity that U and V are this pixel.
22. image compressing methods as claimed in claim 13, is characterized in that: in described step (B), in the time meeting following formula, judge that described 2x2 coding unit is as the 8th artificial type:
temp1=ABS(A y,B y)+ABS(A v,B v)+ABS(A u,B u)
temp2=ABS(A y,C y)+ABS(A v,C v)+ABS(A u,C u)
temp3=ABS(A y,D y)+ABS(A v,D v)+ABS(A u,D u)
temp4=ABS(D y,B y)+ABS(D v,B v)+ABS(D u,B u)
temp5=ABS(C y,B y)+ABS(C v,B v)+ABS(C u,B u)
temp6=ABS(C y,D y)+ABS(C v,D v)+ABS(C u,D u)
MIN(temp1,temp2,temp3,temp4,temp5,temp6)=temp1
ABS(A y,B y)<THDY4
ABS(A v,B v)<THDV4
ABS(A u,B u)<THDU4
ABS (C y, D y) > THDY3 or ABS (C v, D v) > THDV3 or ABS (C u, D u) > THDU3
Wherein, ABS is the poor ABS function of two elements in bracket, and THDY3 is lightness threshold value 3, THDU3 is the first colourity threshold value 3, THDV3 is the second colourity threshold value 3, and THDY4 is lightness threshold value 4, and THDU4 is the first colourity threshold value 4, THDV4 is the second colourity threshold value 4, A is described top left corner pixel, and B is described upper right corner pixel, and C is described lower left corner pixel, D is described lower right corner pixel, A y, A u, A vbe respectively lightness, the first colourity and second chromatic value of pixel A, B y, B u, B vbe respectively lightness, the first colourity and second chromatic value of pixel B, C y, C u, C vbe respectively lightness, the first colourity and the second chromatic value of pixel C, D y, D u, D vbe respectively lightness, the first colourity and the second chromatic value of pixel D;
Wherein, described lightness, the first colourity and the second chromatic value carry out RGB to YUV color gamut conversion by following formula and obtain:
Y U V = 0.25 0.5 0.25 - 0.5 1.0 - 0.5 - 1.0 0 1.0 r g b ,
Wherein, r is the red value of a pixel, the green value that g is this pixel, the blue valve that b is this pixel, the lightness that Y is this pixel, the colourity that U and V are this pixel.
23. image compressing methods as claimed in claim 13, is characterized in that: in described step (B), in the time meeting following formula, judge that described 2x2 coding unit is as the 9th artificial type:
temp1=ABS(A y,B y)+ABS(A v,B v)+ABS(A u,B u)
temp2=ABS(A y,C y)+ABS(A v,C v)+ABS(A u,C u)
temp3=ABS(A y,D y)+ABS(A v,D v)+ABS(A u,D u)
temp4=ABS(D y,B y)+ABS(D v,B v)+ABS(D u,B u)
temp5=ABS(C y,B y)+ABS(C v,B v)+ABS(C u,B u)
temp6=ABS(C y,D y)+ABS(C v,D v)+ABS(C u,D u)
MIN(temp1,temp2,temp3,temp4,temp5,temp6)=temp6
ABS(C y,D y)<THDY4
ABS(C v,D v)<THDV4
ABS(C u,D u)<THDU4
ABS (A y, B y) > THDY3 or ABS (A v, B v) > THDV3 or ABS (A u, B u) > THDU3
Wherein, ABS is the poor ABS function of two elements in bracket, and THDY3 is lightness threshold value 3, THDU3 is the first colourity threshold value 3, THDV3 is the second colourity threshold value 3, and THDY4 is lightness threshold value 4, and THDU4 is the first colourity threshold value 4, THDV4 is the second colourity threshold value 4, A is described top left corner pixel, and B is described upper right corner pixel, and C is described lower left corner pixel, D is described lower right corner pixel, A y, A u, A vbe respectively lightness, the first colourity and second chromatic value of pixel A, B y, B u, B vbe respectively lightness, the first colourity and second chromatic value of pixel B, C y, C u, C vbe respectively lightness, the first colourity and the second chromatic value of pixel C, D y, D u, D vbe respectively lightness, the first colourity and the second chromatic value of pixel D;
Wherein, described lightness, the first colourity and the second chromatic value carry out RGB to YUV color gamut conversion by following formula and obtain:
Y U V = 0.25 0.5 0.25 - 0.5 1.0 - 0.5 - 1.0 0 1.0 r g b ,
Wherein, r is the red value of a pixel, the green value that g is this pixel, the blue valve that b is this pixel, the lightness that Y is this pixel, the colourity that U and V are this pixel.
24. image compressing methods as claimed in claim 13, is characterized in that: in described step (B), in the time meeting following formula, judge that described 2x2 coding unit is as the tenth artificial type:
temp1=ABS(A y,B y)+ABS(A v,B v)+ABS(A u,B u)
temp2=ABS(A y,C y)+ABS(A v,C v)+ABS(A u,C u)
temp3=ABS(A y,D y)+ABS(A v,D v)+ABS(A u,D u)
temp4=ABS(D y,B y)+ABS(D v,B v)+ABS(D u,B u)
temp5=ABS(C y,B y)+ABS(C v,B v)+ABS(C u,B u)
temp6=ABS(C y,D y)+ABS(C v,D v)+ABS(C u,D u)
MIN(temp1,temp2,temp3,temp4,temp5,temp6)=temp2
ABS(A y,C y)<THDY4
ABS(A v,C v)<THDV4
ABS(A u,C u)<THDU4
ABS (B y, D y) > THDY3 or ABS (B v, D v) > THDV3 or ABS (B u, D u) > THDU3
Wherein, ABS is the poor ABS function of two elements in bracket, and THDY3 is lightness threshold value 3, THDU3 is the first colourity threshold value 3, THDV3 is the second colourity threshold value 3, and THDY4 is lightness threshold value 4, and THDU4 is the first colourity threshold value 4, THDV4 is the second colourity threshold value 4, A is described top left corner pixel, and B is described upper right corner pixel, and C is described lower left corner pixel, D is described lower right corner pixel, A y, A u, A vbe respectively lightness, the first colourity and second chromatic value of pixel A, B y, B u, B vbe respectively lightness, the first colourity and second chromatic value of pixel B, C y, C u, C vbe respectively lightness, the first colourity and the second chromatic value of pixel C, D y, D u, D vbe respectively lightness, the first colourity and the second chromatic value of pixel D;
Wherein, described lightness, the first colourity and the second chromatic value carry out RGB to YUV color gamut conversion by following formula and obtain:
Y U V = 0.25 0.5 0.25 - 0.5 1.0 - 0.5 - 1.0 0 1.0 r g b ,
Wherein, r is the red value of a pixel, the green value that g is this pixel, the blue valve that b is this pixel, the lightness that Y is this pixel, the colourity that U and V are this pixel.
25. image compressing methods as claimed in claim 13, is characterized in that: in described step (B), in the time meeting following formula, judge that described 2x2 coding unit is as the 11 artificial type:
temp1=ABS(A y,B y)+ABS(A v,B v)+ABS(A u,B u)
temp2=ABS(A y,C y)+ABS(A v,C v)+ABS(A u,C u)
temp3=ABS(A y,D y)+ABS(A v,D v)+ABS(A u,D u)
temp4=ABS(D y,B y)+ABS(D v,B v)+ABS(D u,B u)
temp5=ABS(C y,B y)+ABS(C v,B v)+ABS(C u,B u)
temp6=ABS(C y,D y)+ABS(C v,D v)+ABS(C u,D u)
MIN(temp1,temp2,temp3,temp4,temp5,temp6)=temp4
ABS(D y,B y)<THDY4
ABS(D v,B v)<THDV4
ABS(D u,B u)<THDU4
ABS (C y, A y) > THDY3 or ABS (C v, A v) > THDV3 or ABS (C u, A u) > THDU3
Wherein, ABS is the poor ABS function of two elements in bracket, and THDY3 is lightness threshold value 3, THDU3 is the first colourity threshold value 3, THDV3 is the second colourity threshold value 3, and THDY4 is lightness threshold value 4, and THDU4 is the first colourity threshold value 4, THDV4 is the second colourity threshold value 4, A is described top left corner pixel, and B is described upper right corner pixel, and C is described lower left corner pixel, D is described lower right corner pixel, A y, A u, A vbe respectively lightness, the first colourity and second chromatic value of pixel A, B y, B u, B vbe respectively lightness, the first colourity and second chromatic value of pixel B, C y, C u, C vbe respectively lightness, the first colourity and the second chromatic value of pixel C, D y, D u, D vbe respectively lightness, the first colourity and the second chromatic value of pixel D;
Wherein, described lightness, the first colourity and the second chromatic value carry out RGB to YUV color gamut conversion by following formula and obtain:
Y U V = 0.25 0.5 0.25 - 0.5 1.0 - 0.5 - 1.0 0 1.0 r g b ,
Wherein, r is the red value of a pixel, the green value that g is this pixel, the blue valve that b is this pixel, the lightness that Y is this pixel, the colourity that U and V are this pixel.
26. image compressing methods as claimed in claim 13, is characterized in that: in described step (B), in the time meeting following formula, judge that described 2x2 coding unit is as the 12 artificial type:
temp1=ABS(A y,B y)+ABS(A v,B v)+ABS(A u,B u)
temp2=ABS(A y,C y)+ABS(A v,C v)+ABS(A u,C u)
temp3=ABS(A y,D y)+ABS(A v,D v)+ABS(A u,D u)
temp4=ABS(D y,B y)+ABS(D v,B v)+ABS(D u,B u)
temp5=ABS(C y,B y)+ABS(C v,B v)+ABS(C u,B u)
temp6=ABS(C y,D y)+ABS(C v,D v)+ABS(C u,D u)
MIN(temp1,temp2,temp3,temp4,temp5,temp6)=temp3
ABS(A y,D y)<THDY4
ABS(A v,D v)<THDV4
ABS(A u,D u)<THDU4
ABS (C y, B y) > THDY3 or ABS (C v, B v) > THDV3 or ABS (C u, B u) > THDU3
Wherein, ABS is the poor ABS function of two elements in bracket, and THDY3 is lightness threshold value 3, THDU3 is the first colourity threshold value 3, THDV3 is the second colourity threshold value 3, and THDY4 is lightness threshold value 4, and THDU4 is the first colourity threshold value 4, THDV4 is the second colourity threshold value 4, A is described top left corner pixel, and B is described upper right corner pixel, and C is described lower left corner pixel, D is described lower right corner pixel, A y, A u, A vbe respectively lightness, the first colourity and second chromatic value of pixel A, B y, B u, B vbe respectively lightness, the first colourity and second chromatic value of pixel B, C y, C u, C vbe respectively lightness, the first colourity and the second chromatic value of pixel C, D y, D u, D vbe respectively lightness, the first colourity and the second chromatic value of pixel D;
Wherein, described lightness, the first colourity and the second chromatic value carry out RGB to YUV color gamut conversion by following formula and obtain:
Y U V = 0.25 0.5 0.25 - 0.5 1.0 - 0.5 - 1.0 0 1.0 r g b ,
Wherein, r is the red value of a pixel, the green value that g is this pixel, the blue valve that b is this pixel, the lightness that Y is this pixel, the colourity that U and V are this pixel.
27. image compressing methods as claimed in claim 13, is characterized in that: in described step (B), in the time meeting following formula, judge that described 2x2 coding unit is as the 13 artificial type:
temp1=ABS(A y,B y)+ABS(A v,B v)+ABS(A u,B u)
temp2=ABS(A y,C y)+ABS(A v,C v)+ABS(A u,C u)
temp3=ABS(A y,D y)+ABS(A v,D v)+ABS(A u,D u)
temp4=ABS(D y,B y)+ABS(D v,B v)+ABS(D u,B u)
temp5=ABS(C y,B y)+ABS(C v,B v)+ABS(C u,B u)
temp6=ABS(C y,D y)+ABS(C v,D v)+ABS(C u,D u)
MIN(temp1,temp2,temp3,temp4,temp5,temp6)=temp5
ABS(C y,B y)<THDY4
ABS(C v,B v)<THDV4
ABS(C u,B u)<THDU4
ABS (A y, D y) > THDY3 or ABS (A v, D v) > THDV3 or ABS (A u, D u) > THDU3
Wherein, ABS is the poor ABS function of two elements in bracket, and THDY3 is lightness threshold value 3, THDU3 is the first colourity threshold value 3, THDV3 is the second colourity threshold value 3, and THDY4 is lightness threshold value 4, and THDU4 is the first colourity threshold value 4, THDV4 is the second colourity threshold value 4, A is described top left corner pixel, and B is described upper right corner pixel, and C is described lower left corner pixel, D is described lower right corner pixel, A y, A u, A vbe respectively lightness, the first colourity and second chromatic value of pixel A, B y, B u, B vbe respectively lightness, the first colourity and second chromatic value of pixel B, C y, C u, C vbe respectively lightness, the first colourity and the second chromatic value of pixel C, D y, D u, D vbe respectively lightness, the first colourity and the second chromatic value of pixel D;
Wherein, described lightness, the first colourity and the second chromatic value carry out RGB to YUV color gamut conversion by following formula and obtain:
Y U V = 0.25 0.5 0.25 - 0.5 1.0 - 0.5 - 1.0 0 1.0 r g b ,
Wherein, r is the red value of a pixel, the green value that g is this pixel, the blue valve that b is this pixel, the lightness that Y is this pixel, the colourity that U and V are this pixel.
28. image compressing methods as claimed in claim 14, is characterized in that: in described step (B), in the time meeting following formula, judge that described 2x2 coding unit is as the 8th artificial type:
temp1=ABS(A y,B y)+ABS(A v,B v)+ABS(A u,B u)
temp2=ABS(A y,C y)+ABS(A v,C v)+ABS(A u,C u)
temp3=ABS(A y,D y)+ABS(A v,D v)+ABS(A u,D u)
temp4=ABS(D y,B y)+ABS(D v,B v)+ABS(D u,B u)
temp5=ABS(C y,B y)+ABS(C v,B v)+ABS(C u,B u)
temp6=ABS(C y,D y)+ABS(C v,D v)+ABS(C u,D u)
MIN(temp1,temp2,temp3,temp4,temp5,temp6)=temp1
ABS(A y,B y)<THDY4
ABS(A v,B v)<THDV4
ABS(A u,B u)<THDU4
Wherein, ABS is the poor ABS function of two elements in bracket, and THDY4 is lightness threshold value 4, and THDU4 is the first colourity threshold value 4, THDV4 is the second colourity threshold value 4, and A is described top left corner pixel, and B is described upper right corner pixel, C is described lower left corner pixel, and D is described lower right corner pixel, A y, A u, A vbe respectively lightness, the first colourity and second chromatic value of pixel A, B y, B u, B vbe respectively lightness, the first colourity and second chromatic value of pixel B, C y, C u, C vbe respectively lightness, the first colourity and the second chromatic value of pixel C, D y, D u, D vbe respectively lightness, the first colourity and the second chromatic value of pixel D;
Wherein, described lightness, the first colourity and the second chromatic value carry out RGB to YUV color gamut conversion by following formula and obtain:
Y U V = 0.25 0.5 0.25 - 0.5 1.0 - 0.5 - 1.0 0 1.0 r g b ,
Wherein, r is the red value of a pixel, the green value that g is this pixel, the blue valve that b is this pixel, the lightness that Y is this pixel, the colourity that U and V are this pixel.
29. image compressing methods as claimed in claim 14, is characterized in that: in described step (B), in the time meeting following formula, judge that described 2x2 coding unit is as the 9th artificial type:
temp1=ABS(A y,B y)+ABS(A v,B v)+ABS(A u,B u)
temp2=ABS(A y,C y)+ABS(A v,C v)+ABS(A u,C u)
temp3=ABS(A y,D y)+ABS(A v,D v)+ABS(A u,D u)
temp4=ABS(D y,B y)+ABS(D v,B v)+ABS(D u,B u)
temp5=ABS(C y,B y)+ABS(C v,B v)+ABS(C u,B u)
temp6=ABS(C y,D y)+ABS(C v,D v)+ABS(C u,D u)
MIN(temp1,temp2,temp3,temp4,temp5,temp6)=temp6
ABS(C y,D y)<THDY4
ABS(C v,D v)<THDV4
ABS(C u,D u)<THDU4
Wherein, ABS is the poor ABS function of two elements in bracket, and THDY4 is lightness threshold value 4, and THDU4 is the first colourity threshold value 4, THDV4 is the second colourity threshold value 4, and A is described top left corner pixel, and B is described upper right corner pixel, C is described lower left corner pixel, and D is described lower right corner pixel, A y, A u, A vbe respectively lightness, the first colourity and second chromatic value of pixel A, B y, B u, B vbe respectively lightness, the first colourity and second chromatic value of pixel B, C y, C u, C vbe respectively lightness, the first colourity and the second chromatic value of pixel C, D y, D u, D vbe respectively lightness, the first colourity and the second chromatic value of pixel D;
Wherein, described lightness, the first colourity and the second chromatic value carry out RGB to YUV color gamut conversion by following formula and obtain:
Y U V = 0.25 0.5 0.25 - 0.5 1.0 - 0.5 - 1.0 0 1.0 r g b ,
Wherein, r is the red value of a pixel, the green value that g is this pixel, the blue valve that b is this pixel, the lightness that Y is this pixel, the colourity that U and V are this pixel.
30. image compressing methods as claimed in claim 14, is characterized in that: in described step (B), in the time meeting following formula, judge that described 2x2 coding unit is as the tenth artificial type:
temp1=ABS(A y,B y)+ABS(A v,B v)+ABS(A u,B u)
temp2=ABS(A y,C y)+ABS(A v,C v)+ABS(A u,C u)
temp3=ABS(A y,D y)+ABS(A v,D v)+ABS(A u,D u)
temp4=ABS(D y,B y)+ABS(D v,B v)+ABS(D u,B u)
temp5=ABS(C y,B y)+ABS(C v,B v)+ABS(C u,B u)
temp6=ABS(C y,D y)+ABS(C v,D v)+ABS(C u,D u)
MIN(temp1,temp2,temp3,temp4,temp5,temp6)=temp2
ABS(A y,C y)<THDY4
ABS(A v,C v)<THDV4
ABS(A u,C u)<THDU4
Wherein, ABS is the poor ABS function of two elements in bracket, and THDY4 is lightness threshold value 4, and THDU4 is the first colourity threshold value 4, THDV4 is the second colourity threshold value 4, and A is described top left corner pixel, and B is described upper right corner pixel, C is described lower left corner pixel, and D is described lower right corner pixel, A y, A u, A vbe respectively lightness, the first colourity and second chromatic value of pixel A, B y, B u, B vbe respectively lightness, the first colourity and second chromatic value of pixel B, C y, C u, C vbe respectively lightness, the first colourity and the second chromatic value of pixel C, D y, D u, D vbe respectively lightness, the first colourity and the second chromatic value of pixel D;
Wherein, described lightness, the first colourity and the second chromatic value carry out RGB to YUV color gamut conversion by following formula and obtain:
Y U V = 0.25 0.5 0.25 - 0.5 1.0 - 0.5 - 1.0 0 1.0 r g b ,
Wherein, r is the red value of a pixel, the green value that g is this pixel, the blue valve that b is this pixel, the lightness that Y is this pixel, the colourity that U and V are this pixel.
31. image compressing methods as claimed in claim 14, is characterized in that: in described step (B), in the time meeting following formula, judge that described 2x2 coding unit is as the 11 artificial type:
temp1=ABS(A y,B y)+ABS(A v,B v)+ABS(A u,B u)
temp2=ABS(A y,C y)+ABS(A v,C v)+ABS(A u,C u)
temp3=ABS(A y,D y)+ABS(A v,D v)+ABS(A u,D u)
temp4=ABS(D y,B y)+ABS(D v,B v)+ABS(D u,B u)
temp5=ABS(C y,B y)+ABS(C v,B v)+ABS(C u,B u)
temp6=ABS(C y,D y)+ABS(C v,D v)+ABS(C u,D u)
MIN(temp1,temp2,temp3,temp4,temp5,temp6)=temp4
ABS(D y,B y)<THDY4
ABS(D v,B v)<THDV4
ABS(D u,B u)<THDU4
Wherein, ABS is the poor ABS function of two elements in bracket, and THDY4 is lightness threshold value 4, and THDU4 is the first colourity threshold value 4, THDV4 is the second colourity threshold value 4, and A is described top left corner pixel, and B is described upper right corner pixel, C is described lower left corner pixel, and D is described lower right corner pixel, A y, A u, A vbe respectively lightness, the first colourity and second chromatic value of pixel A, B y, B u, B vbe respectively lightness, the first colourity and second chromatic value of pixel B, C y, C u, C vbe respectively lightness, the first colourity and the second chromatic value of pixel C, D y, D u, D vbe respectively lightness, the first colourity and the second chromatic value of pixel D;
Wherein, described lightness, the first colourity and the second chromatic value carry out RGB to YUV color gamut conversion by following formula and obtain:
Y U V = 0.25 0.5 0.25 - 0.5 1.0 - 0.5 - 1.0 0 1.0 r g b ,
Wherein, r is the red value of a pixel, the green value that g is this pixel, the blue valve that b is this pixel, the lightness that Y is this pixel, the colourity that U and V are this pixel.
32. image compressing methods as claimed in claim 14, is characterized in that: in described step (B), in the time meeting following formula, judge that described 2x2 coding unit is as the 12 artificial type:
temp1=ABS(A y,B y)+ABS(A v,B v)+ABS(A u,B u)
temp2=ABS(A y,C y)+ABS(A v,C v)+ABS(A u,C u)
temp3=ABS(A y,D y)+ABS(A v,D v)+ABS(A u,D u)
temp4=ABS(D y,B y)+ABS(D v,B v)+ABS(D u,B u)
temp5=ABS(C y,B y)+ABS(C v,B v)+ABS(C u,B u)
temp6=ABS(C y,D y)+ABS(C v,D v)+ABS(C u,D u)
MIN(temp1,temp2,temp3,temp4,temp5,temp6)=temp3
ABS(A y,D y)<THDY4
ABS(A v,D v)<THDV4
ABS(A u,D u)<THDU4
Wherein, ABS is the poor ABS function of two elements in bracket, and THDY4 is lightness threshold value 4, and THDU4 is the first colourity threshold value 4, THDV4 is the second colourity threshold value 4, and A is described top left corner pixel, and B is described upper right corner pixel, C is described lower left corner pixel, and D is described lower right corner pixel, A y, A u, A vbe respectively lightness, the first colourity and second chromatic value of pixel A, B y, B u, B vbe respectively lightness, the first colourity and second chromatic value of pixel B, C y, C u, C vbe respectively lightness, the first colourity and the second chromatic value of pixel C, D y, D u, D vbe respectively lightness, the first colourity and the second chromatic value of pixel D;
Wherein, described lightness, the first colourity and the second chromatic value carry out RGB to YUV color gamut conversion by following formula and obtain:
Y U V = 0.25 0.5 0.25 - 0.5 1.0 - 0.5 - 1.0 0 1.0 r g b ,
Wherein, r is the red value of a pixel, the green value that g is this pixel, the blue valve that b is this pixel, the lightness that Y is this pixel, the colourity that U and V are this pixel.
33. image compressing methods as claimed in claim 14, is characterized in that: in described step (B), in the time meeting following formula, judge that described 2x2 coding unit is as the 13 artificial type:
temp1=ABS(A y,B y)+ABS(A v,B v)+ABS(A u,B u)
temp2=ABS(A y,C y)+ABS(A v,C v)+ABS(A u,C u)
temp3=ABS(A y,D y)+ABS(A v,D v)+ABS(A u,D u)
temp4=ABS(D y,B y)+ABS(D v,B v)+ABS(D u,B u)
temp5=ABS(C y,B y)+ABS(C v,B v)+ABS(C u,B u)
temp6=ABS(C y,D y)+ABS(C v,D v)+ABS(C u,D u)
MIN(temp1,temp2,temp3,temp4,temp5,temp6)=temp5
ABS(C y,B y)<THDY4
ABS(C v,B v)<THDV4
ABS(C u,B u)<THDU4
Wherein, ABS is the poor ABS function of two elements in bracket, and THDY4 is lightness threshold value 4, and THDU4 is the first colourity threshold value 4, THDV4 is the second colourity threshold value 4, and A is described top left corner pixel, and B is described upper right corner pixel, C is described lower left corner pixel, and D is described lower right corner pixel, A y, A u, A vbe respectively lightness, the first colourity and second chromatic value of pixel A, B y, B u, B vbe respectively lightness, the first colourity and second chromatic value of pixel B, C y, C u, C vbe respectively lightness, the first colourity and the second chromatic value of pixel C, D y, D u, D vbe respectively lightness, the first colourity and the second chromatic value of pixel D;
Wherein, described lightness, the first colourity and the second chromatic value carry out RGB to YUV color gamut conversion by following formula and obtain:
Y U V = 0.25 0.5 0.25 - 0.5 1.0 - 0.5 - 1.0 0 1.0 r g b ,
Wherein, r is the red value of a pixel, the green value that g is this pixel, the blue valve that b is this pixel, the lightness that Y is this pixel, the colourity that U and V are this pixel.
34. image compressing methods as described in claim 5,13 or 14, is characterized in that: in step (D), by carrying out RGB to YUV color gamut conversion, to obtain described 2x2 gamut conversion unit, described RGB to YUV color gamut conversion is shown with following formula table:
Y U V = 0.25 0.5 0.25 - 0.5 1.0 - 0.5 - 1.0 0 1.0 r g b ,
Wherein, r is the red value of a pixel, g is the green value of this pixel, b is the blue valve of this pixel, Y is the lightness of this pixel, U and V are the colourity of this pixel, and described 2x2 gamut conversion unit is divided into lightness 2x2 gamut conversion unit (Y), the first colourity 2x2 gamut conversion unit (U) and the second colourity 2x2 gamut conversion unit (V).
35. image compressing methods as claimed in claim 34, is characterized in that: in step (E), described discrete cosine transform is shown with following formula table:
E F G H = 0.25 &times; 1 1 1 1 1 - 1 1 - 1 1 1 - 1 - 1 1 - 1 - 1 1 A &OverBar; B &OverBar; C &OverBar; D &OverBar; ,
Wherein, for the upper left corner value of described 2x2 gamut conversion unit, for the upper right corner value of described 2x2 gamut conversion unit, for the lower left corner value of described 2x2 gamut conversion unit, for the lower right corner value of described 2x2 gamut conversion unit, E element is the upper left corner value of described 2x2 frequency domain unit, F element is the upper right corner value of described 2x2 frequency domain unit, G element is the lower left corner value of described 2x2 frequency domain unit, H element is the lower right corner value of described 2x2 frequency domain unit, and described 2x2 frequency domain unit is divided into lightness 2x2 frequency domain unit, the first colourity 2x2 frequency domain unit and the second colourity 2x2 frequency domain unit.
36. image compressing methods as described in claim 5 or 14, is characterized in that: between described step (E) and step (F), also comprise step:
(H) described 2x2 frequency domain unit is divided into the first natural type or the second nature type, wherein, when F element and G element in described the first colourity 2x2 frequency domain unit (U) meet following formula:
max(ABS(F,0),ABS(G,0))≤THD3,
And F element and G element in described the second colourity 2x2 frequency domain unit (V) meet following formula:
max(ABS(F,0),ABS(G,0))≤THD4,
Judge that this 2x2 frequency domain unit is as described the first natural type, otherwise, judge that this 2x2 frequency domain unit is as described the second nature type, wherein, THD3 is the 3rd threshold value, THD4 is the 4th threshold value;
Wherein, F element is the upper right corner value of described 2x2 frequency domain unit, and G element is the lower left corner value of described 2x2 frequency domain unit.
37. image compressing methods as claimed in claim 13, is characterized in that: between described step (E) and step (F), also comprise step:
Described 2x2 frequency domain unit is divided into the first natural type, the second nature type or Third Nature type by (H '), wherein,
When the H element of the first colourity 2x2 frequency domain unit (U) meets following formula,
H>THD1
Judge that described 2x2 coding unit is as the first natural type;
When F element and G element in the first colourity 2x2 frequency domain unit (U) meet following formula,
MAX(ABS(F,0),ABS(G,0))≤THD2
And F element and G element in the second colourity 2x2 frequency domain unit (V) meet following formula,
MAX(ABS(F,0),ABS(G,0))≤THD3
Judge that described 2x2 coding unit is as the second nature type;
Do not meet the first natural type and the second nature type condition, judge that described 2x2 coding unit is as Third Nature type;
Wherein, THD1 is the first threshold value, and THD2 is the second threshold value, THD3 is the 3rd threshold value, F element is the upper right corner value of described 2x2 frequency domain unit, and G element is the lower left corner value of described 2x2 frequency domain unit, and H element is the lower right corner value of described 2x2 frequency domain unit.
38. image compressing methods as claimed in claim 5, is characterized in that: in step (C), in the time that described 2x2 coding unit is the first artificial type, the second artificial type or the 3rd artificial type, use the wherein mean value of two pixels of 8 records; Use 7 record one 7 bit table cases to put, the content that records that described 7 bit table cases are put is: all record in content in these 7 bit table lattice, differs reckling with the difference of the mean value of other two pixels in this 2x2 coding unit and the mean value of aforesaid two pixels.
39. image compressing methods as claimed in claim 5, it is characterized in that: in step (C), when 2x2 coding unit is that the 4th artificial type, the 5th artificial type, Sixth Man are while making type or the 7th artificial type, use the wherein mean value of three pixels of 8 records, use 7 or 6 quantized values that record another one pixel in this 2x2 coding unit.
40. image compressing methods as claimed in claim 5, is characterized in that: in step (F), in the time that described 2x2 frequency domain unit is the first natural type, use 7 E element, F element and G elements that record in described lightness 2x2 frequency domain unit; Use 4 record one 4 bit table cases to put, the content that records that described 4 bit table cases are put is: all of these 4 bit table lattice record in content, with the reckling in the difference of the value of the H element in this lightness 2x2 frequency domain unit; Wherein, E element is the upper left corner value of described 2x2 frequency domain unit, and F element is the upper right corner value of described 2x2 frequency domain unit, and G element is the lower left corner value of described 2x2 frequency domain unit, and H element is the lower right corner value of described 2x2 frequency domain unit.
41. image compressing methods as claimed in claim 5, is characterized in that: in step (F), in the time that described 2x2 frequency domain unit is the first natural type, use 7 E elements that record in described the first colourity 2x2 frequency domain unit; Use 2 record one 2 bit table cases to put, the content that records that this 2 bit table case is put is: all of these 2 bit table lattice record in content, with the reckling in the difference of the mean value of F element in this first colourity 2x2 frequency domain unit and G element; Do not record the H element in this first colourity 2x2 frequency domain unit; Wherein, E element is the upper left corner value of described 2x2 frequency domain unit, and F element is the upper right corner value of described 2x2 frequency domain unit, and G element is the lower left corner value of described 2x2 frequency domain unit, and H element is the lower right corner value of described 2x2 frequency domain unit.
42. image compressing methods as claimed in claim 5, is characterized in that: in step (F), in the time that described 2x2 frequency domain unit is the first natural type, use 7 E elements that record in described the second colourity 2x2 frequency domain unit; Use 2 record one 2 bit table cases to put, the content that records that this 2 bit table case is put is: all of these 2 bit table lattice record in content, with the reckling in the difference of the mean value of F element in this second colourity 2x2 frequency domain unit and G element; Use 3 record one 3 bit table cases to put, the content that records that this 3 bit table case is put is: all of these 3 bit table lattice record in content, with the reckling in the difference of the H element of this second colourity 2x2 frequency domain unit; Wherein, E element is the upper left corner value of described 2x2 frequency domain unit, and F element is the upper right corner value of described 2x2 frequency domain unit, and G element is the lower left corner value of described 2x2 frequency domain unit, and H element is the lower right corner value of described 2x2 frequency domain unit.
43. image compressing methods as claimed in claim 5, is characterized in that: in step (F), in the time that described 2x2 frequency domain unit is the second nature type, use 6 quantized values that record the E element in described lightness 2x2 frequency domain unit; Use 5 quantized values that record the F element of described lightness 2x2 frequency domain unit; Use 5 quantized values that record the G element of described lightness 2x2 frequency domain unit; Use 3 record one 3 bit table cases to put, the content that records that this 3 bit table case is put is: all of these 3 bit table lattice record in content, with the reckling in the difference of the H element of this lightness 2x2 frequency domain unit; Wherein, E element is the upper left corner value of described 2x2 frequency domain unit, and F element is the upper right corner value of described 2x2 frequency domain unit, and G element is the lower left corner value of described 2x2 frequency domain unit, and H element is the lower right corner value of described 2x2 frequency domain unit.
44. image compressing methods as claimed in claim 5, is characterized in that: in step (F), in the time that described 2x2 frequency domain unit is the second nature type, use 5 quantized values that record the E element in described the first colourity 2x2 frequency domain unit; Use 3 record one 3 bit table cases to put, the content that records that this 3 bit table case is put is: all of these 3 bit table lattice record in content, with the reckling in the difference of the F element in this first colourity 2x2 frequency domain unit; Use 3 record one 3 bit table cases to put, the content that records that this 3 bit table case is put is: all of these 3 bit table lattice record in content, with the reckling in the difference of the G element in this first colourity 2x2 frequency domain unit; Do not record the H element of this first colourity 2x2 frequency domain unit; Wherein, E element is the upper left corner value of described 2x2 frequency domain unit, and F element is the upper right corner value of described 2x2 frequency domain unit, and G element is the lower left corner value of described 2x2 frequency domain unit, and H element is the lower right corner value of described 2x2 frequency domain unit.
45. image compressing methods as claimed in claim 5, is characterized in that: in step (F), in the time that described 2x2 frequency domain unit is the second nature type, use 5 quantized values that record the E element in described the second colourity 2x2 frequency domain unit; Use 4 record one 4 bit table cases to put, the content that records that this 4 bit table case is put is: all of these 4 bit table lattice record in content, with the reckling in the difference of the F element in this second colourity 2x2 frequency domain unit; Use 4 record one 4 bit table cases to put, the content that records that this 4 bit table case is put is: all of these 4 bit table lattice record in content, with the reckling in the difference of the G element in this second colourity 2x2 frequency domain unit; Use 3 record one 3 bit table cases to put, the content that records that this 3 bit table case is put is: all of these 3 bit table lattice record in content, with the reckling in the difference of the H element in this second colourity 2x2 frequency domain unit; Wherein, E element is the upper left corner value of described 2x2 frequency domain unit, and F element is the upper right corner value of described 2x2 frequency domain unit, and G element is the lower left corner value of described 2x2 frequency domain unit, and H element is the lower right corner value of described 2x2 frequency domain unit.
46. image compressing methods as claimed in claim 13, it is characterized in that: in step (C), when described 2x2 coding unit is the first artificial type, when the second artificial type and the 3rd artificial type, use the wherein mean value of two pixels of 8 records, use one 6 of 6 or 7 records or 7 bit table cases to put, the content that records that these 6 or 7 bit table cases are put is: these 6 or all of 7 bit table lattice record in content, the difference of the mean value of two pixels that record with mean value and 8 of the aforesaid uses of other two pixels in this 2x2 coding unit differs reckling.
47. image compressing methods as claimed in claim 13, it is characterized in that: in step (C), in the time that described 2x2 coding unit is the 4th artificial type to the seven artificial type, use the wherein mean value of three pixels of 8 records, use 7 or 6 quantized values that record another one pixel in described 2x2 coding unit.
48. image compressing methods as claimed in claim 13, it is characterized in that: in step (C), in the time that described 2x2 coding unit is the 8th artificial type to the 13 artificial type, use the wherein quantized value of two pixel average of 5 records, use 4 quantized values that record respectively all the other two pixels; Or use the wherein quantized value of two pixel average of 7 records, use 5 quantized values that record all the other two pixels.
49. image compressing methods as claimed in claim 13, is characterized in that: in step (C), in the time that described 2x2 coding unit is the 14 artificial type to the 17 artificial type, uses 8 pixel data is carried out to complete record.
50. image compressing methods as claimed in claim 37, it is characterized in that: in step (F), in the time that described 2x2 frequency domain unit is the first natural type, use the quantized value of 5 E elements that record lightness 2x2 frequency domain unit, F element, G element; Use 3 record one 3 bit table cases to put, the content that records that this 3 bit table case is put is: all of these 3 bit table lattice record in content, with the difference reckling of the value of the H element of described lightness 2x2 frequency domain unit; Wherein, E element is the upper left corner value of described 2x2 frequency domain unit.
51. image compressing methods as claimed in claim 37, is characterized in that: in step (F), in the time that described 2x2 frequency domain unit is the first natural type, use the quantized value of the E element of 5 record the first colourity 2x2 frequency domain unit; Use 3 record one 3 bit table cases to put, the content that records that this 3 bit table case is put is: all of these 3 bit table lattice record in content, with the difference reckling of the value of the F element of described the first colourity 2x2 frequency domain unit; Use 3 record one 3 bit table cases to put, the content that records that this 3 bit table case is put is: all of these 3 bit table lattice record in content, with the difference reckling of the value of the G element of described the first colourity 2x2 frequency domain unit; Use 3 record one 3 bit table cases to put, the content that records that this 3 bit table case is put is: all of these 3 bit table lattice record in content, with the difference reckling of the value of the H element of described the first colourity 2x2 frequency domain unit 770; Wherein, E element is the upper left corner value of described 2x2 frequency domain unit.
52. image compressing methods as claimed in claim 37, is characterized in that: in step (F), in the time that described 2x2 frequency domain unit is the first natural type, use the quantized value of the E element of 5 record the second colourity 2x2 frequency domain unit; Use 3 record one 3 bit table cases to put, the content that records that this 3 bit table case is put is: all of these 3 bit table lattice record in content, with the difference reckling of the value of the F element of described the second colourity 2x2 frequency domain unit; Use 3 record one 3 bit table cases to put, the content that records that this 3 bit table case is put is: all of these 3 bit table lattice record in content, with the difference reckling of the value of the G element of described the second colourity 2x2 frequency domain unit; Use 3 record one 3 bit table cases to put, the content that records that this 3 bit table case is put is: all of these 3 bit table lattice record in content, with the difference reckling of the value of the H element of described the second colourity 2x2 frequency domain unit; Wherein, E element is the upper left corner value of described 2x2 frequency domain unit.
53. image compressing methods as claimed in claim 37, it is characterized in that: in step (F), in the time that described 2x2 frequency domain unit is the second nature type, use the quantized value of 7 E elements that record lightness 2x2 frequency domain unit, F element, G element; Use 4 record one 4 bit table cases to put, the content that records that this 4 bit table case is put is: all of these 4 bit table lattice record in content, with the difference reckling of the value of the H element of described lightness 2x2 frequency domain unit; Wherein, E element is the upper left corner value of described 2x2 frequency domain unit.
54. image compressing methods as claimed in claim 37, is characterized in that: in step (F), in the time that described 2x2 frequency domain unit is the second nature type, use the quantized value of the E element of 6 record the first colourity 2x2 frequency domain unit; Use 2 record one 2 bit table cases to put, the content that records that this 2 bit table case is put is: all of these 2 bit table lattice record in content, with the reckling in the difference of the described first F element of colourity 2x2 frequency domain unit and the mean value of G element; Do not record the H element of described the first colourity 2x2 frequency domain unit; Wherein, E element is the upper left corner value of described 2x2 frequency domain unit.
55. image compressing methods as claimed in claim 37, is characterized in that: in step (F), in the time that described 2x2 frequency domain unit is the second nature type, use the quantized value of the E element of 7 record the second colourity 2x2 frequency domain unit; Use 2 record one 2 bit table cases to put, the content that records that this 2 bit table case is put is: all of these 2 bit table lattice record in content, with the reckling in the difference of the mean value of F element in described the second colourity 2x2 frequency domain unit and G element; Use 3 record one 3 bit table cases to put, the content that records that this 3 bit table case is put is: all of these 3 bit table lattice record in content, with the reckling in the difference of the value of the H element of described the second colourity 2x2 frequency domain unit; Wherein, E element is the upper left corner value of described 2x2 frequency domain unit.
56. image compressing methods as claimed in claim 37, is characterized in that: in step (F), in the time that described 2x2 frequency domain unit is Third Nature type, use 5 quantized values that record the E element of lightness 2x2 frequency domain unit; Use 3 record one 3 bit table cases to put, the content that records that this 3 bit table case is put is: all of these 3 bit table lattice record in content, with the reckling in the difference of the value of the F element of described lightness 2x2 frequency domain unit; Use 3 record one 3 bit table cases to put, the content that records that this 3 bit table case is put is: all of these 3 bit table lattice record in content, with the reckling in the difference of the value of the G element of described lightness 2x2 frequency domain unit; Use 2 record one 2 bit table cases to put, the content that records that this 2 bit table case is put is: all of these 2 bit table lattice record in content, with the reckling in the difference of the value of the H element of described lightness 2x2 frequency domain unit; Wherein, E element is the upper left corner value of described 2x2 frequency domain unit.
57. image compressing methods as claimed in claim 37, is characterized in that: in step (F), in the time that described 2x2 frequency domain unit is Third Nature type, use the quantized value of the E element of 4 record the first colourity 2x2 frequency domain unit; Use 4 record one 4 bit table cases to put, the content that records that this 4 bit table case is put is: all of these 4 bit table lattice record in content, with the reckling in the difference of the value of the F element of described the first colourity 2x2 frequency domain unit; Use 4 record one 4 bit table cases to put, the content that records that this 4 bit table case is put is: all of these 4 bit table lattice record in content, with the reckling in the difference of the value of the G element of described the first colourity 2x2 frequency domain unit; Use 4 record one 4 bit table cases to put, the content that records that this 4 bit table case is put is: all of these 4 bit table lattice record in content, with the reckling in the difference of the value of the H element of described the first colourity 2x2 frequency domain unit; Wherein, E element is the upper left corner value of described 2x2 frequency domain unit.
58. image compressing methods as claimed in claim 37, is characterized in that: in step (F), in the time that described 2x2 frequency domain unit is Third Nature type, use the quantized value of the E element of 4 record the second colourity 2x2 frequency domain unit; Use 4 record one 4 bit table cases to put, the content that records that this 4 bit table case is put is: all of these 4 bit table lattice record in content, with the reckling in the difference of the value of the F element of described the second colourity 2x2 frequency domain unit; Use 4 record one 4 bit table cases to put, the content that records that this 4 bit table case is put is: all of these 4 bit table lattice record in content, with the reckling in the difference of the value of the G element of described the second colourity 2x2 frequency domain unit; Use 4 record one 4 bit table cases to put, the content that records that this 4 bit table case is put is: all of these 4 bit table lattice record in content, with the reckling in the difference of the value of the H element of described the second colourity 2x2 frequency domain unit; Wherein, E element is the upper left corner value of described 2x2 frequency domain unit.
59. image compressing methods as claimed in claim 5, is characterized in that: described 2x2 coding unit is 96, and the coding package of described 2x2 coding unit is 48.
60. image compressing methods as claimed in claim 14, it is characterized in that: in step (C), in the time that described 2x2 coding unit is the first artificial type, the second artificial type or the 3rd artificial type, use the wherein mean value of two pixels of 6 records; Use one 5 of 5 or 4 records or 4 bit table cases to put, the content that records that described 5 or 4 bit table cases are put is: all record in content in these 5 or 4 bit table lattice, differs reckling with the difference of the mean value of other two pixels in this 2x2 coding unit and the mean value of aforesaid two pixels.
61. image compressing methods as claimed in claim 14, it is characterized in that: in step (C), when 2x2 coding unit is that the 4th artificial type, the 5th artificial type, Sixth Man are while making type or the 7th artificial type, use the wherein mean value of three pixels of 6 records, use 5 or 4 quantized values that record another one pixel in this 2x2 coding unit.
62. image compressing methods as claimed in claim 14, it is characterized in that: in step (C), in the time that 2x2 coding unit is the 8th artificial type to the 13 artificial type, use 5 or the wherein quantized value of two close pixel average of 4 records, use respectively 3 quantized values that record another two pixels.
63. image compressing methods as claimed in claim 14, is characterized in that: in step (C), in the time that 2x2 coding unit is the 14 artificial type to the 17 artificial type, uses 6 pixel data is carried out to complete record.
64. image compressing methods as claimed in claim 14, it is characterized in that: in step (F), in the time that described 2x2 frequency domain unit is the first natural type, use 5 quantized values that record E element, F element and G element in described lightness 2x2 frequency domain unit; Use 3 record one 3 bit table cases to put, the content that records that described 3 bit table cases are put is: all of these 3 bit table lattice record in content, with the reckling in the difference of the value of the H element in this lightness 2x2 frequency domain unit; Wherein, E element is the upper left corner value of described 2x2 frequency domain unit, and F element is the upper right corner value of described 2x2 frequency domain unit, and G element is the lower left corner value of described 2x2 frequency domain unit, and H element is the lower right corner value of described 2x2 frequency domain unit.
65. image compressing methods as claimed in claim 14, is characterized in that: in step (F), in the time that described 2x2 frequency domain unit is the first natural type, use 5 quantized values that record the E element in described the first colourity 2x2 frequency domain unit; Use 2 record one 2 bit table cases to put, the content that records that this 2 bit table case is put is: all of these 2 bit table lattice record in content, with the reckling in the difference of the mean value of F element in this first colourity 2x2 frequency domain unit and G element; Do not record the H element in this first colourity 2x2 frequency domain unit; Wherein, E element is the upper left corner value of described 2x2 frequency domain unit, and F element is the upper right corner value of described 2x2 frequency domain unit, and G element is the lower left corner value of described 2x2 frequency domain unit, and H element is the lower right corner value of described 2x2 frequency domain unit.
66. image compressing methods as claimed in claim 14, is characterized in that: in step (F), in the time that described 2x2 frequency domain unit is the first natural type, use 5 quantized values that record the E element in described the second colourity 2x2 frequency domain unit; Use 2 record one 2 bit table cases to put, the content that records that this 2 bit table case is put is: all of these 2 bit table lattice record in content, with the reckling in the difference of the mean value of F element in this second colourity 2x2 frequency domain unit and G element; Use 2 record one 2 bit table cases to put, the content that records that this 2 bit table case is put is: all of these 2 bit table lattice record in content, with the reckling in the difference of the H element of this second colourity 2x2 frequency domain unit; Wherein, E element is the upper left corner value of described 2x2 frequency domain unit, and F element is the upper right corner value of described 2x2 frequency domain unit, and G element is the lower left corner value of described 2x2 frequency domain unit, and H element is the lower right corner value of described 2x2 frequency domain unit.
67. image compressing methods as claimed in claim 14, is characterized in that: in step (F), in the time that described 2x2 frequency domain unit is the second nature type, use 4 quantized values that record the E element in described lightness 2x2 frequency domain unit; Use 3 record one 3 bit table cases to put, the content that records that this 3 bit table case is put is: all of these 3 bit table lattice record in content, with the reckling in the difference of the F element of this lightness 2x2 frequency domain unit; Use 3 record one 3 bit table cases to put, the content that records that this 3 bit table case is put is: all of these 3 bit table lattice record in content, with the reckling in the difference of the G element of this lightness 2x2 frequency domain unit; Use 2 record one 2 bit table cases to put, the content that records that this 2 bit table case is put is: all of these 2 bit table lattice record in content, with the reckling in the difference of the H element of this lightness 2x2 frequency domain unit; Wherein, E element is the upper left corner value of described 2x2 frequency domain unit, and F element is the upper right corner value of described 2x2 frequency domain unit, and G element is the lower left corner value of described 2x2 frequency domain unit, and H element is the lower right corner value of described 2x2 frequency domain unit.
68. image compressing methods as claimed in claim 14, is characterized in that: in step (F), in the time that described 2x2 frequency domain unit is the second nature type, use 3 quantized values that record the E element in described the first colourity 2x2 frequency domain unit; Use 3 record one 3 bit table cases to put, the content that records that this 3 bit table case is put is: all of these 3 bit table lattice record in content, with the reckling in the difference of the F element in this first colourity 2x2 frequency domain unit; Use 3 record one 3 bit table cases to put, the content that records that this 3 bit table case is put is: all of these 3 bit table lattice record in content, with the reckling in the difference of the G element in this first colourity 2x2 frequency domain unit; Use 2 record one 2 bit table cases to put, the content that records that this 2 bit table case is put is: all of these 2 bit table lattice record in content, with the reckling in the difference of the H element of this lightness 2x2 frequency domain unit; Wherein, E element is the upper left corner value of described 2x2 frequency domain unit, and F element is the upper right corner value of described 2x2 frequency domain unit, and G element is the lower left corner value of described 2x2 frequency domain unit, and H element is the lower right corner value of described 2x2 frequency domain unit.
69. image compressing methods as claimed in claim 14, is characterized in that: in step (F), in the time that described 2x2 frequency domain unit is the second nature type, use 3 quantized values that record the E element in described the first colourity 2x2 frequency domain unit; Use 3 record one 3 bit table cases to put, the content that records that this 3 bit table case is put is: all of these 3 bit table lattice record in content, with the reckling in the difference of the F element in this first colourity 2x2 frequency domain unit; Use 3 record one 3 bit table cases to put, the content that records that this 3 bit table case is put is: all of these 3 bit table lattice record in content, with the reckling in the difference of the G element in this first colourity 2x2 frequency domain unit; Use 2 record one 2 bit table cases to put, the content that records that this 2 bit table case is put is: all of these 2 bit table lattice record in content, with the reckling in the difference of the H element of this lightness 2x2 frequency domain unit; Wherein, E element is the upper left corner value of described 2x2 frequency domain unit, and F element is the upper right corner value of described 2x2 frequency domain unit, and G element is the lower left corner value of described 2x2 frequency domain unit, and H element is the lower right corner value of described 2x2 frequency domain unit.
70. image compressing methods as claimed in claim 14, is characterized in that: described 2x2 coding unit is 72, and the coding package of described 2x2 coding unit is 36.
The 71. 1 kinds of image compression with fixing compression ratio, decompression systems based on 2x2 coding unit, is characterized in that, described system comprises:
One display module, for showing described image;
One image input equipment, for inputting described image;
One fixing compression ratio image compression device based on 2x2 coding unit, is connected to described image input equipment, for this image is encoded, to generate coding package;
One apparatus for temporary storage, is connected to the described fixing compression ratio image compression device based on 2x2 coding unit, for described coding package;
One fixing compression ratio image decompressing device based on 2x2 coding unit, is connected to described apparatus for temporary storage, for receiving described coding package, and this coding package is decompressed, to produce the 2x2 decoding unit corresponding with described 2x2 coding unit; And
Time schedule controller, is connected to the described fixing compression ratio image decompressing device based on 2x2 coding unit, and for receiving described 2x2 decoding unit, the sequential that produces described display module drives signal and shows data,
Wherein, described fixing compression ratio image compression device first judges that described 2x2 coding unit is artificial type or natural type, with the coding that carries out differential errors coding, quantizes and table look-up of the 2x2 coding unit to this artificial type, and then generation first coding data, and to the 2x2 coding unit of this natural type coding that carries out color gamut conversion, discrete cosine transform, quantizes and table look-up, and then generation the second coded data, again this first coding data or this second coded data are encapsulated, to produce the coding package with fixing compression ratio;
Wherein, described artificial type comprises the first to the 7th artificial type; Wherein the first artificial type list shows wherein four pixels, two horizontal stripes in horizontal direction, and top left corner pixel and upper right corner pixel are approximate, and lower left corner pixel and lower right corner pixel approximate; The second artificial type represents that wherein four pixels are two vertical stripes of vertical direction, and top left corner pixel and lower left corner pixel are approximate, and upper right corner pixel and lower right corner pixel approximate; The 3rd artificial type represents that wherein the two slanted bar lines that four pixels are miter angle direction intersect, and top left corner pixel and lower right corner pixel are approximate, and lower left corner pixel and upper right corner pixel approximate; The the 4th to the 7th artificial type represents wherein the combination with single-point triangular in shape of four pixels; I.e. the 4th artificial type, represents that lower left corner pixel, upper right corner pixel and lower right corner pixel are approximate; The 5th artificial type, represents that top left corner pixel, upper right corner pixel and lower right corner pixel are approximate; Sixth Man is made type, represents that top left corner pixel, lower left corner pixel and upper right corner pixel are approximate; The 7th artificial type, represents that top left corner pixel, lower left corner pixel and lower right corner pixel are approximate.
72. 1 kinds of image decompression methods with fixing compression ratio based on 2x2 coding unit, it is characterized in that: a coding package is decoded, with the 2x2 decoding unit in reconstructed image, described 2x2 decoding unit comprises four pixels that are matrix arrangement, at least one 2x2 decoding unit forms described image, and described image decompression method comprises the following steps:
(A) receive described coding package;
(B) judge according to the main packet header of this coding package whether this coding package is artificial type, if so, judge that this coding package is behaved to make the coding package of type, otherwise, judge the coding package that this coding package is natural type;
(C) the coding package of this artificial type is carried out to inverse quantization, counter table look-up decoding and contrast point error decoding, to produce the first decoded data;
(D) the coding package of this natural type is carried out to inverse quantization and the anti-decoding of tabling look-up, to produce the second decoded data;
(E) this second decoded data is carried out to discrete cosine transform, to produce the 3rd decoded data;
(F) the 3rd decoded data is carried out to color gamut conversion, to obtain the 4th decoded data; And
(G) receive described the first decoded data or the 4th decoded data, and the first decoded data or the 4th decoded data are rebuild, to produce 2x2 decoding unit;
Wherein, described artificial type comprises the first to the 7th artificial type; Wherein the first artificial type list shows wherein four pixels, two horizontal stripes in horizontal direction, and top left corner pixel and upper right corner pixel are approximate, and lower left corner pixel and lower right corner pixel approximate; The second artificial type represents that wherein four pixels are two vertical stripes of vertical direction, and top left corner pixel and lower left corner pixel are approximate, and upper right corner pixel and lower right corner pixel approximate; The 3rd artificial type represents that wherein the two slanted bar lines that four pixels are miter angle direction intersect, and top left corner pixel and lower right corner pixel are approximate, and lower left corner pixel and upper right corner pixel approximate; The the 4th to the 7th artificial type represents wherein the combination with single-point triangular in shape of four pixels; I.e. the 4th artificial type, represents that lower left corner pixel, upper right corner pixel and lower right corner pixel are approximate; The 5th artificial type, represents that top left corner pixel, upper right corner pixel and lower right corner pixel are approximate; Sixth Man is made type, represents that top left corner pixel, lower left corner pixel and upper right corner pixel are approximate; The 7th artificial type, represents that top left corner pixel, lower left corner pixel and lower right corner pixel are approximate.
73. image decompression methods as described in claim 72, is characterized in that, further comprising the steps of in step (B):
(H) in the time being judged to be the coding package of artificial type, judge according to the sub-packet header in described coding package whether it is in the artificial type of the first artificial type to the three, wherein, described the first artificial type is two vertical stripes that described four pixels are vertical direction, the second artificial type is two vertical stripes that described four pixels are vertical direction, and the 3rd artificial type is the two slanted bar lines intersections that described four pixels are miter angle direction; And
(I) otherwise, judge according to this sub-packet header of this coding package and second son packet header whether it is in the artificial type of the 4th artificial type to the seven again, wherein, the artificial type of described the 4th artificial type to the seven is the combinations with single-point triangular in shape of described four pixels.
74. image decompression methods as described in claim 72, is characterized in that: between step (C) and step (D), further comprising the steps of:
(J) for the coding package of described natural type, judge that according to the sub-packet header of this coding package it is the first natural type or the second nature type.
75. image decompression methods as described in claim 74, is characterized in that: in step (E), the transition matrix coefficient of described discrete cosine transform is:
A &OverBar; B &OverBar; C &OverBar; D &OverBar; = 1 1 1 1 1 - 1 1 - 1 1 1 - 1 - 1 1 - 1 - 1 1 E F G H ,
Wherein, E, F, G, H are described the second decoded data, for described the 3rd decoded data.
76. image decompression methods as described in claim 75, is characterized in that: in step (F), carry out YUV to RGB color gamut conversion, the transition matrix coefficient of described YUV to RGB color gamut conversion is:
r g b = 1.0 - 0.5 - 0.5 1.0 0.5 0 1.0 - 0.5 0.5 Y U V ,
Wherein, Y is the lightness of the pixel in described the 3rd decoded data, the colourity that U and V are this pixel; R is the red value of the pixel in the 4th decoded data, the green value that g is this pixel, the blue valve that b is this pixel.
CN201110455138.7A 2011-12-30 2011-12-30 Image compression and decompression method and system based on 2x2 coding unit Active CN102497557B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201110455138.7A CN102497557B (en) 2011-12-30 2011-12-30 Image compression and decompression method and system based on 2x2 coding unit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201110455138.7A CN102497557B (en) 2011-12-30 2011-12-30 Image compression and decompression method and system based on 2x2 coding unit

Publications (2)

Publication Number Publication Date
CN102497557A CN102497557A (en) 2012-06-13
CN102497557B true CN102497557B (en) 2014-10-22

Family

ID=46189339

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201110455138.7A Active CN102497557B (en) 2011-12-30 2011-12-30 Image compression and decompression method and system based on 2x2 coding unit

Country Status (1)

Country Link
CN (1) CN102497557B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5185655A (en) * 1991-10-02 1993-02-09 Tandy Corporation Method and apparatus for encoding full color video data signals and protocol for encoding same
US6575330B2 (en) * 2000-06-09 2003-06-10 L'oreal Container cap
CN101378506A (en) * 2007-08-30 2009-03-04 崴强科技股份有限公司 image compression method

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH11136519A (en) * 1997-10-28 1999-05-21 Ricoh Co Ltd Picture processor

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5185655A (en) * 1991-10-02 1993-02-09 Tandy Corporation Method and apparatus for encoding full color video data signals and protocol for encoding same
US6575330B2 (en) * 2000-06-09 2003-06-10 L'oreal Container cap
CN101378506A (en) * 2007-08-30 2009-03-04 崴强科技股份有限公司 image compression method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
JP特开平11-136519A 1999.05.21

Also Published As

Publication number Publication date
CN102497557A (en) 2012-06-13

Similar Documents

Publication Publication Date Title
EP1697897B1 (en) Image processing
CN101039374B (en) Image lossless compression method
US7657105B2 (en) Alpha image processing
CN101142821A (en) New compression format and apparatus using the new compression format for temporarily storing image data in a frame memory
US7248735B2 (en) Compression and decompression method of image data
CN104142924A (en) Compression method and device for animation picture format
TW202220441A (en) Image compression method and apparatus
ES2371871T3 (en) APPARATUS AND PROCEDURE FOR MULTIPLE DESCRIPTION CODING.
KR102626217B1 (en) Frame buffer compressor and Image processing device comprising the same
JP3462867B2 (en) Image compression method and apparatus, image compression program, and image processing apparatus
CN114189687B (en) Display screen overdrive controller
CN101765009B (en) Method for compressing and uncompressing video image and circuit for LCD overdriving
US8600181B2 (en) Method for compressing images and a format for compressed images
KR102219133B1 (en) Apparatus and method for compact bit-plane data compression
CN102497557B (en) Image compression and decompression method and system based on 2x2 coding unit
TWI446795B (en) Method and apparatus of fixed bit-rate image compensation/decompression based on 2x2 image unit
CN116156185A (en) Image compression and restoration method based on incremental optimization
CN100417181C (en) Image compression and decompression method capable of coding and decoding pixel data
US20090304073A1 (en) Systems and Methods for the Bandwidth Efficient Processing of Data
JPH08139936A (en) Coding method
JP3709381B2 (en) Color image compression method
US20110243437A1 (en) System and method for image compression
US10002586B1 (en) Compression of display data stored locally on a GPU
CN106878740A (en) Image compression method and image compression system suitable for liquid crystal display drive
US20150245029A1 (en) Image processing system and method

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant