[go: up one dir, main page]

CN118710740A - Data processing method, controller, server, storage medium and program product - Google Patents

Data processing method, controller, server, storage medium and program product Download PDF

Info

Publication number
CN118710740A
CN118710740A CN202411187774.XA CN202411187774A CN118710740A CN 118710740 A CN118710740 A CN 118710740A CN 202411187774 A CN202411187774 A CN 202411187774A CN 118710740 A CN118710740 A CN 118710740A
Authority
CN
China
Prior art keywords
pixels
coding
row
video memory
address
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.)
Granted
Application number
CN202411187774.XA
Other languages
Chinese (zh)
Other versions
CN118710740B (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.)
Shandong Yunhai Guochuang Cloud Computing Equipment Industry Innovation Center Co Ltd
Original Assignee
Shandong Yunhai Guochuang Cloud Computing Equipment Industry Innovation Center 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 Shandong Yunhai Guochuang Cloud Computing Equipment Industry Innovation Center Co Ltd filed Critical Shandong Yunhai Guochuang Cloud Computing Equipment Industry Innovation Center Co Ltd
Priority to CN202411187774.XA priority Critical patent/CN118710740B/en
Publication of CN118710740A publication Critical patent/CN118710740A/en
Application granted granted Critical
Publication of CN118710740B publication Critical patent/CN118710740B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T9/00Image coding
    • G06T9/005Statistical coding, e.g. Huffman, run length coding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T1/00General purpose image data processing
    • G06T1/60Memory management

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Multimedia (AREA)
  • Image Processing (AREA)
  • Compression, Expansion, Code Conversion, And Decoders (AREA)

Abstract

本申请在计算机技术领域,公开了一种数据处理方法、控制器、服务器、存储介质及程序产品,该方法包括:基于主机写入的显示画面数据,按行更新采样缓冲区;从采样缓冲区中读取新行像素,并确定新行像素中不同像素值出现的概率;在概率满足最大长度哈夫曼编码条件的情况下,对新行像素进行哈夫曼编码,并在显存中存储编码结果;在概率未满足最大长度哈夫曼编码条件的情况下,对新行像素进行行程编码,并在显存中存储编码结果;将编码结果的存储地址写入地址映射寄存器后,返回执行基于主机写入的显示画面数据,按行更新采样缓冲区,直到完成显示画面数据的存储。技术效果:本申请可以在保障画面效果的情况下,降低本地显示画面所需的显存带宽。

In the field of computer technology, the present application discloses a data processing method, a controller, a server, a storage medium and a program product, the method comprising: updating the sampling buffer row by row based on the display screen data written by the host; reading new row pixels from the sampling buffer and determining the probability of different pixel values appearing in the new row pixels; when the probability meets the maximum length Huffman coding condition, Huffman coding the new row pixels and storing the coding result in the video memory; when the probability does not meet the maximum length Huffman coding condition, run coding the new row pixels and storing the coding result in the video memory; after writing the storage address of the coding result into the address mapping register, returning to execute based on the display screen data written by the host, updating the sampling buffer row by row until the storage of the display screen data is completed. Technical effect: The present application can reduce the video memory bandwidth required for the local display screen while ensuring the picture effect.

Description

数据处理方法、控制器、服务器、存储介质及程序产品Data processing method, controller, server, storage medium and program product

技术领域Technical Field

本申请涉及计算机技术领域,特别是涉及一种数据处理方法、控制器、服务器、存储介质及程序产品。The present application relates to the field of computer technology, and in particular to a data processing method, a controller, a server, a storage medium and a program product.

背景技术Background Art

通用服务器的本地显示画面需要经BMC(Baseboard Management Controller,基板管理控制器)内部集成显卡处理输出至显示器显示,对于集成显卡使用的显存一般是使用BMC系统的系统内存一部分预留空间使用。在BMC系统中,系统的内存往往不止作为主机显存使用,也要作为BMC中CPU计算、网络、linux内核运行等使用。由于是多个对象共用系统内存,当BMC中在进行大量内存读写操作的时候,用于给显存区域的内存带宽将会不足,就会直接影响显存的数据的读写,此时本地显示屏幕就会出现花屏或者黑色块现象,严重影响操作人员的观感体验。The local display screen of a general server needs to be processed by the internal integrated graphics card of the BMC (Baseboard Management Controller) and output to the display for display. The video memory used by the integrated graphics card is generally used as a reserved space of the system memory of the BMC system. In the BMC system, the system memory is often used not only as the host video memory, but also for CPU calculation, network, Linux kernel operation, etc. in the BMC. Since multiple objects share the system memory, when a large number of memory read and write operations are performed in the BMC, the memory bandwidth used for the video memory area will be insufficient, which will directly affect the reading and writing of video memory data. At this time, the local display screen will appear distorted or black blocks, seriously affecting the operator's viewing experience.

目前,降低显存带宽的方法一般是使用RGB888转换成RGB565方式,通过RGB565的方式让每个像素点占用2个字节的地址空间,可使得从内存中读取像素的总数据量减少了一倍,从而降低了对显存带宽的需求。该类方法在一定程度上可以良好的解决带宽不足的问题,但是RGB565模式会降低显示画面的图像色彩丰富度。At present, the method to reduce video memory bandwidth is generally to convert RGB888 into RGB565. Through RGB565, each pixel occupies 2 bytes of address space, which can reduce the total amount of pixel data read from the memory by half, thereby reducing the demand for video memory bandwidth. This method can solve the problem of insufficient bandwidth to a certain extent, but the RGB565 mode will reduce the color richness of the displayed image.

此外,有方案中,通过不读取图像边缘像素数据,在帧缓存数据排列成数据矩阵时,添加边缘像素值,从而降低对图像带宽的消耗。此类方案中,图像边缘像素点显示精细度将会降低。但是都会在一定程度上损失色彩精度,影响显示画面效果。In addition, there are solutions that do not read the edge pixel data of the image, and add the edge pixel value when the frame buffer data is arranged into a data matrix, thereby reducing the consumption of image bandwidth. In such solutions, the display fineness of the edge pixel points of the image will be reduced. However, the color accuracy will be lost to a certain extent, affecting the display effect.

综上所述,如何有效地解决显存带带宽不足的等问题,是目前本领域技术人员急需解决的技术问题。In summary, how to effectively solve the problem of insufficient video memory bandwidth is a technical problem that those skilled in the art urgently need to solve.

发明内容Summary of the invention

本申请的目的是提供一种数据处理方法、控制器、服务器、存储介质及程序产品,能够在保障画面效果的情况下,降低本地显示画面所需的显存带宽。The purpose of the present application is to provide a data processing method, a controller, a server, a storage medium and a program product, which can reduce the video memory bandwidth required for local display of pictures while ensuring the picture effect.

为解决上述技术问题,本申请提供如下技术方案:In order to solve the above technical problems, this application provides the following technical solutions:

一种显示画面数据处理方法,包括:A display screen data processing method, comprising:

基于主机写入的显示画面数据,按行更新采样缓冲区;其中,所述采样缓冲区中存储新旧两行像素;Based on the display screen data written by the host, the sampling buffer is updated row by row; wherein the sampling buffer stores two rows of old and new pixels;

从所述采样缓冲区中读取新行像素,并确定所述新行像素中不同像素值出现的概率;Reading a new row of pixels from the sampling buffer and determining the probability of occurrence of different pixel values in the new row of pixels;

在所述概率满足最大长度哈夫曼编码条件的情况下,对所述新行像素进行哈夫曼编码,并在显存中存储编码结果;In the case where the probability satisfies the maximum length Huffman coding condition, Huffman coding is performed on the new row of pixels, and the coding result is stored in the video memory;

在所述概率未满足最大长度哈夫曼编码条件的情况下,对所述新行像素进行行程编码,并在显存中存储编码结果;When the probability does not satisfy the maximum length Huffman coding condition, run length coding is performed on the new row of pixels, and the coding result is stored in the video memory;

将所述编码结果的存储地址写入地址映射寄存器后,返回执行基于主机写入的显示画面数据,按行更新采样缓冲区,直到完成所述显示画面数据的存储。After the storage address of the encoding result is written into the address mapping register, the process returns to execute the display screen data written by the host, and updates the sampling buffer row by row until the storage of the display screen data is completed.

优选地,在所述概率未满足最大长度哈夫曼编码条件的情况下,对所述新行像素进行行程编码,并在显存中存储编码结果,包括:Preferably, when the probability does not satisfy the maximum length Huffman coding condition, the new row of pixels is run-length coded, and the coding result is stored in the video memory, including:

在所述概率未满足最大长度哈夫曼编码条件的情况下,判断所述新行像素是否为首行像素;In the case where the probability does not satisfy the maximum length Huffman coding condition, determining whether the new row of pixels is the first row of pixels;

如果是,则将所述新行像素确定为所述编码结果,并在显存中所述存储编码结果;If yes, determining the new row of pixels as the encoding result, and storing the encoding result in a video memory;

如果否,则在所述新行像素与旧行像素的累计差值小于第二阈值的情况下,对所述新行像素与所述旧行像素的像素差值进行行程编码,在显存中存储编码结果,在所述累计差值不小于所述第二阈值的情况下,将所述新行像素确定为所述编码结果,并在显存中所述存储编码结果。If not, then when the cumulative difference between the new row of pixels and the old row of pixels is less than a second threshold, the pixel difference between the new row of pixels and the old row of pixels is run-length encoded, and the encoding result is stored in the video memory; when the cumulative difference is not less than the second threshold, the new row of pixels is determined as the encoding result, and the encoding result is stored in the video memory.

优选地,在所述新行像素与所述旧行像素的累计差值小于第二阈值的情况下,对所述新行像素与所述旧行像素的像素差值进行行程编码,在显存中存储编码结果,在所述累计差值不小于所述第二阈值的情况下,将所述新行像素确定为所述编码结果,并在显存中所述存储编码结果,包括:Preferably, when the cumulative difference between the new row of pixels and the old row of pixels is less than a second threshold, run encoding is performed on the pixel difference between the new row of pixels and the old row of pixels, and the encoding result is stored in the video memory; when the cumulative difference is not less than the second threshold, the new row of pixels is determined as the encoding result, and the encoding result is stored in the video memory, including:

对所述新行像素和所述旧行像素做差,得到所述像素差值;Subtracting the new row of pixels from the old row of pixels to obtain the pixel difference value;

结合动态加权系数,对所述像素差值中出现差值的区域逐渐加权求和,得到所述差值;其中,所述动态加权系数Cn的计算公式:Combined with the dynamic weighting coefficient, the area where the difference appears in the pixel difference is gradually weighted and summed to obtain the difference; wherein the calculation formula of the dynamic weighting coefficient Cn is:

其中,m为当前像素n前面连续像素差值不为0的个数,w为权重系数,i为第i个Sn不为0的像素位置,为第i个动态加权系数;Where m is the number of consecutive pixels whose difference before the current pixel n is not 0, w is the weight coefficient, i is the position of the pixel where Sn is not 0, is the ith dynamic weighting coefficient;

判断所述差值是否大于所述第二阈值;Determine whether the difference is greater than the second threshold;

如果否,则对所述像素差值进行行程编码,在显存中所述存储编码结果;If not, run encoding is performed on the pixel difference value, and the encoding result is stored in the video memory;

如果是,则将所述新行像素确定为所述编码结果,并在显存中所述存储编码结果。If yes, the new row of pixels is determined as the encoding result, and the encoding result is stored in the video memory.

优选地,判断所述概率是否满足最大长度哈夫曼编码条件,包括:Preferably, judging whether the probability satisfies a maximum length Huffman coding condition comprises:

判断所述概率是否超过第一阈值;Determining whether the probability exceeds a first threshold;

如果是,则确定所述概率满足所述最大长度哈夫曼编码条件;If yes, determining that the probability satisfies the maximum length Huffman coding condition;

如果否,则确定所述概率未满足所述最大长度哈夫曼编码条件。If not, it is determined that the probability does not satisfy the maximum length Huffman coding condition.

优选地,基于主机写入的显示画面数据,按行更新采样缓冲区,包括:Preferably, updating the sampling buffer row by row based on the display screen data written by the host includes:

基于所述显示画面数据,对所述采样缓冲区中的旧行像素进行覆盖写,得到新行像素,上一次写入的新行像素变更为旧行像素。Based on the display screen data, the old row of pixels in the sampling buffer is overwritten to obtain a new row of pixels, and the new row of pixels written last time are changed to the old row of pixels.

优选地,将所述编码结果的存储地址写入地址映射寄存器,包括:Preferably, writing the storage address of the encoding result into an address mapping register comprises:

获取存储所述编码结果的存储地址;Obtaining a storage address for storing the encoding result;

基于所述存储地址,确定所述新行像素的编码存储信息;Determining the coded storage information of the new row of pixels based on the storage address;

在所述地址映射寄存器中,按行记录编码存储信息;其中,所述编码存储信息包括编码类型、存入显存的地址、编码后数据写入显存的长度和哈夫曼编码表存储的地址。In the address mapping register, the coding storage information is recorded row by row; wherein the coding storage information includes the coding type, the address stored in the video memory, the length of the coded data written into the video memory and the address stored in the Huffman coding table.

优选地,在所述地址映射寄存器中,按行记录编码存储信息,包括:Preferably, in the address mapping register, the encoded storage information is recorded in rows, including:

在所述地址映射寄存器中,按行记录具有固定长度和顺序的所述编码存储信息。In the address mapping register, the coded storage information having a fixed length and order is recorded in rows.

优选地,获取存储所述编码结果的存储地址,包括:Preferably, obtaining a storage address for storing the encoding result includes:

若对所述新行像素进行哈夫曼编码,则将所述新行像素对应哈夫曼表格暂存在内部内存条中,并将所述哈夫曼表格对应的内存条首地址确定为所述存储地址;If Huffman coding is performed on the new row of pixels, the Huffman table corresponding to the new row of pixels is temporarily stored in an internal memory bar, and the first address of the memory bar corresponding to the Huffman table is determined as the storage address;

若对所述新行像素进行行程编码,则所述新行像素对应的编码结果的写入显存的首地址、长度确定为所述存储地址;If the new row of pixels is run-length encoded, the first address and length of the encoding result corresponding to the new row of pixels written into the display memory are determined as the storage address;

若所述新行像素未进行编码,则将所述新行像素写入显存的首地址、长度确定为所述存储地址。If the new row of pixels is not encoded, the new row of pixels is written into the first address of the video memory, and the length is determined as the storage address.

优选地,还包括:Preferably, it also includes:

以行为单元,从所述地址映射寄存器确定目标行像素的指定显存地址;Determine the designated display memory address of the target row of pixels from the address mapping register in row units;

从所述指定显存地址中读取,所述目标行像素的编码数据;Reading the encoded data of the target row of pixels from the designated video memory address;

根据所述编码数据的编码类型进行解码,得到解码数据;Decoding the encoded data according to the encoding type to obtain decoded data;

将所述解码数据写入到输出缓冲区,以便所述主机读取。The decoded data is written to an output buffer so that the host can read it.

优选地,根据所述编码数据的编码类型进行解码,得到解码数据,包括:Preferably, decoding is performed according to the encoding type of the encoded data to obtain decoded data, including:

若所述编码数据未经过编码,则将所述编码数据确定为所述解码数据;If the encoded data has not been encoded, determining the encoded data as the decoded data;

若所述编码数据经过行程编码,则对所述编码数据进行行程解码,得到所述解码数据;If the encoded data is run-length encoded, run-length decoding is performed on the encoded data to obtain the decoded data;

若所述编码数据经过哈夫曼编码,则对所述编码数据进行哈夫曼解码,得打所述解码数据。If the coded data is Huffman coded, Huffman decoding is performed on the coded data to obtain the decoded data.

优选地,对所述编码数据进行行程解码,得到所述解码数据,包括:Preferably, performing run-length decoding on the encoded data to obtain the decoded data comprises:

从所述输出缓冲区中读取所述目标行像素的上一行解码数据;Reading a previous row of decoded data of pixels in the target row from the output buffer;

以所述上一行解码数据为参考,结合所述编码数据进行行程解码,得到所述解码数据。The decoded data of the previous line is used as a reference and run-length decoding is performed in combination with the encoded data to obtain the decoded data.

一种控制器,包括:A controller, comprising:

显存缓冲单元,用于基于主机写入的显示画面数据,按行更新采样缓冲区;其中,所述采样缓冲区中存储新旧两行像素;A display memory buffer unit, used to update the sampling buffer by row based on the display screen data written by the host; wherein the sampling buffer stores two rows of old and new pixels;

压缩编码单元,用于从所述采样缓冲区中读取新行像素,并确定所述新行像素中不同像素值出现的概率;在所述概率满足最大长度哈夫曼编码条件的情况下,对所述新行像素进行哈夫曼编码,并在显存中存储编码结果;在所述概率未满足最大长度哈夫曼编码条件的情况下,对所述新行像素进行行程编码,并在显存中存储编码结果;A compression coding unit, used for reading a new row of pixels from the sampling buffer and determining the probability of occurrence of different pixel values in the new row of pixels; when the probability meets the maximum length Huffman coding condition, performing Huffman coding on the new row of pixels and storing the coding result in the video memory; when the probability does not meet the maximum length Huffman coding condition, performing run length coding on the new row of pixels and storing the coding result in the video memory;

地址映射单元,用于将所述编码结果的存储地址写入地址映射寄存器,并触发所述显存缓冲单元,直到完成所述显示画面数据的存储。The address mapping unit is used to write the storage address of the encoding result into the address mapping register and trigger the display memory buffer unit until the storage of the display screen data is completed.

一种服务器,包括:A server, comprising:

如上述的控制器;A controller as described above;

所述控制器实现如上述数据处理方法的步骤。The controller implements the steps of the above data processing method.

一种可读存储介质,所述可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现上述数据处理方法的步骤。A readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above data processing method are implemented.

一种计算机程序产品,包括计算机程序/指令,该计算机程序/指令被处理器执行时,实现上述数据处理方法的步骤。A computer program product comprises a computer program/instruction, which implements the steps of the above data processing method when executed by a processor.

应用本申请实施例所提供的方法,包括:基于主机写入的显示画面数据,按行更新采样缓冲区;其中,采样缓冲区中存储新旧两行像素;从采样缓冲区中读取新行像素,并确定新行像素中不同像素值出现的概率;在概率满足最大长度哈夫曼编码条件的情况下,对新行像素进行哈夫曼编码,并在显存中存储编码结果;在概率未满足最大长度哈夫曼编码条件的情况下,对新行像素进行行程编码,并在显存中存储编码结果;将编码结果的存储地址写入地址映射寄存器后,返回执行基于主机写入的显示画面数据,按行更新采样缓冲区,直到完成显示画面数据的存储。The method provided by the embodiment of the present application includes: updating the sampling buffer row by row based on the display screen data written by the host; wherein the sampling buffer stores two rows of old and new pixels; reading the new row of pixels from the sampling buffer and determining the probability of different pixel values appearing in the new row of pixels; when the probability meets the maximum length Huffman coding condition, performing Huffman coding on the new row of pixels and storing the coding result in the video memory; when the probability does not meet the maximum length Huffman coding condition, performing run length coding on the new row of pixels and storing the coding result in the video memory; after writing the storage address of the coding result into the address mapping register, returning to execute the display screen data written by the host, updating the sampling buffer row by row until the storage of the display screen data is completed.

具体的,可以采用采样缓冲区来对主机写入的显示画面数据进行缓存,在进行编码处理时,以行为单元,对采样缓冲区中存储新行像素进行编码方式选择。具体的,可通过确定新行像素中不同像素出现的概率,明确新行像素是否满足最大长度哈夫曼编码条件,如果满足,则对新行像素进行哈夫曼编码,并在显存中存储编码结果;如果不满足,则对新行像素进行行程编码,并在显存中存储编码结果;在将编码结果的存储地址写入地址映射寄存器后,便可返回执行基于主机写入的显示画面数据,按行更新采样缓冲区,直到完成显示画面数据的存储。Specifically, a sampling buffer can be used to cache the display screen data written by the host. When performing encoding processing, the encoding method for storing new row pixels in the sampling buffer is selected in units of lines. Specifically, by determining the probability of occurrence of different pixels in the new row of pixels, it can be determined whether the new row of pixels meets the maximum length Huffman encoding condition. If it does, the new row of pixels is Huffman encoded and the encoding result is stored in the video memory; if it does not meet the condition, the new row of pixels is run-length encoded and the encoding result is stored in the video memory; after writing the storage address of the encoding result into the address mapping register, it can return to execute the display screen data written by the host, and update the sampling buffer by line until the storage of the display screen data is completed.

由于服务器显示画面较为单一,一般为文本窗口显示画面,且画面中各行像素之间的冗余度比较高,行与行像素之间的关联相似程度较高,所以采取对行与行之间进行压缩编码的方式对像素进行无损压缩,可以使得读写显存中的数据量变小,从而来降低对显存写带宽需求。对于满足最大长度哈夫曼编码条件的行像素,则优先采用哈夫曼编码来进行无损压缩。从而结合两种压缩编码方式对以行为单位进行压缩编码,从而保障压缩后的显示画面数据占用更少的显存存储空间。Since the server display screen is relatively simple, generally a text window display screen, and the redundancy between the pixels in each row of the screen is relatively high, and the correlation and similarity between the pixels in the rows are relatively high, the pixels are losslessly compressed by compressing the rows, which can reduce the amount of data in the read and write video memory, thereby reducing the demand for video memory write bandwidth. For row pixels that meet the maximum length Huffman coding conditions, Huffman coding is preferentially used for lossless compression. Therefore, the two compression coding methods are combined to compress and encode the rows in units, thereby ensuring that the compressed display screen data occupies less video memory storage space.

技术效果:在本申请中,对于主机写入的显示画面数据,实质存入到显存中的是逐行进行压缩编码的编码结果,该编码结果相对于原显示画面数据,所需要显存带宽更小,占据更小存储空间,且该编码结果是可以通过对应的解码方式进行无损解码的,因此,本申请可以在保障画面效果的情况下,降低本地显示画面所需的显存带宽。Technical effect: In the present application, for the display screen data written by the host, what is actually stored in the video memory is the encoding result of compression encoding line by line. Compared with the original display screen data, the encoding result requires a smaller video memory bandwidth and occupies a smaller storage space, and the encoding result can be losslessly decoded through the corresponding decoding method. Therefore, the present application can reduce the video memory bandwidth required for the local display screen while ensuring the picture effect.

相应地,本申请实施例还提供了与上述数据处理方法相对应的控制器、服务器、可读存储介质及计算机程序产品,具有上述技术效果,在此不再赘述。Correspondingly, the embodiments of the present application also provide a controller, a server, a readable storage medium and a computer program product corresponding to the above-mentioned data processing method, which have the above-mentioned technical effects and are not repeated here.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

为了更清楚地说明本申请实施例或相关技术中的技术方案,下面将对实施例或相关技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments or the related technical descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

图1为本申请实施例中一种数据处理方法的实施流程图;FIG1 is a flowchart of an implementation method of a data processing method in an embodiment of the present application;

图2为本申请实施例中一种数据处理方法的具体实施示意图;FIG2 is a schematic diagram of a specific implementation of a data processing method in an embodiment of the present application;

图3为本申请实施例中一种控制器的结构示意图;FIG3 is a schematic diagram of the structure of a controller in an embodiment of the present application;

图4为本申请实施例中一种服务器的结构示意图。FIG. 4 is a schematic diagram of the structure of a server in an embodiment of the present application.

具体实施方式DETAILED DESCRIPTION

为了使本技术领域的人员更好地理解本申请方案,下面结合附图和具体实施方式对本申请作进一步的详细说明。显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.

请参考图1,图1为本申请实施例中一种数据处理方法的流程图,可应用于服务器的基板管理控制器中,该方法包括以下步骤:Please refer to FIG. 1 , which is a flow chart of a data processing method in an embodiment of the present application, which can be applied to a baseboard management controller of a server. The method includes the following steps:

S101、基于主机写入的显示画面数据,按行更新采样缓冲区。S101 . Based on the display screen data written by the host, the sampling buffer is updated row by row.

其中,采样缓冲区中存储新旧两行像素。The sampling buffer stores two rows of pixels, old and new.

在本申请实施例中,可以设置一个采样缓冲区,在该采样缓冲区中存储最大像素的两行像素。In the embodiment of the present application, a sampling buffer may be set, in which two rows of pixels of the maximum pixel are stored.

为了便于区别,在本实施例中,将采样缓冲区中的两行像素,按照写入的先后顺序,分别称为新行像素和旧行像素。行像素即一行显示区域所对应的像素值。For the sake of distinction, in this embodiment, two rows of pixels in the sampling buffer are respectively referred to as new row pixels and old row pixels according to the order of writing. Row pixels are pixel values corresponding to a row of display area.

在本申请中的一种实施例中,基于主机写入的显示画面数据,按行更新采样缓冲区,包括:In one embodiment of the present application, updating the sampling buffer by line based on the display screen data written by the host includes:

基于显示画面数据,对采样缓冲区中的旧行像素进行覆盖写,得到新行像素,上一次写入的新行像素变更为旧行像素。Based on the display screen data, the old row of pixels in the sampling buffer is overwritten to obtain a new row of pixels, and the new row of pixels written last time are changed to the old row of pixels.

也就是说,每当完成一行像素的编码处理并存储之后,则可以对采样缓冲区进行更新,更新主要将新旧两行像素中旧行像素进行更新,从而使得上一次编码的新行像素变更为旧行像素,最新写入的行像素作为新行像素。如此循环往复,最终实现全部显示画面数据的全部行像素被进行压缩编码存储。That is to say, every time a row of pixels is encoded and stored, the sampling buffer can be updated. The update mainly updates the old row of pixels in the new and old rows of pixels, so that the new row of pixels encoded last time is changed to the old row of pixels, and the newly written row of pixels is used as the new row of pixels. This cycle is repeated, and finally all rows of pixels of all display screen data are compressed, encoded and stored.

S102、从采样缓冲区中读取新行像素,并确定新行像素中不同像素值出现的概率。S102 , reading a new row of pixels from the sampling buffer, and determining the probability of occurrence of different pixel values in the new row of pixels.

在本实施例中,为了减少显存带宽,可以以行像素为单元,对行像素进行压缩编码。In this embodiment, in order to reduce the video memory bandwidth, the row pixels may be compressed and encoded based on the row pixels as a unit.

考虑到不同的行像素情况,不同的压缩编码的效果不同,因此,在从采样缓冲区中读取到新行像素之后,可以首先明确新行像素的像素值分布的特点,特别是新行像素中不同像素值出现的概率。基于该概率可以明确该新行像素是否适合最大长度哈夫曼编码。Considering that different row pixel situations have different effects of different compression codes, after reading a new row pixel from the sampling buffer, the characteristics of the pixel value distribution of the new row pixel can be first determined, especially the probability of different pixel values appearing in the new row pixel. Based on the probability, it can be determined whether the new row pixel is suitable for maximum length Huffman coding.

S103、在概率满足最大长度哈夫曼编码条件的情况下,对新行像素进行哈夫曼编码,并在显存中存储编码结果。S103 . When the probability satisfies the maximum length Huffman coding condition, perform Huffman coding on the new row of pixels, and store the coding result in the video memory.

在概率满足最大长度哈夫曼编码条件的情况下,可以对该新行像素进行哈夫曼编码,从而得到编码结果,并在显存中存储编码结果。When the probability satisfies the maximum length Huffman coding condition, the new row of pixels may be Huffman coded to obtain a coding result, and the coding result is stored in the video memory.

编码之后的编码结果所需存储空间比新行像素小,从而达到节约显存空间的目的。The encoding result after encoding requires less storage space than a new row of pixels, thereby achieving the purpose of saving video memory space.

也就是说,采用哈夫曼编码,可以基于行内的像素值的相似情况实现压缩编码。That is to say, by using Huffman coding, compression coding can be achieved based on the similarity of pixel values within a row.

在本申请中的一种实施例中,判断概率是否满足最大长度哈夫曼编码条件,包括:In one embodiment of the present application, determining whether the probability satisfies the maximum length Huffman coding condition includes:

判断概率是否超过第一阈值;Determining whether the probability exceeds a first threshold;

如果是,则确定概率满足最大长度哈夫曼编码条件;If yes, then determine the probability of satisfying the maximum length Huffman coding condition;

如果否,则确定概率未满足最大长度哈夫曼编码条件。If not, it is determined that the probability does not satisfy the maximum length Huffman coding condition.

为便于描述,下面将上述步骤结合起来进行说明。For ease of description, the above steps are combined for explanation below.

对于统计出新行像素中不同像素值出现的概率,如果不同像素值出现的数值太多,则不适合哈夫曼编码。具体的,可以根据实际需求,设置并调整该第一阈值的大小。在概率超过第一阈值的情况下,则确定不适合进行哈夫曼编码,反之则适合。For the probability of different pixel values in the new row of pixels being counted, if the number of different pixel values is too large, it is not suitable for Huffman coding. Specifically, the size of the first threshold can be set and adjusted according to actual needs. If the probability exceeds the first threshold, it is determined that it is not suitable for Huffman coding, otherwise it is suitable.

在本申请中的一种实施例中,对新行像素进行哈夫曼编码,并在显存中存储编码结果,包括:In one embodiment of the present application, Huffman encoding is performed on the new row of pixels, and the encoding result is stored in the video memory, including:

采取哈夫曼编码不定长度编码方式进行编码,对出现概率最大的数据,使用最短的编码;Huffman coding indefinite length coding is used for encoding, and the shortest code is used for the data with the highest probability of occurrence;

对新行像素编码完成后,将新行像素对应哈夫曼表格暂存在内部RAM中,并将新行像素哈夫曼表格对应的RAM首地址写入到指定的寄存器暂存;After the encoding of the new row of pixels is completed, the Huffman table corresponding to the new row of pixels is temporarily stored in the internal RAM, and the RAM first address corresponding to the Huffman table of the new row of pixels is written into the designated register for temporary storage;

将编码后的像素值写入到像素缓冲区中,等待写入显存中。Write the encoded pixel value into the pixel buffer, waiting to be written into the video memory.

如此,对出现概率最大的数据,使用最短的编码,便可使得编码后的像素值的所需存储空间越小,此外,将哈夫曼表格进行暂存,将暂存的首地址写入指定的寄存器,可以在后续需要进行解码时,快速且准确地读到哈夫曼表格,从而实现无损解码。In this way, by using the shortest code for the data with the highest probability of occurrence, the required storage space for the encoded pixel value can be reduced. In addition, the Huffman table is temporarily stored and the temporary first address is written into the specified register. When decoding is required later, the Huffman table can be read quickly and accurately, thereby achieving lossless decoding.

S104、在概率未满足最大长度哈夫曼编码条件的情况下,对新行像素进行行程编码,并在显存中存储编码结果。S104: When the probability does not satisfy the maximum length Huffman coding condition, run length coding is performed on the new row of pixels, and the coding result is stored in the video memory.

由于服务器显示画面较为单一,一般为文本窗口显示画面,且画面中各行像素之间的冗余度比较高,行与行像素之间的关联相似程度较高,所以采取对行与行之间进行压缩编码的方式对像素进行无损压缩,可以使得读写显存中的数据量变小,从而来降低对显存写带宽需求。Since the server display screen is relatively simple, generally a text window display screen, and the redundancy between pixels in each row of the screen is relatively high, and the correlation and similarity between pixels in rows are relatively high, the pixels are losslessly compressed by compressing the rows. This can reduce the amount of data in the read and write video memory, thereby reducing the demand for video memory write bandwidth.

即,在新行像素不适合进行哈夫曼编码时,则对新行像素进行行程编码,仅在显存中存储行程编码的编码结果,从而减少占用显示的存储空间。That is, when the new row of pixels is not suitable for Huffman coding, run length coding is performed on the new row of pixels, and only the coding result of the run length coding is stored in the video memory, thereby reducing the storage space occupied by the display.

也就是说,采用行程编码,可以基于行间的像素值的相似性实现压缩编码。That is to say, by using run length coding, compression coding can be achieved based on the similarity of pixel values between rows.

在本申请中的一种实施例中,在概率未满足最大长度哈夫曼编码条件的情况下,对新行像素进行行程编码,并在显存中存储编码结果,包括:In one embodiment of the present application, when the probability does not meet the maximum length Huffman coding condition, run encoding is performed on the new row of pixels, and the encoding result is stored in the video memory, including:

在概率未满足最大长度哈夫曼编码条件的情况下,判断新行像素是否为首行像素;When the probability does not meet the maximum length Huffman coding condition, determine whether the new row of pixels is the first row of pixels;

如果是,则将新行像素确定为编码结果,并在显存中存储编码结果;If yes, the new row of pixels is determined as the encoding result, and the encoding result is stored in the video memory;

如果否,则在新行像素与旧行像素的累计差值小于第二阈值的情况下,对新行像素与旧行像素的像素差值进行行程编码,在显存中存储编码结果,在累计差值不小于第二阈值的情况下,将新行像素确定为编码结果,并在显存中存储编码结果。If not, then when the cumulative difference between the new row of pixels and the old row of pixels is less than the second threshold, the pixel difference between the new row of pixels and the old row of pixels is run-length encoded, and the encoding result is stored in the video memory; when the cumulative difference is not less than the second threshold, the new row of pixels is determined as the encoding result, and the encoding result is stored in the video memory.

为便于描述,下面将上述步骤结合起来进行说明。For ease of description, the above steps are combined for explanation below.

由于行程编码是基于行间的相似性进行压缩编码,因此需要有上一行像素作为参考,从而基于上下两行的差异,对差异进行编码。Since run length coding is a compression coding based on the similarity between rows, the pixels in the previous row are required as a reference, so that the difference between the upper and lower rows can be encoded.

若新行像素为首行像素,则其无相应的参考上一行像素,因此,在本实施例中,若明确新行像素不满足最大长度哈夫曼编码条件,且其为首行像素的情况下,可直接将新行像素确定为编码结果,并直接存入到显存中。If the new row of pixels is the first row of pixels, it has no corresponding reference to the previous row of pixels. Therefore, in this embodiment, if it is clear that the new row of pixels does not meet the maximum length Huffman coding conditions and it is the first row of pixels, the new row of pixels can be directly determined as the coding result and directly stored in the video memory.

对于非首行像素的其他行像素,在本实施例中称之为续行像素。在续行像素不满足最大长度哈夫曼编码条件,则可以先明确一下其与上一行像素的差异情况,从而确定是否进行行程编码。For other rows of pixels other than the first row of pixels, they are called continuation row pixels in this embodiment. If the continuation row pixels do not meet the maximum length Huffman coding condition, the difference between them and the previous row of pixels can be clarified to determine whether to perform run length coding.

具体的,在本实施例中,新行像素的上一行像素即存储的采样缓冲区中的旧行像素。两行之间的差异越小,则进行行程编码的结果所需存储空间越小,因此,在新行像素与旧行像素的累计差值小于第二阈值的情况下,对新行像素与旧行像素的像素差值进行行程编码,在显存中存储编码结果;在累计差值不小于第二阈值的情况下,将新行像素确定为编码结果,并在显存中存储编码结果。Specifically, in this embodiment, the previous row of pixels of the new row of pixels is the old row of pixels stored in the sampling buffer. The smaller the difference between the two rows, the smaller the storage space required for the result of run length encoding. Therefore, when the cumulative difference between the new row of pixels and the old row of pixels is less than the second threshold, the pixel difference between the new row of pixels and the old row of pixels is run length encoded, and the encoding result is stored in the video memory; when the cumulative difference is not less than the second threshold, the new row of pixels is determined as the encoding result, and the encoding result is stored in the video memory.

其中,第二阈值可以根据实际应用需求进行设置和调整,在本实施例中并不做具体限定。The second threshold can be set and adjusted according to actual application requirements and is not specifically limited in this embodiment.

在本申请中的一种实施例中,在新行像素与旧行像素的累计差值小于第二阈值的情况下,对新行像素与旧行像素的像素差值进行行程编码,在显存中存储编码结果,在累计差值不小于第二阈值的情况下,将新行像素确定为编码结果,并在显存中存储编码结果,包括:In one embodiment of the present application, when the cumulative difference between the new row of pixels and the old row of pixels is less than a second threshold, the pixel difference between the new row of pixels and the old row of pixels is run-length coded, and the coding result is stored in the video memory; when the cumulative difference is not less than the second threshold, the new row of pixels is determined as the coding result, and the coding result is stored in the video memory, including:

对新行像素和旧行像素做差,得到像素差值;Subtract the new row of pixels from the old row of pixels to get the pixel difference;

结合动态加权系数,对像素差值中出现差值的区域逐渐加权求和,得到差值;其中,动态加权系数Cn的计算公式:Combined with the dynamic weighting coefficient, the difference area in the pixel difference is gradually weighted and summed to obtain the difference; the calculation formula of the dynamic weighting coefficient Cn is:

其中,m为当前像素n前面连续像素差值不为0的个数,w为权重系数,i为第i个Sn不为0的像素位置,为第i个动态加权系数;Where m is the number of consecutive pixels whose difference before the current pixel n is not 0, w is the weight coefficient, i is the position of the pixel where Sn is not 0, is the ith dynamic weighting coefficient;

判断差值是否大于第二阈值;Determine whether the difference is greater than a second threshold;

如果否,则对像素差值进行行程编码,在显存中存储编码结果;If not, run encoding is performed on the pixel difference and the encoding result is stored in the video memory;

如果是,则将新行像素确定为编码结果,并在显存中存储编码结果。If yes, the new row of pixels is determined as the encoding result, and the encoding result is stored in the video memory.

为便于描述,下面将上述步骤结合起来进行说明。For ease of description, the above steps are combined for explanation below.

对于不能使用哈夫曼编码的行像素,如果不是首行像素,则计算出本行像素与上一行行像素的累计差值,如果累计差值大于设定的阈值,则证明本行像素与上一行像素差别较大,不适宜采用行程编码,则直接将该行像素存入像素缓冲区。For the row pixels that cannot use Huffman coding, if it is not the first row of pixels, the cumulative difference between the pixels in this row and the pixels in the previous row is calculated. If the cumulative difference is greater than the set threshold, it proves that the pixels in this row are significantly different from the pixels in the previous row, and it is not suitable to use run encoding. In this case, the pixels in this row are directly stored in the pixel buffer.

如果计算出下一行像素与本行像素的累计差值,如果累计差值小于第二阈值,则证明下一行像素与本行像素的像素差值较小,计算得到下一行像素与本行像素的像素差值,对像素差值进行行程编码,将行程编码后的像素值写入到像素缓冲区中等待进一步写入显存。If the cumulative difference between the pixels in the next row and the pixels in this row is calculated, and if the cumulative difference is less than the second threshold, it proves that the pixel difference between the pixels in the next row and the pixels in this row is small, the pixel difference between the pixels in the next row and the pixels in this row is calculated, the pixel difference is run-length encoded, and the pixel value after run-length encoding is written into the pixel buffer to wait for further writing into the video memory.

举例说明:如下表所示:For example, as shown in the following table:

表1,表1为行程编码像素差值示意表Table 1 is a schematic table of run length coding pixel difference values.

在表1中,前2行像素分别是新旧两行像素的像素值,第3行的数值为前两行的像素差值。对像素差值进行行程编码,得到0002000401…等,其中行程编码可采取19bit=11bit+8bit定长编码,最大分辨率支持到1920*1200。In Table 1, the first two rows of pixels are the pixel values of the old and new rows of pixels respectively, and the value of the third row is the pixel difference between the first two rows. The pixel difference is run-length encoded to obtain 0002000401... etc., where the run-length encoding can adopt 19bit=11bit+8bit fixed-length encoding, and the maximum resolution supported is 1920*1200.

对于像素差值计算规则如下,采取上下两行做差的方式,得到一行像素差值,然后对像素差值中出现差值的区域逐渐加权的方式求和。其计算规则如下:The calculation rules for pixel difference are as follows: take the difference between the upper and lower rows to get a row of pixel difference, and then gradually weight the sum of the areas where the difference occurs in the pixel difference. The calculation rules are as follows:

Cn为动态加权系数,当前像素点的加权后的差值Dn= Sn*Cn,若Dn小于阈值,则认为像素差值小。Cn is the dynamic weighting coefficient. The weighted difference of the current pixel point Dn = Sn*Cn. If Dn is less than the threshold, the pixel difference is considered small.

如果下一个像素差值Sn+1不为0,则继续增加系数值为Cn+1的。If the next pixel difference Sn+1 is not 0, the coefficient value continues to increase to Cn+1.

如果该行中第N个像素的位置开始出现了差值不为0,则用该处的差值Sn*系数Cn得到当前像素点的加权后的差值,如果下一个像素差值Sn+1不为0,则继续增加系数值为Cn+1的。Cn的增加规则如下:If the difference value at the position of the Nth pixel in the row is not 0, the weighted difference value of the current pixel is obtained by using the difference value Sn*coefficient Cn. If the next pixel difference value Sn+1 is not 0, the coefficient value Cn+1 is continued to be increased. The increase rule of Cn is as follows:

其中,m为当前像素n前面连续像素差值Sn不为0的个数,w为权重系数,i为第i个Sn不为0的像素位置;若当前行内像素位置n前面有5个连续Sn不为0的值,则Cn=w*1*C1 + w*2*C2+ w*3*C3+ w*4*C4+ w*5*C5;Where m is the number of consecutive pixel difference values Sn that are not zero before the current pixel n, w is the weight coefficient, and i is the i-th pixel position where Sn is not zero; if there are 5 consecutive non-zero values of Sn before the pixel position n in the current row, then Cn=w*1*C1 + w*2*C2+ w*3*C3+ w*4*C4+ w*5*C5;

当连续的不相等的像素差值较多的时候,则下一个像素的加权系数就会变大,最后计算行与行之间的累计差值也会变大。当像素之间存在差值,且不连续的时候,计算最后的累计差值就会变小。When there are many consecutive unequal pixel differences, the weight coefficient of the next pixel will become larger, and the final cumulative difference between rows will also become larger. When there are differences between pixels and they are not continuous, the final cumulative difference will become smaller.

完成行程编码之后,仅存储编码结果在显存中。After the run length encoding is completed, only the encoding result is stored in the video memory.

S105、将编码结果的存储地址写入地址映射寄存器后,返回执行基于主机写入的显示画面数据,按行更新采样缓冲区,直到完成显示画面数据的存储。S105 , after writing the storage address of the encoding result into the address mapping register, returning to execute the display screen data written by the host, and updating the sampling buffer row by row until the storage of the display screen data is completed.

在本实施例中,可以设置一个地址映射寄存器,用于存储编码结果的存储地址,以便后续解码时,可以基于地址映射寄存器读取编码结果,从而实现无损解玛。In this embodiment, an address mapping register may be provided to store the storage address of the encoding result, so that during subsequent decoding, the encoding result may be read based on the address mapping register, thereby achieving lossless demodulation.

在显示画面数据中的还有行像素未经过处理的情况下,返回执行步骤S101,在显示画面数据全部经过上述处理存入显存后,则结束本次显示画面数据的写入过程。If there are still rows of pixels in the display screen data that have not been processed, the process returns to step S101 , and after all the display screen data have been processed as described above and stored in the video memory, the writing process of the display screen data is terminated.

即,每当编码完成一行像素之后,将新的一行像素覆盖写入最早已经编码完的fifo中,继续后续编码,直至完成所有像素的编码。写入的缓冲区的像素按照顺序写入到显存中。That is, every time a row of pixels is encoded, a new row of pixels is written into the earliest encoded fifo, and subsequent encoding is continued until all pixels are encoded. The pixels in the buffer are written into the video memory in order.

在本申请中的一种实施例中,将编码结果的存储地址写入地址映射寄存器,包括:In one embodiment of the present application, writing the storage address of the encoding result into the address mapping register includes:

获取存储编码结果的存储地址;Get the storage address where the encoding result is stored;

基于存储地址,确定新行像素的编码存储信息;Determining the encoding storage information of the new row of pixels based on the storage address;

在地址映射寄存器中,按行记录编码存储信息;其中,编码存储信息包括编码类型、存入显存的地址、编码后数据写入显存的长度和哈夫曼编码表存储的地址。In the address mapping register, the coding storage information is recorded row by row; wherein the coding storage information includes the coding type, the address stored in the video memory, the length of the coded data written into the video memory and the address stored in the Huffman coding table.

其中,在地址映射寄存器中,按行记录编码存储信息,包括:Among them, in the address mapping register, the information is stored in row-by-row record encoding, including:

在地址映射寄存器中,按行记录具有固定长度和顺序的编码存储信息。In the address mapping register, the encoded storage information with fixed length and order is recorded in rows.

其中,获取存储编码结果的存储地址,包括:Wherein, obtaining the storage address for storing the encoding result includes:

若对新行像素进行哈夫曼编码,则将新行像素对应哈夫曼表格暂存在内部内存条中,并将哈夫曼表格对应的内存条首地址确定为存储地址;If Huffman coding is performed on the new row of pixels, the Huffman table corresponding to the new row of pixels is temporarily stored in the internal memory bar, and the first address of the memory bar corresponding to the Huffman table is determined as the storage address;

若对新行像素进行行程编码,则新行像素对应的编码结果的写入显存的首地址、长度确定为存储地址;If the new row of pixels is run-length encoded, the first address and length of the encoding result corresponding to the new row of pixels written into the display memory are determined as the storage address;

若新行像素未进行编码,则将新行像素写入显存的首地址、长度确定为存储地址。If the new row of pixels is not encoded, the new row of pixels is written to the first address of the video memory and the length is determined as the storage address.

为便于描述,下面将上述步骤结合起来进行说明。For ease of description, the above steps are combined for explanation below.

显示画面数据(即图像数据)经过由主机经过显示控制器写入与读取。写入的像素值数据首先写入像素行缓冲区,缓冲区内最大可以缓存2行像素,如h1行,h2行。当第一行像素h1缓存完成之后便开始进行编码,如果是判断满足设定的不同像素值出现的阈值,则采取哈夫曼编码,其他行则根据是否满足行程编码的累计差值阈值进行确定编码类型进行编码。新的下一行像素写入到了h2行,当h2行像素编码完成后,新的数据继续写入到h1行,如此交替进行缓存每一行像素。The display screen data (i.e., image data) is written and read by the host through the display controller. The written pixel value data is first written into the pixel row buffer, which can cache up to 2 rows of pixels, such as row h1 and row h2. When the first row of pixels h1 is cached, encoding begins. If it is determined that the threshold of the occurrence of different pixel values is met, Huffman encoding is adopted. The other rows are encoded based on whether the cumulative difference threshold of the run encoding is met. The next row of pixels is written to row h2. When the encoding of row h2 is completed, new data continues to be written to row h1, and each row of pixels is cached alternately.

像素从采样缓冲区进入压缩编码单元,压缩编码单元遍历所有的像素值进行确定编码类型,如果确定是哈夫曼编码,则将对该行像素进行哈夫曼编码,并将哈夫曼编码表写入到哈夫曼表单元,并将该哈夫曼表存在单元中的位置写入到地址映射单元,同时将编码完成的数据在显存存储的地址、长度写入地址映射单元;如果确定是行程编码,则按照差值进行形成编码,并将编码后的写入显存的首地址、长度写入地址映射单元。Pixels enter the compression coding unit from the sampling buffer. The compression coding unit traverses all pixel values to determine the coding type. If it is determined to be Huffman coding, Huffman coding will be performed on the row of pixels, and the Huffman coding table will be written into the Huffman table unit, and the location of the Huffman table in the unit will be written into the address mapping unit, and the address and length of the encoded data stored in the video memory will be written into the address mapping unit; if it is determined to be run-length coding, the coding will be formed according to the difference, and the first address and length of the encoded data written into the video memory will be written into the address mapping unit.

地址映射单元中有地址映射寄存器用于存储编码后的每行像素存在显存的首地址与长度。其中地址映射单元按照像素行确定,每行像素在地址映射单元的长度是固定的。例如,如图2所示,首位bit57-bit56代表编码类型为不编码、行程编码、哈夫曼编码。Bit55-Bit24代表着存入显存的地址,bit23-13表示着编码后数据写入显存的长度。bit12-bit0代表着哈夫曼编码表存储的地址。The address mapping unit has an address mapping register for storing the first address and length of each row of pixels in the video memory after encoding. The address mapping unit is determined according to the pixel row, and the length of each row of pixels in the address mapping unit is fixed. For example, as shown in Figure 2, the first bit57-bit56 represents the encoding type as no encoding, run encoding, or Huffman encoding. Bit55-Bit24 represents the address stored in the video memory, and bits23-13 represent the length of the encoded data written to the video memory. Bit12-bit0 represents the address where the Huffman coding table is stored.

其中哈夫曼表同样按照行为单位进行存储,对此本申请限制了哈夫曼编码的长度,采用最大长度哈夫曼编码。当该行像素哈夫曼编码的叶子节点编码长度超过最大长度阈值的时候,将不再使用哈夫曼编码,以此来节约哈夫曼编码表的存储空间。The Huffman table is also stored in units of rows. For this reason, the present application limits the length of the Huffman code and adopts the maximum length Huffman code. When the length of the leaf node code of the Huffman code of the row of pixels exceeds the maximum length threshold, the Huffman code will no longer be used to save the storage space of the Huffman code table.

应用本申请实施例所提供的方法,包括:基于主机写入的显示画面数据,按行更新采样缓冲区;其中,采样缓冲区中存储新旧两行像素;从采样缓冲区中读取新行像素,并确定新行像素中不同像素值出现的概率;在概率满足最大长度哈夫曼编码条件的情况下,对新行像素进行哈夫曼编码,并在显存中存储编码结果;在概率未满足最大长度哈夫曼编码条件的情况下,对新行像素进行行程编码,并在显存中存储编码结果;将编码结果的存储地址写入地址映射寄存器后,返回执行基于主机写入的显示画面数据,按行更新采样缓冲区,直到完成显示画面数据的存储。The method provided by the embodiment of the present application includes: updating the sampling buffer row by row based on the display screen data written by the host; wherein the sampling buffer stores two rows of old and new pixels; reading the new row of pixels from the sampling buffer and determining the probability of different pixel values appearing in the new row of pixels; when the probability meets the maximum length Huffman coding condition, performing Huffman coding on the new row of pixels and storing the coding result in the video memory; when the probability does not meet the maximum length Huffman coding condition, performing run length coding on the new row of pixels and storing the coding result in the video memory; after writing the storage address of the coding result into the address mapping register, returning to execute the display screen data written by the host, updating the sampling buffer row by row until the storage of the display screen data is completed.

具体的,可以采用采样缓冲区来对主机写入的显示画面数据进行缓存,在进行编码处理时,以行为单元,对采样缓冲区中存储新行像素进行编码方式选择。具体的,可通过确定新行像素中不同像素出现的概率,明确新行像素是否满足最大长度哈夫曼编码条件,如果满足,则对新行像素进行哈夫曼编码,并在显存中存储编码结果;如果不满足,则对新行像素进行行程编码,并在显存中存储编码结果;在将编码结果的存储地址写入地址映射寄存器后,便可返回执行基于主机写入的显示画面数据,按行更新采样缓冲区,直到完成显示画面数据的存储。Specifically, a sampling buffer can be used to cache the display screen data written by the host. When performing encoding processing, the encoding method for storing new row pixels in the sampling buffer is selected in units of lines. Specifically, by determining the probability of different pixels in the new row of pixels appearing, it can be determined whether the new row of pixels meets the maximum length Huffman encoding condition. If it does, the new row of pixels is Huffman encoded and the encoding result is stored in the video memory; if it does not meet the condition, the new row of pixels is run-length encoded and the encoding result is stored in the video memory; after writing the storage address of the encoding result into the address mapping register, it can return to execute the display screen data written by the host, and update the sampling buffer by line until the storage of the display screen data is completed.

由于服务器显示画面较为单一,一般为文本窗口显示画面,且画面中各行像素之间的冗余度比较高,行与行像素之间的关联相似程度较高,所以采取对行与行之间进行压缩编码的方式对像素进行无损压缩,可以使得读写显存中的数据量变小,从而来降低对显存写带宽需求。对于满足最大长度哈夫曼编码条件的行像素,则优先采用哈夫曼编码来进行无损压缩。从而结合两种压缩编码方式对以行为单位进行压缩编码,从而保障压缩后的显示画面数据占用更少的显存存储空间。Since the server display screen is relatively simple, generally a text window display screen, and the redundancy between the pixels in each row of the screen is relatively high, and the correlation and similarity between the pixels in the rows are relatively high, the pixels are losslessly compressed by compressing the rows, which can reduce the amount of data in the read and write video memory, thereby reducing the demand for video memory write bandwidth. For row pixels that meet the maximum length Huffman coding conditions, Huffman coding is preferentially used for lossless compression. Therefore, the two compression coding methods are combined to compress and encode the rows in units, thereby ensuring that the compressed display screen data occupies less video memory storage space.

技术效果:在本申请中,对于主机写入的显示画面数据,实质存入到显存中的是逐行进行压缩编码的编码结果,该编码结果相对于原显示画面数据,所需要显存带宽更小,占据更小存储空间,且该编码结果是可以通过对应的解码方式进行无损解码的,因此,本申请可以在保障画面效果的情况下,降低本地显示画面所需的显存带宽。Technical effect: In the present application, for the display screen data written by the host, what is actually stored in the video memory is the encoding result of compression encoding line by line. Compared with the original display screen data, the encoding result requires a smaller video memory bandwidth and occupies a smaller storage space, and the encoding result can be losslessly decoded through the corresponding decoding method. Therefore, the present application can reduce the video memory bandwidth required for the local display screen while ensuring the picture effect.

需要说明的是,基于上述实施例,本申请实施例还提供了相应的改进方案。在优选/改进实施例中涉及与上述实施例中相同步骤或相应步骤之间可相互参考,相应的有益效果也可相互参照,在本文的优选/改进实施例中不再一一赘述。It should be noted that, based on the above embodiments, the embodiments of the present application also provide corresponding improved solutions. In the preferred/improved embodiments, the same steps or corresponding steps as those in the above embodiments can be referenced to each other, and the corresponding beneficial effects can also be referenced to each other, which will not be described one by one in the preferred/improved embodiments of this article.

在本申请中的一种实施例中,对编码后的显示画面数据进行无损解码的过程,包括:In one embodiment of the present application, the process of losslessly decoding the encoded display picture data includes:

以行为单元,从地址映射寄存器确定目标行像素的指定显存地址;Determine the designated video memory address of the target row of pixels from the address mapping register in row units;

从指定显存地址中读取,目标行像素的编码数据;Read the encoded data of the target row of pixels from the specified video memory address;

根据编码数据的编码类型进行解码,得到解码数据;Decode the encoded data according to the encoding type to obtain decoded data;

将解码数据写入到输出缓冲区,以便主机读取。Writes decoded data to the output buffer for reading by the host.

其中,根据编码数据的编码类型进行解码,得到解码数据,包括:The decoding is performed according to the encoding type of the encoded data to obtain the decoded data, including:

若编码数据未经过编码,则将编码数据确定为解码数据;If the encoded data has not been encoded, determining the encoded data as decoded data;

若编码数据经过行程编码,则对编码数据进行行程解码,得到解码数据;If the encoded data is run-length encoded, run-length decoding is performed on the encoded data to obtain decoded data;

若编码数据经过哈夫曼编码,则对编码数据进行哈夫曼解码,得打解码数据。If the encoded data is Huffman encoded, Huffman decoding is performed on the encoded data to obtain decoded data.

其中,对编码数据进行行程解码,得到解码数据,包括:The encoded data is run-length decoded to obtain decoded data, including:

从输出缓冲区中读取目标行像素的上一行解码数据;Read the previous row of decoded data of the target row of pixels from the output buffer;

以上一行解码数据为参考,结合编码数据进行行程解码,得到解码数据。The decoded data of the previous line is used as a reference, and run-length decoding is performed in combination with the encoded data to obtain the decoded data.

即,当需要从显存中读取显示画面数据的时候,首先根据地址映射单元从指定显存地址读取显存的数据,然后根据其编码类型进行解码。如果是哈夫曼编码则读取哈夫曼编码表的内容,进行解码输出;如果是行程编码,则根据行程编码差值进行解码并将像素输出到输出缓冲区内部,供主机读取;如果未经过编码,则直接输出到缓冲区内部,供主机读取。That is, when it is necessary to read the display screen data from the video memory, first read the data from the specified video memory address according to the address mapping unit, and then decode it according to its encoding type. If it is Huffman encoding, read the content of the Huffman encoding table and decode it for output; if it is run-length encoding, decode it according to the run-length encoding difference and output the pixels to the output buffer for the host to read; if it is not encoded, it is directly output to the buffer for the host to read.

相应于上面的方法实施例,本申请实施例还提供了一种控制器,该控制器可以具体为基板管理控制器,下文描述的控制器与上文描述的数据处理方法可相互对应参照。Corresponding to the above method embodiment, the embodiment of the present application further provides a controller, which may be specifically a baseboard management controller. The controller described below and the data processing method described above may refer to each other.

参见图3所示,该控制器包括以下单元:As shown in FIG3 , the controller includes the following units:

显存缓冲单元101,用于基于主机写入的显示画面数据,按行更新采样缓冲区;其中,采样缓冲区中存储新旧两行像素;The display memory buffer unit 101 is used to update the sampling buffer row by row based on the display screen data written by the host; wherein the sampling buffer stores two rows of old and new pixels;

压缩编码单元102,用于从采样缓冲区中读取新行像素,并确定新行像素中不同像素值出现的概率;在概率满足最大长度哈夫曼编码条件的情况下,对新行像素进行哈夫曼编码,并在显存中存储编码结果;在概率未满足最大长度哈夫曼编码条件的情况下,对新行像素进行行程编码,并在显存中存储编码结果;The compression coding unit 102 is used to read the new row of pixels from the sampling buffer and determine the probability of occurrence of different pixel values in the new row of pixels; when the probability meets the maximum length Huffman coding condition, the new row of pixels is Huffman coded and the coding result is stored in the video memory; when the probability does not meet the maximum length Huffman coding condition, the new row of pixels is run length coded and the coding result is stored in the video memory;

地址映射单元103,用于将编码结果的存储地址写入地址映射寄存器,并触发显存缓冲单元,直到完成显示画面数据的存储。The address mapping unit 103 is used to write the storage address of the encoding result into the address mapping register and trigger the display memory buffer unit until the storage of the display screen data is completed.

应用本申请实施例所提供的控制器,基于主机写入的显示画面数据,按行更新采样缓冲区;其中,采样缓冲区中存储新旧两行像素;从采样缓冲区中读取新行像素,并确定新行像素中不同像素值出现的概率;在概率满足最大长度哈夫曼编码条件的情况下,对新行像素进行哈夫曼编码,并在显存中存储编码结果;在概率未满足最大长度哈夫曼编码条件的情况下,对新行像素进行行程编码,并在显存中存储编码结果;将编码结果的存储地址写入地址映射寄存器后,返回执行基于主机写入的显示画面数据,按行更新采样缓冲区,直到完成显示画面数据的存储。The controller provided in the embodiment of the present application is applied to update the sampling buffer row by row based on the display screen data written by the host; wherein the old and new rows of pixels are stored in the sampling buffer; the new row of pixels is read from the sampling buffer, and the probability of different pixel values appearing in the new row of pixels is determined; when the probability meets the maximum length Huffman coding condition, the new row of pixels is Huffman coded, and the coding result is stored in the video memory; when the probability does not meet the maximum length Huffman coding condition, the new row of pixels is run-length coded, and the coding result is stored in the video memory; after writing the storage address of the coding result into the address mapping register, the display screen data written by the host is returned to be executed, and the sampling buffer is updated row by row until the storage of the display screen data is completed.

具体的,可以采用采样缓冲区来对主机写入的显示画面数据进行缓存,在进行编码处理时,以行为单元,对采样缓冲区中存储新行像素进行编码方式选择。具体的,可通过确定新行像素中不同像素出现的概率,明确新行像素是否满足最大长度哈夫曼编码条件,如果满足,则对新行像素进行哈夫曼编码,并在显存中存储编码结果;如果不满足,则对新行像素进行行程编码,并在显存中存储编码结果;在将编码结果的存储地址写入地址映射寄存器后,便可返回执行基于主机写入的显示画面数据,按行更新采样缓冲区,直到完成显示画面数据的存储。Specifically, a sampling buffer can be used to cache the display screen data written by the host. When performing encoding processing, the encoding method for storing new row pixels in the sampling buffer is selected in units of lines. Specifically, by determining the probability of occurrence of different pixels in the new row of pixels, it can be determined whether the new row of pixels meets the maximum length Huffman encoding condition. If it does, the new row of pixels is Huffman encoded and the encoding result is stored in the video memory; if it does not meet the condition, the new row of pixels is run-length encoded and the encoding result is stored in the video memory; after writing the storage address of the encoding result into the address mapping register, it can return to execute the display screen data written by the host, and update the sampling buffer by line until the storage of the display screen data is completed.

由于服务器显示画面较为单一,一般为文本窗口显示画面,且画面中各行像素之间的冗余度比较高,行与行像素之间的关联相似程度较高,所以采取对行与行之间进行压缩编码的方式对像素进行无损压缩,可以使得读写显存中的数据量变小,从而来降低对显存写带宽需求。对于满足最大长度哈夫曼编码条件的行像素,则优先采用哈夫曼编码来进行无损压缩。从而结合两种压缩编码方式对以行为单位进行压缩编码,从而保障压缩后的显示画面数据占用更少的显存存储空间。Since the server display screen is relatively simple, generally a text window display screen, and the redundancy between the pixels in each row of the screen is relatively high, and the correlation and similarity between the pixels in the rows are relatively high, the pixels are losslessly compressed by compressing the rows, which can reduce the amount of data in the read and write video memory, thereby reducing the demand for video memory write bandwidth. For row pixels that meet the maximum length Huffman coding conditions, Huffman coding is preferentially used for lossless compression. Therefore, the two compression coding methods are combined to compress and encode the rows in units, thereby ensuring that the compressed display screen data occupies less video memory storage space.

技术效果:在本申请中,对于主机写入的显示画面数据,实质存入到显存中的是逐行进行压缩编码的编码结果,该编码结果相对于原显示画面数据,所需要显存带宽更小,占据更小存储空间,且该编码结果是可以通过对应的解码方式进行无损解码的,因此,本申请可以在保障画面效果的情况下,降低本地显示画面所需的显存带宽。Technical effect: In the present application, for the display screen data written by the host, what is actually stored in the video memory is the encoding result of compression encoding line by line. Compared with the original display screen data, the encoding result requires a smaller video memory bandwidth and occupies a smaller storage space, and the encoding result can be losslessly decoded through the corresponding decoding method. Therefore, the present application can reduce the video memory bandwidth required for the local display screen while ensuring the picture effect.

在本申请的一种具体实施方式中,压缩编码单元102,具体用于在概率未满足最大长度哈夫曼编码条件的情况下,判断新行像素是否为首行像素;In a specific implementation of the present application, the compression coding unit 102 is specifically used to determine whether the new row of pixels is the first row of pixels when the probability does not meet the maximum length Huffman coding condition;

如果是,则将新行像素确定为编码结果,并在显存中存储编码结果;If yes, the new row of pixels is determined as the encoding result, and the encoding result is stored in the video memory;

如果否,则在新行像素与旧行像素的累计差值小于第二阈值的情况下,对新行像素与旧行像素的像素差值进行行程编码,在显存中存储编码结果,在累计差值不小于第二阈值的情况下,将新行像素确定为编码结果,并在显存中存储编码结果。If not, then when the cumulative difference between the new row of pixels and the old row of pixels is less than the second threshold, the pixel difference between the new row of pixels and the old row of pixels is run-length encoded, and the encoding result is stored in the video memory; when the cumulative difference is not less than the second threshold, the new row of pixels is determined as the encoding result, and the encoding result is stored in the video memory.

在本申请的一种具体实施方式中,压缩编码单元102,具体用于对新行像素和旧行像素做差,得到像素差值;In a specific implementation of the present application, the compression coding unit 102 is specifically used to perform a difference between the new row of pixels and the old row of pixels to obtain a pixel difference value;

结合动态加权系数,对像素差值中出现差值的区域逐渐加权求和,得到差值;其中,动态加权系数Cn的计算公式:Combined with the dynamic weighting coefficient, the difference area in the pixel difference is gradually weighted and summed to obtain the difference; the calculation formula of the dynamic weighting coefficient Cn is:

其中,m为当前像素n前面连续像素差值不为0的个数,w为权重系数,i为第i个Sn不为0的像素位置,为第i个动态加权系数; Where m is the number of consecutive pixels whose difference before the current pixel n is not 0, w is the weight coefficient, i is the position of the pixel where Sn is not 0, is the ith dynamic weighting coefficient;

判断差值是否大于第二阈值;Determine whether the difference is greater than a second threshold;

如果否,则对像素差值进行行程编码,在显存中存储编码结果;If not, run encoding is performed on the pixel difference and the encoding result is stored in the video memory;

如果是,则将新行像素确定为编码结果,并在显存中存储编码结果。If yes, the new row of pixels is determined as the encoding result, and the encoding result is stored in the video memory.

在本申请的一种具体实施方式中,压缩编码单元,具体用于判断概率是否超过第一阈值;In a specific implementation of the present application, the compression coding unit is specifically used to determine whether the probability exceeds a first threshold;

如果是,则确定概率满足最大长度哈夫曼编码条件;If yes, then determine the probability of satisfying the maximum length Huffman coding condition;

如果否,则确定概率未满足最大长度哈夫曼编码条件。If not, it is determined that the probability does not satisfy the maximum length Huffman coding condition.

在本申请的一种具体实施方式中,显存缓冲单元,具体用于基于显示画面数据,对采样缓冲区中的旧行像素进行覆盖写,得到新行像素,上一次写入的新行像素变更为旧行像素。In a specific implementation of the present application, the display memory buffer unit is specifically used to overwrite the old row of pixels in the sampling buffer based on the display screen data to obtain a new row of pixels, and the new row of pixels written last time are changed to the old row of pixels.

在本申请的一种具体实施方式中,地址映射单元,具体用于获取存储编码结果的存储地址;In a specific implementation of the present application, the address mapping unit is specifically used to obtain a storage address for storing the encoding result;

基于存储地址,确定新行像素的编码存储信息;Determining the encoding storage information of the new row of pixels based on the storage address;

在地址映射寄存器中,按行记录编码存储信息;其中,编码存储信息包括编码类型、存入显存的地址、编码后数据写入显存的长度和哈夫曼编码表存储的地址。In the address mapping register, the coding storage information is recorded row by row; wherein the coding storage information includes the coding type, the address stored in the video memory, the length of the coded data written into the video memory and the address stored in the Huffman coding table.

在本申请的一种具体实施方式中,地址映射单元,具体用于在地址映射寄存器中,按行记录具有固定长度和顺序的编码存储信息。In a specific implementation of the present application, the address mapping unit is specifically used to record the coded storage information with a fixed length and order in rows in the address mapping register.

在本申请的一种具体实施方式中,地址映射单元,具体用于若对新行像素进行哈夫曼编码,则将新行像素对应哈夫曼表格暂存在内部内存条中,并将哈夫曼表格对应的内存条首地址确定为存储地址;In a specific implementation of the present application, the address mapping unit is specifically used to temporarily store the Huffman table corresponding to the new row of pixels in the internal memory bar if Huffman encoding is performed on the new row of pixels, and determine the first address of the memory bar corresponding to the Huffman table as the storage address;

若对新行像素进行行程编码,则新行像素对应的编码结果的写入显存的首地址、长度确定为存储地址;If the new row of pixels is run-length encoded, the first address and length of the encoding result corresponding to the new row of pixels written into the display memory are determined as the storage address;

若新行像素未进行编码,则将新行像素写入显存的首地址、长度确定为存储地址。If the new row of pixels is not encoded, the new row of pixels is written to the first address of the video memory and the length is determined as the storage address.

在本申请的一种具体实施方式中,还包括:In a specific implementation of the present application, it also includes:

无损解码单元,用于以行为单元,从地址映射寄存器确定目标行像素的指定显存地址;A lossless decoding unit, used for determining a designated video memory address of a target row of pixels from an address mapping register in a row unit;

从指定显存地址中读取,目标行像素的编码数据;Read the encoded data of the target row of pixels from the specified video memory address;

根据编码数据的编码类型进行解码,得到解码数据;Decode the encoded data according to the encoding type to obtain decoded data;

将解码数据写入到输出缓冲区,以便主机读取。Writes decoded data to the output buffer for reading by the host.

在本申请的一种具体实施方式中,无损解码单元,具体用于若编码数据未经过编码,则将编码数据确定为解码数据;In a specific implementation of the present application, the lossless decoding unit is specifically configured to determine the encoded data as decoded data if the encoded data has not been encoded;

若编码数据经过行程编码,则对编码数据进行行程解码,得到解码数据;If the encoded data is run-length encoded, run-length decoding is performed on the encoded data to obtain decoded data;

若编码数据经过哈夫曼编码,则对编码数据进行哈夫曼解码,得打解码数据。If the encoded data is Huffman encoded, Huffman decoding is performed on the encoded data to obtain decoded data.

在本申请的一种具体实施方式中,无损解码单元,具体用于从输出缓冲区中读取目标行像素的上一行解码数据;In a specific implementation of the present application, the lossless decoding unit is specifically configured to read a previous row of decoded data of pixels in a target row from an output buffer;

以上一行解码数据为参考,结合编码数据进行行程解码,得到解码数据。The decoded data of the previous line is used as a reference, and run-length decoding is performed in combination with the encoded data to obtain the decoded data.

相应于上面的方法实施例,本申请实施例还提供了一种控制器,下文描述的一种服务器与上文描述的一种数据处理方法、一种控制器可相互对应参照。Corresponding to the above method embodiment, the embodiment of the present application further provides a controller, and the server described below and the data processing method and controller described above can refer to each other.

请参考图4,该服务器,包括:Please refer to Figure 4, the server includes:

如上述的控制器;A controller as described above;

控制器实现如上述数据处理方法的步骤。The controller implements the steps of the above data processing method.

在该服务器中,包括主机,和如图3所示的基板管理控制器,以及显存。The server includes a host, a baseboard management controller as shown in FIG3 , and a video memory.

在基板管理控制器中,包括数据采样缓冲区,压缩编码模块(同压缩编码单元)、像素行写入缓冲区、控制模块、地址映射单元(其内具有地址映射寄存器)、哈夫曼存储单元(其内存储哈夫曼表格)、解码模块(同无损解码单元)、显存读取缓冲区和数据输出缓冲区。The baseboard management controller includes a data sampling buffer, a compression coding module (same as the compression coding unit), a pixel row write buffer, a control module, an address mapping unit (which has an address mapping register), a Huffman storage unit (which stores the Huffman table), a decoding module (same as the lossless decoding unit), a video memory read buffer and a data output buffer.

具体的,图像数据经过由主机经过显示控制器写入与读取。写入的像素值数据首先写入像素行缓冲区,缓冲区内最大可以缓存2行像素h1行h2行。当第一行像素h1缓存完成之后便开始进行编码,如果是判断满足本文设定的不同像素值出现的阈值,则采取哈夫曼编码,其他行则根据是否满足行程编码的累计差值阈值进行确定编码类型进行编码。新的下一行像素写入到了h2行,当h2行像素编码完成后,新的数据继续写入到h1行,如此交替进行缓存每一行像素。Specifically, the image data is written and read by the host through the display controller. The written pixel value data is first written into the pixel row buffer, and a maximum of 2 rows of pixels, h1 and h2, can be cached in the buffer. When the first row of pixels h1 is cached, encoding begins. If it is determined that the threshold of different pixel values set in this article is met, Huffman encoding is adopted, and other rows are encoded based on whether the cumulative difference threshold of the run encoding is met. The next row of pixels is written to the h2 row. When the encoding of the h2 row of pixels is completed, the new data continues to be written to the h1 row, and each row of pixels is cached alternately.

像素从采样缓冲区进入压缩编码单元,压缩编码单元遍历所有的像素值进行确定编码类型,如果确定是哈夫曼编码,则将对该行像素进行哈夫曼编码,并将哈夫曼编码表写入到哈夫曼表单元,并将该哈夫曼表存在单元中的位置写入到地址映射单元,同时将编码完成的数据在显存存储的地址、长度写入地址映射单元;如果确定是行程编码,则按照差值进行形成编码,并将编码后的写入显存的首地址、长度写入地址映射单元。Pixels enter the compression coding unit from the sampling buffer. The compression coding unit traverses all pixel values to determine the coding type. If it is determined to be Huffman coding, Huffman coding will be performed on the row of pixels, and the Huffman coding table will be written into the Huffman table unit, and the location of the Huffman table in the unit will be written into the address mapping unit, and the address and length of the encoded data stored in the video memory will be written into the address mapping unit; if it is determined to be run-length coding, the coding will be formed according to the difference, and the first address and length of the encoded data written into the video memory will be written into the address mapping unit.

地址映射单元用于存储编码后的每行像素存在显存的首地址与长度。其中地址映射单元按照像素行确定,每行像素在地址映射单元的长度是固定的。其中首位bit57-bit56代表编码类型为不编码、行程编码、哈夫曼编码。Bit55-Bit24代表着存入显存的地址,bit23-13表示着编码后数据写入显存的长度。bit12-bit0代表着哈夫曼编码表存储的地址。The address mapping unit is used to store the first address and length of each row of pixels in the video memory after encoding. The address mapping unit is determined according to the pixel row, and the length of each row of pixels in the address mapping unit is fixed. The first bit57-bit56 represents the encoding type, which is no encoding, run encoding, or Huffman encoding. Bit55-Bit24 represents the address stored in the video memory, and bits23-13 represent the length of the encoded data written to the video memory. Bit12-bit0 represents the address where the Huffman coding table is stored.

其中哈夫曼表同样按照行为单位进行存储,对此本文限制了哈夫曼编码的长度,采用最大长度哈夫曼编码。当该行像素哈夫曼编码的叶子节点编码长度超过最大长度阈值的时候,将不再使用哈夫曼编码,以此来节约哈夫曼编码表的存储空间。The Huffman table is also stored in units of rows. For this reason, this paper limits the length of Huffman coding and adopts maximum length Huffman coding. When the length of the leaf node coding of the Huffman coding of the row of pixels exceeds the maximum length threshold, Huffman coding will no longer be used to save the storage space of the Huffman coding table.

当需要从显存中读取显示的数据的时候,首先控制模块根据地址映射单元从指定显存地址读取显存的数据,然后根据其编码类型进行解码。如果是哈夫曼编码则读取哈夫曼编码表的内容,进行解码输出;如果是行程编码,则根据行程编码差值进行解码并将像素输出到输出缓冲区内部,供主机读取。When it is necessary to read the display data from the video memory, the control module first reads the data from the specified video memory address according to the address mapping unit, and then decodes it according to its encoding type. If it is Huffman encoding, the content of the Huffman encoding table is read and decoded and output; if it is run-length encoding, it is decoded according to the run-length encoding difference and the pixels are output to the output buffer for the host to read.

可见,在该服务器中,可以实现降低读写显存的数据量,从而降低显存需求带宽;在服务器显示应用场景下,可以将显存数据量压缩至50%-70%,从而节约50%-70%显存带宽,提高BMC系统的性能。采用无损压缩的方式,保证显示画面无失真,无花点、黑点问题等。一定程度上节约相关的硬件成本,提高系统性能与稳定性。It can be seen that in this server, the amount of data read and written to the video memory can be reduced, thereby reducing the required bandwidth of the video memory; in the server display application scenario, the amount of video memory data can be compressed to 50%-70%, thereby saving 50%-70% of the video memory bandwidth and improving the performance of the BMC system. The use of lossless compression ensures that the display screen is free of distortion, spots, black spots, etc. This saves related hardware costs to a certain extent and improves system performance and stability.

相应于上面的方法实施例,本申请实施例还提供了一种可读存储介质,下文描述的一种可读存储介质与上文描述的一种数据处理方法可相互对应参照。Corresponding to the above method embodiment, the embodiment of the present application further provides a readable storage medium. The readable storage medium described below and the data processing method described above can refer to each other.

一种可读存储介质,可读存储介质上存储有计算机程序,计算机程序被处理器执行时实现上述方法实施例的数据处理方法的步骤。A readable storage medium stores a computer program, which implements the steps of the data processing method of the above method embodiment when the computer program is executed by a processor.

该可读存储介质具体可以为U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可存储程序代码的可读存储介质。The readable storage medium may specifically be a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, or other readable storage medium that can store program codes.

相应于上面的方法实施例,本申请实施例还提供了一种计算机程序产品,下文描述的一种计算机程序产品与上文描述的一种数据处理方法可相互对应参照。Corresponding to the above method embodiment, the embodiment of the present application further provides a computer program product. The computer program product described below and the data processing method described above can refer to each other.

一种计算机程序产品,包括计算机程序/指令,计算机程序/指令被处理器执行时,实现上述数据处理方法的步骤。A computer program product includes a computer program/instruction. When the computer program/instruction is executed by a processor, the steps of the above data processing method are implemented.

本说明书中各个实施例采用递进的方式描述,每个实施例重点说明的都是与其它实施例的不同之处,各个实施例之间相同或相似部分互相参见即可。对于实施例公开的装置而言,由于其与实施例公开的方法相对应,所以描述的比较简单,相关之处参见方法部分说明即可。In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

本领域技术人员还可以进一步意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件的方式来执行,取决于技术方案的特定应用和设计约束条件。本领域技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应该认为超出本申请的范围。Those skilled in the art may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

结合本文中所公开的实施例描述的方法或算法的步骤可以直接用硬件、处理器执行的软件模块,或者二者的结合来实施。软件模块可以置于随机存储器(RAM)、内存、只读存储器(ROM)、电可编程ROM、电可擦除可编程ROM、寄存器、硬盘、可移动磁盘、CD-ROM、或技术领域内所公知的任意其它形式的存储介质中。The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

最后,还需要说明的是,在本文中,诸如第一和第二等之类的关系属于仅仅用来将一个实体或者操作与另一个实体或者操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语包括、包含或者其他任何变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。Finally, it should be noted that, in this article, relationships such as first and second, etc. are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms include, include or any other variations are intended to cover non-exclusive inclusion, so that a process, method, article or device that includes a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device.

本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的一般技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上,本说明书内容不应理解为对本申请的限制。Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core idea of the present application. At the same time, for those skilled in the art, according to the idea of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims (15)

1. A method of data processing, comprising:
updating the sampling buffer area according to the line based on the display picture data written by the host; wherein, the sampling buffer area stores two rows of pixels of new and old;
reading a new line of pixels from the sampling buffer, and determining the probability of occurrence of different pixel values in the new line of pixels;
under the condition that the probability meets the maximum length Huffman coding condition, carrying out Huffman coding on the new line of pixels, and storing the coding result in a video memory;
Under the condition that the probability does not meet the maximum length Huffman coding condition, carrying out run-length coding on the pixels of the new line, and storing a coding result in a video memory;
and after the storage address of the coding result is written into an address mapping register, returning to execute the display picture data written in based on the host, and updating the sampling buffer area according to the row until the storage of the display picture data is completed.
2. The method of claim 1, wherein, in the case where the probability does not satisfy a maximum length huffman coding condition, run-length coding the new line of pixels and storing the coding result in a video memory, comprising:
judging whether the new line of pixels are the first line of pixels or not under the condition that the probability does not meet the maximum length Huffman coding condition;
If yes, determining the new line of pixels as the coding result, and storing the coding result in a video memory;
If not, carrying out stroke coding on the pixel difference value of the new line pixel and the old line pixel under the condition that the accumulated difference value of the new line pixel and the old line pixel is smaller than a second threshold value, storing a coding result in a video memory, determining the new line pixel as the coding result under the condition that the accumulated difference value is not smaller than the second threshold value, and storing the coding result in the video memory.
3. The method according to claim 2, wherein run-length encoding the pixel difference value of the new line pixel and the old line pixel in a case where the accumulated difference value of the new line pixel and the old line pixel is smaller than a second threshold value, storing the encoded result in a display memory, determining the new line pixel as the encoded result in a case where the accumulated difference value is not smaller than the second threshold value, and storing the encoded result in a display memory, comprises:
Performing difference on the new line of pixels and the old line of pixels to obtain the pixel difference value;
Gradually weighting and summing areas with differences in the pixel differences by combining dynamic weighting coefficients to obtain the differences; wherein, the calculation formula of the dynamic weighting coefficient Cn is as follows:
wherein m is the number of the continuous pixel difference values which are not 0 before the current pixel n, w is a weight coefficient, i is the pixel position of which the ith Sn is not 0, Is the i-th dynamic weighting coefficient;
Judging whether the difference value is larger than the second threshold value or not;
if not, carrying out run-length coding on the pixel difference value, and storing the coding result in a video memory;
if yes, the new line of pixels are determined to be the coding result, and the coding result is stored in a video memory.
4. The method of claim 1, wherein determining whether the probability satisfies a maximum length huffman coding condition comprises:
Judging whether the probability exceeds a first threshold value;
If yes, determining that the probability meets the Huffman coding condition of the maximum length;
if not, determining that the probability does not meet the Huffman coding condition of the maximum length.
5. The method of claim 1, wherein updating the sample buffer on a row-by-row basis based on display screen data written by the host comprises:
and based on the display picture data, overwriting the old line pixels in the sampling buffer area to obtain new line pixels, and changing the last written new line pixels into the old line pixels.
6. The method of claim 1, wherein writing the memory address of the encoded result to an address mapping register comprises:
Acquiring a storage address for storing the coding result;
determining the coding storage information of the new line of pixels based on the storage address;
In the address mapping register, the code storage information is recorded according to the row; the coding storage information comprises a coding type, an address stored in a video memory, the length of the coded data written in the video memory and the address stored in a Huffman coding table.
7. The method of claim 6, wherein encoding stored information in the address mapping register in a row record comprises:
in the address mapping register, the encoded storage information having a fixed length and order is recorded in rows.
8. The method of claim 6, wherein obtaining a memory address storing the encoded result comprises:
If Huffman coding is carried out on the new line of pixels, temporarily storing a Huffman table corresponding to the new line of pixels in an internal memory bank, and determining a memory bank head address corresponding to the Huffman table as the storage address;
If the new line of pixels are subjected to run-length coding, determining the first address and the length of the writing video memory of the coding result corresponding to the new line of pixels as the storage address;
And if the new line of pixels are not coded, determining the first address and the length of the new line of pixels written into the video memory as the storage address.
9. The method according to any one of claims 1 to 8, further comprising:
determining a specified video memory address of a target row pixel from the address mapping register by using a row unit;
reading the coded data of the pixels of the target row from the appointed video memory address;
Decoding according to the coding type of the coded data to obtain decoded data;
the decoded data is written to an output buffer for reading by the host.
10. The method of claim 9, wherein decoding according to the type of encoding of the encoded data results in decoded data, comprising:
If the encoded data is not encoded, determining the encoded data as the decoded data;
If the coded data is subjected to run-length coding, run-length decoding is carried out on the coded data to obtain decoded data;
and if the coded data is subjected to Huffman coding, carrying out Huffman decoding on the coded data to obtain the decoded data.
11. The method of claim 10, wherein run-length decoding the encoded data to obtain the decoded data comprises:
Reading the decoded data of the last row of pixels of the target row from the output buffer;
And taking the decoded data of the previous line as a reference, and carrying out run-length decoding by combining the encoded data to obtain the decoded data.
12.A controller for a vehicle, which is configured to control a controller, characterized by comprising the following steps:
the video memory buffer unit is used for updating the sampling buffer area according to the line based on the display picture data written by the host; wherein, the sampling buffer area stores two rows of pixels of new and old;
The compression coding unit is used for reading the pixels of the new line from the sampling buffer area and determining the occurrence probability of different pixel values in the pixels of the new line; under the condition that the probability meets the maximum length Huffman coding condition, carrying out Huffman coding on the new line of pixels, and storing the coding result in a video memory; under the condition that the probability does not meet the maximum length Huffman coding condition, carrying out run-length coding on the pixels of the new line, and storing a coding result in a video memory;
and the address mapping unit is used for writing the storage address of the coding result into an address mapping register and triggering the video memory buffer unit until the storage of the display picture data is completed.
13. A server for a server, which comprises a server and a server, characterized by comprising the following steps:
the controller of claim 12;
The controller implements the steps of the data processing method according to any one of claims 1 to 11.
14. A readable storage medium, characterized in that the readable storage medium has stored thereon a computer program which, when executed by a processor, implements the steps of the data processing method according to any of claims 1 to 11.
15. A computer program product comprising computer programs/instructions which, when executed by a processor, implement the steps of the data processing method of any of claims 1 to 11.
CN202411187774.XA 2024-08-28 2024-08-28 Data processing method, controller, server, storage medium and program product Active CN118710740B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202411187774.XA CN118710740B (en) 2024-08-28 2024-08-28 Data processing method, controller, server, storage medium and program product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202411187774.XA CN118710740B (en) 2024-08-28 2024-08-28 Data processing method, controller, server, storage medium and program product

Publications (2)

Publication Number Publication Date
CN118710740A true CN118710740A (en) 2024-09-27
CN118710740B CN118710740B (en) 2025-01-10

Family

ID=92818218

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202411187774.XA Active CN118710740B (en) 2024-08-28 2024-08-28 Data processing method, controller, server, storage medium and program product

Country Status (1)

Country Link
CN (1) CN118710740B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH1032696A (en) * 1996-07-18 1998-02-03 Matsushita Electric Ind Co Ltd Image transmitter
CN1221291A (en) * 1997-12-22 1999-06-30 大宇电子株式会社 Method and apparatus for adaptively encoding binary shape signal
CN1867077A (en) * 2005-05-19 2006-11-22 佳能株式会社 Image encoding device and method
JP2009076992A (en) * 2007-09-18 2009-04-09 Canon Inc Image coding device and its control method
CN109151436A (en) * 2018-09-30 2019-01-04 Oppo广东移动通信有限公司 Data processing method and device, electronic equipment and storage medium
CN109672451A (en) * 2018-12-24 2019-04-23 哈尔滨工业大学(深圳) Demura data compression method, mura compensation method and device
CN116664705A (en) * 2023-03-29 2023-08-29 中国科学院高能物理研究所 Heterogeneous calculation acceleration method for intelligent lossless compression algorithm

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH1032696A (en) * 1996-07-18 1998-02-03 Matsushita Electric Ind Co Ltd Image transmitter
CN1221291A (en) * 1997-12-22 1999-06-30 大宇电子株式会社 Method and apparatus for adaptively encoding binary shape signal
CN1867077A (en) * 2005-05-19 2006-11-22 佳能株式会社 Image encoding device and method
JP2009076992A (en) * 2007-09-18 2009-04-09 Canon Inc Image coding device and its control method
CN109151436A (en) * 2018-09-30 2019-01-04 Oppo广东移动通信有限公司 Data processing method and device, electronic equipment and storage medium
CN109672451A (en) * 2018-12-24 2019-04-23 哈尔滨工业大学(深圳) Demura data compression method, mura compensation method and device
CN116664705A (en) * 2023-03-29 2023-08-29 中国科学院高能物理研究所 Heterogeneous calculation acceleration method for intelligent lossless compression algorithm

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
戴微微;杨铭;: "基于JPEG标准的图像压缩技术的研究", 中国新技术新产品, no. 11, 10 June 2012 (2012-06-10) *

Also Published As

Publication number Publication date
CN118710740B (en) 2025-01-10

Similar Documents

Publication Publication Date Title
US5936616A (en) Method and system for accessing and displaying a compressed display image in a computer system
US8774535B2 (en) Method and apparatus for compression of multi-sampled anti-aliasing color data
US10542276B2 (en) Data caching method and apparatus for video decoder
US7039241B1 (en) Method and apparatus for compression and decompression of color data
US6492991B1 (en) Method and apparatus for controlling compressed Z information in a video graphics system
US7764833B2 (en) Method and apparatus for anti-aliasing using floating point subpixel color values and compression of same
US7519781B1 (en) Physically-based page characterization data
US6630933B1 (en) Method and apparatus for compression and decompression of Z data
CN108377394B (en) Image data reading method of video encoder, computer device and computer-readable storage medium
CN111355962A (en) Video decoding caching method suitable for multiple reference frames, computer device and computer readable storage medium
CN104952088B (en) A kind of method for being compressed and decompressing to display data
US7932914B1 (en) Storing high dynamic range data in a low dynamic range format
CN1163079C (en) Method and device for video decoding
US8320684B2 (en) Image compressing apparatus, image compressing method and program
JP4189443B2 (en) Graphics image compression and decompression method
GB2604266A (en) Compression techniques for pixel write data
CN114422807B (en) Transmission optimization method based on Spice protocol
CN113709494B (en) Image decompression method and device for super-resolution reconstruction
CN118710740A (en) Data processing method, controller, server, storage medium and program product
CN104731519B (en) Cache memory management device and dynamic image system and method using the cache memory management device
JP3322233B2 (en) Moving image decompression method and recording medium recording program for executing the method
US11205243B2 (en) Data processing systems
CN114567787B (en) Video compression method, system and related device applied to BMC
CN115829846A (en) Image processing method, image processing device, electronic equipment and storage medium
JP3859325B2 (en) Image iterative transform decoding apparatus and method, and recording medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant