Reference frame compression method and device for OD algorithm

By converting the pixel data of the video image from the RGB color space to the YCoCg color space, and using the optimal prediction mode for prediction and encoding, the problem of complex and high cost in the prior art is solved, and a simple and efficient image compression with good visual effects is achieved.

CN119728976APending Publication Date: 2025-03-28JI RUI ZHI YUAN (XIAMEN) TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411905533.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-23
Publication Date
2025-03-28

AI Technical Summary

Technical Problem

In the prior art, the image compression method used for the display OverDrive (OD) algorithm is complex and costly, making it difficult to achieve simple and efficient image compression with good visual effects.

Method used

The final compressed data is obtained by converting the pixel data of the video image from the RGB color space to the YCoCg color space, and using the optimal prediction mode determined by the filtering to predict the data, calculate the residual, and entropy encoding and interleaving encoding according to the encoding structure.

Benefits of technology

It realizes simple and efficient image compression, meets the requirements of reference frame compression in the OD algorithm, and can achieve 4:1 compression specifications and have good visual effects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119728976A_ABST
    Figure CN119728976A_ABST
Patent Text Reader

Abstract

The invention provides a reference frame compression method and device for an OD algorithm, and relates to the technical field of data processing, and the method comprises the steps: converting the pixel data of a video image after width completion processing from an RGB color space to a YCoCg color space; predicting the pixel data after color conversion by using the optimal prediction mode of each group of data determined by screening, and calculating a residual error between the original data and the predicted data; determining a coding structure of each group of residual errors according to the optimal prediction mode, and performing entropy coding on the quantized residual errors according to the coding structures to obtain three types of component data Y, Co and Cg which are independent from one another; and carrying out interleaving coding on the three kinds of component data to obtain final compressed data. According to the scheme, stream-based compression with a 4: 1 compression specification and a good visual effect can be simply and efficiently realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data processing, and in particular to a reference frame compression method and device for an OD algorithm. Background Art

[0002] The display OverDrive (OD) algorithm is a technology used to optimize the response time of the display. In the common OD algorithm, it is necessary to compress the previous frame image, compare the reconstructed frame with the current frame pixel value, and adjust the pixel voltage in advance to accelerate the rotation of liquid crystal molecules, thereby improving the response speed of the display to increase the response speed and reduce motion blur.

[0003] In the related art, although the commonly used image compression technology has relatively good quality after compression, it is usually complicated to implement and has high actual application cost.

[0004] Based on this, there is an urgent need for a reference frame compression method and device for an OD algorithm to solve the above technical problems. Summary of the invention

[0005] The embodiment of the present invention provides a reference frame compression method and device for an OD algorithm, which can simply and efficiently realize image compression and decompression with good visual effects.

[0006] In a first aspect, an embodiment of the present invention provides a reference frame compression method for an OD algorithm, comprising:

[0007] Convert the pixel data of the video image after width padding from the RGB color space to the YCoCg color space; wherein the pixel data is divided into multiple groups, each group includes multiple continuous pixels, and any two groups of data do not overlap, and a single group of data does not cross rows;

[0008] The pixel data after color conversion is predicted using the optimal prediction mode of each group of data determined by screening, and the residual between the original data and the predicted data is calculated; wherein the prediction mode includes direction prediction, median prediction, ICH prediction, ZeroQP prediction and Copy prediction;

[0009] Determine a coding structure for each group of residuals according to the optimal prediction mode, and perform entropy coding on the residuals after quantization according to the coding structure to obtain three independent component data of Y, Co, and Cg;

[0010] The three component data are interleaved and encoded to obtain final compressed data.

[0011] In a second aspect, an embodiment of the present invention further provides a reference frame compression device for an OD algorithm, comprising:

[0012] A conversion module, used to convert the pixel data of the video image that has completed the width padding processing from the RGB color space to the YCoCg color space; wherein the pixel data is divided into multiple groups, each group includes multiple continuous pixels, and any two groups of data do not overlap, and a single group of data does not cross rows;

[0013] A determination module, used to predict the pixel data after color conversion by using the optimal prediction mode of each group of data determined by screening, and calculate the residual between the original data and the predicted data; wherein the prediction mode includes direction prediction, median prediction, ICH prediction, ZeroQP prediction and Copy prediction;

[0014] A first encoding module is used to determine the encoding structure of each group of residuals according to the optimal prediction mode, and perform entropy encoding on the residuals after quantization according to the encoding structure to obtain three independent component data of Y, Co, and Cg;

[0015] The second encoding module is used to perform interleaving encoding on the three component data to obtain final compressed data.

[0016] In a third aspect, an embodiment of the present invention further provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the method described in any embodiment of this specification is implemented.

[0017] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, enables the computer to execute the method described in any embodiment of this specification.

[0018] The embodiment of the present invention provides a reference frame compression method and device for OD algorithm, firstly, the image data after width padding is converted into color space, then the conversion result is predicted using a preset prediction mode, and the residual of the optimal prediction mode is selected according to the prediction result, and finally, the residual value after quantization reconstruction is subjected to hybrid entropy coding and interleaving coding according to the prediction mode corresponding to the residual, so as to obtain the final compressed data. The method meets the requirements of compressing reference frames in the display OD algorithm, and can simply and efficiently realize stream-based compression and decompression with 4:1 compression specification and good visual effect. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0020] Figure 1 is a flow chart of a reference frame compression method for an OD algorithm provided by an embodiment of the present invention;

[0021] Figure 2 is a schematic diagram of a left direction prediction mode provided by an embodiment of the present invention;

[0022] Figure 3 is a schematic diagram of an upper left direction prediction mode provided by an embodiment of the present invention;

[0023] Figure 4 is a schematic diagram of an upward prediction mode provided by an embodiment of the present invention;

[0024] Figure 5 is a schematic diagram of an upper right direction prediction mode provided by an embodiment of the present invention;

[0025] Figure 6 It is a schematic diagram of an update strategy of an ICH prediction model provided by an embodiment of the present invention;

[0026] Figure 7 is a schematic diagram of a rate buffer model of a rate control algorithm provided by an embodiment of the present invention;

[0027] Figure 8 It is a schematic diagram of an interleaving coding process provided by an embodiment of the present invention;

[0028] Fig. 9 is a schematic diagram of a possible arrangement order of three components during interleaving coding provided by an embodiment of the present invention;

[0029] Fig.10 is a schematic diagram of a test image set provided by an embodiment of the present invention;

[0030] Fig.11 is a structural diagram of a reference frame compression device for an OD algorithm provided by an embodiment of the present invention;

[0031] Fig.12 This is a hardware architecture diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0032] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0033] As mentioned above, common video encoding and image compression algorithms are often based on macroblock compression methods, which means that they require more expensive costs, higher power consumption and more complex algorithm design.

[0034] Based on this, the present invention proposes a simple, efficient, stream-based compression method that can achieve a 4:1 compression specification and has good visual effects.

[0035] The specific implementation of the above concept is described below.

[0036] Please refer to Figure 1 , an embodiment of the present invention provides a reference frame compression method for an OD algorithm, the method comprising:

[0037] Step 100, converting the pixel data of the video image that has completed the width padding process from the RGB color space to the YCoCg color space; wherein the pixel data is divided into multiple groups, each group includes multiple continuous pixels, and any two groups of data do not overlap, and a single group of data does not cross rows;

[0038] Step 102, predicting the pixel data after color conversion using the optimal prediction mode of each group of data determined by screening, and calculating the residual between the original data and the predicted data; wherein the prediction mode includes direction prediction, median prediction, ICH prediction, ZeroQP prediction and Copy prediction;

[0039] Step 104, determining a coding structure for each group of residuals according to the optimal prediction mode, and performing entropy coding on the residuals after quantization according to the coding structure to obtain three independent component data of Y, Co, and Cg;

[0040] Step 106: interleave and encode the three component data to obtain final compressed data.

[0041] In the embodiment of the present invention, the image data after width padding is first converted into color space, and then the conversion result is predicted using a preset prediction mode, and the residual of the optimal prediction mode is selected according to the prediction result, and finally the residual value after quantization reconstruction is subjected to hybrid entropy coding and interleaving coding according to the prediction mode corresponding to the residual to obtain the final compressed data. This method meets the requirements of compressed reference frames in the display OD algorithm, and can simply and efficiently realize stream-based compression and decompression with a 4:1 compression specification and good visual effects.

[0042] Described below Figure 1 How the various steps are performed.

[0043] First, with respect to step 100, pixel data of the video image that has undergone width padding processing is converted from the RGB color space to the YCoCg color space.

[0044] In the embodiment of the present invention, the encoding process is performed in groups. A group contains a number of continuous pixels, and the groups do not overlap, and a single group does not cross rows. Therefore, to encode each row of video pixels, the number of pixels contained in each row must be divided by the number of pixels in each group. If the width of the input image does not meet the above conditions, it needs to be padded. Padded means filling the pixel value of the last column at the end of each row.

[0045] The following code can be designed to implement the corresponding functions:

[0046]

[0047] ImageW: width of the original image

[0048] w: width of the input encoder image

[0049] GroupS: The number of pixels contained in each group

[0050] Furthermore, after the padded 8-bit RGB video is input into the encoder, it needs to be converted into the YCoCg color space. After the conversion, Y is still 8 bits deep, and Co and Cg are both 9 bits deep. The specific conversion formula is as follows (refer to the DSC algorithm):

[0051] cosCo=RB

[0052] t=B+(cscCo>>1)

[0053] cscCg=Gt

[0054] Y=t+(cscCg>>1)

[0055] Co=cscCo+(1<<8)

[0056] Cg=cscCg+(1<<8)

[0057] Among them, >> is the bitwise right shift operator; << is the bitwise left shift operator.

[0058] Then, for step 102, the pixel data after color conversion is predicted using the optimal prediction mode of each group of data determined by screening, and the residual between the original data and the predicted data is calculated.

[0059] The embodiment of the present invention selects 8 prediction modes, of which 6 prediction modes are represented by 3 bits, and the other 2 prediction modes require an additional 3 bits to represent. The first four prediction modes are directional predictions, namely left, upper left, upper, and upper right. If the residuals obtained by these four prediction modes use the same number of bits after entropy coding, the upper direction is preferentially selected as a reference, followed by left, upper left, and upper right. The fifth is the median prediction mode, the sixth prediction mode is the ICH mode, the seventh prediction mode is the ZeroQp mode, and the eighth prediction mode is the Copy mode. Among them, the last two prediction modes are special modes based on the first 5 prediction modes, and an additional 3 bits are required to record the original prediction modes.

[0060] The following is a detailed explanation of the eight prediction modes selected in this embodiment:

[0061] like Figure 2-5 As shown, the directional prediction includes four types: left, upper left, upper, and upper right. The upper left, upper, and upper right directions all need to use the reconstructed pixels of the previous row as reference pixels. These reference pixels are stored in the line buffer. The pixels of the first row are initialized (median value, Y=128, Co=Cg=256) as reference pixels. The bit depth of each single component of each pixel in the line buffer is designed to be 8 bits, but after the actual calculation of color conversion, Co and Cg are both 9 bits, so the lowest bit of Co and Cg needs to be discarded when storing the reconstructed value.

[0062] When a group selects median prediction, it means that the reference pixels of all pixels in the current group are the initial values ​​(median values). The initial values ​​are set to Y=0x80, Co=Cg=0x100.

[0063] For ICH prediction, many types of content, such as textures and images rendered by computers, have similar pixel values ​​that tend to appear in relatively close locations, but not necessarily adjacent to each other. Therefore, the ICH stores the most recently used pixel values, and when encoding new pixel values, the new pixel values ​​are likely to have been stored in the ICH. When the encoder selects the ICH prediction mode for the current group, the encoder sends the index value of the selected pixel in the corresponding ICH to the entropy coder.

[0064] ICH is a storage unit that stores the most recently used color values, and the encoder and decoder have the same ICH state. There are 32 pixels in ICH, of which the first 26 pixels are reconstructed values ​​from the most recently used pixel values ​​before the current group, and the remaining 6 pixels are reference pixels at fixed positions in the previous row of the current group.

[0065] The first group of each frame cannot use the ICH mode. All other groups in the first row cannot use the last 6 pixels as reference pixels when using the ICH mode. The ICH update strategy requires that the first 26 pixels are not repeated and the last 6 pixels are fixed in relative position. The specific update strategy is as follows Figure 6 shown.

[0066] Input the reconstructed value of the current group from left to right in turn, and determine whether the pixel already exists in ICH. If it does and assuming that its corresponding index is A, delete the pixel of the corresponding index in ICH, and move all the pixels before the index backward by one position, that is, IndexA=Index(A-1)...Index1=Index0, and then assign the pixel value to Index0. If it does not exist, delete Index25 in ICH, and move all the pixels before index 25 backward by one position, and then assign the pixel value to Index0.

[0067] The current group can use the ICH mode only if and only if all pixels in the current group can find the index pixel in ICH. ICH stores the reconstructed value. The Y, Co, and Cg of the 6 pixels indexed 26-31 are all 8 bits. The Y of the 26 pixels indexed 0-25 is 8 bits, and Co and Cg are 9 bits. When performing ICH prediction, there are two principles for matching the current pixel with the ICH pixel. First, the three components are equal (priority). Second, if the three components are not equal, then determine whether the Y component is equal. If the result of subtracting the Co and Cg of the index pixel from the Co and Cg of the current pixel is not greater than 1, then the current pixel is also considered to match the pixel in ICH.

[0068] For ZeroQP prediction mode, the encoder and decoder use the same rate control algorithm to generate the quantization parameter QP. For each group, the QP corresponding to encoding and decoding is the same. The purpose of this algorithm is to optimize the visual quality of the image by adjusting the quantization parameter QP, because in complex areas of the image, the QP should be relatively large to save as many bits as possible, while in flat areas of the image, the QP should be kept as small as possible to maintain visual quality.

[0069] The rate control algorithm can achieve the following two functions:

[0070] (1) The QP generated by the encoder and decoder for each group is the same, and the QP value does not need to be written into the bitstream for transmission.

[0071] (2) Ensure that the rate buffer (similar to FIFO, first-in-first-out) does not overflow or underflow.

[0072] The rate control algorithm actually converts variable-length bit input into constant-length bit output through the rate buffer. The model of the rate buffer is as follows: Figure 7 As shown. When a group is encoded, these codewords are written into the ratebuffer, and the bit data of targetBpg is read from the rate buffer. A pointer is set to indicate the current fullness of the ratebuffer. When the pointer reaches different fullness, different QPs are set to ensure that the rate buffer does not overflow or underflow. Each group can be encoded into a bitstream of different lengths, but the total bitstream length of each frame is fixed.

[0073] When the rate buffer is full and less than -Q_MAX_THRESHOLD, set maxFlag to 1. This parameter will affect the first half of the pixels in the next group to always use the maximum number of bits (15 bits) for encoding, thus preventing the rate buffer from underflowing.

[0074] At the same time, in order to balance the image quality as much as possible, if the encoding length of the current group is greater than 2 times the targetBpg, and the QP range of the next group obtained by rate control is between (1, 7), the QP of the next group is increased by 1 on the original basis; if the encoding length of the current group is greater than 3 times the targetBpg and the QP range of the next group obtained by rate control is between (1, 5), the QP of the next group is increased by 2 on the original basis

[0075] Considering that in many images there is a transition from a large complex area to a flat area, a large complex area will cause a sharp increase in QP, while a flat area requires a small QP for quantization to ensure that the visual quality is not lost, so this embodiment sets the ZeroQp mode. The ZeroQp mode is performed on the basis of four directional predictions and median predictions. After completing the four directional predictions and median predictions, one of the prediction modes is selected as the first prediction mode. Then, according to the mode, the QP value is combined to make subsequent judgments.

[0076] For the Copy prediction mode, there will be a lot of identical residuals generated by directional prediction and median prediction. When faced with multiple identical residuals, only one of them needs to be encoded, which can save a lot of bits.

[0077] The following is a detailed description of the screening process of the above 8 modes, selecting the optimal prediction mode for each set of data to reduce the loss in the data compression process.

[0078] In an embodiment of the present invention, the process of determining the optimal prediction mode includes: respectively calculating the bit values ​​consumed when encoding the initial residuals of the directional prediction and the median prediction, and determining that the prediction mode with the smallest bit consumption is the available first prediction mode; performing ICH matching processing on each group of the pixel data, if all pixels in the current group can find matching index pixels, then determining that the ICH prediction mode is available, and recording the index value in the ICH index table; calculating the number of bits consumed when encoding the residual of the first prediction mode when the QP value is 0, and determining whether the ZeroQP prediction mode is available in combination with the current QP value; wherein the QP value is obtained by processing the video image through a bit rate control algorithm; determining whether the residuals in the subgroups of the pixel data are the same according to the residuals calculated by the first prediction mode, and if they are the same, determining that the Copy prediction mode is available; wherein the subgroup is obtained by dividing the entire group of data into a subset with 4 consecutive pixel values; and screening all available test modes to obtain the optimal prediction mode.

[0079] Specifically, mode0-mode7 are used to represent the eight prediction modes described above. Among them, ICH mode, ZeroQp mode and Copy mode are controlled by Flags, namely ICHFlag, ZeroQpFlag, CpFlag. Before prediction, these three Flags must be set to 0.

[0080] For directional prediction and median prediction, directly calculate the bit length corresponding to the residual of each prediction mode, and select the mode with the smallest bit length as the first prediction mode. If there are two or more prediction modes with the smallest bit length consumed by the residual, the prediction mode is selected in the order of top, left, upper left, upper right, and median prediction.

[0081] At the same time, ICH matching is performed. If all pixels in the current group can find matching index pixels, ICHFlag is set to 1. The index value is recorded in the ICHIndex table.

[0082] Then, the bit length corresponding to the residual in the first prediction mode is calculated when the QP is 0, and combined with the current QP, if the current QP value is greater than 5 and the number of bits consumed by the coded residual when the QP value is equal to 0 is within a preset threshold range, it is determined that the ZeroQP prediction mode is available, that is, ZeroQpFlag is set to 1; otherwise, it is determined that the ZeroQP prediction mode is unavailable.

[0083] The threshold range may be that the current QP is greater than 5, and when the number of bits consumed when QP is equal to 0 is less than targetBpg, and greater than 48, the ZeroQp prediction mode is selected.

[0084] targetBpg=groupSize*targetBpp

[0085] groupSize refers to the number of pixels contained in the current group, and targetBpp refers to the number of target pixel bits to be compressed to the original pixels (must be greater than 6bpp).

[0086] According to the above determination process, it is determined whether the Copy mode can be used. If so, CpFlag is set to 1.

[0087] Furthermore, after completing the mode discrimination, these modes need to be screened, and the screening process includes: if the ZeroQP prediction mode is in an available state, determining the ZeroQP prediction mode as the optimal prediction mode; if the ZeroQP prediction mode is not available, the Copy prediction mode is available and the output parameter of the bit rate control algorithm is 0, determining the Copy prediction mode as the optimal prediction mode; if both the ZeroQP prediction mode and the Copy prediction mode are not available, and the maximum error value of the first prediction mode or the number of bits consumed for encoding a group of residuals is greater than a preset threshold, determining the ICH prediction mode as the optimal prediction mode; if the ZeroQP prediction mode, the Copy prediction mode and the ICH prediction mode are all unavailable, determining the first prediction mode as the optimal prediction mode.

[0088] The above process of screening and determining the optimal prediction mode can be implemented using the following code:

[0089]

[0090] Among them, prevMaxFlag is the output parameter. From the above introduction to the rate control algorithm, it can be known that when the rate buffer, that is, the fullness of the rate buffer is less than the set threshold, maxFlag will be set to zero. Like QP, maxFlag will also be delayed by 2 groups. prevmaxFlag is the output of the previous group when it passes through the rate control algorithm.

[0091] code_len is the number of bits required to encode the residual; error_max is the maximum error value of the first prediction mode, calculated by the following formula:

[0092] error_max=max(error_y,error_co,error_cg)

[0093] error_y=max(abs(recon_y-cur_y))

[0094] error_co=max(abs(recon_co-cur_co))

[0095] error_cg=max(abs(recon_cg-cur_cg))

[0096] In the formula, recon represents the reconstructed value of the data, and cur represents the original value of the data.

[0097] In an embodiment of the present invention, the data quantization and reconstruction process includes the following steps: determining the QP value of the video image according to the bit rate control algorithm, and then quantizing the data in the YCoCg color space using a uniform quantization method, wherein the quantization parameter of the Y component is equal to QP, and the quantization parameter of the Co, Cg component is equal to QP+CPQ_INC, wherein CQP_INC is controlled by a register, and CQP_INC is greater than or equal to 1, and rounding is required in the quantization process.

[0098] The specific formula is as follows:

[0099] residX=X-PX

[0100] Among them, X represents the current value of the three data of Y, Co, and Cg, PX represents the predicted value of the three component data of Y, Co, and Cg, and residX is the residual.

[0101] If(residX<0)

[0102] QX=-((ROUND-residX)>>QP)

[0103] else

[0104] QX=-((ROUND+residX)>>QP)

[0105] in

[0106]

[0107] get

[0108] reconX=QX<<QP

[0109] Reconstruction is the inverse operation of quantization, which is to simply shift the current residual left by QP and add the reference value.

[0110] The above process completes the screening of 8 prediction modes in combination with each set of data, obtains the optimal prediction mode suitable for each set of data, and obtains the residual value calculated by the optimal prediction mode.

[0111] For example, after the above screening, the first set of data may determine that the ICH prediction model is the optimal prediction model, and after the screening of the second set of data, the Copy prediction model may be determined as the optimal prediction model..., and each set of data is screened until the optimal prediction model is determined for all data.

[0112] With respect to step 104, the coding structure of each group of data residuals is determined according to the optimal prediction mode, and entropy coding is performed on the residuals after quantization according to the coding structure to obtain three independent component data of Y, Co, and Cg.

[0113] In an embodiment of the present invention, a hybrid entropy coding structure is used to encode the quantized residual, including exponential Golomb coding and fixed coding: if the prediction mode of the current Group is the ICH mode, fixed coding is used; if the current Group is other prediction modes, 0-order exponential Golomb coding is used.

[0114] Specifically, fixed coding uses fixed 5-bit data to represent the index of the current reference pixel. And the index of each pixel is stored in the bit stream corresponding to Y, Co, and Cg in sequence, that is, the index of the first pixel in the current group is stored in the bit stream of Y, the index of the second pixel is stored in the bit stream of Co, the index of the third pixel is stored in the bit stream of Cg, the index of the fourth pixel is stored in the bit stream of Y, and so on.

[0115] The process of 0-order exponential Golomb coding is as follows:

[0116] 0--------------------------0

[0117] -1or 1--------------------0xx

[0118] -2,-3or 2,3---------------00xxx

[0119] [-7,-4]or[4,7]----------------000xxxx

[0120] [-15,-8]or[8,15]---------0000xxxxx

[0121] [-31,-16]or[16,31]-------00000xxxxxx

[0122] [-255,-32]or[32,255]----000000xxxxxxxxx

[0123] It is understandable that the above two encoding methods are well known to those skilled in the art and will not be described in detail here.

[0124] With respect to step 106, the three component data are interleaved and encoded to obtain final compressed data.

[0125] In an embodiment of the present invention, the process of interleaving encoding includes: using a preset virtual decoder to perform decoding simulation to determine the interleaving order of the component data; wherein the interleaving order is the order in which the virtual decoder takes the component data from the rate buffer; and merging and storing the three initialized component data according to the interleaving order to obtain the final compressed data.

[0126] Furthermore, a request signal sent by the virtual decoder is obtained; wherein the request signal is used to characterize the component type of the data taken by the virtual decoder; according to the request signal, corresponding component data is sent from the three component data after initialization to the rate buffer for merging and storage to obtain final compressed data; wherein, when multiple request signals are received at the same time, the component data is sent to the rate buffer in the order of Y component, Co component and Cg component; when no request signal is received within a given time, the component data is not sent.

[0127] Specifically, since the three components Y, Co, and Cg are entropy coded independently, the bitstreams of these three components need to be merged into one in interleaved coding. The order in which the three components are arranged needs to be stored in the order in which the decoder takes them from the rate buffer. Figure 8 It is a flowchart of interleaving coding. Fig. 9 This is an example of the possible order of placement of the three components during interleaving coding. When implementing interleaving coding, a virtual decoder is constructed to simulate the decoding behavior, so that the three components are arranged in the order they are supposed to be placed, and each component is stored as a fixed-length codeword with a length of 128 bits. Of course, this length can be changed arbitrarily according to the needs of the actual hardware design.

[0128] The virtual decoder is used to simulate the decoding behavior of taking numbers from the stream buffer to determine the interleaving order of Y, Co, and Cg. During the decoding process, Y, Co, and Cg have independent decoders, each of which consists of a funnel shifter and an entropy decoder. Each funnel shifter initially contains a 128-bit data. Every 4 pixel times, the fullness of the funnel shifter will reduce the length of the entropy encoding of the first 4 pixels of the funnel shifter. If the new fullness is less than 128 bits, a request signal is sent and a new 128 bits are added to the funnel shifter.

[0129] Interleaved coding is every 4 pixel times. After the three component buffers are initialized, the interleaved encoder initially provides three 128-bit data to the virtual decoder to start the decoder. The decoder model can issue any combination of requests (requestY, requestCo, requestCg) every 4 pixel times, or not send any request signal. If no request signal is issued within a given time, no data will be sent to the rate buffer (Stream Buffer). If a request signal is sent, the data of the component is sent to the rate buffer (Stream Buffer). If multiple request signals are sent, the data of the corresponding components are sent to the rate buffer (Stream Buffer) in the order of Y, Co, and Cg.

[0130] When encoding a frame is about to end, the Buffer may be empty. If the Buffer is empty, it is filled with 0. In some cases, 128 bits of 0 may be sent to the stream buffer.

[0131] In addition to the above encoding process, the embodiment of the present invention also provides a decoding method, including:

[0132] The decoder first deinterleaves the code and separates the code stream of one frame into three sub-code streams: Y, Co, and Cg. It takes three 128-bit data from the ratebuffer and stores them in the Y buffer, Co buffer, and Cg buffer respectively, and then performs entropy decoding on them.

[0133] First, read 3 bits of data from the Y bitstream to determine the prediction mode. If the prediction mode is equal to [0,4], directly perform Golomb index decoding on the three components to obtain the residual, and then obtain the reconstruction value based on the quantization parameter QP of the current group. If the prediction mode is equal to 5, it is the ICH mode. Read 5 bits from Y, Co, and Cg in sequence to determine the index value until the index value of the entire group is decoded, and then look up the ICH table to obtain the reconstruction value. If the prediction mode is equal to 6 or 7, it is necessary to read 3 bits from Ybuffer to determine the first prediction direction. Then decode the residual, and then obtain the reconstruction value based on QP and the reference value.

[0134] After decoding every 4 pixels, compare the fullness of Y buffer, Co buffer, and Cg buffer. If their fullness is less than 128 bits, take another 128 bits from the rate buffer and put it into the buffer of the corresponding component.

[0135] It is understandable that decoding is the reverse process of encoding, and the grammatical semantics of the encoding process are not elaborated in detail here.

[0136] To sum up, the compression method provided in the embodiment of the present invention can support compressing 24 bits of data per pixel to 6 bits or more per pixel, supports per-pixel bit compression of 1 / 16 decimal places, and the compression and decompression methods are simple and feasible. For hardware implementation, the area is small and the power consumption is low.

[0137] The feasibility of the above method is demonstrated through a test image set:

[0138] like Fig.10 As shown, Fig.10 This is the test image set provided by this embodiment, and the resolution of most of the images is 1920x1080. Table 1 shows the PSNR values ​​of the test image set (12 of which) after compression and decompression compared with the original images. The Group Size is set to 16, the original bit per pixel is 24, and the target bit per pixel is 6.

[0139] Table 1

[0140] Image Name PSNR(db) t_1024x1024Cr 33.05 t_1280x768_Noise 16.72 t_Barbara 37.98 t_Boats 42.25 t_CircularPatterns26 29.4 t_Desktop10 34.31 t_FineTextRendering14 24.83 t_HSweepSplit 44.11 t_Mandrill 29.03 t_Noise_gradient 30.21 t_TextOnTreeInField_crop 34.11 t_Tools 30.49

[0141] Please refer to Fig.11 The embodiment of the present invention provides a reference frame compression device for an OD algorithm, the device comprising:

[0142] The conversion module A1 is used to convert the pixel data of the video image that has completed the width padding processing from the RGB color space to the YCoCg color space; wherein the pixel data is divided into multiple groups, each group includes multiple continuous pixels, and any two groups of data do not overlap, and a single group of data does not cross lines;

[0143] Determine module A2, used to predict the pixel data after color conversion by using the optimal prediction mode of each group of data determined by screening, and calculate the residual between the original data and the predicted data; wherein the prediction mode includes direction prediction, median prediction, ICH prediction, ZeroQP prediction and Copy prediction;

[0144] A first encoding module A3, used to determine the encoding structure of each group of residuals according to the optimal prediction mode, and perform entropy encoding on the residuals after quantization according to the encoding structure to obtain three independent component data of Y, Co, and Cg;

[0145] The second encoding module A4 is used to perform interleaving encoding on the three component data to obtain final compressed data.

[0146] In the embodiment of the present invention, when determining the optimal prediction mode, the determination module A2 is specifically used to perform the following operations: respectively calculating the bit values ​​consumed when encoding the initial residuals of the directional prediction and the median prediction, and determining the prediction mode with the smallest bit consumption as the available first prediction mode; performing ICH matching processing on each group of the pixel data, if all pixels in the current group can find matching index pixels, then determining that the ICH prediction mode is available, and recording the index value in the ICH index table; calculating the number of bits consumed when encoding the residual of the first prediction mode when the QP value is 0, and determining whether the ZeroQP prediction mode is available in combination with the current QP value; wherein the QP value is obtained by processing the video image through a bit rate control algorithm; determining whether the residuals in the subgroups of the pixel data are the same according to the residuals calculated by the first prediction mode, and if they are the same, determining that the Copy prediction mode is available; wherein the subgroup is obtained by dividing a group of data into a subset with 4 consecutive pixel values; and screening all available test modes to obtain the optimal prediction mode.

[0147] In an embodiment of the present invention, when determining whether the ZeroQP prediction mode is available in combination with the current QP value, the determination module A2 is specifically used to perform the following operations: if the current QP value is greater than 5 and the number of bits consumed by the coding residual when the QP value is equal to 0 is within a preset threshold range, it is determined that the ZeroQP prediction mode is available; otherwise, it is determined that the ZeroQP prediction mode is unavailable.

[0148] In an embodiment of the present invention, when the determination module A2 performs screening of all available test modes to obtain the optimal prediction mode, it is specifically used to perform the following operations: if the ZeroQP prediction mode is in an available state, the ZeroQP prediction mode is determined to be the optimal prediction mode; if the ZeroQP prediction mode is not available, the Copy prediction mode is available and the output parameter of the bit rate control algorithm is 0, the Copy prediction mode is determined to be the optimal prediction mode; if both the ZeroQP prediction mode and the Copy prediction mode are not available, and the maximum error value of the first prediction mode or the number of bits consumed by encoding a group of residuals is greater than a preset threshold, the ICH prediction mode is determined to be the optimal prediction mode; if the ZeroQP prediction mode, the Copy prediction mode and the ICH prediction mode are all unavailable, the first prediction mode is determined to be the optimal prediction mode.

[0149] In an embodiment of the present invention, when the first encoding module A3 determines the encoding structure of the residual according to the optimal prediction mode, it is specifically used to perform the following operations: if the optimal prediction mode is the ICH prediction mode, the encoding structure is determined to be fixed encoding; otherwise, the encoding structure is determined to be 0th-order exponential Columbus encoding.

[0150] In an embodiment of the present invention, when the second encoding module A4 performs interleaving encoding on the three component data to obtain the final compressed data, it is specifically used to perform the following operations: using a preset virtual decoder to perform decoding simulation to determine the interleaving order of the component data; wherein the interleaving order is the order in which the virtual decoder takes the component data from the rate buffer; the three component data after initialization are merged and stored according to the interleaving order to obtain the final compressed data.

[0151] In an embodiment of the present invention, when the second encoding module A4 executes the merging and storage of the three component data after initialization according to the interleaving order to obtain the final compressed data, it is specifically used to perform the following operations: obtain the request signal sent by the virtual decoder; wherein the request signal is used to characterize the component type of the data taken by the virtual decoder; according to the request signal, the corresponding component data is sent from the three component data after initialization to the rate buffer for merging and storage to obtain the final compressed data; wherein, when multiple request signals are received at the same time, the component data is sent to the rate buffer in the order of Y component, Co component and Cg component; when no request signal is received within a given time, the component data is not sent.

[0152] It should be noted that the reference frame compression device for the OD algorithm provided in the above embodiment is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the reference frame compression device for the OD algorithm provided in the above embodiment and the reference frame compression method embodiment for the OD algorithm belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.

[0153] The embodiment of the present application also provides a computer device, please refer to Fig.12 The computer device includes a processor and a memory, in which at least one instruction, at least one program, a code set or an instruction set is stored, and the at least one instruction, at least one program, a code set or an instruction set is loaded and executed by the processor to implement the reference frame compression method for the OD algorithm provided in the above-mentioned method embodiments.

[0154] An embodiment of the present application also provides a computer-readable storage medium, on which is stored at least one instruction, at least one program, code set or instruction set, and the at least one instruction, at least one program, code set or instruction set is loaded and executed by a processor to implement the reference frame compression method for the OD algorithm provided in the above-mentioned method embodiments.

[0155] For the convenience of description, the above system or device is described by dividing it into various modules or units according to its functions. Of course, when implementing the present application, the functions of each unit can be implemented in the same or multiple software and / or hardware.

[0156] It can be known from the description of the above implementation methods that those skilled in the art can clearly understand that the present application can be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the present application can be essentially or partly contributed to the prior art in the form of a software product, which can be stored in a storage medium such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in the various embodiments of the present application or certain parts of the embodiments.

[0157] Finally, it should be noted that, in this article, relational terms such as first, second, third and fourth are only used 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", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including 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. In the absence of further restrictions, the elements defined by the statement "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0158] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A reference frame compression method for OD algorithm, characterized in that: include: Convert the pixel data of the video image after width padding from the RGB color space to the YCoCg color space; wherein the pixel data is divided into multiple groups, each group includes multiple continuous pixels, and any two groups of data do not overlap, and a single group of data does not cross rows; The pixel data after color conversion is predicted using the optimal prediction mode of each group of data determined by screening, and the residual between the original data and the predicted data is calculated; wherein the prediction mode includes direction prediction, median prediction, ICH prediction, ZeroQP prediction and Copy prediction; Determine a coding structure for each group of residuals according to the optimal prediction mode, and perform entropy coding on the residuals after quantization according to the coding structure to obtain three independent component data of Y, Co, and Cg; The three component data are interleaved and encoded to obtain final compressed data.

2. The method according to claim 1, characterized in that The optimal prediction model is determined as follows: respectively calculating bit values ​​consumed when encoding the initial residuals of the directional prediction and the median prediction, and determining a prediction mode with the smallest bit consumption as an available first prediction mode; Performing ICH matching processing on each group of pixel data, if all pixels in the current group can find matching index pixels, it is determined that the ICH prediction mode is available, and the index value is recorded in the ICH index table; Calculating the number of bits consumed when encoding the residual of the first prediction mode when the QP value is 0, and determining whether the ZeroQP prediction mode is available in combination with the current QP value; wherein the QP value is obtained by processing the video image through a bit rate control algorithm; Determine whether the residuals in the subgroups of the pixel data are the same according to the residuals calculated by the first prediction mode, and if they are the same, determine that the Copy prediction mode is available; wherein the subgroups are obtained by dividing a group of data into a subset of four consecutive pixel values; All available test modes are screened to obtain the optimal prediction mode.

3. The method according to claim 2, characterized in that The determining whether the ZeroQP prediction mode is available in combination with the current QP value includes: If the current QP value is greater than 5, and the number of bits consumed by the coded residual when the QP value is equal to 0 is within a preset threshold range, it is determined that the ZeroQP prediction mode is available; otherwise, it is determined that the ZeroQP prediction mode is not available.

4. The method according to claim 2, characterized in that: The screening of all available test modes to obtain the optimal prediction mode includes: If the ZeroQP prediction mode is in an available state, determining that the ZeroQP prediction mode is an optimal prediction mode; If the ZeroQP prediction mode is not available, the Copy prediction mode is available and the output parameter of the rate control algorithm is 0, then the Copy prediction mode is determined to be the optimal prediction mode; wherein the output parameter is calculated by the rate control algorithm when the fullness of the rate buffer is less than a preset threshold. If both the ZeroQP prediction mode and the Copy prediction mode are unavailable, and a maximum error value of the first prediction mode or a number of bits consumed for encoding a group of residuals is greater than a preset threshold, determining that the ICH prediction mode is the optimal prediction mode; If the ZeroQP prediction mode, the Copy prediction mode and the ICH prediction mode are all unavailable, the first prediction mode is determined to be the optimal prediction mode.

5. The method according to claim 1, characterized in that The determining the coding structure of the residual according to the optimal prediction mode includes: If the optimal prediction mode is the ICH prediction mode, the coding structure is determined to be fixed coding, otherwise the coding structure is determined to be 0-order exponential Golomb coding.

6. The method according to claim 1, characterized in that The interleaving encoding of the three component data to obtain final compressed data includes: Performing decoding simulation using a preset virtual decoder to determine an interleaving order of the component data; wherein the interleaving order is an order in which the virtual decoder takes the component data from a rate buffer; The initialized three component data are merged and stored according to the interleaving order to obtain the final compressed data.

7. The method according to claim 6, characterized in that The step of merging and storing the initialized three component data according to the interleaving order to obtain the final compressed data includes: Acquire a request signal sent by the virtual decoder; wherein the request signal is used to characterize the component type of the data taken by the virtual decoder; According to the request signal, the corresponding component data is sent from the three component data after initialization to the rate buffer for merging and storage to obtain the final compressed data; wherein, when multiple request signals are received at the same time, the component data is sent to the rate buffer in the order of Y component, Co component and Cg component; when no request signal is received within a given time, the component data is not sent.

8. A reference frame compression device for OD algorithm, characterized in that: include: A conversion module, used to convert the pixel data of the video image that has completed the width padding processing from the RGB color space to the YCoCg color space; wherein the pixel data is divided into multiple groups, each group includes multiple continuous pixels, and any two groups of data do not overlap, and a single group of data does not cross rows; A determination module, used to predict the pixel data after color conversion by using the optimal prediction mode of each group of data determined by screening, and calculate the residual between the original data and the predicted data; wherein the prediction mode includes direction prediction, median prediction, ICH prediction, ZeroQP prediction and Copy prediction; A first encoding module is used to determine the encoding structure of each group of residuals according to the optimal prediction mode, and perform entropy encoding on the residuals after quantization according to the encoding structure to obtain three independent component data of Y, Co, and Cg; The second encoding module is used to perform interleaving encoding on the three component data to obtain final compressed data.

9. An electronic device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the method according to any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed in a computer, the computer is caused to execute the method according to any one of claims 1 to 7.