[go: up one dir, main page]

CN100558166C - A kind of encoding and decoding method of graphic terminal interface - Google Patents

A kind of encoding and decoding method of graphic terminal interface Download PDF

Info

Publication number
CN100558166C
CN100558166C CN 200610112819 CN200610112819A CN100558166C CN 100558166 C CN100558166 C CN 100558166C CN 200610112819 CN200610112819 CN 200610112819 CN 200610112819 A CN200610112819 A CN 200610112819A CN 100558166 C CN100558166 C CN 100558166C
Authority
CN
China
Prior art keywords
current
encoding
pixel
run length
pixel value
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.)
Expired - Fee Related
Application number
CN 200610112819
Other languages
Chinese (zh)
Other versions
CN1925612A (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.)
Dongguan Lianzhou Electronic Technology Co Ltd
Original Assignee
Institute of Computing Technology of CAS
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 Institute of Computing Technology of CAS filed Critical Institute of Computing Technology of CAS
Priority to CN 200610112819 priority Critical patent/CN100558166C/en
Publication of CN1925612A publication Critical patent/CN1925612A/en
Application granted granted Critical
Publication of CN100558166C publication Critical patent/CN100558166C/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Compression Of Band Width Or Redundancy In Fax (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)
  • Compression, Expansion, Code Conversion, And Decoders (AREA)

Abstract

The invention discloses a graphical terminal interface coding method. The method selects a reference position of a current encoding position and uniformly sets position marks. When encoding the current encoding position, the pixel values of the reference position are searched first. When the pixel value of the pixel point at the current coding position does not appear at the reference position, the position mark of the current coding position is coded into a code word, the code word is coded into a code stream, and then the pixel value of the pixel point at the current coding position is coded into the code stream. When the pixel value of the pixel point at the current coding position appears at the reference position, the position mark of the reference position is coded into a code word, the run length is searched backwards, the run length is coded into the code word, and the code word is coded into a code stream. The coding and decoding algorithm of the graphical terminal interface is simple, the coding efficiency is high, the operation amount is small, the requirement on the computing power of an application server and a terminal is not high, and the graphical terminal interface is suitable for terminal equipment with weak computing power.

Description

一种图形终端界面的编码和解码方法 A kind of encoding and decoding method of graphic terminal interface

技术领域 technical field

本发明涉及图形终端应用协议中的界面数据传输技术领域,更具体地说,本发明涉及一种图形终端界面数据传输中的编码和解码方法。The present invention relates to the technical field of interface data transmission in the graphic terminal application protocol, and more specifically, the present invention relates to a coding and decoding method in the graphic terminal interface data transmission.

背景技术 Background technique

随着网络基础设施和互联网络的迅速发展,各种终端设备包括PC、PDA、NC等的使用日益普及。使用网络终端访问网络上的各种应用已经成为人们获取信息和各种网络服务的重要方式。在各种访问方式中,通过图形终端应用协议使用网络上的各种图形界面的应用程序逐渐成为一种趋势,采用这种方式,可以大大降低各种软件和硬件的维护和管理成本。With the rapid development of network infrastructure and Internet, the use of various terminal equipment including PC, PDA, NC, etc. is becoming more and more popular. Using a network terminal to access various applications on the network has become an important way for people to obtain information and various network services. Among various access methods, it has gradually become a trend to use various graphical interface applications on the network through the graphical terminal application protocol. Using this method can greatly reduce the maintenance and management costs of various software and hardware.

在图形终端应用中,应用程序存放在终端服务器上,终端通过网络执行服务器上的应用程序。如图1所示,应用程序的图形界面在终端服务器上被绘制到虚屏幕中。终端同终端服务器之间的图形界面交互主要通过虚屏幕完成。终端服务器检查虚屏幕状态,如果虚屏幕的某些区域(图1中的阴影部分)数据发生改变,则终端服务器每隔固定时间间隔向终端传送发生变化区域(一般为一个矩形区域)的虚屏幕数据,并在终端屏幕上显示。虚屏幕的数据一般以BMP格式存放,顺序描述了虚屏幕中各个象素的象素值,象素值的位数(BPP)可以设置为8位、16位、24位或32位。In the graphic terminal application, the application program is stored on the terminal server, and the terminal executes the application program on the server through the network. As shown in Figure 1, the graphical interface of the application program is drawn into the virtual screen on the terminal server. The graphic interface interaction between the terminal and the terminal server is mainly completed through the virtual screen. The terminal server checks the status of the virtual screen. If the data in some areas of the virtual screen (the shaded part in Figure 1) changes, the terminal server transmits the virtual screen of the changed area (usually a rectangular area) to the terminal at regular intervals. data and display it on the terminal screen. The data of the virtual screen is generally stored in BMP format, which sequentially describes the pixel value of each pixel in the virtual screen, and the number of bits (BPP) of the pixel value can be set to 8 bits, 16 bits, 24 bits or 32 bits.

在图1所示的图形终端应用中,通过网络将屏幕数据从终端服务器向终端传输,对屏幕数据进行高效快速的编码压缩以便减少网络的数据传输量,则是图形终端应用协议的一项关键技术。在图形终端应用过程中,应用服务器上的图形界面数据压缩一般要求是无损压缩过程,数据格式为BMP格式。由于终端应用服务器同时处理多个用户图形界面,因此要求压缩算法必须简单快速,而终端则可能包括从PC到PDA的各种设备,这就要求解码算法也要尽可能的简单。另外在图形终端应用中,图形界面的数据传输将占用大量的网络带宽,提供尽可能高的压缩率也是压缩算法的一个基本要求。In the graphics terminal application shown in Figure 1, the screen data is transmitted from the terminal server to the terminal through the network, and efficient and fast encoding and compression of the screen data to reduce the amount of network data transmission is a key to the graphics terminal application protocol technology. In the graphic terminal application process, the graphic interface data compression on the application server generally requires a lossless compression process, and the data format is BMP format. Since the terminal application server handles multiple user graphical interfaces at the same time, the compression algorithm must be simple and fast, and the terminal may include various devices from PC to PDA, which requires the decoding algorithm to be as simple as possible. In addition, in the graphic terminal application, the data transmission of the graphic interface will occupy a large amount of network bandwidth, and providing the highest possible compression rate is also a basic requirement of the compression algorithm.

发明内容 Contents of the invention

本发明的目的在于为BMP格式的图形界面数据提供一种简单快速的图形终端界面的编码和解码方法,并且尽可能提高压缩率。The purpose of the present invention is to provide a simple and fast encoding and decoding method for graphic interface data in BMP format, and improve the compression rate as much as possible.

为了实现上述目的,本发明提供一种图形终端界面编码方法,用于对终端服务器上矩形区域的虚屏幕数据进行编码,以便通过网络传输至终端。该方法包括:In order to achieve the above object, the present invention provides a graphical terminal interface encoding method, which is used to encode the virtual screen data of the rectangular area on the terminal server, so as to be transmitted to the terminal through the network. The method includes:

选择当前编码位置的参考位置,并对当前编码位置和参考位置统一设置位置标记;所述参考位置在编码顺序中位于当前编码位置之前;Selecting the reference position of the current encoding position, and uniformly setting a position mark for the current encoding position and the reference position; the reference position is located before the current encoding position in the encoding sequence;

对某一当前编码位置进行编码时,首先搜索其参考位置的象素值,并比较当前编码位置与参考位置的象素点的象素值,然后根据两种情况进行编码:When encoding a certain current encoding position, first search for the pixel value of its reference position, and compare the pixel values of the current encoding position and the pixel point of the reference position, and then encode according to two situations:

当前编码位置象素点的象素值未在其参考位置出现时,将当前编码位置的位置标记编入当前编码位置象素点的码字;将该码字编入码流,并随后将当前编码位置象素点的象素值编入码流;When the pixel value of the pixel point at the current encoding position does not appear at its reference position, the position mark of the current encoding position is encoded into the code word of the pixel point at the current encoding position; this code word is encoded into the code stream, and then the current The pixel value of the pixel at the encoding position is encoded into the code stream;

当前编码位置象素点的象素值在其参考位置出现时,将参考位置的位置标记编入当前编码位置象素点的码字,并向后搜索与当前编码位置象素点具有相同象素值的象素点的游程长度,并将该游程长度编入当前编码位置象素点的码字;将该码字编入码流;When the pixel value of the pixel point of the current coding position appears at its reference position, the position mark of the reference position is compiled into the codeword of the pixel point of the current coding position, and the pixel point with the same pixel point of the current coding position is searched backward. The run length of the pixel point of value, and this run length is coded into the code word of the pixel point of the current coding position; This code word is coded into the code stream;

对所述矩形区域从起始位置开始按顺序按前述方法进行编码,直至完成整个矩形区域的编码。在编码时,所述矩形区域的起始位置为该区域的左上角的象素点,其编码顺序为从左至右从上至下。The rectangular area is encoded sequentially from the starting position according to the aforementioned method until the encoding of the entire rectangular area is completed. When encoding, the starting position of the rectangular area is the pixel point in the upper left corner of the area, and the encoding sequence is from left to right and from top to bottom.

所述当前编码位置的参考位置分别为当前编码位置的左前一个位置、左上两个位置、正上两个位置、右上两个位置。所述当前编码位置及其参考位置的位置标记可用三个连续的二进制位表示,位于所述码字的高三位。The reference positions of the current encoding position are respectively one position to the left, two positions to the upper left, two positions directly to the upper side, and two positions to the upper right of the current encoding position. The position marks of the current encoding position and its reference position can be represented by three consecutive binary bits, which are located in the upper three bits of the codeword.

所述当前编码位置及其参考位置的位置标记分别为:左前一个位置为011,左上第一个位置为110,左上第二个位置为010,正上第一个位置为101,正上第二个位置为001,右上第一个位置为100,右上第二个位置为000,当前编码位置为111。The position marks of the current encoding position and its reference position are respectively: the first position on the left is 011, the first position on the upper left is 110, the second position on the left is 010, the first position on the upper left is 101, and the second position on the upper left is 010. The first position is 001, the first position on the upper right is 100, the second position on the upper right is 000, and the current encoding position is 111.

对参考位置象素值的搜索按照预定的顺序进行,当搜索过程中发现一个参考位置的象素值与当前编码位置的象素值相同时即停止搜索。The search for the pixel value of the reference position is carried out in a predetermined order, and when the pixel value of a reference position is found to be the same as the pixel value of the current encoding position during the search, the search is stopped.

当前编码位置象素点的象素值在其参考位置出现时,所述当前编码位置象素点的码字还包括一游程长度标记位,用于标识游程长度在码字中所占据的位数。所述位置标记、游程长度标志位和游程长度在码字中顺序紧邻排列。When the pixel value of the pixel point at the current encoding position occurs at its reference position, the code word of the pixel point at the current encoding position also includes a run length flag bit, which is used to identify the number of bits occupied by the run length in the code word . The position mark, the run length flag bit and the run length are arranged next to each other in the code word.

当前编码位置象素点的象素值在其参考位置出现时,所述当前编码位置缘素点的码字由一个或两个字节组成,其中码字第一个字节高三位为参考位置的位置标记,随后是游程长度标记位,根据游程长度标记位的不同状态,采用第一个字节的低四位或该第一个字节的低四位和随后的一个字节为游程长度。When the pixel value of the pixel point at the current encoding position appears at its reference position, the code word of the pixel point at the current encoding position is composed of one or two bytes, wherein the high three bits of the first byte of the code word are the reference position The position mark, followed by the run length mark bit, according to the different states of the run length mark bit, the lower four bits of the first byte or the lower four bits of the first byte and the following byte are used as the run length .

当前编码位置象素点的象素值未在其参考位置出现时,码字由一个字节组成,其中该字节的高三位为当前编码位置的位置标记,其它位为保留位。When the pixel value of the pixel point at the current coding position does not appear at its reference position, the code word consists of one byte, wherein the upper three bits of the byte are the position mark of the current coding position, and the other bits are reserved bits.

所述矩形区域的调色板象素大于16。The palette pixels of the rectangular area are greater than 16.

本发明提供一种用于对前述编码方法进行编码后的数据进行解码的图形终端界面解码方法,该方法包括:The present invention provides a graphic terminal interface decoding method for decoding data encoded by the aforementioned encoding method, the method comprising:

读取码流中当前解码位置的码字,所述当前解码位置与编码方法中的当前编码位置对应;Reading the codeword at the current decoding position in the code stream, the current decoding position corresponds to the current encoding position in the encoding method;

读取该码字中的位置标记,然后根据两种情况进行解码:The position markers in the codeword are read and then decoded according to two conditions:

如果该读取的位置标记为编码方法中当前编码位置的位置标记,则将码流中紧随码字的象素值作为当前解码位置象素点的象素值;If the read position mark is the position mark of the current encoding position in the encoding method, then the pixel value following the codeword in the code stream is used as the pixel value of the current decoding position pixel point;

如果该读取的位置标记为编码方法中一个参考位置的位置标记,则读取该码字中的游程长度n,将从当前解码位置开始的n个连续象素点的象素值设置为该位置标记对应的参考位置的象素值;If the read position mark is the position mark of a reference position in the encoding method, then read the run length n in the codeword, and set the pixel values of n consecutive pixel points starting from the current decoding position as the The pixel value of the reference position corresponding to the position marker;

按顺序读取码流中的码字,直至完成整个数据的解码。Read the code words in the code stream in order until the entire data is decoded.

在读取所述码字中的游程长度时,要根据码字中的游程长度位置标记的状态,读取码流中不同长度的位作为游程长度。When reading the run length in the code word, according to the state of the run length position mark in the code word, read bits of different lengths in the code stream as the run length.

本发明的图形终端界面的编码方法属于无损编码,该编码方法算法简单,对应用服务器和终端的计算能力要求都不高,而且相应的解码算法也相对简单,可以明显减少解码时的运算量,适合于计算能力较弱的移动终端设备。本发明的编码方法在编码过程中考虑图形界面的二维信息,被编码值可以根据当前位置的左前、左上、正上以及右上的7个点进行参考编码,减少编码图形界面数据的相关性,提高编码效率。The encoding method of the graphical terminal interface of the present invention belongs to lossless encoding, the encoding method has a simple algorithm, and does not require high computing power of the application server and the terminal, and the corresponding decoding algorithm is relatively simple, which can significantly reduce the amount of calculation during decoding. It is suitable for mobile terminal equipment with weak computing power. The coding method of the present invention considers the two-dimensional information of the graphical interface during the coding process, and the coded value can be reference coded according to the 7 points of the current position, the left front, the upper left, the upper right, and the upper right, so as to reduce the correlation of the encoded graphical interface data, Improve coding efficiency.

附图说明 Description of drawings

图1是图形终端应用中虚屏幕数据的传输示意图;Fig. 1 is a schematic diagram of transmission of virtual screen data in a graphics terminal application;

图2是本发明的编码方法中选择当前编码位置的参考位置的一个实施例;Fig. 2 is an embodiment of selecting the reference position of the current encoding position in the encoding method of the present invention;

图3是对图2所示的当前编码位置及其参考位置的进行位置标记设置的一个实施例;Fig. 3 is an embodiment of carrying out position mark setting to the current encoding position shown in Fig. 2 and its reference position;

图4是本发明的编码方法中码字结构的示意图;其中图4(a)是对当前编码位置的直接编码,图4(b)是当前编码位置相对于参考位置的间接编码。Fig. 4 is the schematic diagram of codeword structure in the coding method of the present invention; Wherein Fig. 4 (a) is the direct coding to current coding position, Fig. 4 (b) is the indirect coding of current coding position relative to reference position.

具体实施方式 Detailed ways

下面结合附图和具体实施方式对本发明作进一步详细描述。The present invention will be further described in detail below in conjunction with the accompanying drawings and specific embodiments.

在图形终端应用协议中,当终端服务器检测到虚屏幕区域发生改变后,在预设的计时器超时时,对发生变化区域的BMP数据采用本发明提供的方法进行编码,其中编码区域一般为矩形,描述参数为一四元数组(x,y,w,h),其中x和y表示此区域的左上角在虚屏幕上的坐标位置,w和h表示此区域的宽度和长度。在图形界面的绘制过程中,目前有两种典型的应用程序接口X和Windows,在这两种情况下,可以通过在其接口上加入钩子(Hook)函数,也就是对这些接口再进行一次包装,就可以记录下应用程序对屏幕的所有操作,而这些操作所涉及的区域就是发生变化的区域。通过钩子(Hook)函数即可获得编码区域的描述参数(x,y,w,h)。In the graphic terminal application protocol, when the terminal server detects that the virtual screen area changes, when the preset timer times out, the method provided by the present invention is used to encode the BMP data in the changed area, wherein the encoding area is generally rectangular , the description parameter is a quaternion array (x, y, w, h), where x and y indicate the coordinate position of the upper left corner of this area on the virtual screen, and w and h indicate the width and length of this area. In the drawing process of the graphical interface, there are currently two typical application program interfaces X and Windows. In these two cases, you can add a hook (Hook) function to the interface, that is, to wrap these interfaces again. , you can record all the operations of the application on the screen, and the areas involved in these operations are the changed areas. The description parameters (x, y, w, h) of the coding region can be obtained through the hook (Hook) function.

在本发明中,对矩形编码区域的编码是从其左上角的象素点开始,按照从左至右、从上至下的顺序进行。In the present invention, the coding of the rectangular coding area starts from the pixel point at the upper left corner thereof, and proceeds in order from left to right and from top to bottom.

在编码的过程中,对当前编码位置象素点的编码需要参考其参考位置的编码,因此在这里首先需要定义当前编码位置的参考位置。如图2所示,在本发明的一个实施例中,共选择了7个参考位置,其中图2中的7号位置为当前编码位置,0~6号位置为当前编码位置的参考位置。图2中的参考位置分别为当前编码位置(7号)的左前一个位置(1号)、左上两个位置(2和4号)、正上两个位置(0和5号)、右上两个位置(3和6号)。从图2可知,参考位置在编码顺序中位于当前编码位置之前。In the process of encoding, the encoding of the pixel point at the current encoding position needs to refer to the encoding of its reference position, so here it is first necessary to define the reference position of the current encoding position. As shown in Fig. 2, in one embodiment of the present invention, a total of 7 reference positions are selected, wherein No. 7 position in Fig. 2 is the current encoding position, and positions 0-6 are the reference positions of the current encoding position. The reference positions in Fig. 2 are respectively the left front position (No. 1), the upper left two positions (No. 2 and 4), the two positions directly above (No. 0 and 5), and the upper right two positions of the current encoding position (No. 7). location (No. 3 and 6). It can be seen from Fig. 2 that the reference position is located before the current encoding position in the encoding order.

参考位置选择结束后,需要对当前编码位置和参考位置统一进行位置标记,以便在编码时将该位置标记编入码字中,而且在解码时也需要根据码字中的该位置标记来判断该码字是对当前编码位置的直接编码还是相对于参考位置的编码。位置标记的作用将在下文中更详细的说明。图3示出了本发明对参考位置进行位置标记的一个实施例,与图2的位置相对应,当前编码位置的位置标记为111,当前编码位置的左前一个位置为011,左上第一个位置为110,左上第二个位置为010,正上第一个位置为101,正上第二个位置为001,右上第一个位置为100,右上第二个位置为000。After the selection of the reference position is completed, the current encoding position and the reference position need to be marked uniformly, so that the position mark can be encoded into the codeword during encoding, and it is also necessary to judge the position mark according to the position mark in the codeword during decoding. Whether the codeword is a direct encoding of the current encoding position or an encoding relative to a reference position. The role of position markers will be explained in more detail below. Fig. 3 shows an embodiment of the present invention to mark the position of the reference position, corresponding to the position in Fig. 2, the position mark of the current encoding position is 111, the position before the left of the current encoding position is 011, and the first position on the upper left It is 110, the second upper left position is 010, the first upper right position is 101, the second upper right position is 001, the first upper right position is 100, and the second upper right position is 000.

当前编码位置及其参考位置的位置标记设置完成后,即可对待编码的矩形区域进行编码。本发明的编码策略为:After the position marks of the current encoding position and its reference position are set, the rectangular area to be encoded can be encoded. The encoding strategy of the present invention is:

对某一当前编码位置进行编码时,首先要搜索其参考位置的象素值,一种示例性的搜索顺序为区域中当前编码位置的象素值依图2中的标号顺序从0到6依次比较。然后根据(A)和(B)两种情况进行编码:When encoding a certain current coding position, first search for the pixel value of its reference position, an exemplary search sequence is that the pixel values of the current coding position in the region are in sequence from 0 to 6 according to the labeling sequence in Figure 2 Compare. Then encode according to two cases (A) and (B):

(A)搜索结束后,当前编码位置象素点的象素值未在其参考位置出现,则将当前编码位置的位置标记编入当前编码位置象素点的码字;将该码字编入码流,并随后将当前编码位置象素点的象素值编入码流。(A) after the search finishes, the pixel value of the current coding position pixel point does not appear at its reference position, then the position mark of the current coding position is coded into the code word of the current coding position pixel point; this code word is coded into code stream, and then encode the pixel value of the pixel at the current coding position into the code stream.

在该种情况的一个实施例中,对当前编码位置象素点的编码如图4(a)所示,包括码字和当前编码位置象素点的象素值两部分。其中在图4(a)所示的实施例中,码字占用一个字节,位置标记位于码字的高三位t765,即码字的5~7位,对应于前述的对当前编码位置设置的位置标记可知t765=111。码字中的其它位t43210在该编码方案中为保留位,在一个实施例中它们均被置零。在码字随后的BPP/8个字节存放当前编码位置象素点的象素值,其中BPP为每个象素点的BMP数据位数,且BPP=8/16/24/32。In an embodiment of this case, the encoding of the pixel point at the current encoding position is shown in FIG. 4(a), which includes two parts, the code word and the pixel value of the pixel point at the current encoding position. Wherein in the embodiment shown in Fig. 4 (a), the code word occupies one byte, and the position mark is located at the upper three bits t 765 of the code word, that is, the 5-7 bits of the code word, corresponding to the aforementioned setting of the current encoding position It can be known that t 765 =111. The other bits t 43210 in the codeword are reserved bits in this encoding scheme and in one embodiment they are all set to zero. The BPP/8 bytes following the code word store the pixel value of the pixel at the current encoding position, where BPP is the number of BMP data bits for each pixel, and BPP=8/16/24/32.

(B)在搜索过程中,当前编码位置象素点的象素值在某一参考位置出现时,则停止搜索并将参考位置的位置标记编入当前编码位置象素点的码字,然后向后搜索与当前编码位置象素点具有相同象素值的象素点的游程长度,并将该游程长度编入当前编码位置象素点的码字;将该码字编入码流。(B) in the search process, when the pixel value of the pixel point of the current encoding position occurs at a certain reference position, then stop searching and code the position mark of the reference position into the code word of the pixel point of the current encoding position, and then send Then search for the run length of the pixel point with the same pixel value as the pixel point at the current encoding position, and encode the run length into the code word of the pixel point at the current encoding position; encode the code word into the code stream.

在该种情况的一个实施例中,对当前编码位置象素点的编码码字如图4(b)所示,码字的高三位t765存放与搜索到的参考位置的位置标记,并在该字节的低四位t3210存放游程长度。为了扩展该码字可存放的游程长度的范围,可将码字中的第四位t4作为游程长度标记位。当游程长度标记位t4被设置为0时,码字长度为一个字节,该字节的低四位表t3210示游程长度,可表示的最大游程为15;当游程长度标记位被设置为1时,码字长度为两个字节,码字中第一个字节的低四位t3210与随后的一个字节共12位表示游程长度,可表示的最大游程为4095。In an embodiment of this situation, as shown in Figure 4 (b) to the coding codeword of current coded position pixel point, the upper three t 765 of codeword are stored and searched for the position mark of the reference position, and in The lower four bits t 3210 of this byte store the run length. In order to expand the range of the run length that can be stored in the code word, the fourth bit t4 in the code word can be used as the run length mark bit. When the run-length flag bit t4 was set to 0, the codeword length was one byte, and the lower four bits of the byte represented the run length in t 3210 , and the maximum run length that could be represented was 15; when the run-length flag bit was set When it is 1, the length of the code word is two bytes, the lower four bits t 3210 of the first byte in the code word and the following byte represent the length of the run length with a total of 12 bits, and the maximum run length that can be represented is 4095.

对矩形区域从起始位置开始按顺序按照上述本发明的编码方法进行编码,并顺序编入码流,直至完成整个矩形区域的编码。The rectangular area is encoded sequentially from the starting position according to the above-mentioned encoding method of the present invention, and is sequentially encoded into the code stream until the encoding of the entire rectangular area is completed.

下面以一个具体的16×16象素的矩形块为例对本发明的编码方法进一步详细说明。如表1所示,第1列中的数字表示矩形块的行,第1行中的数字表示矩形块的列。表1中其它的元素表示象素,其数值表示该象素点的象素值。象素可用其对应的行数和列数作为坐标来表示,例如,第0行第8列的象素用(0,8)表示。在本实施例中,BPP=32,即象素值用四个字节表示。The encoding method of the present invention will be further described in detail below by taking a specific rectangular block of 16*16 pixels as an example. As shown in Table 1, the number in the first column indicates the row of the rectangular block, and the number in the first row indicates the column of the rectangular block. Other elements in Table 1 represent pixels, and their values represent the pixel value of the pixel point. A pixel can be represented by its corresponding row number and column number as coordinates, for example, the pixel in row 0 and column 8 is represented by (0, 8). In this embodiment, BPP=32, that is, the pixel value is represented by four bytes.

表1Table 1

Figure C20061011281900091
Figure C20061011281900091

编码从(0,0)象素开始。从图2所示的参考位置可知,在表1所示的矩形区域中,(0,0)象素无参考位置,因此(0,0)象素点的象素值未能在参考位置出现,于是码字的高三位t765为当前编码位置的位置标记,在图3中可知该位置标记为111。码字中的其它位被置0,即码字为11100000。将该码字编入码流后,紧跟码字,将(0,0)象素的象素值(00000000,00000000,00000000,00000000)编入码流,完后(0,0)象素的编码。Encoding starts from (0,0) pixel. From the reference position shown in Figure 2, it can be seen that in the rectangular area shown in Table 1, the (0,0) pixel has no reference position, so the pixel value of the (0,0) pixel point cannot appear at the reference position , so the upper three bits t 765 of the codeword are the position mark of the current encoding position, and it can be seen that the position mark is 111 in FIG. 3 . The other bits in the codeword are set to 0, that is, the codeword is 11100000. After the code word is encoded into the code stream, following the code word, the pixel value (00000000, 00000000, 00000000, 00000000) of the (0,0) pixel is encoded into the code stream, and the (0, 0) pixel encoding.

然后,(0,1)象素成为当前编码位置,(0,0)象素为(0,1)象素的参考位置,且(0,1)象素与(0,0)象素的象素值相同。从图3的位置标记可知,(0,0)象素作为(0,1)象素的参考位置时,其位置标记为011,因此将011编入码字的高三位。从(0,1)象素到(0,7)象素连续7个象素具有具有相同的象素值,因此游程长度为7,该游程长度小于15,因此码字中的游程程度标志位置零,在码字中的低四位表示游程长度0111。最终,从(0,1)象素到(0,7)象素的编码的码字为01100111。Then, (0,1) pixel becomes the current encoding position, (0,0) pixel is the reference position of (0,1) pixel, and (0,1) pixel and (0,0) pixel The pixel values are the same. It can be seen from the position mark in FIG. 3 that when the (0,0) pixel is used as the reference position of the (0,1) pixel, its position mark is 011, so 011 is coded into the upper three bits of the code word. From (0,1) pixel to (0,7) pixel, 7 consecutive pixels have the same pixel value, so the run length is 7, and the run length is less than 15, so the run length mark position in the codeword Zero, the lower four bits in the codeword represent a runlength of 0111. Finally, the encoded codeword from (0,1) pixel to (0,7) pixel is 01100111.

然后,(0,8)象素成为当前编码位置,继续按照本发明的编码方法进行编码。Then, the (0, 8) pixel becomes the current coding position, and the coding continues according to the coding method of the present invention.

当(2,4)象素成为当前编码位置时,在其参考位置上,(1,4)和(1,5)象素的象素值与(2,4)相同均为3。因为参考位置的搜索是从图2中的从0到6的顺序进行的,因此首先搜索到(1,4)象素的象素值与当前编码位置(2,4)象素的象素值相同,此时即可停止搜索。由图3可知,(1,4)象素作为(2,4)象素的参考位置时,其位置标记为101,因此将101编入当前编码的码字中的高三位。从(2,4)象素到(2,15)象素连续12个象素具有具有相同的象素值,因此游程长度为12,该游程长度小于15,因此码字中的游程程度标志位置零,在码字中的低四位表示游程长度1100。最终,从(2,4)象素到(2,15)象素的编码的码字为10101100。When the (2,4) pixel becomes the current coding position, at its reference position, the pixel values of the (1,4) and (1,5) pixels are the same as (2,4) and both are 3. Because the search of the reference position is carried out in the order from 0 to 6 in Fig. 2, the pixel value of the (1,4) pixel and the pixel value of the current coding position (2,4) pixel are first searched Likewise, the search can be stopped at this point. It can be seen from FIG. 3 that when the (1,4) pixel is used as the reference position of the (2,4) pixel, its position is marked as 101, so 101 is coded into the upper three bits of the currently encoded codeword. From (2, 4) pixel to (2, 15) pixel, 12 consecutive pixels have the same pixel value, so the run length is 12, and the run length is less than 15, so the run length mark position in the codeword Zero, the lower four bits in the codeword represent a runlength of 1100. Finally, the encoded codeword from (2, 4) pixels to (2, 15) pixels is 10101100.

当(13,0)象素成为当前编码位置时,其象素值为17,在其参考位置没有相同的象素值,于是码字的高三位t765为当前编码位置的位置标记,在图3中可知该位置标记为111。码字中的其它位被置0,即码字为11100000。将该码字编入码流后,紧跟码字,将(13,0)象素的象素值(00000000,00000000,00000000,00010001)编入码流,完后(13,0)象素的编码。When the (13,0) pixel becomes the current coding position, its pixel value is 17, and there is no identical pixel value at its reference position, so the upper three bits t 765 of the codeword are the position mark of the current coding position, as shown in Fig. 3, it can be seen that the position is marked as 111. The other bits in the codeword are set to 0, that is, the codeword is 11100000. After the code word is encoded into the code stream, following the code word, the pixel value (00000000, 00000000, 00000000, 00010001) of the (13, 0) pixel is encoded into the code stream, and the (13, 0) pixel encoding.

然后,(13,1)象素成为当前编码位置,在其参考位置上,(13,0)象素与当前编码位置(13,1)象素的象素值相同。从图3的位置标记可知,(13,0)象素作为(13,1)象素的参考位置时,其位置标记为011,因此将011编入码字的高三位。从(13,1)象素到(15,15)象素连续47个象素具有具有相同的象素值,因此游程长度为47,该游程长度大于15,因此码字中的游程程度标志位置为1,在码字中的低四位以及随后的一个字节共12为表示游程长度(0000 00101111)。最终,从(13,1)象素到(15,15)象素的编码的码字为(01110000 00101111)。Then, the (13, 1) pixel becomes the current coding position, and at its reference position, the (13, 0) pixel has the same pixel value as the current coding position (13, 1) pixel. It can be seen from the position mark in Fig. 3 that when the (13,0) pixel is used as the reference position of the (13,1) pixel, its position mark is 011, so 011 is coded into the upper three bits of the code word. From (13, 1) pixel to (15, 15) pixel, 47 consecutive pixels have the same pixel value, so the run length is 47, and the run length is greater than 15, so the run length mark position in the codeword is 1, the lower four bits in the codeword and the subsequent byte are 12 to represent the run length (0000 00101111). Finally, the encoded codeword from (13,1) pixel to (15,15) pixel is (01110000 00101111).

最后,按照本发明的方法进行编码后的整个矩形块的码流为:共952(bit)。Finally, the code stream of the entire rectangular block encoded according to the method of the present invention is: a total of 952 (bit).

11100000,00000000,00000000,00000000,00000000,01100111,11100000, 00000000, 00000000, 00000000, 00000000, 01100111,

11100000,00000000,00000000,00000000,00000001,01100111,11100000, 00000000, 00000000, 00000000, 00000001, 01100111,

11100000,00000000,00000000,00000000,00000010,01100011,11100000, 00000000, 00000000, 00000000, 00000010, 01100011,

11100000,00000000,00000000,00000000,00000011,01101001,11100000, 00000000, 00000000, 00000000, 00000011, 01101001,

11100000,00000000,00000000,00000000,00000100,01100101,11100000, 00000000, 00000000, 00000000, 00000100, 01100101,

10101100,10101100,

11100000,00000000,00000000,00000000,00000101,01100011,11100000, 00000000, 00000000, 00000000, 00000101, 01100011,

11000100,11000100,

11100000,00000000,00000000,00000000,00000110,01100111,11100000, 00000000, 00000000, 00000000, 00000110, 01100111,

11100000,00000000,00000000,00000000,00000111,01100110,11100000, 00000000, 00000000, 00000000, 00000111, 01100110,

10001000,10001000,

11100000,00000000,00000000,00000000,00001000,01100011,11100000, 00000000, 00000000, 00000000, 00001000, 01100011,

01000100,01000100,

11100000,00000000,00000000,00000000,00001001,01100111,11100000, 00000000, 00000000, 00000000, 00001001, 01100111,

11100000,00000000,00000000,00000000,00001010,01100111,11100000, 00000000, 00000000, 00000000, 00001010, 01100111,

11100000,00000000,00000000,00000000,00001011,01100011,11100000, 00000000, 00000000, 00000000, 00001011, 01100011,

11100000,00000000,00000000,00000000,00001100,01100011,11100000, 00000000, 00000000, 00000000, 00001100, 01100011,

10101000,10101000,

11100000,00000000,00000000,00000000,00001101,01100011,11100000, 00000000, 00000000, 00000000, 00001101, 01100011,

11100000,00000000,00000000,00000000,00001110,01100011,11100000, 00000000, 00000000, 00000000, 00001110, 01100011,

11100000,00000000,00000000,00000000,00001111,01110000,11100000, 00000000, 00000000, 00000000, 00001111, 01110000,

00010001,00010001,

11100000,00000000,00000000,00000000,00010000,01110000,11100000, 00000000, 00000000, 00000000, 00010000, 01110000,

00010101,01000110,10110000,00100010,00010101, 01000110, 10110000, 00100010,

11100000,00000000,00000000,00000000,00010001,01110000,11100000, 00000000, 00000000, 00000000, 00010001, 01110000,

00101111,00101111,

在了解本发明上述的编码方法之后,相应的解码方法也就是很明显的。在对码流进行解码时,读取码流中的一个码字(或者说一个字节),对码字中的位置标记进行判断,例如在前述的实施例中,该位置标记位于码字的高三位。当该位置标记是当前编码的位置标记时,在前述的实施例中即为111,则将码流中紧随码字的象素值作为当前解码位置象素点的象素值。当该位置标记为一个参考位置的位置标记时,在前述的实施例中为图3中定义的各参考位置的位置标记,则读取该码字中的游程长度n,将从当前解码位置开始的n个连续象素点的象素值设置为该位置标记对应的参考位置的象素值。当在码字中定义了游程长度标记位时,还要根据码字中的游程长度位置标记的状态,读取码流中不同长度的位作为游程长度。After understanding the above-mentioned encoding method of the present invention, the corresponding decoding method is also very obvious. When decoding the code stream, read a code word (or a byte) in the code stream, and judge the position mark in the code word. For example, in the foregoing embodiments, the position mark is located at the end of the code word High three. When the position mark is the position mark of the current encoding, which is 111 in the aforementioned embodiment, then the pixel value following the codeword in the code stream is taken as the pixel value of the pixel point at the current decoding position. When the position mark is a position mark of a reference position, in the aforementioned embodiment, it is the position mark of each reference position defined in Fig. 3, then reading the run length n in the codeword will start from the current decoding position The pixel values of n consecutive pixel points in are set as the pixel values of the reference position corresponding to the position marker. When the run length flag bit is defined in the code word, bits of different lengths in the code stream are read as the run length according to the state of the run length position mark in the code word.

相应于前述的编码实施例,在一个解码实施例中,可采用如下的解码步骤:Corresponding to the aforementioned encoding embodiment, in a decoding embodiment, the following decoding steps can be used:

(1)取码字的高三位;(1) get the upper three bits of the codeword;

(2)如果码字的高三位的值为当前编码位置(也就是当前解码位置)的位置标记,即图3中的111,则当前位置的象素值从下一个字节开始;(2) if the value of the upper three bits of the codeword is the position marker of the current encoding position (that is, the current decoding position), i.e. 111 among Fig. 3, then the pixel value of the current position begins from the next byte;

(3)如果码字的高三位的值为当前编码位置(也就是当前解码位置)的参考位置的位置标记,即图3中除111外的其它值。继续读取码字中与位置标记相邻的游程长度标志位,即码字中的第四位t4(3) If the value of the upper three bits of the codeword is the position mark of the reference position of the current encoding position (that is, the current decoding position), that is, other values except 111 in FIG. 3 . Continue to read the run length flag bit adjacent to the position mark in the codeword, that is, the fourth bit t 4 in the codeword:

(I)当第四位t4为0时,表示码字长度为一个字节,读取码字中与游程长度标记位相邻的的低四位t3210的值作为游程长度;(1) when the fourth t 4 is 0, it means that the length of the code word is a byte, and the value of the lower four t 3210 adjacent to the run length mark position in the read code word is used as the length of the run;

(II)当第四位t4为1时,表示码字长度为两个字节,读取码字中与游程长度标记位相邻的随后12位值,即图4(b)中的t3210位和其随后的一个字节,作为游程长度,设该长度为n;(II) When the fourth bit t 4 is 1, it means that the length of the code word is two bytes, read the subsequent 12-bit value adjacent to the run-length flag in the code word, i.e. t in Fig. 4(b) 3210 bits and the following byte are used as the length of the run, and the length is set to n;

(4)将从当前解码位置开始的n个连续象素点的象素值设置为码字中的位置标记对应的参考位置的象素值将当前解码位置的象素值。特别是,当码字中的位置标记为011时,如图3所示,所设置的象素值和当前解码位置的前一位置象素值相同;当码字中的位置标记为011外的其它参考位置的位置标记时,所设置的象素值如下式所示的位置象素值相同:(4) Set the pixel values of n consecutive pixel points starting from the current decoding position as the pixel value of the reference position corresponding to the position mark in the codeword and the pixel value of the current decoding position. Especially, when the position mark in the code word is 011, as shown in Figure 3, the pixel value of setting and the previous position pixel value of current decoding position are identical; When the position mark in the code word is outside 011 When other reference positions are marked, the set pixel value is the same as the pixel value of the position shown in the following formula:

c-(2-t7)×w+(1-t65)c-(2-t 7 )×w+(1-t 65 )

其中c为当前解码位置,t7为码字第七位的值,w为编码矩形区域的宽,t65为码字第六位和第五位的值。Where c is the current decoding position, t 7 is the value of the seventh bit of the codeword, w is the width of the encoded rectangular area, and t 65 is the value of the sixth and fifth bits of the codeword.

(5)读取下一个码字,重复步骤(1)到(4)的过程直到解出所有码字。(5) Read the next codeword, repeat the process of steps (1) to (4) until all codewords are solved.

虽然在上述的一个具体实施例中,描述了采用本发明的方法对一个16×16象素的矩形区域进行编码和解码,并选择了如图2所示的参考位置,而且采用了BPP=32位来描述一个象素点的象素值,但是本发明并不仅限于该实施例。本领域的一般技术人员可以理解,本发明也可用于其它大小的矩形区域的编码,例如在本发明的实施例中,游程长度最长用12个二进制位表示,其可表示的最大游程为4095,因此任何不超过4096个象素点的矩形区域均可采用本发明的方法。而且,对于更大的矩形区域,可以通过划分为多个小的矩形区域以便采用本发明的方法。本领域的一般技术人员也可以理解,本发明可以采用其它的例如8/16/24位来描述象素值,这些变化都应该包含在本发明的技术方案之内。Although in the above-mentioned specific embodiment, described adopting the method of the present invention to encode and decode a rectangular area of 16 * 16 pixels, and selected the reference position as shown in Figure 2, and adopted BPP=32 Bits are used to describe the pixel value of a pixel point, but the present invention is not limited to this embodiment. Those of ordinary skill in the art can understand that the present invention can also be used for the encoding of rectangular areas of other sizes. For example, in the embodiment of the present invention, the longest run length is represented by 12 binary bits, and the maximum representable run length is 4095 , so any rectangular area no more than 4096 pixels can adopt the method of the present invention. Moreover, for a larger rectangular area, the method of the present invention can be adopted by dividing it into a plurality of small rectangular areas. Those skilled in the art can also understand that the present invention can use other bits such as 8/16/24 to describe the pixel value, and these changes should be included in the technical solution of the present invention.

在本发明中,对待编码的矩形区域中所包含的调色板象素个数(即该矩形区域中所包含的不同的象素值的个数)不作限制,但是本发明优选应用于调色板象素个数大于16的矩形区域。对于调色板象素个数小于等于16的情况,优选采用现有的一些编码方案。如图4(a)所示,当前编码位置象素点的象素值未在其参考位置出现时,本发明的码字中还留有一些保留位t43210,可用于与其它现有的编码方法的接口,通过定义这些保留位可以方便地将本发明的技术方案与现有的一些编码方案结合在一起使用,以便获得更好的效果。例如,如下所示的一个优选的编码方案:In the present invention, the number of palette pixels contained in the rectangular area to be coded (that is, the number of different pixel values contained in the rectangular area) is not limited, but the present invention is preferably applied to color palette A rectangular area with more than 16 board pixels. For the case where the number of pixels in the palette is less than or equal to 16, it is preferable to use some existing coding schemes. As shown in Fig. 4 (a), when the pixel value of the pixel point of the current encoding position does not appear in its reference position, some reserved bits t 43210 are left in the codeword of the present invention, which can be used to combine with other existing encoding The interface of the method, by defining these reserved bits, the technical solution of the present invention can be conveniently used in combination with some existing coding schemes, so as to obtain better effects. For example, a preferred encoding scheme is shown below:

(a1)如果整个矩形块为一种颜色,则直接设置码字为(11110000),即将保留位t43210设置位10000,随后用(BPP/8)字节存放当前象素值,返回。(a1) If the whole rectangular block is a color, then the code word is directly set as (11110000), that is, the reserved bit t 43210 is set to 10000, then the current pixel value is stored in (BPP/8) byte, and returns.

(a2)如果整个矩形区域的调色板象素个数大于1而小于或等于16,则设置码字高四位为(1111),低四位为调色板象素个数,即将保留位设置为(1+调色板象素个数)。随后用(BPP/8×调色板象素个数)字节存放调色板象素值,随后为象素索引值,返回。其中,如果:(a2) If the number of palette pixels in the entire rectangular area is greater than 1 and less than or equal to 16, then the upper four bits of the codeword are set to (1111), and the lower four bits are the number of palette pixels, which are about to be reserved. Set to (1+number of pixels in the palette). Then use (BPP/8×the number of palette pixels) bytes to store the palette pixel value, followed by the pixel index value, and return. where, if:

调色板象素个数为2,则用1位代表一个索引;If the number of pixels in the palette is 2, use 1 bit to represent an index;

调色板象素个数为〔3…4〕,则用2位代表一个索引;If the number of pixels in the palette is [3...4], use 2 bits to represent an index;

调色板象素个数为〔5…16〕,则用4位代表一个索引。If the number of pixels in the palette is [5...16], 4 bits are used to represent an index.

(a3)如果整个矩形区域的调色板象素个数大于16,直接采用本发明中提供的编码方法进行编码。(a3) If the number of palette pixels in the entire rectangular area is greater than 16, directly adopt the encoding method provided in the present invention for encoding.

相应的解码方案为:The corresponding decoding scheme is:

(b1)取码字的高三位;(b1) get the upper three bits of the codeword;

(b2)如果码字的高三位的值为111,(b2) If the value of the upper three bits of the codeword is 111,

取码字第四位,如果为1,The fourth bit of the code word, if it is 1,

取码字低四位,如果为0,The lower four bits of the code word, if it is 0,

表示整个矩形区域为一个象素值,象素值从下一个字节开始;Indicates that the entire rectangular area is a pixel value, and the pixel value starts from the next byte;

否则otherwise

表示整个矩形块的调色板象素个数小于16,象素值从下一个字节开始,个数为码字低四位值,接下来为整个矩形块每个象素的调色板索引,索引位数随调色板象素个数不同而不同;Indicates that the number of pixels in the palette of the entire rectangular block is less than 16, and the pixel value starts from the next byte, and the number is the lower four bits of the codeword, followed by the palette index of each pixel of the entire rectangular block , the number of index digits varies with the number of pixels in the palette;

否则otherwise

按本发明提供的解码方法进行解码;Decoding according to the decoding method provided by the present invention;

(b3)如果码字的高三位的值不为111,则按本发明提供的解码方法进行解码。(b3) If the value of the upper three bits of the codeword is not 111, then perform decoding according to the decoding method provided by the present invention.

Claims (10)

1、一种图形终端界面编码方法,用于对终端服务器上矩形区域的虚屏幕数据进行编码,以便通过网络传输至终端;该方法包括:1. A graphical terminal interface encoding method, which is used to encode virtual screen data in a rectangular area on a terminal server, so as to be transmitted to the terminal through the network; the method includes: 选择当前编码位置的参考位置,并对当前编码位置和参考位置统一设置位置标记;所述参考位置在编码顺序中位于当前编码位置之前;Selecting the reference position of the current encoding position, and uniformly setting a position mark for the current encoding position and the reference position; the reference position is located before the current encoding position in the encoding order; 所述当前编码位置的参考位置分别为当前编码位置的左前一个位置、左上两个位置、正上两个位置、右上两个位置;The reference positions of the current coding position are respectively the previous left position, the upper left two positions, the two upper right positions, and the upper right two positions of the current encoding position; 对某一当前编码位置进行编码时,首先搜索其参考位置的象素值,并比较当前编码位置与参考位置的象素点的象素值,然后根据两种情况进行编码:When encoding a certain current encoding position, first search for the pixel value of its reference position, and compare the pixel values of the current encoding position and the pixel point of the reference position, and then encode according to two situations: 所述当前编码位置及其参考位置的位置标记用三个连续的二进制位表示,位于所述码字的高三位;The position marks of the current coding position and its reference position are represented by three consecutive binary bits, which are located in the upper three bits of the codeword; 所述当前编码位置及其参考位置的位置标记分别为:左前一个位置为011,左上第一个位置为110,左上第二个位置为010,正上第一个位置为101,正上第二个位置为001,右上第一个位置为100,右上第二个位置为000,当前编码位置为111;The position marks of the current encoding position and its reference position are respectively: the first position on the left is 011, the first position on the upper left is 110, the second position on the left is 010, the first position on the upper left is 101, and the second position on the upper left is 010. The first position is 001, the first position on the upper right is 100, the second position on the upper right is 000, and the current encoding position is 111; 当前编码位置象素点的象素值未在其参考位置出现时,将当前编码位置的位置标记编入当前编码位置象素点的码字;将该码字编入码流,并随后将当前编码位置象素点的象素值编入码流;When the pixel value of the pixel point at the current encoding position does not appear at its reference position, the position mark of the current encoding position is encoded into the code word of the pixel point at the current encoding position; this code word is encoded into the code stream, and then the current The pixel value of the pixel at the encoding position is encoded into the code stream; 当前编码位置象素点的象素值在其参考位置出现时,将参考位置的位置标记编入当前编码位置象素点的码字,并向后搜索与当前编码位置象素点具有相同象素值的象素点的游程长度,并将该游程长度编入当前编码位置象素点的码字;将该码字编入码流;When the pixel value of the pixel point of the current coding position appears at its reference position, the position mark of the reference position is compiled into the codeword of the pixel point of the current coding position, and the pixel point with the same pixel point of the current coding position is searched backward. The run length of the pixel point of value, and this run length is coded into the code word of the pixel point of the current coding position; This code word is coded into the code stream; 对所述矩形区域从起始位置开始按顺序按前述方法进行编码,直至完成整个矩形区域的编码。The rectangular area is encoded sequentially from the starting position according to the aforementioned method until the encoding of the entire rectangular area is completed. 2、根据权利要求1所述的图形终端界面编码方法,其特征在于,所述矩形区域的起始位置为该区域的左上角的象素点,其编码顺序为从左至右从上至下。2. The graphic terminal interface coding method according to claim 1, wherein the starting position of the rectangular area is the pixel point in the upper left corner of the area, and the coding sequence is from left to right and from top to bottom . 3、根据权利要求1所述的图形终端界面编码方法,其特征在于,对参考位置象素值的搜索按照标号的顺序从0到6依次比较,当搜索过程中发现一个参考位置的象素值与当前编码位置的象素值相同时即停止搜索。3. The graphical terminal interface coding method according to claim 1, wherein the search for the pixel value of the reference position is compared sequentially from 0 to 6 according to the order of the labels, and when a pixel value of the reference position is found in the search process Stop searching when it is the same as the pixel value of the current coding position. 4、根据权利要求1所述的图形终端界面编码方法,其特征在于,当前编码位置象素点的象素值在其参考位置出现时,所述当前编码位置象素点的码字还包括一游程长度标记位,用于标识游程长度在码字中所占据的位数。4. The graphic terminal interface coding method according to claim 1, wherein when the pixel value of the pixel point at the current coding position appears at its reference position, the codeword of the pixel point at the current coding position also includes a The run length flag bit is used to identify the number of bits occupied by the run length in the codeword. 5、根据权利要求4所述的图形终端界面编码方法,其特征在于,当前编码位置象素点的象素值在其参考位置出现时,所述位置标记、游程长度标志位和游程长度在码字中顺序紧邻排列。5. The graphic terminal interface encoding method according to claim 4, wherein, when the pixel value of the pixel point at the current encoding position appears at its reference position, the position mark, the run length flag and the run length are in the code The order of words is arranged next to each other. 6、根据权利要求1所述的图形终端界面编码方法,其特征在于,当前编码位置象素点的象素值在其参考位置出现时,所述当前编码位置象素点的码字由一个或两个字节组成,其中码字第一个字节高三位为参考位置的位置标记,随后是游程长度标记位,根据游程长度标记位的不同状态,采用第一个字节的低四位或该第一个字节的低四位和随后的一个字节为游程长度。6. The graphic terminal interface coding method according to claim 1, wherein, when the pixel value of the pixel point at the current coding position appears at its reference position, the code word of the pixel point at the current coding position is composed of one or Composed of two bytes, the high three bits of the first byte of the codeword are the position mark of the reference position, followed by the run length mark bit, according to the different states of the run length mark bit, the low four bits of the first byte or The lower four bits of the first byte and the following byte are the run length. 7、根据权利要求1所述的图形终端界面编码方法,其特征在于,当前编码位置象素点的象素值未在其参考位置出现时,码字由一个字节组成,其中该字节的高三位为当前编码位置的位置标记,其它位为保留位。7. The graphic terminal interface coding method according to claim 1, wherein, when the pixel value of the pixel point at the current coding position does not appear at its reference position, the codeword is composed of one byte, wherein the byte of the byte The upper three bits are the position mark of the current encoding position, and the other bits are reserved bits. 8、根据权利要求1或7所述的图形终端界面编码方法,其特征在于,所述矩形区域的调色板象素大于16。8. The graphic terminal interface coding method according to claim 1 or 7, characterized in that the palette pixels of the rectangular area are greater than 16. 9、一种对用权利要求1所述编码方法进行编码后的数据进行解码的图形终端界面解码方法,该方法包括:9. A graphic terminal interface decoding method for decoding data encoded by the encoding method according to claim 1, the method comprising: 读取码流中当前解码位置的码字,所述当前解码位置与编码方法中的当前编码位置对应;Reading the codeword at the current decoding position in the code stream, the current decoding position corresponds to the current encoding position in the encoding method; 读取该码字中的位置标记,然后根据两种情况进行解码:The position markers in the codeword are read and then decoded according to two conditions: 如果该读取的位置标记为编码方法中当前编码位置的位置标记,则将码流中紧随码字的象素值作为当前解码位置象素点的象素值;If the read position mark is the position mark of the current encoding position in the encoding method, then the pixel value following the codeword in the code stream is used as the pixel value of the current decoding position pixel point; 如果该读取的位置标记为编码方法中一个参考位置的位置标记,则读取该码字中的游程长度n,将从当前解码位置开始的n个连续象素点的象素值设置为该位置标记对应的参考位置的象素值;所述的游程长度n为1-4095;If the read position mark is the position mark of a reference position in the encoding method, then read the run length n in the codeword, and set the pixel values of n consecutive pixel points starting from the current decoding position as the The pixel value of the reference position corresponding to the position mark; the run length n is 1-4095; 按顺序读取码流中的码字,直至完成整个数据的解码。Read the code words in the code stream in order until the entire data is decoded. 10、根据权利要求9所述的图形终端界面解码方法,其特征在于,在读取所述码字中的游程长度时,要根据码字中的游程长度位置标记的状态,读取码流中不同长度的位作为游程长度。10. The graphic terminal interface decoding method according to claim 9, characterized in that, when reading the run length in the code word, it is necessary to read the run length in the code stream according to the state of the run length position mark in the code word Bits of different lengths are used as run lengths.
CN 200610112819 2006-09-04 2006-09-04 A kind of encoding and decoding method of graphic terminal interface Expired - Fee Related CN100558166C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 200610112819 CN100558166C (en) 2006-09-04 2006-09-04 A kind of encoding and decoding method of graphic terminal interface

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 200610112819 CN100558166C (en) 2006-09-04 2006-09-04 A kind of encoding and decoding method of graphic terminal interface

Publications (2)

Publication Number Publication Date
CN1925612A CN1925612A (en) 2007-03-07
CN100558166C true CN100558166C (en) 2009-11-04

Family

ID=37818033

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 200610112819 Expired - Fee Related CN100558166C (en) 2006-09-04 2006-09-04 A kind of encoding and decoding method of graphic terminal interface

Country Status (1)

Country Link
CN (1) CN100558166C (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102299718A (en) * 2010-06-25 2011-12-28 汉王科技股份有限公司 Compression and decompression methods for locus at hand-written terminal
US12164937B2 (en) * 2022-10-31 2024-12-10 Bitdrift, Inc. Systems and methods for encoding and rendering generic visualizations of a GUI of a client application

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101261740B (en) * 2008-03-27 2012-01-04 于培宁 Processing method of an image storage
WO2015135484A1 (en) * 2014-03-14 2015-09-17 Mediatek Inc. Method of color index coding with palette stuffing
US9877029B2 (en) * 2014-10-07 2018-01-23 Qualcomm Incorporated Palette index binarization for palette-based video coding

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1556652A (en) * 2003-12-30 2004-12-22 中国科学院计算技术研究所 A fast coding method for video intra-frame images based on the probability of the best prediction mode
CN1581978A (en) * 2004-05-17 2005-02-16 中国科学院计算技术研究所 Tree block structure and multi-frame-reference motion estimating method and apparatus
CN1235411C (en) * 2003-10-17 2006-01-04 中国科学院计算技术研究所 Flow-line-based frame predictive mode coding acceleration method

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1235411C (en) * 2003-10-17 2006-01-04 中国科学院计算技术研究所 Flow-line-based frame predictive mode coding acceleration method
CN1556652A (en) * 2003-12-30 2004-12-22 中国科学院计算技术研究所 A fast coding method for video intra-frame images based on the probability of the best prediction mode
CN1581978A (en) * 2004-05-17 2005-02-16 中国科学院计算技术研究所 Tree block structure and multi-frame-reference motion estimating method and apparatus

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102299718A (en) * 2010-06-25 2011-12-28 汉王科技股份有限公司 Compression and decompression methods for locus at hand-written terminal
US12164937B2 (en) * 2022-10-31 2024-12-10 Bitdrift, Inc. Systems and methods for encoding and rendering generic visualizations of a GUI of a client application

Also Published As

Publication number Publication date
CN1925612A (en) 2007-03-07

Similar Documents

Publication Publication Date Title
US6542631B1 (en) Encoding method of a color image and its encoding device and a decoding method of the color image and its decoding device
CN100558166C (en) A kind of encoding and decoding method of graphic terminal interface
US7990289B2 (en) Combinatorial coding/decoding for electrical computers and digital data processing systems
CN102244784B (en) Method for compressing and displaying picture including transparent information
CN107094021A (en) Data compression
CN106170922B (en) The source code of data and decoded device and method
CN103236847A (en) Multilayer Hash structure and run coding-based lossless compression method for data
CN103581679B (en) Decode the decoder and method of run-length encoded data
US9286698B2 (en) Method and device for storing a compression ratio indication in a pixel value buffer in tile encoding
WO2017198189A1 (en) Generation and reading method and device for colour identified colour two-dimensional figure code
CN103167289B (en) The coding of image, coding/decoding method and coding, decoding device
JP2008541503A (en) Remote display processing method based on server / client structure
WO2009009574A2 (en) Blocking for combinatorial coding/decoding for electrical computers and digital data processing systems
Gumhold New bounds on the encoding of planar triangulations
CN111708574B (en) Instruction stream compression and decompression method and device
AU2007249117B2 (en) Variable-length encoding for image data compression
CN103873868A (en) Bitmap data compression method
CN103297183A (en) Data communication method and device
US9591309B2 (en) Progressive lossy memory compression
US9014497B2 (en) Tile encoding and decoding
CN102651795B (en) Binary Sequence Compression Coding Method with Run Length Reduction
CN105491384A (en) Palette encoding method, palette decoding method, and electronic device
CN1238644A (en) Video encoding and decoding method and device using error recovery mode
CN102622630A (en) Method for storing private data by aid of quick response (QR) codes
CN101188753B (en) A table structure for video entropy decoding search and corresponding decoding 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
ASS Succession or assignment of patent right

Owner name: DONGGUAN LIANZHOU ELECTRONIC TECHNOLOGY CO., LTD.

Free format text: FORMER OWNER: INSTITUTE OF COMPUTING TECHNOLOGY, CHINESE ACADEMY OF SCIENCES

Effective date: 20130116

C41 Transfer of patent application or patent right or utility model
COR Change of bibliographic data

Free format text: CORRECT: ADDRESS; FROM: 100080 HAIDIAN, BEIJING TO: 523000 DONGGUAN, GUANGDONG PROVINCE

TR01 Transfer of patent right

Effective date of registration: 20130116

Address after: 523000 Yuquan Industrial Zone, Fenggang Town, Guangdong, Dongguan

Patentee after: Dongguan Lianzhou Electronic Technology Co., Ltd.

Address before: 100080 Haidian District, Zhongguancun Academy of Sciences, South Road, No. 6, No.

Patentee before: Institute of Computing Technology, Chinese Academy of Sciences

CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20091104

Termination date: 20150904

EXPY Termination of patent right or utility model