KVM video compression method and system

By dividing KVM video frames into pixel blocks and compressing them based on block check code comparison, the problems of high hardware overhead and memory bandwidth in the existing technology are solved, efficient video compression and low-bandwidth transmission are achieved, and the user experience is improved.

CN120639989APending Publication Date: 2025-09-12GUANGDONG STARFIVE TECH LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511075063.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-01
Publication Date
2025-09-12

AI Technical Summary

Technical Problem

Existing KVM video compression technology is difficult to achieve high compression ratios while ensuring clarity, and has high hardware overhead and memory bandwidth requirements, affecting user experience and network transmission efficiency.

Method used

The KVM video frame is divided into pixel blocks, the frame type is determined by calculating the block check code and comparing them, and only the changed blocks are JPEG compressed and encoded, which is compatible with the OpenBMC RFB protocol.

Benefits of technology

It achieves efficient video compression, reduces hardware overhead and memory bandwidth requirements, and has good compatibility, adapts to low-bandwidth network transmission, and improves user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120639989A_ABST
    Figure CN120639989A_ABST
Patent Text Reader

Abstract

The invention provides a KVM (Keyboard Video Mouse) video compression method and system. The method comprises the following steps: S1, segmenting an I frame and all P frames in an image group into pixel blocks and outputting the pixel blocks frame by frame; s2, judging the type of the current frame; if the frame is the I frame, executing the step S3; if the frame is a common P frame, executing the step S4; if the frame is the complete P frame, executing the step S6; s3, each pixel block of the I frame is sent to a JPEG compression encoder for compression encoding; the JPEG compression encoder outputs the compressed data to a data packer; then executing the step S7; step S4, performing a to-be-coded region CR, and then executing step S5; s5, sending a to-be-coded region CR corresponding to the current frame to a JPEG compression encoder; the JPEG compression encoder outputs the compressed data to a data packer; then executing the step S7; and step S6, the block comparison module directly sends a no-data frame identifier to the data packager. According to the method, the definition of the KVM video can be ensured, and a relatively high compression ratio can be achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of digital video processing, and in particular relates to a KVM video compression method and system. Background Art

[0002] The remote switching management system of keyboard, video and mouse, namely KVM system, is also known as multi-computer control system, which is mainly used for remote control of various computers in the computer room. KVM video is the data collected and compressed from the original video output of the computer screen in the digital KVM system. Figure 1 As shown in the figure, a typical KVM system consists of a server, a BMC (baseboard management control) chip, a local monitor, a gateway router, a display controller, and a remote client. This solution implements the video compression function in the BMC chip. The video output from the video compression to the KVM module is compressed video.

[0003] There are many technologies for KVM video data compression, which can be roughly divided into two categories: 1. Using existing video compression standards, such as MPEG and H264, has the advantage of mature technology, but the disadvantage is high hardware overhead and high computing power requirements for the compressor and decoder. In addition, their compression optimization methods for moving objects are not applicable to KVM videos, resulting in unclear textures, which affects the display of characters and geometric graphics and brings a poor user experience.

[0004] 2. Customized video compression methods have various implementation methods. In summary, some methods have simple compressors but high requirements on memory bandwidth; some methods draw on MPEG standards, but the hardware overhead is still large. Summary of the Invention

[0005] The purpose of the present invention is to provide a KVM video compression method and system that can ensure the clarity of KVM video while achieving a high compression rate to meet the requirements of low-bandwidth network transmission. The technical solution adopted is as follows: A KVM video compression method comprises the following steps: Step S1: Obtain a KVM video stream of an image group from the system memory frame by frame, then divide the I frame and all P frames in the image group into pixel blocks and output them frame by frame; A group of pictures consists of an I frame and subsequent multiple P frames; Step S2: Calculate the block check code of all pixel blocks in the current frame. The block comparison module Blockcompare determines the type of the current frame based on the block check code comparison results of the previous and next frames. The specific determination method includes the following: (1) If it is the first frame, it must be an I frame, and only the block check code is cached without comparison; (2) Starting from the second frame, each block check code of the current frame is compared with the block check code of the same position in the previous frame. If the number of different block check codes exceeds the set threshold, the block check code of the current frame is considered to be different from that of the previous frame, and the current frame is determined to be an I frame. Otherwise, it is an ordinary P frame, and the pixel block cb in the current frame, that is, the pixel block block where the block check code changes, is recorded; If the block check codes of the two frames are exactly the same, it is determined to be a complete P frame; After the judgment is completed, all block check codes of the current frame are cached and all block check codes of the previous frame are discarded; Except for the first frame, the rest of the I frames are forced to insert the current P frame at regular intervals through the Block compare module; Based on the above two determination methods, if it is an I frame, execute step S3; if it is a normal P frame, execute step S4; if it is a complete P frame, execute step S6; In step S3, each pixel block of the I frame is sent to the JPEG compression encoder for compression encoding; the JPEG compression encoder outputs the compressed data to the data packager; and then step S7 is executed; Step S4: Delimit the region to be encoded CR including all pixel blocks cb according to the pixel blocks cb, and then execute step S5; Step S5: Send the to-be-encoded region CR corresponding to the current frame to the JPEG compression encoder; the JPEG compression encoder outputs the compressed data to the data packager; then execute step S7; Step S6: The block comparison module Block compare directly sends a no data frame identifier to the data packager; Step S7: The data packager classifies and packages the data according to whether it is an I frame, a normal P frame or a complete P frame sent from the previous stage, and finally stores it in the system memory.

[0006] Preferably, step S4 further includes the following steps: The region to be encoded CR is a bitmap.

[0007] Preferably, the verification code in step S2 includes a CRC value and a Checksum value.

[0008] Preferably, the region to be encoded CR of the current frame in step S4 includes all pixel blocks cb and contains a minimum number of complete pixel blocks.

[0009] Preferably, it is characterized in that in step S7, the compressed data is packaged using the OpenBMC RFB protocol.

[0010] A KVM video compression system, used to implement the KVM video compression method, comprising: The video reading and segmentation module Block Organize is used to obtain the KVM video stream of an image group, then divide the I frame and all P frames in the image group into pixel blocks and output them frame by frame to the verification code calculation module; The verification code calculation module is used to calculate the block verification code of all pixel blocks in the current frame and cache it; The block comparison module, Block Compare, is used to compare the block check codes of the pixel blocks at the same position in the current frame and the previous frame after the first frame, and output the pixel block cb and the region to be encoded CR in the previous frame; the pixel block cb is the pixel block whose block check code has changed; A JPEG compression encoder is used to receive the region to be encoded CR and output compressed data; and a data packing module, Compressed Data Pack, for receiving compressed data and packing it according to the OpenBMC RFB protocol.

[0011] Compared with the prior art, the advantages of the present invention are: 1. Divide a frame of image into several pixel blocks, calculate the CRC and CheckSum values ​​of each block, and determine whether the image content has changed by comparing the CRC and CheckSum values ​​of the previous and next frames. Only the changed blocks are compressed and encoded, which simplifies the calculation complexity and reduces latency, while also reducing the memory bandwidth requirement.

[0012] 2. Fully compatible with the OpenBMC RFB protocol, reducing the difficulty of developing upper-layer application software.

[0013] 3. While ensuring image quality, the average compression rate also meets the requirements of low-bandwidth network transmission, thus adapting to various complex network environments.

[0014] 4. The core of the compression engine uses standard baseline JPEG, which has good compatibility, low hardware overhead and low cost. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] Figure 1 This is a typical KVM system diagram; Figure 2 This is the hardware framework diagram of the KVM video compression system; Figure 3 A diagram illustrating the relationship between video frames; Figure 4 is a flow chart of a KVM video compression method; Figure 5 Schematic diagram of the region to be encoded CR; Figure 6 This is the structural diagram of the JPEG encoder. DETAILED DESCRIPTION

[0016] The following is a more detailed description of the KVM video compression method and system of the present invention, with reference to schematic diagrams. These schematic diagrams illustrate preferred embodiments of the present invention. It should be understood that those skilled in the art may modify the present invention as described herein while still achieving the beneficial effects of the present invention. Therefore, the following description should be understood as a general guideline for those skilled in the art and not as a limitation of the present invention.

[0017] like Figures 2 to 6 As shown, a KVM video compression method includes the following steps: Step S1: The Block Organize module reads the KVM video stream (uncompressed original video stream) of an image group from the memory mem frame by frame, then divides the I frame and all P frames in the image group into pixel blocks and outputs them frame by frame.

[0018] A group of pictures (GOP) consists of an I frame and a plurality of subsequent P frames.

[0019] I-frame is the base frame (also called reference frame) and is fully JPEG encoded, while P-frame is the predicted frame and only the difference compared to the previous frame (I-frame or P-frame) is JPEG encoded.

[0020] The pixel block size can be configured, such as 64x64 pixels.

[0021] In step S2, the CRC and checksum modules calculate the block checksums of all pixel blocks in the current frame. The block compare module determines the type of the current frame based on the block checksum comparison results of the previous and next frames. The determination method specifically includes: (1) If it is the first frame, it must be an I frame, and only the block check code is cached without comparison; (2) Starting from the second frame, the block check code of the current frame is compared with the block check code of the previous frame. If the number of unequal block check codes exceeds a certain threshold (software configurable), that is, more blocks have changed between the previous and next frames (indicating a significant change in image content), the current frame is determined to be an I frame. Otherwise, the current frame is a normal P frame, and the pixel block cb in the current frame, that is, the pixel block block whose block check code has changed, is recorded; There is a special case where the block check codes of the two frames are exactly the same, in which case it is determined to be a complete P frame.

[0022] After the determination is completed, the block check code of the current frame is cached and the block check code of the previous frame is discarded.

[0023] According to the image compression algorithm in the prior art: if the picture changes, the first frame after the change is generally an I frame, and the subsequent frames with stable pictures are generally P frames.

[0024] In summary, the current frame includes several block check codes. When the difference exceeds a set threshold, the current frame is considered an I frame. The "difference" refers to the number of unequal block check codes.

[0025] Specifically, if a frame is divided into N pixel blocks, there are N block check codes; Assume that a frame consists of 600 pixel blocks and the threshold is set to 20. Create a counter C and compare the checksums of the same blocks in the previous and next frames one by one. If the checksums are not equal, C+1 is incremented. After comparing all 600 pixel blocks, if C > 20, the current frame is considered an I-frame; if 0 < C <= 20, it is considered a normal P-frame; and if C = 0, it is considered a full P-frame.

[0026] That is, the checksum comparison can only be equal (same) or unequal (different). If the checksum is equal, it means the two blocks are the same; if it is not equal, it means the two blocks are different.

[0027] To enhance the fault tolerance of KVM video streams, the Block Compare module will forcibly insert an I-frame at regular intervals (software configurable). This prevents the decoder from being unable to restore normal video streaming if errors occur during the transmission of long P-frames. In other words, I-frames are not compared with block checksums. Instead, all block checksums of the current frame are cached and all block checksums of the previous frame are discarded. That is, "insertion" means: it does not mean adding an extra frame, but forcibly judging the current P frame as an I frame, which is equivalent to inserting an I frame.

[0028] That is, I frames are continuously inserted into the video stream.

[0029] A video can be divided into multiple groups of pictures; a group of pictures consists of an I frame and multiple P frames; so the whole video is IPPP...P IPPP...P...IPPP...P and so on ( Figure 3 ).

[0030] In the above two determinations, if it is an I frame, execute step S3; if it is a normal P frame, execute step S4; if it is a complete P frame, execute step S6.

[0031] Figure 4 In the block data, the pixel block is block.

[0032] In step S3, each pixel block of the I frame is sent to the JPEG Encoder module for compression encoding; the JPEG compression encoder outputs the compressed data to the data packager; and then step S7 is executed; Step S4: While determining the P frame, the Block compare module also records the pixel block cb (changed block) in the current frame, i.e., the pixel block whose block check code has changed; According to these cb, a to-be-coded region CR (Changed Region) including all pixel blocks cb can be delineated, and then step S5 is executed.

[0033] The pixel block whose block check code changes, that is, the block check code of the pixel block in the current frame is different from the block check code of the previous frame.

[0034] Step S5: Send the to-be-encoded region CR corresponding to the current frame to the JPEG compression encoder; the JPEG compression encoder outputs the compressed data to the data packager; then execute step S7; Step S6: The characteristic of a complete P frame is that it is exactly the same as the previous frame (all block check codes are the same) and does not contain CR, so it does not need to be JPEG compressed. The block compare module will directly send a no data frame flag (frame_wo_data_flag) to the data packager. Step S7: The data packager classifies and packages the data according to whether it is an I frame, a normal P frame or a complete P frame sent from the previous stage, and finally stores it in the system memory.

[0035] Step S8: Repeat steps S1 to S7 to process the next frame in the image group.

[0036] Furthermore, step S4 further includes the following steps: More specifically, a bitmap is generated, where the bitmap is composed of pixel blocks cb; and the bitmap is reported to the software.

[0037] The specific method of generating a bitmap is to use 1 bit to identify each pixel block, 1 represents CB, and 0 represents non-CB. These bits are combined to form a bitmap; in this way, the CB of the entire frame image can be accurately described by such a bitmap and reported to the software through an interrupt.

[0038] like Figure 3 As shown, the insertion of I frames follows two principles: one is that I frames must be inserted within a fixed time interval to enhance system stability; the other is that I frames are inserted when the difference between the current and subsequent frames exceeds a certain threshold.

[0039] The difference between the previous and next frames refers to the number of pixel blocks cb.

[0040] The interval between I frames (Ti1, Ti2) is determined by these two principles.

[0041] Furthermore, the block check code in step S2 includes a CRC value and a checksum value. The purpose of using double check here is to reduce the probability of data collision (i.e., different data but the same checksum value).

[0042] Compare the CRC value of the pixel block at the same position in the current frame with that in the previous frame, and compare the Checksum value of the pixel block at the same position in the current frame with that in the previous frame; If one of the above two types of values ​​changes, the pixel block block in the current frame becomes the pixel block cb in the current frame.

[0043] like Figure 2 As shown, a KVM video compression system is used to implement a KVM video compression method, comprising: The video reading and segmentation module Block Organize is used to obtain the KVM video stream of an image group, then divide the I frame and all P frames in the image group into pixel blocks and output them frame by frame to the verification code calculation module.

[0044] The Block Organize module is mainly composed of image block buffers and read-write control logic. The image block buffers have different combinations depending on the video stream format. For example, for the YUV420 format, the Y element has a separate buffer, while the UV element shares a buffer. The read-write control logic controls the writing order from the system memory Mem to the block buffer and the reading order from the block buffer to the CRC and checksum.

[0045] The verification code calculation module is used to calculate the block verification code of all pixel blocks in the current frame and cache it; The verification code calculation module consists of two parts: CRC and checksum. CRC uses the CRC32 algorithm. The checksum algorithm aligns and accumulates 32 bits, discards any overflows and carries, and finally obtains a 32-bit block checksum. The block compare module, Block Compare, compares the block check codes of the pixel blocks at the same position in the current frame and the previous frame after the first frame, and outputs the pixel block cb and the region to be encoded CR in the previous frame. Pixel block cb is the pixel block whose block check code has changed. The Block Compare module mainly consists of a block check code cache and a comparator. After each pixel block is compared, the block check code of the current frame replaces the block check code of the previous frame and is stored in the cache.

[0046] The JPEG encoder is used to receive the region to be encoded CR and output compressed data; the JPEG encoder complies with the JPEG ISO / IEC 10918-1 and ITU-T T.81 standards and is mainly composed of four parts: two-dimensional discrete cosine transform, quantizer and Zigzag rescanning, run-length encoding and Huffman encoder (see Figure 6 ).

[0047] And the data packaging module Compressed Data Pack is used to receive I frames and compressed data; the data packaging module is mainly composed of a frame header generator and a splicer, where the frame header generator outputs the corresponding OpenBMC RFB frame header according to the result of the previous stage processing, and then the splicer splices the frame header and data and writes them into the system memory Mem.

[0048] In summary, the present invention has the following advantages: 1. Segment an image frame into blocks and compare the CRC and checksum values ​​of the blocks to determine whether the blocks at the same position in the previous and next frames have changed. Compared with other solutions that compare pixel by pixel, this solution is more efficient, greatly saves storage overhead, and is much more cost-effective.

[0049] 2. Using block comparison instead of pixel-by-pixel comparison will inevitably lead to data collision. This solution uses CRC and checksum cross-checking to greatly reduce the probability of data collision.

[0050] 3. Defining the Changed Region (CR) based on pixel blocks (cb) reduces accuracy (compared to dividing CR by pixel), but it is more efficient and significantly reduces both software and hardware overhead. Furthermore, from the perspective of KVM applications, CR accuracy has minimal impact on bandwidth and user experience, making this solution a clear advantage.

[0051] 4. The JPEG compression encoder uses standard baseline JPEG to compress and encode I frames and CRs. It has good compatibility, low cost, and is perfectly adapted to the OpenBMC RFB protocol. It is very friendly to cross-platform or OS systems.

[0052] 5. According to theoretical calculations, the compression ratio of this solution can reach 100:1~2140:1 (depending on the image quality and the rate of change). Calculated based on FHD (1920x1080@30Hz) resolution, the average data bandwidth is approximately 800Kbps~7.5Mbps, which can meet the demanding requirements of low-bandwidth network environments.

[0053] The above description is merely a preferred embodiment of the present invention and does not limit the present invention in any way. Any person skilled in the art who, without departing from the scope of the present invention, makes any equivalent substitution, modification, or other changes to the technical solution and technical content disclosed in the present invention shall be deemed to be within the scope of the present invention and still fall within the scope of protection of the present invention.

Claims

1. A KVM video compression method, characterized in that: The following steps are involved: Step S1: Obtain a KVM video stream of an image group from the system memory frame by frame, then divide the I frame and all P frames in the image group into pixel blocks and output them frame by frame; A group of pictures consists of an I frame and subsequent multiple P frames; Step S2: Calculate the block check codes of all pixel blocks in the current frame. The block comparison module Block compare determines the type of the current frame based on the block check code comparison results of the previous and next frames. The specific determination method includes the following: (1) If it is the first frame, it must be an I frame, and only the block check code is cached without comparison; (2) Starting from the second frame, each block check code of the current frame is compared with the block check code of the same position in the previous frame. If the number of different block check codes exceeds the set threshold, the block check code of the current frame is considered to be different from that of the previous frame, and the current frame is determined to be an I frame. Otherwise, it is an ordinary P frame, and the pixel block cb in the current frame, that is, the pixel block block where the block check code changes, is recorded; If the block check codes of the two frames are exactly the same, it is determined to be a complete P frame; After the judgment is completed, all block check codes of the current frame are cached and all block check codes of the previous frame are discarded; Except for the first frame, the rest of the I frames are forced to insert the current P frame at regular intervals through the Block compare module; Based on the above two determination methods, if it is an I frame, execute step S3; if it is a normal P frame, execute step S4; if it is a complete P frame, execute step S6; In step S3, each pixel block of the I frame is sent to the JPEG compression encoder for compression encoding; the JPEG compression encoder outputs the compressed data to the data packager; and then step S7 is executed; Step S4: Delimit the region to be encoded CR including all pixel blocks cb according to the pixel blocks cb, and then execute step S5; Step S5: Send the to-be-encoded region CR corresponding to the current frame to the JPEG compression encoder; the JPEG compression encoder outputs the compressed data to the data packager; then execute step S7; Step S6: The block comparison module Block compare directly sends a no data frame identifier to the data packager; Step S7: The data packager classifies and packages the data according to whether it is an I frame, a normal P frame or a complete P frame sent from the previous stage, and finally stores it in the system memory.

2. The KVM video compression method according to claim 1, wherein: Step S4 also includes the following steps: The region to be encoded CR is a bitmap.

3. The KVM video compression method according to claim 1, wherein: The verification code in step S2 includes a CRC value and a Checksum value.

4. The KVM video compression method according to claim 1, wherein: In step S4, the region to be encoded CR of the current frame includes all pixel blocks cb and contains the minimum number of complete pixel blocks.

5. The KVM video compression method according to claim 1, wherein: In step S7, the compressed data is packaged using the OpenBMC RFB protocol.

6. A KVM video compression system, used to implement the KVM video compression method according to any one of claims 1 to 5, characterized in that: include: The video reading and segmentation module Block Organize is used to obtain the KVM video stream of an image group, then divide the I frame and all P frames in the image group into pixel blocks and output them frame by frame to the verification code calculation module; The verification code calculation module is used to calculate the block verification code of all pixel blocks in the current frame and cache it; The block comparison module, Block Compare, is used to compare the block check codes of the pixel blocks at the same position in the current frame and the previous frame after the first frame, and output the pixel block cb and the region to be encoded CR in the previous frame; the pixel block cb is the pixel block whose block check code has changed; A JPEG compression encoder is used to receive the region to be encoded CR and output compressed data; and a data packing module, Compressed Data Pack, for receiving compressed data and packing it according to the OpenBMC RFB protocol.