A video encoding and decoding method, device, equipment and storage medium
By constructing an entry container that maps prediction units to IBH indices, the problem of low transmission efficiency in screen content video encoding is solved, and efficient transmission of video streams is achieved.
Patent Information
- Application Number
- CN202310230040.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-06
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2043-03-06
AI Technical Summary
In existing screen content video encoding methods, the transmission based on the color index of each pixel results in low video bitstream transmission efficiency and high transmission cost.
By adopting the Indexed Block History (IBH) mode, an entry container that constructs the correspondence between prediction units and IBH indices is built, reducing the transmission of indices at the prediction unit level and avoiding the transmission of indices at the pixel level.
It effectively reduces the transmission cost of video streams and improves transmission efficiency.
Smart Images

Figure CN116233449B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of video processing technology, and in particular to a video encoding and decoding method, device, equipment and storage medium. Background Art
[0002] Video coding is a video processing technology widely used in various industries. With the widespread popularity of applications such as screen sharing, remote display, and cloud technology, screen content coding has emerged as a video coding method and has received widespread attention.
[0003] At present, video encoding for screen content mainly adopts the ICH (Indexed Color History) mode of the DSC (Display Stream Compression) standard. Specifically, for the coding unit CU (Coding Unit) corresponding to the screen content, a corresponding ICH container is created, and each pixel in the prediction unit PU (Prediction Unit) included in each CU corresponds to a color index, and the color index corresponds to an entry in the ICH container, which is taken from historical pixel information or reconstructed pixel information.
[0004] During the encoding process, the color index corresponding to each pixel is encoded and transmitted to the decoding end. Since the color index is in pixels, and the number of pixels in the video frame corresponding to the screen content is very large, the cost of transmitting the encoded video stream is high and the transmission efficiency is low. Summary of the invention
[0005] The purpose of the embodiments of the present application is to provide a video encoding and decoding method, apparatus, device and storage medium to reduce the cost of transmitting the encoded video stream and improve the transmission efficiency. The specific technical solution is as follows:
[0006] In a first aspect, an embodiment of the present application provides a video decoding method, the method comprising:
[0007] Acquire a code stream to be decoded, decode the code stream to be decoded, and obtain a decoding result corresponding to a current decoding unit, wherein the decoding result at least includes a historical block index mode IBH index corresponding to each prediction unit to be decoded included in the current decoding unit;
[0008] For each prediction unit to be decoded, based on the IBH index corresponding to the prediction unit, determine the IBH entry corresponding to the prediction unit from a pre-constructed entry container corresponding to the prediction unit, wherein the entry container is used to store the correspondence between the IBH entry and the IBH index of the prediction unit included in the current decoding unit;
[0009] Based on the IBH entries corresponding to the prediction units to be decoded in the current decoding unit, a reconstructed value corresponding to each prediction unit to be decoded in the current decoding unit is determined.
[0010] In a second aspect, an embodiment of the present application provides a video encoding method, the method comprising:
[0011] For each prediction unit to be encoded, determine an IBH index corresponding to the prediction unit from a pre-constructed entry container corresponding to the prediction unit, wherein the entry container is used to store the correspondence between the IBH entry and the IBH index of the prediction unit included in the current coding unit;
[0012] The current coding unit is encoded based on the IBH index corresponding to each prediction unit to be encoded in the current coding unit.
[0013] In a third aspect, an embodiment of the present application provides a video decoding device, the device comprising:
[0014] A decoding result acquisition module, used to acquire a code stream to be decoded, decode the code stream to be decoded, and obtain a decoding result corresponding to a current decoding unit, wherein the decoding result at least includes an IBH index corresponding to each prediction unit to be decoded included in the current decoding unit;
[0015] An IBH entry determination module is used to determine, for each prediction unit to be decoded, an IBH entry corresponding to the prediction unit from a pre-constructed entry container corresponding to the prediction unit based on the IBH index corresponding to the prediction unit, wherein the entry container is used to store the correspondence between the IBH entry and the IBH index of the prediction unit included in the current decoding unit;
[0016] The reconstruction value determination module is used to determine the reconstruction value corresponding to each prediction unit to be decoded in the current decoding unit based on the IBH entry corresponding to each prediction unit to be decoded in the current decoding unit.
[0017] In a fourth aspect, an embodiment of the present application provides a video encoding device, the device comprising:
[0018] An IBH index determination module, configured to determine, for each prediction unit to be encoded, an IBH index corresponding to the prediction unit from a pre-constructed entry container corresponding to the prediction unit, wherein the entry container is used to store the correspondence between the IBH entry and the IBH index of the prediction unit included in the current coding unit;
[0019] The coding unit coding module is used to encode the current coding unit based on the IBH index corresponding to each prediction unit to be encoded in the current coding unit.
[0020] In a fifth aspect, an embodiment of the present application further provides a decoding device, including:
[0021] Memory, used to store computer programs;
[0022] The processor is used to implement any method described in the first aspect when executing a program stored in the memory.
[0023] In a sixth aspect, an embodiment of the present application further provides an encoding device, including:
[0024] Memory, used to store computer programs;
[0025] The processor is used to implement any method described in the second aspect when executing a program stored in the memory.
[0026] In the seventh aspect, an embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method described in any one of the first aspect or the second aspect is implemented.
[0027] Beneficial effects of the embodiments of the present application:
[0028] According to the solution provided by the embodiment of the present application, the electronic device can obtain a code stream to be decoded, decode the code stream to be decoded, and obtain a decoding result corresponding to the current decoding unit, wherein the decoding result at least includes a historical block index mode IBH index corresponding to each prediction unit to be decoded included in the current decoding unit, and for each prediction unit to be decoded, based on the IBH index corresponding to the prediction unit, the IBH entry corresponding to the prediction unit is determined from a pre-constructed entry container corresponding to the prediction unit, wherein the entry container is used to store the correspondence between the IBH entry and the IBH index of the prediction unit included in the current decoding unit, and based on the IBH entry corresponding to each prediction unit to be decoded in the current decoding unit, the reconstruction value corresponding to each prediction unit to be decoded in the current decoding unit is determined. Since the pre-constructed entry container can store the correspondence between the IBH entry and the IBH index of the prediction unit, when the IBH index corresponding to the prediction unit is determined, the current decoding unit can be decoded based on the IBH index corresponding to the prediction unit, so that when the encoding end transmits the video code stream including the index to the decoding end, the index in units of the prediction unit can be transmitted, and there is no need to transmit the index in units of each pixel, so the cost of transmitting the code stream to be decoded can be reduced and the transmission efficiency can be improved. Of course, it is not necessary to achieve all the advantages described above at the same time when implementing any product or method of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] In order to more clearly illustrate the embodiments of the present application 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 only some embodiments of the present application, and for ordinary technicians in this field, other embodiments can also be obtained based on these drawings.
[0030] Figure 1 A schematic diagram of the structure of a video coding framework;
[0031] Figure 2 A flowchart of a video decoding method provided in an embodiment of the present application;
[0032] FIG. 3( a ) is a schematic diagram of prediction unit division in a 420 color mode provided in an embodiment of the present application;
[0033] FIG3( b ) is a schematic diagram of prediction unit division in a 422 color mode provided in an embodiment of the present application;
[0034] FIG3( c ) is a schematic diagram of prediction unit division in a 444 color mode provided in an embodiment of the present application;
[0035] Figure 4 Based on Figure 2 A specific flow chart of decoding a prediction unit in the illustrated embodiment;
[0036] Figure 5 Based on Figure 2 A flow chart of constructing an entry container provided by the illustrated embodiment;
[0037] Figure 6 A schematic diagram showing that the first row of the current coding unit provided in an embodiment of the present application is the first row of the corresponding slice;
[0038] Figure 7 A schematic diagram showing that each entry provided in the embodiment of the present application is taken from historical IBH entry information;
[0039] Figure 8 Based on Figure 2 The illustrated embodiment is a schematic diagram of constructing an entry container based on the YCbCr420 color mode;
[0040] Fig. 9 Based on Figure 2 The illustrated embodiment is another schematic diagram of constructing an entry container based on the YCbCr420 color mode;
[0041] Fig.10 Based on Figure 2The illustrated embodiment is a schematic diagram of constructing an entry container based on the YCbCr422 color model;
[0042] Fig.11 Based on Figure 2 The illustrated embodiment is a schematic diagram of constructing an entry container based on the YCbCr444 color mode;
[0043] Fig.12 Based on Figure 2 A specific flow chart of updating the entry container corresponding to the prediction unit in the illustrated embodiment;
[0044] Fig.13 Based on Fig.12 A schematic diagram of the embodiment shown in which an entry container is updated according to a preset update sequence;
[0045] Fig.14 Based on Fig.12 The illustrated embodiment is a schematic diagram of updating an entry container by a replacement update method;
[0046] Fig.15 Based on Fig.12 The embodiment shown is a schematic diagram of updating an entry container by adding and discarding update method;
[0047] Fig.16 A flowchart of a video encoding method provided in an embodiment of the present application;
[0048] Fig.17 for Fig.16 A specific flow chart of step S1601 in the illustrated embodiment;
[0049] Fig.18 for Fig.16 A specific flow chart of step S1602 in the illustrated embodiment;
[0050] Fig.19 Based on Fig.18 The embodiment shown is a specific flow chart for selecting the coding mode of the current coding unit;
[0051] Fig. 20 A schematic diagram of the structure of a video decoding device provided in an embodiment of the present application;
[0052] Fig.21 A schematic diagram of the structure of a video encoding device provided in an embodiment of the present application;
[0053] Fig. 22 A schematic diagram of the structure of a decoding device provided in an embodiment of the present application;
[0054] Fig.23 A schematic diagram of the structure of an encoding device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0055] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field based on the present application belong to the scope of protection of the present application.
[0056] Since video images occupy a large space, in order to reduce the cost of transmitting video images, a video encoding framework is usually used to encode the video images, and then the encoded video code stream is transmitted to the decoding end for decoding.
[0057] For example, the video coding framework is as follows: Figure 1 As shown, it may include intra-frame prediction unit, motion estimation / motion compensation (inter-frame prediction unit), reference image buffer, in-loop filtering, reconstruction, transformation, quantization, inverse transformation, inverse quantization, entropy encoder and other modules, and the video encoding is realized through the collaborative work of each module in the video encoding framework. Using this video encoding framework, the intra-frame mode information can be obtained by inputting the video frame into the intra-frame prediction unit, and the inter-frame mode information can be obtained by inputting the video frame into the inter-frame prediction unit. The intra-frame mode information and the inter-frame mode information can be converted into a bit stream for transmission by the entropy encoder. Among them:
[0058] The prediction module includes intra prediction and inter prediction. Intra prediction uses the reconstructed pixel information around the current block to make predictions and remove spatial redundancy. Inter prediction uses the reconstructed pixels on the temporal reference frame to make predictions and remove temporal redundancy.
[0059] Intra-frame prediction modes are generally divided into special modes and angle modes. Special modes include DC mode, Planar mode, and Bilinear mode. Angle mode is to find the corresponding reference pixel for each pixel of the block according to the angle direction, and then generate a prediction block.
[0060] Inter-frame prediction can be achieved by motion estimation and motion compensation. Motion estimation (ME) is the encoder searching for matching blocks based on the current block and transmitting BV (Block Vector) or BVD (Block Vector Difference) in the bitstream, which indicates the relative displacement between the current block and its matching block. Motion compensation (MC) is to generate a prediction block based on the matching block.
[0061] The transformation module linearly maps the residual information in the spatial domain to the transformation domain (such as the frequency domain) to make the energy more concentrated and remove the frequency domain correlation of the signal. Theoretically, the transformation matrix is reversible and will not cause signal loss.
[0062] The quantization module is a "many-to-one" mapping process, which is irreversible and will cause signal loss, but it can greatly reduce the value range of the signal, allowing the encoder to give a good approximation of the original signal with a small number of symbols, thereby improving the compression rate.
[0063] The entropy coding module is a lossless coding method based on the principle of information entropy. It converts a series of element symbols used to represent the video sequence (such as transform coefficients and mode information, etc.) into a binary code stream to remove the statistical redundancy of these video element symbols.
[0064] The filtering module will enhance the reconstructed image to make it closer to the original image, while reducing the impact of block effect and ringing effect, thereby improving the quality of the reconstructed image.
[0065] At present, with the development of network technology, the transmitted video includes not only the video shot by mobile devices such as cameras, but also the screen content video generated by computers. Since pixels with completely consistent colors often appear in screen content videos, the historical color index ICH method can be used to encode screen content videos. The screen content can be a web page, a programming interface, a remote video screen, a slide show, etc., which is not specifically limited here.
[0066] For example, the color mode of the video frame corresponding to the screen content is YCbCr444 mode. The video frame is encoded, and the current encoding unit uses the pixel as the prediction unit. The corresponding ICH container is created based on the color mode and the prediction unit. There are 32 indexes (index numbers 0-31) in the ICH container, and each index corresponds to an entry. Then, the ICH container can store the correspondence between 32 indexes and entries. For the entries in this color mode, each entry includes 1 luminance component, 1 Cb chrominance component, and 1 Cr chrominance component.
[0067] For the first row of the current coding unit, the entries corresponding to the 32 indexes (index numbers 0-31) are taken from the historical pixel information. For the first row of the current coding unit, which is not the first row, the entries corresponding to the first 25 indexes (index numbers 0-24) are taken from the historical pixel information, and the entries corresponding to the last 7 indexes (index numbers 25-31) are taken from the reconstructed pixel information.
[0068] The historical pixel information is the reconstructed value of the pixel stored in the encoded coding unit, and the reconstructed pixel information is the reconstructed value of each pixel in the encoded unit. For the first line of the coding unit, since there is no previous line of encoded coding units before the first line, all entries in the entry container take the historical pixel information.
[0069] After creating the corresponding ICH container, for each pixel of the current coding unit, the index corresponding to the pixel can be determined from the ICH container, and then the brightness component, Cb chroma component and Cr chroma component corresponding to the pixel can be determined. In this way, the current coding unit can be encoded based on the index corresponding to each pixel.
[0070] However, when encoding the index corresponding to each pixel in this way, when transmitting the index corresponding to each pixel to the decoding end, since it is in units of pixels, when the number of pixels in the video frame corresponding to the screen content is very large, the cost of transmitting the encoded video code stream will be high and the transmission efficiency will be low.
[0071] In order to reduce the cost of transmitting the encoded video code stream and improve the transmission efficiency, the embodiments of the present application provide a video encoding and decoding method, device, equipment, computer-readable storage medium and computer program product. The following first introduces a video decoding method provided in the embodiments of the present application.
[0072] A video decoding method provided in an embodiment of the present application can be applied to any decoding device that needs to decode a video, for example, a laptop computer, a tablet computer, a mobile phone, etc., which is not specifically limited here. For the sake of clear description, it is referred to as an electronic device below.
[0073] like Figure 2 As shown, a video decoding method, the method comprising:
[0074] S201, obtaining a code stream to be decoded, decoding the code stream to be decoded, and obtaining a decoding result corresponding to a current decoding unit;
[0075] The decoding result at least includes a historical block index mode IBH index corresponding to each prediction unit to be decoded included in the current decoding unit.
[0076] S202, for each prediction unit to be decoded, based on the IBH index corresponding to the prediction unit, determine the IBH entry corresponding to the prediction unit from the pre-constructed entry container corresponding to the prediction unit;
[0077] The entry container is used to store the correspondence between the IBH entry and the IBH index of the prediction unit included in the current decoding unit.
[0078] S203: Determine a reconstructed value corresponding to each prediction unit to be decoded in the current decoding unit based on the IBH entry corresponding to each prediction unit to be decoded in the current decoding unit.
[0079] It can be seen that in the solution provided in the embodiment of the present application, the electronic device can obtain a code stream to be decoded, decode the code stream to be decoded, and obtain a decoding result corresponding to the current decoding unit, wherein the decoding result at least includes a historical block index mode IBH index corresponding to each prediction unit to be decoded included in the current decoding unit, and for each prediction unit to be decoded, based on the IBH index corresponding to the prediction unit, the IBH entry corresponding to the prediction unit is determined from a pre-constructed entry container corresponding to the prediction unit, wherein the entry container is used to store the correspondence between the IBH entry and the IBH index of the prediction unit included in the current decoding unit, and based on the IBH entry corresponding to each prediction unit to be decoded in the current decoding unit, the reconstruction value corresponding to each prediction unit to be decoded in the current decoding unit is determined. Since the pre-constructed entry container can store the correspondence between the IBH entry and the IBH index of the prediction unit, when the IBH index corresponding to the prediction unit is determined, the current decoding unit can be decoded based on the IBH index corresponding to the prediction unit. In this way, when the encoding end transmits the to-be-decoded code stream including the index to the decoding end, the index in units of the prediction unit can be transmitted without transmitting the index in units of each pixel. Therefore, the cost of transmitting the to-be-decoded code stream can be reduced and the transmission efficiency can be improved.
[0080] For encoding the screen content video, the electronic device may use an IBH (Indexed Block History) mode at the encoding end to encode the video frame corresponding to the screen content.
[0081] Specifically, for each row of the coding unit corresponding to the screen content, the electronic device can construct a corresponding entry container. The entry container is used to store the correspondence between the IBH entry and the IBH index of the prediction unit included in the coding unit. Each coding unit is divided into multiple prediction units, then the IBH index of each prediction unit can be determined from the entry container, and then the coding unit is encoded as a code stream to be decoded.
[0082] The entry is a reconstructed pixel block of a preset size, for example, a reconstructed pixel block of 1×2 or 1×4, etc. In order to adapt to different scenarios, it can also be set to other sizes, which are not specifically limited here.
[0083] As an implementation, the number of pixels included in each entry is the same as the number of pixels included in a prediction unit. For example, as shown in FIG3(a), the prediction unit 301 includes 1x2 pixels, and the entry is the same as the prediction unit 301, including 1x2 pixels.
[0084] When the encoding end transmits the code stream to be decoded to the decoding end, at the decoding end, the electronic device can obtain the code stream to be decoded, and then decode the code stream to be decoded to obtain a decoding result corresponding to the current decoding unit, that is, execute step S201.
[0085] The decoding result at least includes the IBH index corresponding to each prediction unit to be decoded included in the current decoding unit. Since at the encoding end, when the electronic device encodes the coding unit in the IBH mode, it encodes based on the IBH index corresponding to each prediction unit to be encoded in the coding unit, the decoding result includes the IBH index corresponding to each prediction unit to be decoded included in the current decoding unit.
[0086] In one embodiment, at the encoding end, the electronic device may encode the coding unit based on the IBH index and residual corresponding to each prediction unit to be encoded in the coding unit when encoding the coding unit. Then, the decoding result may include the IBH index and residual corresponding to each prediction unit to be decoded included in the current decoding unit.
[0087] For example, when the encoding end transmits the to-be-decoded bitstream to the decoding end, the electronic device obtains the to-be-decoded bitstream and decodes the to-be-decoded bitstream to obtain a decoding result corresponding to the current decoding unit. The current decoding unit is 2x16 in size, the prediction unit is 1x2 in size, and the decoding result includes the IBH index corresponding to each to-be-decoded prediction unit included in the current decoding unit. Then, the electronic device can obtain 16 IBH indexes.
[0088] Next, in step S202, for each prediction unit to be decoded, based on the IBH index corresponding to the prediction unit, an IBH entry corresponding to the prediction unit is determined from a pre-constructed entry container corresponding to the prediction unit.
[0089] Among them, the entry container is used to store the correspondence between the IBH entries and the IBH indexes of the prediction units included in the current decoding unit. There is a one-to-one correspondence between the IBH entries in the entry container and the IBH indexes. Since at the encoding end, for each row of the encoding unit, the electronic device constructs a corresponding entry container, correspondingly, at the decoding end, the electronic device constructs the same entry container for each row of the current decoding unit. Then, for each prediction unit to be decoded, the electronic device can determine the IBH entry corresponding to the prediction unit from the pre-constructed entry container corresponding to the prediction unit according to the IBH index corresponding to the prediction unit.
[0090] In order to improve decoding efficiency, the video frame of the screen content can be divided into multiple slices, and then the multiple slices of the video frame can be decoded in parallel. For each slice, it can be divided into multiple decoding units, and then the decoding units are divided based on the size of the decoding units to obtain multiple prediction units. Then, for each row of the decoding unit, an entry container corresponding to the prediction unit is constructed.
[0091] Since the color mode corresponding to the current decoding unit is different, the entry components included in the IBH entry in the entry container are different. Therefore, it is necessary to determine the color mode corresponding to the current decoding unit, and then set the components of the IBH entry in the entry container corresponding to the prediction unit based on the color mode corresponding to the current decoding unit.
[0092] In one implementation, the current decoding unit adopts the color mode adopted by the video frame corresponding to the screen content. Therefore, when the color mode of the current video frame is determined, the color mode corresponding to the current decoding unit can be determined.
[0093] For example, as shown in FIG3(b), the color mode used by the video frame corresponding to the screen content is the YCbCr422 mode, then the color mode corresponding to the current decoding unit is the YCbCr422 mode, so the ratio of the luminance component, Cb chrominance component, and Cr chrominance component included in the IBH entry in the entry container is 2:1:1, and then the IBH entry can be set to include 2 luminance components, 1 Cb chrominance component, and 1 Cr chrominance component. The IBH entry corresponds to two pixels as shown in the prediction unit 303. The entry container includes 32 IBH entries, corresponding to 32 IBH indexes I0-I 31 ,
[0094] Following the example of S201 above, after the electronic device obtains 16 IBH indexes, it can determine the IBH entry corresponding to each prediction unit from the constructed entry container, that is, from indexes I0-I 31If the IBH index of the first prediction unit is I5, the electronic device can determine from the constructed entry container that the IBH entry corresponding to the prediction unit is the IBH entry with index I5, and further determine the luminance component, Cb chrominance component, and Cr chrominance component of the prediction unit.
[0095] In step S203, based on the IBH entries corresponding to the prediction units to be decoded in the current decoding unit, the reconstructed values corresponding to the prediction units to be decoded in the current decoding unit are determined.
[0096] In view of different decoding results, the electronic device may determine the reconstructed value corresponding to each prediction unit to be decoded in the current decoding unit based on the decoding result and the IBH entry corresponding to each prediction unit to be decoded in the current decoding unit.
[0097] In one implementation, the decoding result only includes the IBH index corresponding to each prediction unit to be decoded included in the current decoding unit. Then, after the electronic device determines the IBH entries corresponding to each prediction unit to be decoded in the current decoding unit, it can determine the reconstruction value corresponding to each prediction unit to be decoded in the current decoding unit based on the IBH entries corresponding to each prediction unit to be decoded in the current decoding unit.
[0098] In one implementation, the decoding result includes an IBH index and a residual corresponding to each prediction unit to be decoded included in the current decoding unit. Then, after the electronic device determines the IBH entries corresponding to each prediction unit to be decoded in the current decoding unit, it can determine the reconstruction value corresponding to each prediction unit to be decoded in the current decoding unit based on the IBH entries and the residual corresponding to each prediction unit to be decoded in the current decoding unit.
[0099] For example, continuing with the example of S202, the decoding result includes the IBH index and residual corresponding to each prediction unit to be decoded included in the current decoding unit. Then, after determining the IBH entries corresponding to the 16 prediction units, the electronic device can calculate the reconstruction value corresponding to the prediction unit based on the IBH entries and residuals corresponding to each prediction unit.
[0100] In this embodiment, since the pre-constructed entry container can store the correspondence between the IBH entry and the IBH index of the prediction unit, when the IBH index corresponding to the prediction unit is determined, the current decoding unit can be decoded based on the IBH index corresponding to the prediction unit. In this way, when the encoding end transmits the to-be-decoded code stream including the index to the decoding end, the index in units of the prediction unit can be transmitted without transmitting the index in units of each pixel. Therefore, the cost of transmitting the to-be-decoded code stream can be reduced and the transmission efficiency can be improved.
[0101] As an implementation method of the present application, Figure 4 As shown, before the step of decoding the to-be-decoded bitstream to obtain a decoding result corresponding to the current decoding unit, the method may further include:
[0102] S401, obtaining the encoding mode of the current decoding unit;
[0103] Since the electronic device can use different coding modes to encode the coding unit at the encoding end, the electronic device needs to decode the prediction unit in the current decoding unit to obtain a reconstructed value according to the coding mode used by the encoding end at the decoding end.
[0104] For example, at the encoding end, the electronic device uses the P mode and the IBH mode to encode the encoding unit, and the IBH mode is used to encode the current encoding unit 1. Then, at the decoding end, when the electronic device decodes the bit stream to be decoded, the encoding mode of the current decoding unit 1 can be obtained, that is, the IBH mode.
[0105] S402: If the coding mode is the IBH mode, construct an entry container corresponding to the prediction unit;
[0106] S403: If the encoding mode is a non-IBH mode, use the non-IBH mode to decode the prediction unit to obtain a reconstructed value.
[0107] The encoding modes acquired by the electronic device are different, so the manners of decoding the prediction unit in the current decoding unit to obtain the reconstructed value are different.
[0108] If the encoding mode obtained by the electronic device is the IBH mode, at the decoding end, the IBH mode is correspondingly used to decode each prediction unit in the current decoding unit, and the electronic device can construct an entry container corresponding to the prediction unit. When constructing the entry container, the construction method is the same as that of the encoding end, and the entry container can be constructed for each row of the current decoding unit, or for the current decoding unit, which is not specifically limited here.
[0109] If the encoding mode acquired by the electronic device is a non-IBH mode, the non-IBH mode may be used to decode each prediction unit in the current decoding unit to obtain a reconstructed value corresponding to the prediction unit.
[0110] It can be seen that in this embodiment, since the encoding modes acquired by the electronic device are different, the acquired encoding modes can be used to decode the prediction unit of the current decoding unit to obtain the reconstructed value corresponding to the prediction unit.
[0111] As an implementation method of the present application, Figure 5As shown, the step of constructing the entry container corresponding to the prediction unit may include:
[0112] S501, dividing the current decoding unit according to a preset division method to obtain a prediction unit to be decoded;
[0113] An entry container is constructed for each row of the current decoding unit. The electronic device can divide the current decoding unit into multiple prediction units based on the size of the current decoding unit so that the number of pixels corresponding to the components included in each IBH entry in the entry container is the same as the number of pixels included in a prediction unit.
[0114] As an implementation method, the PLC (Perceptually Lossless Display Compression) standard adopts a 2x16 encoding unit, so the current decoding unit in the embodiment of the present application correspondingly adopts a 2x16 size. Of course, the number of rows and columns of the current decoding unit can be set according to the actual application scenario.
[0115] In one implementation, the electronic device may divide the current decoding unit according to a preset division method, thereby obtaining a plurality of prediction units to be decoded.
[0116] Since the current decoding unit is 2x16 in size, i.e., includes 2x16 pixels, the current decoding unit can be divided based on 2 pixels. For example, 2 pixels are divided into 1 prediction unit, and the preset division method can be 1x2; 4 pixels are divided into 1 prediction unit, and the preset division method can be 1x4 or 2x2; 8 pixels are divided into 1 prediction unit. The preset division method can be 1x8 or 2x4, which is not specifically limited here.
[0117] For example, as shown in FIG3(a), the current decoding unit is 2x16 in size. If the current decoding unit is divided in a 1x2 manner, that is, 2 pixels are divided into 1 prediction unit, then 16 prediction units can be obtained; if the current coding unit is divided in a 1x4 manner, that is, 4 pixels are divided into 1 prediction unit, then 8 prediction units can be obtained; if the current coding unit is divided in a 2x2 manner, that is, 4 pixels are divided into 1 unit, then 8 prediction units can also be obtained.
[0118] S502: construct an entry container corresponding to the prediction unit based on the color mode corresponding to the current decoding unit.
[0119] The color mode corresponding to the current decoding unit is different, and the components included in the IBH entry in the entry container corresponding to the prediction unit are different. The color mode of the current decoding unit is consistent with the color mode of the video frame corresponding to the screen content. Therefore, the electronic device can determine the color mode of the current decoding unit through the color mode of the video frame corresponding to the screen content, and then construct the entry container corresponding to the prediction unit.
[0120] For example, if the color mode of the current decoding unit is RGB (Red Green Blue) mode, then the IBH entry in the entry container corresponding to the prediction unit is constructed including three chrominance components of R, G, and B; if the color mode of the current decoding unit is YUV (Luminance Chrominance Chroma) mode, then the IBH entry in the entry container corresponding to the prediction unit is constructed including luminance components and chrominance components.
[0121] The entry container includes a preset number of IBH entries, each IBH entry corresponds to an index, and each IBH entry is taken from historical pixel block information or reconstructed pixel information. Since the more IBH entries the entry container includes, the larger the space occupied, the preset number of entries can be set according to actual conditions, and no specific limitation is made here.
[0122] As an implementation mode, a preset number of IBH indexes are created in the entry container, and the IBH entries correspond to the IBH indexes one by one, so the entry container includes a preset number of IBH entries. Exemplarily, 32 IBH indexes are created in the entry container, so the entry container includes 32 IBH entries; 64 IBH indexes are created in the entry, so the entry container includes 64 entries. In the embodiment of the present application, the number of IBH indexes in the entry container is 32, which can be specifically set according to actual conditions.
[0123] For example, as shown in Figure 3(a), the current decoding unit is 2x16 in size, and the current decoding unit is divided in a 1x2 manner, that is, 2 pixels are divided into 1 prediction unit. The color mode of the current decoding unit is the YCbCr420 mode, then each prediction unit may include 2 luminance components, 1 Cb chrominance component, or each prediction unit includes 2 luminance components and 1 Cr chrominance component. Correspondingly, each IBH entry includes 2 luminance components, 1 Cb chrominance component, or each IBH entry includes 2 luminance components and 1 Cr chrominance component. 32 IBH indexes are created in the entry container, each IBH index corresponds to an IBH entry, and the entry container may include 32 IBH entries. Among them, each IBH entry is taken from historical pixel block information or reconstructed pixel information.
[0124] As shown in FIG3(b), the color mode of the current decoding unit is YCbCr422 mode, then each prediction unit may include 2 luminance components, 1 Cb chrominance component and 1 Cr chrominance component. Accordingly, each IBH entry includes 2 luminance components, 1 Cb chrominance component and 1 Cr chrominance component. 32 IBH indexes are created in the entry container, each IBH index corresponds to an IBH entry, and the entry container may include 32 IBH entries.
[0125] As shown in FIG3(c), the color mode of the current decoding unit is YCbCr444 mode, then each prediction unit may include 2 luminance components, 2 Cb chrominance components, and 2 Cr chrominance components. Accordingly, each IBH entry includes 2 luminance components, 2 Cb chrominance components, and 2 Cr chrominance components. 32 IBH indexes are created in the entry container, each IBH index corresponds to an IBH entry, and the entry container may include 32 IBH entries.
[0126] It can be seen that in this embodiment, since the electronic device can divide the current decoding unit according to a preset mode, multiple pixels can be divided into one prediction unit. Then, when constructing an entry container corresponding to the prediction unit, multiple pixels can be used as units to further determine the IBH index of the prediction unit in units of multiple pixels. In this way, when transmitting the to-be-decoded code stream including the index to the decoding end, the index in units of the prediction unit can be transmitted without transmitting the index in units of each pixel. Therefore, the cost of transmitting the to-be-decoded code stream can be reduced and the transmission efficiency can be improved.
[0127] As an implementation manner of the embodiment of the present application, when the first row of the current decoding unit is the first row of the slice to which it belongs, the IBH entry corresponding to the prediction unit is taken from the historical pixel block information, wherein the historical pixel block information is the reconstructed pixel information of the decoding unit before the current decoding unit;
[0128] When the first row of the current decoding unit is not the first row of the slice to which it belongs, a first preset number of IBH entries are taken from historical IBH entry information, and a second preset number of IBH entries are taken from reconstructed pixel information, wherein the historical IBH entry information is the IBH entries in the entry container updated based on the reconstructed pixel information of the previous decoding unit.
[0129] In order to improve the decoding rate, the electronic device divides the video frame corresponding to the screen content into several slices, and divides each slice into multiple decoding units. Then, the first row of some decoding units is located in the first row of the slice to which they belong.
[0130] If the first row of the current decoding unit is the first row of the slice to which it belongs, since there is no pixel row above the first row for the slice, the IBH entry in the entry container corresponding to the prediction unit for the first row of the current decoding unit can be taken from the historical pixel block information. The historical pixel block information is the reconstructed pixel information of the decoding unit before the current decoding unit. Exemplarily, the historical pixel block information may be the reconstructed pixel information of the previous decoding unit of the current decoding unit, or it may be the reconstructed pixel information of the previous decoding units. As shown in FIG. 3(a), the historical pixel block information includes a preset number of pixel points, corresponding to the components included in the prediction unit, as shown in prediction unit 301.
[0131] Specifically, if the first row of the current decoding unit is the first row of the slice to which it belongs, and the first column is the first column of the slice to which it belongs, the entry container is empty, that is, the number of entries is 0. When encoding, the encoding unit corresponding to the current decoding unit can be encoded in a non-IBH mode, and correspondingly, the non-IBH mode can also be used when decoding the current decoding unit, so as to calculate the reconstruction value of the current decoding unit. The reconstruction value can be used as the historical pixel block information corresponding to the next decoding unit.
[0132] If the first row of the current decoding unit is the first row of the slice to which it belongs, and the first column is a non-first column of the slice to which it belongs, the IBH entry in the entry container can be taken from the historical pixel block information of the previous decoding unit, so that the current decoding unit can use the IBH mode for decoding. Similarly, the IBH entry in the entry container of the subsequent decoding unit can be taken from the historical pixel block information of the previous decoding unit.
[0133] For example, Figure 6 As shown, the first rows of decoding unit 601, decoding unit 602, and decoding unit 603 are all the first rows of the corresponding slices, and each decoding unit is 2x16 in size, and the prediction unit is 1x2 in size. Among them, for the first row of decoding unit 601, the entry container is constructed to be empty, and the reconstruction value of each prediction unit in decoding unit 601 can be calculated in a non-IBH mode as the historical pixel block information of decoding unit 602. For the first row of decoding unit 602, the entry container is constructed, and the 16 reconstruction values in decoding unit 601 can be used as 16 IBH entries, so that the entry container includes 16 IBH entries.
[0134] For the first row of the current decoding unit 603, the IBH entries in the entry container can be taken from the historical pixel block information of the decoding unit 601 and the decoding unit 602, so the entry container can include 32 IBH entries. For the first row of the following decoding units, the entry container can include 32 IBH entries.
[0135] Therefore, for each slice, the number of entries in the first entry container is 0, and the entry containers of the first few coding units may be in an underfull state until the constructed entry container always includes 32 IBH entries.
[0136] If the first line of the current decoding unit is a non-first line of the slice to which it belongs, it is generally similar to the pixels of the coding unit located above it, so the entries in the constructed entry container are also similar. Therefore, the electronic device can construct the entries in the entry container corresponding to the prediction unit based on the historical IBH entry information and reconstructed pixel information of the coding unit above the current coding.
[0137] In one embodiment, based on the number of IBH entries in the entry container, the IBH entries in the entry container can be divided into a first preset number of IBH entries and a second preset number of IBH entries. The first preset number of IBH entries is taken from historical IBH entry information, and the second preset number of IBH entries is taken from reconstructed pixel information. Exemplarily, the number of entries in the entry container is 32, the first preset number is 24, and the second preset number is 8.
[0138] The historical IBH entry information is the IBH entry in the entry container updated based on the reconstructed pixel information of the previous decoding unit. The reconstructed pixel information is the reconstructed value corresponding to each prediction unit in the previous decoding unit of the current decoding unit.
[0139] For example, when the first line of the current decoding unit is a non-first line of the slice to which it belongs, the electronic device constructs an entry container corresponding to the prediction unit, the number of IBH entries is 32, and each IBH entry corresponds to an index, that is, it includes 32 indexes I0-I 31 The first preset number is 24, and the second preset number is 8. Then, the first 24 IBH entries (index I0-I 23 ) is taken from the historical IBH entry information of the previous decoding unit, and the last 8 IBH entries (index I 24 -I 31 ) is taken from the reconstructed pixel information of the previous decoding unit.
[0140] It can be seen that in this embodiment, the electronic device can construct an entry container according to the first row or non-first row of the slice to which the first row of the current decoding unit belongs, so that the IBH entry is taken from the closest reconstructed pixel information, and then the entry container stores the correspondence between the IBH entry and the IBH index.
[0141] As an implementation manner of the embodiment of the present application, the step of constructing the entry container corresponding to the prediction unit based on the color mode corresponding to the current decoding unit may include:
[0142] When the first row of the current decoding unit is the first row of the slice to which it belongs, the reconstructed pixel information of each prediction unit included in the previous decoding unit is used as the IBH entry in the entry container.
[0143] Since the first row of the current decoding unit is the first row of the slice to which it belongs, the IBH entry in the entry container corresponding to the prediction unit can be taken from the historical pixel block information. Therefore, the electronic device can use the reconstructed pixel information of the decoding units before the current decoding unit as the IBH entry in the entry container.
[0144] For example, when the first line of the current decoding unit is the first line of the slice to which it belongs, the entry container corresponding to the constructed prediction unit includes 32 IBH entries, and the electronic device can use the reconstructed pixel information of the 32 prediction units included in the first two coding units as the 32 IBH entries in the entry container.
[0145] When the first row of the current decoding unit is not the first row of the slice to which it belongs, a first preset number of IBH entries in the entry container updated based on the reconstructed pixel information of the previous decoding unit are determined as the IBH entries in the current entry container;
[0146] Based on the number of pixels included in the prediction unit, the color mode corresponding to the current decoding unit, and the reconstructed pixel information corresponding to the pixel row before the current decoding unit, other IBH entries in the current entry container are determined.
[0147] Since the first row of the current decoding unit is not the first row of the slice to which it belongs, the first preset number of IBH entries is taken from the historical IBH entry information. Therefore, the electronic device can determine the first preset number of IBH entries in the current entry container from the entry container of the previous decoding unit, that is, determine the first preset number of IBH entries in the entry container updated based on the reconstructed pixel information of the previous decoding unit as the first preset number of IBH entries in the current entry container.
[0148] If the second preset number of IBH entries is taken from the reconstructed pixel information, the electronic device may determine the second preset number of IBH entries in the current entry container based on the number of pixels included in the prediction unit in the current decoding unit, the color mode corresponding to the current decoding unit, and the reconstructed pixel information corresponding to the pixel row before the current decoding unit. The pixel row before the current decoding unit may be located directly above the current coding unit or may be located above and to the left of the current coding unit, which is not specifically limited here.
[0149] For example, when the current decoding unit is 2x16 in size and the color mode is YCbCr422, and the first line of the current decoding unit is a non-first line of the slice to which it belongs, the entry container corresponding to the prediction unit is constructed. The number of IBH entries is 32, and the index is I0-I 31 . Among them, the first preset number is 24, and the second preset number is 8.
[0150] The number of IBH entries in the entry container of the previous pixel row of the current decoding unit is 32. Then, the electronic device can use the first 24 IBH entries in the entry container of the previous pixel row as the first preset number of IBH entries in the current entry container, that is, as indexes I0-I 23 IBH entries, such as Figure 7 shown.
[0151] The reconstructed pixel information corresponding to the previous pixel row of the current decoding unit is: Y0Y1Cb1Cr1, Y2Y3Cb2Cr2, Y4Y5Cb3Cr3, Y6Y7Cb4Cr4, Y8Y9Cb5Cr5, Y 10 Y 11 Cb6Cr6, Y 12 Y 13 Cb7Cr7, Y 14 Y 15 Cb8Cr8, then the electronic device can convert Y0Y1Cb1Cr1, Y2Y3Cb2Cr2, Y4Y5Cb3Cr3, Y6Y7Cb4Cr4, Y8Y9Cb5Cr5, Y 10 Y 11 Cb6Cr6, Y 12 Y 13 Cb7Cr7, Y 14 Y 15 Cb8Cr8 is determined as the second preset number of IBH entries in the current entry container, that is, index I 24 -I 31 IBH entry.
[0152] It can be seen that in this embodiment, the electronic device can determine the first preset number of IBH entries and the second preset number of IBH entries in the constructed entry container for the first row or non-first row of the slice to which the first row of the current decoding unit belongs, and then the entry container can store the correspondence between the IBH entries and the IBH indexes.
[0153] As an implementation of an embodiment of the present application, the color mode corresponding to the current decoding unit is the first color mode, and the IBH entry includes 2 luminance components, 1 first chrominance component or 1 second chrominance component;
[0154] As a way to record the color of an image, the color mode can be divided into multiple color modes. The color mode corresponding to the current decoding unit is different, and the components corresponding to the pixel are different.
[0155] As an implementation manner, the first color mode is a YUV420 mode, and the IBH entry includes two luminance components, one first chrominance component, or one second chrominance component. The YUV420 mode may include a YCbCr420 mode and a YCoCg420 mode.
[0156] In one implementation, the color mode corresponding to the current decoding unit is the YCbCr420 mode, then, in the current decoding unit, the IBH entry includes 2 luminance components, 1 Cb chrominance component or 1 Cr chrominance component.
[0157] For example, as shown in Figure 3(a), the color mode corresponding to the current decoding unit is the YCbCr420 mode, and the IBH entry includes 2 luminance components, 1 Cb chrominance component or 1 Cr chrominance component. Then, each prediction unit in the current decoding unit includes 2 luminance components and 1 Cb chrominance component, such as prediction unit 301, or includes 2 luminance components and 1 Cr chrominance component, such as prediction unit 302.
[0158] In another implementation, the color mode corresponding to the current decoding unit is the YCoCg420 mode, then, in the current decoding unit, the IBH entry includes 2 luminance components, 1 Co chrominance component or 1 Cg chrominance component.
[0159] When the first row of the current decoding unit is a non-first row of the slice to which it belongs, the brightness components included in other IBH entries in the current entry container are reconstructed brightness components of pixels at preset positions of a previous pixel row of the current decoding unit.
[0160] Since the closer the decoding unit before the current decoding unit is to the current decoding unit, the higher the pixel similarity is generally, then after determining the color mode corresponding to the current decoding unit, the reconstructed pixel information corresponding to the previous pixel row of the current decoding unit can be determined as the second preset number of IBH entries of the current entry container, that is, the luminance component, the first chrominance component or the second chrominance component included in each IBH entry can be determined.
[0161] In one implementation, when the first row of the current decoding unit is a non-first row of the slice to which it belongs, the electronic device may use the reconstructed brightness component corresponding to the pixel point at the preset position of the previous pixel row of the current coding unit as the brightness component included in other IBH entries in the current entry container. The pixel points corresponding to the brightness component included in each IBH entry are not repeated, and the brightness components are taken from the previous pixel row without overlap to reconstruct the brightness component.
[0162] For example, Figure 8 As shown, the current decoding unit is 2x16 in size, the color mode is YCbCr420 mode, the prediction unit is 1x2 in size, and the entry container may include 32 IBH entries, with indexes of I0-I 31 , index I0-I 23 The IBH entries are the first preset number of IBH entries, index I 24 -I 31 The IBH entries of the previous pixel row 802 of the current decoding unit include a luminance component and a Cr chrominance component, and the IBH entries of the previous two pixel rows 803 include a luminance component and a Cb chrominance component. Both the previous pixel row 802 and the previous two pixel rows 803 include a luminance component.
[0163] The first row 801 of the current decoding unit is a non-first row of the slice to which it belongs, and the IBH entry includes the luminance component and the Cr chrominance component, as shown in IBH entry 804. The reconstructed luminance components corresponding to each pixel point of the previous pixel row 802 are Y0, Y1, Y2, ..., Y 15 , then, the brightness components included in other IBH entries can be determined according to the prediction unit pixel size 1x2, that is, index I 24 The brightness components of the corresponding IBH entries are Y0, Y1, index I 25 The brightness components of the corresponding IBH entries are Y2, Y3, and so on. 31 The brightness component of the corresponding IBH entry is Y 14 , Y 15 .
[0164] The first chrominance component included in other IBH entries in the current entry container is a reconstructed first chrominance component of a pixel point at a preset position of a previous pixel row of the current decoding unit; or,
[0165] The second chrominance components included in other IBH entries in the current entry container are reconstructed second chrominance components of the pixel points at the preset positions of the two pixel rows on the current decoding unit.
[0166] Since each IBH entry includes a luminance component and a first chrominance component, or a luminance component and a second chrominance component based on the color mode corresponding to the current decoding unit, the first chrominance component and the second chrominance component will not appear simultaneously in the IBH entry of the current entry container.
[0167] In one embodiment, the current decoding unit includes two rows, and when constructing an entry container corresponding to the second row of prediction units, the IBH entry includes a luminance component and a first chrominance component, and when constructing an entry container corresponding to the first row of prediction units, the IBH entry includes a luminance component and a second chrominance component. Then, when constructing an entry container based on the prediction units of the second row of the current decoding unit, the electronic device can use the reconstructed first chrominance component of the pixel point at the preset position of the previous pixel row of the current decoding unit as the first chrominance component included in other IBH entries in the current entry container.
[0168] When constructing an entry container based on the prediction unit of the first row of the current decoding unit, the reconstructed second chroma component of the pixel points at the preset positions of two pixel rows on the current decoding unit is used as the second chroma component included in other IBH entries in the current entry container.
[0169] For example, following the above example, Figure 8 As shown, for the second row of the current decoding unit, the IBH entry of the previous pixel row 802 includes a chroma component and a Cr chroma component, and the Cr chroma components corresponding to the pixels at the preset positions are Cr1, Cr2, Cr3, ..., Cr8, respectively. Then, the first chroma component included in other IBH entries in the current entry container can be determined according to the size of the prediction unit pixel 1x2, that is, the index I 24 The Cr chroma component of the corresponding IBH entry is Cr1, index I 25 The Cr chromaticity component of the corresponding IBH entry is Cr2, and so on. 31 The Cr chrominance component of the corresponding IBH entry is Cr8.
[0170] For example, Fig. 9 As shown, the current decoding unit includes two rows, the IBH entry of the previous pixel row 902 of the current decoding unit includes a luminance component and a Cr chrominance component, and the IBH entry of the previous two pixel rows 903 includes a luminance component and a Cb chrominance component.
[0171] For the first row 901 of the current decoding unit, the IBH entry includes a luminance component and a Cb chrominance component, as shown in IBH entry 904. The IBH entries of the two pixel rows 903 above include chrominance components and Cb chrominance components, and the Cb chrominance components corresponding to the pixels at the preset positions are Cb1, Cb2, Cb3, ..., Cb8, respectively. Then, the second chrominance component included in other IBH entries in the current entry container can be determined according to the size of the prediction unit pixel 1x2, that is, index I 24 The Cb chrominance component of the corresponding IBH entry is Cb1, index I 25 The Cb chrominance component of the corresponding IBH entry is Cb2, and so on. 31The Cb chrominance component of the corresponding IBH entry is Cb8.
[0172] It can be seen that in this embodiment, the electronic device can, based on the color mode corresponding to the current decoding unit, use the reconstructed luminance component, the reconstructed first chrominance component or the reconstructed second chrominance component corresponding to the pixel point at the preset position before the current decoding unit as the luminance component, the first chrominance component or the second chrominance component in other IBH entries in the current entry container, and then determine the correspondence between the second preset number of IBH entries in the entry container and the IBH index.
[0173] As an implementation of an embodiment of the present application, the color mode corresponding to the current decoding unit is the second color mode, and the IBH entry includes 2 luminance components, 1 first chrominance component and 1 second chrominance component.
[0174] As an implementation, the second color mode is a YUV422 mode, and the IBH entry includes two luminance components, one first chrominance component, and one second chrominance component. The YUV422 mode may include a YCbCr422 mode and a YCoCg422 mode.
[0175] In one implementation, the color mode corresponding to the current decoding unit is the YCbCr422 mode, then, in the current decoding unit, the IBH entry includes 2 luminance components, 1 Cb chrominance component, and 1 Cr chrominance component.
[0176] For example, as shown in Figure 3(b), the color mode corresponding to the current decoding unit is the YCbCr422 mode, and the IBH entry includes 2 luminance components, 1 Cb chrominance component and 1 Cr chrominance component. Then, each prediction unit in the current decoding unit includes 2 luminance components, 1 Cb chrominance component and 1 Cr chrominance component, such as prediction unit 303.
[0177] In another implementation manner, the color mode corresponding to the current decoding unit is the YCoCg422 mode, then, in the current decoding unit, the IBH entry includes 2 luminance components, 1 Co chrominance component and 1 Cg chrominance component.
[0178] When the first row of the current decoding unit is a non-first row of the slice to which it belongs, the brightness components included in other IBH entries in the current entry container are reconstructed brightness components of the pixel points at the preset positions of the previous pixel row of the current decoding unit;
[0179] The first chrominance component included in the other IBH entries in the current entry container is a reconstructed first chrominance component of a pixel point at a preset position of a previous pixel row of the current decoding unit;
[0180] The second chrominance components included in other IBH entries in the current entry container are reconstructed second chrominance components of the pixel points at the preset positions of the previous pixel row of the current decoding unit.
[0181] Based on the color mode corresponding to the current decoding unit, each IBH entry includes a luminance component, a first chrominance component, and a second chrominance component. Then, the electronic device can determine the reconstructed pixel information corresponding to the previous pixel row of the current decoding unit as the second preset number of IBH entries of the current entry container, that is, the luminance component, the first chrominance component, and the second chrominance component included in each IBH entry can be determined.
[0182] In one implementation, when the first row of the current decoding unit is not the first row of the slice to which it belongs, the electronic device may use the reconstructed brightness component corresponding to the pixel point at the preset position of the previous pixel row of the current decoding unit as the brightness component included in other IBH entries in the current entry container. The pixel points corresponding to the brightness component included in each IBH entry are not repeated, and the brightness components are taken from the previous pixel row without overlap to reconstruct the brightness component.
[0183] The electronic device can use the reconstructed first chromaticity component of the pixel point at the preset position of the previous pixel row of the current decoding unit as the first chromaticity component included in other IBH entries in the current entry container, and use the reconstructed second chromaticity component of the pixel point at the preset position of the previous pixel row of the current decoding unit as the second chromaticity component included in other IBH entries in the current entry container.
[0184] For example, Fig.10 As shown, the current decoding unit is 2x16 in size, the color mode is YCbCr422 mode, the prediction unit is 1x2 in size, and the entry container may include 32 IBH entries, with indexes of I0-I 31 , index I0-I 23 The IBH entries are the first preset number of IBH entries, index I 24 -I 31 The IBH entries of the pixel row 1002 of the current decoding unit include a luminance component, a Cr chrominance component, and a Cb chrominance component.
[0185] The first row 1001 of the current decoding unit is a non-first row of the slice to which it belongs, and the IBH entry includes a luminance component, a Cr chrominance component, and a Cb chrominance component, as shown in IBH entry 1003. The reconstructed luminance components corresponding to each pixel point of the previous pixel row 1002 are Y0, Y1, Y2, ..., Y 15 , then, the brightness components included in other IBH entries can be determined according to the prediction unit pixel size 1x2, that is, index I 24The brightness components of the corresponding IBH entries are Y0, Y1, index I 25 The brightness components of the corresponding IBH entries are Y2, Y3, and so on. 31 The brightness component of the corresponding IBH entry is Y 14 , Y 15 .
[0186] The Cr chromaticity components corresponding to the pixels at the preset positions of the previous pixel row 1002 are Cr1, Cr2, Cr3, ..., Cr8, and the Cb chromaticity components are Cb1, Cb2, Cb3, ..., Cb8, respectively. Then, the first chromaticity component and the second chromaticity component included in other IBH entries in the current entry container can be determined according to the size of the prediction unit pixel 1x2, that is, the index I 24 The Cr chromaticity component of the corresponding IBH entry is Cr1, the Cb chromaticity component is Cb1, and the index is I 25 The Cr chromaticity component of the corresponding IBH entry is Cr2, the Cb chromaticity component is Cb2, and so on. The index I 31 The Cr chrominance component of the corresponding IBH entry is Cr8, and the Cb chrominance component is Cb8.
[0187] It can be seen that in this embodiment, the electronic device can, based on the color mode corresponding to the current decoding unit, use the reconstructed luminance component, the reconstructed first chrominance component and the reconstructed second chrominance component corresponding to the pixel point at the preset position before the current decoding unit as the luminance component, the first chrominance component and the second chrominance component in other IBH entries in the current entry container, and then determine the correspondence between the second preset number of IBH entries in the entry container and the IBH index.
[0188] As an implementation manner of an embodiment of the present application, the color mode corresponding to the above-mentioned current decoding unit is the third color mode, and the IBH entry includes 2 luminance components, 2 first chrominance components and 2 second chrominance components.
[0189] As an implementation, the third color mode is a YUV444 mode, and the IBH entry includes 2 luminance components, 2 first chrominance components, and 2 second chrominance components. The YUV444 mode may include a YCbCr444 mode and a YCoCg444 mode.
[0190] In one implementation, the color mode corresponding to the current decoding unit is the YCbCr444 mode, then, in the current decoding unit, the IBH entry includes 2 luminance components, 2 Cb chrominance components, and 2 Cr chrominance components.
[0191] For example, as shown in Figure 3(c), the color mode corresponding to the current decoding unit is the YCbCr444 mode, and the IBH entry includes 2 luminance components, 2 Cb chrominance components, and 2 Cr chrominance components. Then, each prediction unit in the current decoding unit includes 2 luminance components, 2 Cb chrominance components, and 2 Cr chrominance components, such as prediction unit 304.
[0192] In another implementation manner, the color mode corresponding to the current decoding unit is the YCoCg444 mode, then, in the current decoding unit, the IBH entry includes 2 luminance components, 2 Co chrominance components, and 2 Cg chrominance components.
[0193] When the first row of the current decoding unit is a non-first row of the slice to which it belongs, the brightness components included in other IBH entries in the current entry container are reconstructed brightness components of the pixel points at the preset positions of the previous pixel row of the current decoding unit;
[0194] The first chrominance component included in the other IBH entries in the current entry container is a reconstructed first chrominance component of a pixel point at a preset position of a previous pixel row of the current decoding unit;
[0195] The second chrominance components included in other IBH entries in the current entry container are reconstructed second chrominance components of the pixel points at the preset positions of the previous pixel row of the current decoding unit.
[0196] Based on the color mode corresponding to the current decoding unit, each IBH entry includes a luminance component, a first chrominance component, and a second chrominance component. Then, the electronic device can determine the reconstructed pixel information corresponding to the previous pixel row of the current decoding unit as the second preset number of IBH entries of the current entry container, that is, the luminance component, the first chrominance component, and the second chrominance component included in each IBH entry can be determined.
[0197] In one implementation, when the first row of the current decoding unit is not the first row of the slice to which it belongs, the electronic device may use the reconstructed brightness component corresponding to the pixel point at the preset position of the previous pixel row of the current decoding unit as the brightness component included in other IBH entries in the current entry container. The pixel points corresponding to the brightness component included in each IBH entry are not repeated, and the brightness components are taken from the previous pixel row without overlap to reconstruct the brightness component.
[0198] The electronic device can use the reconstructed first chromaticity component of the pixel point at the preset position of the previous pixel row of the current decoding unit as the first chromaticity component included in other IBH entries in the current entry container, and use the reconstructed second chromaticity component of the pixel point at the preset position of the previous pixel row of the current decoding unit as the second chromaticity component included in other IBH entries in the current entry container.
[0199] For example, Fig.11 As shown, the current decoding unit is 2x16 in size, the color mode is YCbCr444 mode, the prediction unit is 1x2 in size, and the entry container may include 32 IBH entries, with indexes of I0-I 31 , index I0-I 23 The IBH entries are the first preset number of IBH entries, index I 24 -I 31 The IBH entries of the pixel row 1102 of the current decoding unit include a luminance component, a Cr chrominance component, and a Cb chrominance component.
[0200] The first row 1101 of the current decoding unit is a non-first row of the slice to which it belongs, and the IBH entry includes a luminance component, a Cr chrominance component, and a Cb chrominance component, as shown in an IBH entry 1103. The reconstructed luminance components corresponding to each pixel point of the previous pixel row 1102 are Y0, Y1, Y2, ..., Y 15 , then, the brightness components included in other IBH entries can be determined according to the prediction unit pixel size 1x2, that is, index I 24 The brightness components of the corresponding IBH entries are Y0, Y1, index I 25 The brightness components of the corresponding IBH entries are Y2, Y3, and so on. 31 The brightness component of the corresponding IBH entry is Y 14 , Y 15 .
[0201] The Cr chromaticity components corresponding to the pixels at the preset positions of the previous pixel row 1102 are Cr1, Cr2 ... Cr8, Cr1 ... Cr8, and the Cb chromaticity components are Cb1, Cb2 ... Cb8, Cb1 ... Cb8, respectively. Then, the first chromaticity component and the second chromaticity component included in other IBH entries in the current entry container can be determined according to the size of the prediction unit pixel 1x2, that is, the index I 24 The Cr chromaticity components of the corresponding IBH entry are Cr1, Cr2, and the Cb chromaticity components are Cb1, Cb2. 25 The Cr chromaticity components of the corresponding IBH entries are Cr3, Cr4, the Cb chromaticity components are Cb3, Cb4, and so on. The index I 31 The Cr chroma components of the corresponding IBH entries are Cr7 and Cr8, and the Cb chroma components are Cb7 and Cb8.
[0202] It can be seen that in this embodiment, the electronic device can, based on the color mode corresponding to the current decoding unit, use the reconstructed luminance component, the reconstructed first chrominance component and the reconstructed second chrominance component corresponding to the pixel point at the preset position before the current decoding unit as the luminance component, the first chrominance component and the second chrominance component in other IBH entries in the current entry container, and then determine the correspondence between the second preset number of IBH entries in the entry container and the IBH index.
[0203] As an implementation of an embodiment of the present application, the color mode corresponding to the current decoding unit is the fourth color mode, the fourth color mode is the RGB 444 mode, and the IBH entry includes 2 R components, 2 G components, and 2 B components;
[0204] When the first row of the current decoding unit is not the first row of the slice to which it belongs, the R, G, and B components included in other IBH entries in the current entry container are respectively the reconstructed R, G, and B components of the pixel points at the preset position of the previous pixel row of the current decoding unit.
[0205] For example, the color mode corresponding to the current decoding unit is the RGB444 mode, and the IBH entry includes 2 R components, 2 G components, and 2 B components. Then, each prediction unit in the current decoding unit includes 2 R components, 2 G components, and 2 B components.
[0206] In one implementation, the color mode corresponding to the current decoding unit is a Bayer mode, which can be converted into an RGB444 mode first, so that in the current decoding unit, the IBH entry includes 2 R components, 2 G components and 2 B components.
[0207] Based on the color mode corresponding to the current decoding unit, each IBH entry includes an R component, a G component, and a B component. Then, the electronic device can determine the reconstructed pixel information corresponding to the previous pixel row of the current decoding unit as the second preset number of IBH entries of the current entry container, that is, it can determine the R component, G component, and B component included in each IBH entry.
[0208] In one embodiment, when the first row of the current decoding unit is not the first row of the slice to which it belongs, the electronic device can use the reconstructed R, G, and B components of the pixel point at a preset position of the previous pixel row of the current decoding unit as the R, G, and B components included in other IBH entries in the current entry container.
[0209] For example, the current decoding unit is 2x16 in size, the color mode is RGB444 mode, the prediction unit is 1x2 in size, and the entry container may include 32 IBH entries with indexes of I0-I 31 , index I0-I 23The IBH entries are the first preset number of IBH entries, index I 24 -I 31 The IBH entries of the pixel row before the current decoding unit include an R component, a G component and a B component.
[0210] The first row 1101 of the current decoding unit is a non-first row of the slice to which it belongs. The reconstructed R, G, and B components corresponding to the pixels at the preset positions of the previous row are R1R2G1G2B1B2…R7R8G7G8B7B8…R1R2G1G2B1B2…R7R8G7G8B7B8, respectively. Then, the R, G, and B components included in the IBH entry can be determined according to the 1x2 size of the prediction unit pixel, that is, the index I 24 The R, G, and B components of the corresponding IBH entry are R1R2G1G2B1B2, index I 25 The R, G, and B components of the corresponding IBH entry are R3R4G3G4B3B4, and so on. 31 The R, G, and B components of the corresponding IBH entry are R7R8G7G8B7B8.
[0211] It can be seen that in this embodiment, the electronic device can use the reconstructed R, G, and B components corresponding to the pixel point at the preset position before the current decoding unit as the R, G, and B components in other IBH entries in the current entry container, based on the color mode corresponding to the current decoding unit, and then determine the correspondence between the second preset number of IBH entries in the entry container and the IBH index.
[0212] As an implementation of the embodiment of the present application, the above method may also include:
[0213] Obtain a residual corresponding to each prediction unit to be decoded.
[0214] In one implementation, the IBH index and residual corresponding to the current decoding unit are encoded into the bitstream to be decoded at the encoding end, and then at the decoding end, the electronic device can obtain the residual corresponding to each prediction unit to be decoded from the decoding result.
[0215] The step of determining the reconstructed value corresponding to each prediction unit to be decoded in the current decoding unit based on the IBH entry corresponding to each prediction unit to be decoded in the current decoding unit may include:
[0216] Obtaining a prediction value corresponding to each prediction unit to be decoded in the current decoding unit based on the IBH entries corresponding to the prediction units to be decoded;
[0217] Based on the prediction value and the residual corresponding to the prediction unit, a reconstruction value corresponding to the prediction unit is calculated.
[0218] Since each IBH entry corresponds to an IBH index in a one-to-one correspondence in the entry container corresponding to the prediction unit, for each prediction unit to be decoded, the electronic device can obtain the IBH entry corresponding to the prediction unit based on the IBH index corresponding to the prediction unit, that is, can obtain the prediction value corresponding to the prediction unit.
[0219] For example, for the first prediction unit to be decoded, the IBH index corresponding to the prediction unit is I 10 , then the electronic device can be based on the IBH index I corresponding to the prediction unit 10 The IBH entry corresponding to the prediction unit is determined. The IBH entry includes 2 luminance components, 1 Cb chrominance component and 1 Cr chrominance component. That is, the values of the luminance component, the Cb chrominance component and the Cr chrominance component can be determined, and then the prediction value corresponding to the prediction unit can be obtained.
[0220] Since the residual corresponding to the prediction unit is the difference between the prediction value corresponding to the prediction unit and the reconstructed value corresponding to the prediction unit, for each prediction unit to be decoded, the electronic device can calculate the reconstructed value corresponding to the prediction unit based on the prediction value corresponding to the prediction unit and the residual.
[0221] In one implementation, the electronic device may calculate the sum of the prediction value and the residual corresponding to the prediction unit to obtain the reconstructed value corresponding to the prediction unit.
[0222] It can be seen that in this embodiment, the electronic device can calculate the reconstruction value corresponding to the prediction unit based on the index and residual corresponding to each prediction unit, so that the residual is transmitted to the decoding end, which can improve the reconstruction accuracy and improve the subjective and objective performance of the screen.
[0223] As an implementation of the embodiment of the present application, after the step of calculating the reconstruction value corresponding to each prediction unit based on the prediction value and the residual corresponding to the prediction unit, the method may further include:
[0224] The entry container is updated according to the encoding mode corresponding to the current decoding unit and the reconstructed value corresponding to the prediction unit.
[0225] Since the first preset number of IBH entries in the entry container constructed by the current decoding unit will be used as the historical IBH entry information of the next decoding unit, in order for the next decoding unit to obtain the most commonly used IBH entries, after the electronic device decodes the current decoding unit and obtains the reconstructed values corresponding to each prediction unit, the entry container can be updated according to the encoding mode corresponding to the current decoding unit and the reconstructed values corresponding to the prediction unit.
[0226] For example, an electronic device uses the IBH mode to decode the current decoding unit and obtains a reconstruction value corresponding to the prediction unit included in the current decoding unit. Then, according to the IBH mode and the reconstruction value corresponding to the prediction unit, the entry container corresponding to the prediction unit can be updated, and the reconstruction value commonly used in the current coding unit can be updated to the entry container.
[0227] It can be seen that in this embodiment, the electronic device can update the entry container according to the encoding mode corresponding to the current decoding unit and the reconstruction value corresponding to the prediction unit, so that the entry container stores the correspondence between the most commonly used IBH entries and IBH indexes.
[0228] As an implementation method of the present application, Fig.12 As shown, the step of updating the entry container according to the encoding mode corresponding to the current decoding unit and the reconstruction value corresponding to the prediction unit may include:
[0229] S1201, if the encoding mode is the IBH mode, determine whether the residual corresponding to the currently traversed prediction unit is 0. If the residual is 0, execute step S1202, if the residual is not 0, execute step S1203.
[0230] The current decoding unit adopts a corresponding encoding mode for decoding. When the encoding modes are different, the electronic device may adopt different updating methods to update the entry container.
[0231] In one implementation, the encoding mode of the current decoding unit is the IBH mode, and the electronic device can traverse the prediction unit according to the preset update order to determine whether the residual corresponding to the currently traversed prediction unit is 0. The update entry container is based on the current decoding unit, and the preset update order can be from top to bottom or from left to right, which is not specifically limited here.
[0232] For example, Fig.13As shown, in the current decoding unit, the prediction unit is divided in 1x2 mode, and 16 prediction units, namely PU0 to PU15, can be obtained. Among them, the preset update order is from top to bottom, then, when the encoding mode is the IBH mode, the electronic device can traverse the prediction unit in the update order from top to bottom, that is, traverse the prediction unit in the order of PU0, PU1, PU2...PU15, and determine whether the residual corresponding to the currently traversed prediction unit is 0.
[0233] S1202: Move the IBH entry whose corresponding IBH index is the IBH index corresponding to the prediction unit backward by one entry position, and place the IBH entry corresponding to the prediction unit at the first entry position of the entry container.
[0234] In one embodiment, if the residual corresponding to the currently traversed prediction unit is 0, the electronic device can update the entry container by replacement update, move the entry whose corresponding IBH index is before the IBH index corresponding to the prediction unit backward by one entry position, and place the IBH entry corresponding to the prediction unit at the first entry position of the entry container, that is, execute step S1202.
[0235] That is to say, when the first row of the current decoding unit is not the first row of the slice to which it belongs, when the entry container is full, the IBH entries with a smaller IBH index than that corresponding to the prediction unit can be moved down one grid one by one, and the IBH entry corresponding to the prediction unit can be placed at the first entry position, and the IBH entries with a larger IBH index than that corresponding to the prediction unit can remain unchanged.
[0236] For example, Fig.14 As shown, the entry container includes 32 indexes, indexes I0-I 23 The corresponding IBH entry belongs to the first preset number of IBH entries, the MRU is the IBH entry corresponding to index I0, and the LRU is the IBH entry corresponding to index I 23 The corresponding IBH entry. The residual corresponding to the current prediction unit is 0, and the IBH index is I 13 , the corresponding IBH entry is entry 1401, then the electronic device can replace and update the MRU in the entry container and set the corresponding IBH index to I0-I 12 The IBH entry of the IBH is moved back one position, and the corresponding IBH index is I 14 -I 23 The IBH entry of the prediction unit remains unchanged, and the IBH entry corresponding to the prediction unit is placed in the first position of the entry container, that is, in the entry position 1402 corresponding to the IBH index I0.
[0237] S1203: discard the last IBH entry of the first preset number of IBH entries in the entry container, move the other IBH entries backward by one entry position, and place the IBH entry corresponding to the prediction unit at the first entry position of the entry container.
[0238] In one implementation, if the residual corresponding to the currently traversed prediction unit is not 0, the electronic device may update the entry container in an add-discard manner, discard the last IBH entry of the first preset number of IBH entries in the entry container, move the other IBH entries back by one entry position, and place the IBH entry corresponding to the prediction unit at the first entry position of the entry container. If the entry container is not full, the last IBH entry is not discarded.
[0239] For example, Fig.15 As shown, the entry container includes 32 indexes, indexes I0-I 23 The corresponding IBH entry belongs to the first preset number of entries, the MRU is the IBH entry corresponding to index I0, and the LRU is the IBH entry corresponding to index I 23 The corresponding IBH entry. The residual corresponding to the current prediction unit is not 0, and the IBH index is I 13 , the corresponding IBH entry is entry 1501, then the electronic device can update the entry container by adding-discarding update mode, and set the IBH index to I 23 The IBH entry is discarded, and the corresponding IBH index is I0-I 22 The IBH entry of the prediction unit is moved backward by one entry position, and the IBH entry corresponding to the prediction unit is placed at the first position of the entry container, that is, at the entry position 1502 corresponding to the IBH index I0.
[0240] It can be seen that in this embodiment, when the current encoding mode is the IBH mode, the electronic device can determine whether the residual corresponding to the currently traversed prediction unit is 0, and then use different update methods to update the entry container so that the entry container stores the correspondence between the most commonly used IBH entries and IBH indexes.
[0241] As an implementation manner of an embodiment of the present application, the step of updating the entry container according to the encoding mode corresponding to the current decoding unit and the reconstruction value corresponding to the prediction unit may include:
[0242] If the encoding mode is the non-IBH mode, the last IBH entry of the first preset number of IBH entries in the entry container is discarded, the other IBH entries are shifted back by one entry position, and the IBH entry corresponding to the prediction unit is placed at the first entry position of the entry container.
[0243] In one embodiment, when the encoding mode is a non-IBH mode, the electronic device can update the entry container in an add-discard manner, discard the last IBH entry of the first preset number of IBH entries in the entry container, move the other IBH entries back by one entry position, and place the IBH entry corresponding to the prediction unit at the first entry position of the entry container.
[0244] When the encoding mode is non-IBH mode, the electronic device updates the entry container in a manner similar to the add-discard manner when the encoding mode is IBH mode, and the example in step S1203 is referred to, which will not be described in detail here.
[0245] It can be seen that in this embodiment, when the encoding mode is non-IBH mode, the electronic device can update the entry container in an add-discard update manner so that the entry container stores the correspondence between the most commonly used IBH entries and IBH indexes.
[0246] Corresponding to the above-mentioned video decoding method, an embodiment of the present application provides a video encoding method.
[0247] A video encoding method provided in an embodiment of the present application can be applied to any encoding device that needs to encode a video, for example, a laptop computer, a tablet computer, a mobile phone, etc., which is not specifically limited here. For the sake of clear description, it is referred to as an electronic device below.
[0248] like Fig.16 As shown, a video encoding method, the method comprising:
[0249] S1601, for each prediction unit to be encoded, determine an IBH index corresponding to the prediction unit from a pre-constructed entry container corresponding to the prediction unit;
[0250] The entry container is used to store the correspondence between the IBH entries and the IBH indexes of the prediction units included in the current coding unit.
[0251] S1602: Encode the current coding unit based on the IBH index corresponding to each prediction unit to be encoded in the current coding unit.
[0252] It can be seen that in the solution provided by the embodiment of the present application, the electronic device can determine the IBH index corresponding to the prediction unit from the pre-constructed entry container corresponding to the prediction unit for each prediction unit to be encoded, wherein the entry container is used to store the correspondence between the IBH entry and the IBH index of the prediction unit included in the current coding unit, and encode the current coding unit based on the IBH index corresponding to each prediction unit to be encoded in the current coding unit. Since the IBH index corresponding to the prediction unit can be determined according to the pre-constructed entry container, and then the current coding unit is encoded based on the IBH index corresponding to the prediction unit, in this way, when transmitting the code stream to be decoded including the index to the decoding end, the index in the prediction unit can be transmitted, and there is no need to transmit the index in each pixel. Therefore, the cost of transmitting the code stream to be decoded can be reduced and the transmission efficiency can be improved.
[0253] In the above step S1601, for each prediction unit to be encoded, the electronic device may determine the IBH index corresponding to the prediction unit from the pre-constructed entry container corresponding to the prediction unit.
[0254] The entry container is used to store the correspondence between the IBH entry and the IBH index of the prediction unit included in the current coding unit, and the number of pixels corresponding to the components included in each entry is the same as the number of pixels included in a prediction unit. Each IBH index and the IBH entry are in one-to-one correspondence. When the IBH entry corresponding to the prediction unit is determined, the electronic device can determine the index corresponding to the prediction unit.
[0255] In order to improve the coding efficiency, the video frame corresponding to the screen content can be divided into multiple slices, and then the multiple slices of the video frame can be encoded in parallel. For each slice, it can be divided into multiple coding units, and then the coding units are divided based on the size of the coding units to obtain multiple prediction units, and then for each row of the coding units, an entry container corresponding to the prediction unit is constructed. Among them, when constructing the entry container, the entry container can be constructed for each row, or for the current coding unit, which is not specifically limited here.
[0256] Since the color mode of the current coding unit is different, the entry components included in the IBH entry in the entry container are different. Therefore, the components of the entry in the entry container corresponding to the prediction unit can be set based on the color mode corresponding to the current coding unit. For example, if the color mode corresponding to the current coding unit is the YCbCr422 mode, then the ratio of the luminance component, Cb chrominance component, and Cr chrominance component included in the IBH entry is 2:1:1, and then the IBH entry in the entry container corresponding to the prediction unit can be set to include 2 luminance components, 1 Cb chrominance component, and 1 Cr chrominance component.
[0257] For the video frame corresponding to the screen content, different color modes can be used, such as RGB mode, YUV mode, etc. Then, the color mode used by the video frame determines the color mode used by the coding unit in the video frame. That is, when the color mode of the current video frame is determined, the color mode corresponding to the corresponding current coding unit can be determined.
[0258] For example, as shown in FIG3(a), the size of the current coding unit is 2x16, and the current coding unit is divided, and 1x2 pixels are divided into one prediction unit, so 16 prediction units can be obtained. The color mode corresponding to the current coding unit is the YCbCr420 mode, so an entry container is constructed for the prediction unit of each row of the current coding unit.
[0259] For the prediction units of the first row, entry container 1 is constructed, and each IBH entry includes 2 luminance components and 1 Cb chrominance component. For the prediction units of the second row, entry container 2 is constructed, and each IBH entry includes 2 luminance components and 1 Cr chrominance component. In entry container 1 or entry container 2, each IBH entry corresponds to a unique IBH index.
[0260] For the prediction unit 301 to be encoded, which is located in the first row of the current coding unit, the corresponding pre-constructed entry container is entry container 1, and the electronic device can determine the IBH index corresponding to the prediction unit 301 from the entry container 1 corresponding to the prediction unit 301.
[0261] Next, in step S1602, the electronic device may encode the current coding unit based on the IBH index corresponding to each to-be-encoded prediction unit in the current coding unit.
[0262] After the electronic device determines the IBH index corresponding to each prediction unit to be encoded, if the IBH index is transmitted to the decoding end, the decoding end can determine the IBH entry corresponding to each unit to be encoded from the entry container corresponding to the prediction unit based on the IBH index. Therefore, the electronic device can encode the current coding unit based on the IBH index corresponding to each prediction unit to be encoded in the current coding unit.
[0263] For example, as shown in FIG3(a), the current coding unit includes 16 prediction units, the entry container corresponding to the first row of prediction units is entry container 1, and the entry container corresponding to the second row of prediction units is entry container 2. Then, the electronic device can determine the IBH indexes corresponding to the 8 prediction units in the first row from entry container 1, and determine the IBH indexes corresponding to the 8 prediction units in the second row from entry container 2, that is, the IBH indexes corresponding to the 16 prediction units can be obtained. Then, the electronic device can encode the current coding unit based on the IBH indexes corresponding to the 16 prediction units.
[0264] In the scheme of this embodiment, since the IBH index corresponding to the prediction unit can be determined according to the pre-constructed entry container, and then the current coding unit is encoded based on the IBH index corresponding to the prediction unit, when transmitting the video code stream including the index to the decoding end, the index in units of prediction units can be transmitted, and there is no need to transmit the index in units of each pixel. Therefore, the cost of transmitting the code stream to be decoded can be reduced and the transmission efficiency can be improved.
[0265] As an implementation of the embodiment of the present application, before the step of determining the IBH index corresponding to the prediction unit from the pre-constructed entry container corresponding to the prediction unit, the method may further include:
[0266] Divide the current coding unit according to a preset division method to obtain a prediction unit to be encoded;
[0267] Based on the color mode corresponding to the current coding unit, an entry container corresponding to the prediction unit is constructed, wherein the entry container includes a preset number of IBH entries, each IBH entry corresponds to an index, and each IBH entry is taken from historical pixel block information or reconstructed pixel information.
[0268] The specific way in which the encoding end divides the current coding unit and the specific way in which the entry container corresponding to the prediction unit is constructed based on the color mode corresponding to the current coding unit are similar to the specific way in which the decoding end divides the current decoding unit and the specific way in which the entry container corresponding to the prediction unit is constructed based on the color mode corresponding to the current decoding unit. Please refer to the description of the corresponding part of the decoding end and will not be repeated here.
[0269] It can be seen that in this embodiment, since the electronic device can divide the current coding unit according to a preset mode, multiple pixels can be divided into a prediction unit. Then, when constructing an entry container corresponding to the prediction unit, multiple pixels can be used as units to further determine the index of the prediction unit in units of multiple pixels. In this way, when transmitting the to-be-decoded code stream including the index to the decoding end, the index in units of the prediction unit can be transmitted without transmitting the index in units of each pixel. Therefore, the cost of transmitting the to-be-decoded code stream can be reduced and the transmission efficiency can be improved.
[0270] As an implementation manner of an embodiment of the present application, when the first line of the current coding unit is the first line of the slice to which it belongs, the IBH entry corresponding to the prediction unit is taken from historical pixel block information, wherein the historical pixel block information is reconstructed pixel information of the coding unit before the current coding unit;
[0271] When the first row of the current coding unit is not the first row of the slice to which it belongs, a first preset number of IBH entries are taken from historical IBH entry information, and a second preset number of IBH entries are taken from reconstructed pixel information, wherein the historical IBH entry information is the IBH entries in the entry container updated based on the reconstructed pixel information of the previous coding unit.
[0272] It can be seen that in this embodiment, the electronic device can construct an entry container according to the first row or non-first row of the slice to which the first row of the current coding unit belongs, so that the IBH entry is taken from the closest reconstructed pixel information, and then the entry container stores the correspondence between the IBH entry and the IBH index.
[0273] As an implementation manner of the embodiment of the present application, the step of constructing the entry container corresponding to the prediction unit based on the color mode corresponding to the current coding unit may include:
[0274] When the first row of the current coding unit is the first row of the slice to which it belongs, reconstructed pixel information of each prediction unit included in the previous coding unit is used as an IBH entry in the entry container;
[0275] When the first row of the current coding unit is a non-first row of the slice to which it belongs, a first preset number of IBH entries in the entry container updated based on the reconstructed pixel information of the previous coding unit are determined as the IBH entries in the current entry container;
[0276] Based on the number of pixels included in the prediction unit, the color mode corresponding to the current coding unit, and the reconstructed pixel information corresponding to the pixel row before the current coding unit, other IBH entries in the current entry container are determined.
[0277] The specific manner in which the encoding end determines the first preset number of IBH entries and the specific manner in which the second preset number of IBH entries are determined is similar to the specific manner in which the decoding end determines the first preset number of IBH entries and the specific manner in which the second preset number of IBH entries are determined. Please refer to the description of the corresponding part of the decoding end and will not be repeated here.
[0278] It can be seen that in this embodiment, the electronic device can determine the first preset number of IBH entries and the second preset number of IBH entries in the constructed entry container based on whether the first line of the current coding unit is the first line or non-first line of the corresponding slice, and then the entry container can store the correspondence between the IBH entries and the IBH indexes.
[0279] As an implementation manner of an embodiment of the present application, the color mode corresponding to the current coding unit is the first color mode, and the IBH entry includes 2 luminance components, 1 first chrominance component or 1 second chrominance component;
[0280] When the first row of the current decoding unit is not the first row of the slice to which it belongs, the luminance component included in other IBH entries in the current entry container is the reconstructed luminance component of the pixel point at the preset position of the previous pixel row of the current decoding unit; the first chrominance component included in other IBH entries in the current entry container is the reconstructed first chrominance component of the pixel point at the preset position of the previous pixel row of the current coding unit; or, the second chrominance component included in other IBH entries in the current entry container is the reconstructed second chrominance component of the pixel point at the preset position of two pixel rows on the current coding unit; or,
[0281] The color mode corresponding to the current coding unit is the second color mode, and the IBH entry includes 2 luminance components, 1 first chrominance component and 1 second chrominance component;
[0282] When the first row of the current coding unit is a non-first row of the slice to which it belongs, the luminance component included in other IBH entries in the current entry container is the reconstructed luminance component of the pixel point at the preset position of the previous pixel row of the current coding unit; the first chrominance component included in other IBH entries in the current entry container is the reconstructed first chrominance component of the pixel point at the preset position of the previous pixel row of the current coding unit; the second chrominance component included in other IBH entries in the current entry container is the reconstructed second chrominance component of the pixel point at the preset position of the previous pixel row of the current coding unit; or,
[0283] The color mode corresponding to the current coding unit is the third color mode, and the IBH entry includes 2 luminance components, 2 first chrominance components, and 2 second chrominance components;
[0284] When the first row of the current coding unit is a non-first row of the slice to which it belongs, the luminance component included in other IBH entries in the current entry container is the reconstructed luminance component of the pixel point at the preset position of the previous pixel row of the current coding unit; the first chrominance component included in other IBH entries in the current entry container is the reconstructed first chrominance component of the pixel point at the preset position of the previous pixel row of the current coding unit; the second chrominance component included in other IBH entries in the current entry container is the reconstructed second chrominance component of the pixel point at the preset position of the previous pixel row of the current coding unit; or,
[0285] The color mode corresponding to the current coding unit is the fourth color mode, the fourth color mode is the RGB444 mode, and the IBH entry includes 2 R components, 2 G components and 2 B components; when the first row of the current coding unit is a non-first row of the slice to which it belongs, the R, G, and B components included in other IBH entries in the current entry container are respectively the reconstructed R, G, and B components of the pixel points at the preset position of the previous pixel row of the current coding unit.
[0286] The specific manner in which the encoding end determines the luminance component, the first chrominance component, the second chrominance component or the RGB component included in the IBH entry is similar to the specific manner in which the decoding end determines the luminance component, the first chrominance component, the second chrominance component or the RGB component included in the IBH entry. Please refer to the description of the corresponding part of the decoding end, and will not be repeated here.
[0287] In this embodiment, the electronic device can, based on the color mode corresponding to the current coding unit, use the reconstructed brightness component, the reconstructed first chromaticity component, the reconstructed second chromaticity component or the reconstructed RGB component corresponding to the pixel point at the preset position before the current coding unit as the brightness component, the first chromaticity component, the second chromaticity component or the RGB component in other IBH entries in the current entry container, and further determine the correspondence between the second preset number of IBH entries in the entry container and the IBH index.
[0288] As an implementation method of the present application, Fig.17 As shown, the above step of determining, for each prediction unit to be encoded, from a pre-constructed entry container corresponding to the prediction unit, the IBH index corresponding to the prediction unit may include:
[0289] S1701, for each prediction unit to be encoded, traverse the IBH entries included in the pre-constructed entry container corresponding to the prediction unit;
[0290] Since the IBH entries in the pre-constructed entry container are taken from the historical IBH entry information or reconstructed pixel information of the previous coding unit, for each prediction unit to be encoded, the electronic device can traverse the IBH entries included in the pre-constructed entry container corresponding to the prediction unit to determine the IBH entry that is most similar to the prediction unit.
[0291] In one embodiment, for each prediction unit to be encoded, the electronic device traverses the IBH entries included in the pre-constructed entry container corresponding to each prediction unit in a preset order, wherein the preset order may be the order from small to large IBH indexes in the entry container, which is not specifically limited here.
[0292] For example, as shown in FIG3(c), the prediction unit of the current coding unit is 1x2 in size. For the first row of the current coding unit, the pre-constructed entry container includes 32 IBH entries, and the IBH index is I0-I 31 Then, the electronic device may start with the first prediction unit 304 on the left and follow the indexes I0-I 31 The IBH entries included in the pre-built entry container corresponding to the prediction unit are traversed in the order of I0-I 31 The corresponding IBH entries are searched to determine the closest IBH entry.
[0293] S1702, calculating an error between the prediction unit and each IBH entry based on an original value of a pixel included in the prediction unit and a component value corresponding to each IBH entry;
[0294] Since each IBH entry in the entry container is taken from the historical IBH entry information or reconstructed pixel information of the coding unit before the current coding unit, the difference between the original value of the pixel point included in the prediction unit and the historical IBH entry block information or reconstructed pixel information can be determined. If the difference is smaller, it means that the similarity between the prediction unit and the corresponding IBH entry is higher, and if the difference is larger, it means that the similarity between the prediction unit and the corresponding IBH entry is lower.
[0295] In one implementation, the electronic device may calculate the error between the prediction unit and each IBH entry based on the original value of the pixel included in the prediction unit and the component value corresponding to each IBH entry.
[0296] For example, as shown in FIG3(c), the prediction unit of the current coding unit is 1x2 in size, and the pre-constructed entry container includes 32 IBH entries, each of which includes 2 luminance components, 2 Cb chrominance components, and 2 Cr chrominance components, with indexes of I0-I 31 The original value of the pixel point included in the prediction unit 304 is Y 01 Y 02 Cb 01 Cb 02 Cr 01 Cr 02 , the component value corresponding to the IBH entry with IBH index I0 is Y0Y1Cb1Cb2Cr1Cr2, then the electronic device can predict the original value Y of the pixel point included in the prediction unit 304 01 Y 02 Cb 01 Cb 02 Cr 01 Cr 02The error between the prediction unit 304 and the IBH entry with the IBH index I0 is calculated by comparing the component value Y0Y1Cb1Cb2Cr1Cr2 corresponding to the IBH entry with the IBH index I0. Similarly, the error between the prediction unit and the IBH entry with the IBH index I1-I 31 The error between the IBH entries.
[0297] S1703: Based on the error, determine the IBH index corresponding to the prediction unit from the IBH indexes corresponding to the IBH entries included in the entry container.
[0298] In one implementation, after calculating the error between the prediction unit and each IBH entry in the entry container, the electronic device may determine the IBH index of the IBH entry with the smallest corresponding error as the IBH index corresponding to the prediction unit.
[0299] For example, following the example in S1702 above, the electronic device can calculate that the prediction unit 304 and the IBH index are I0-I 31 The error between each IBH entry, where the prediction unit 304 and the IBH index are I 23 The error between the IBH entries is the smallest, then it can be determined that I 23 is the IBH index corresponding to the prediction unit 304.
[0300] It can be seen that in this embodiment, the electronic device can determine the IBH index corresponding to the prediction unit from the indexes corresponding to the IBH entries included in the entry container based on the original value of the pixel point included in the prediction unit and the error of the component value corresponding to each IBH entry in the entry container. In this way, the entry container can store the correspondence between the IBH entry and the IBH index of the prediction unit included in the current coding unit, and then encode the current coding unit based on the IBH index corresponding to the prediction unit.
[0301] As an implementation manner of an embodiment of the present application, the step of calculating the error between the prediction unit and each IBH entry based on the original value of the pixel point included in the prediction unit and the component value corresponding to each IBH entry may include:
[0302] Based on the original value of the pixel point included in the prediction unit and the component value corresponding to each IBH entry, the error between the prediction unit and each IBH entry is calculated according to the following formula;
[0303]
[0304] Among them, OrigComp i is the original value of the pixel point included in the prediction unit, HistoryCompi Each IBH entry corresponds to a component value, and N is the number of components corresponding to each IBH entry.
[0305] In one implementation, the electronic device may calculate the error between the prediction unit and each IBH entry according to a preset error formula based on the original value of the pixel point included in the prediction unit and the component value corresponding to each IBH entry. The preset error formula may be the above formula or may be determined according to actual conditions, which is reasonable.
[0306] In the above formula, N can be set according to the number of components corresponding to each IBH entry. For example, for the color mode of YCbCr422 mode, the IBH entry includes 2 luminance components, 1 Cb chrominance component and 1 Cr chrominance component, then the value of N is 4; for the color mode of YCbCr444 mode, the IBH entry includes 2 luminance components, 2 Cb chrominance components and 2 Cr chrominance components, then the value of N is 6.
[0307] For example, the original value of the pixel included in the prediction unit is Y 01 Y 02 Cb 01 Cb 02 Cr 01 Cr 02 , the component value corresponding to the IBH entry with IBH index I0 is Y0Y1Cb1Cb2Cr1Cr2, then the electronic device can predict the original value Y of the pixel point included in the unit based on 01 Y 02 Cb 01 Cb 02 Cr 01 Cr 02 The component value Y0Y1Cb1Cb2Cr1Cr2 corresponding to the IBH entry with IBH index I0 is calculated according to the following formula to calculate the error between the prediction unit and the IBH entry with IBH index I0,
[0308]
[0309] Among them, OrigComp i The original value of the pixel point included in the prediction unit is Y0Y1Cb1Cb2Cr1Cr2, HistoryComp i is the component value Y0Y1Cb1Cb2Cr1Cr2 corresponding to the IBH entry with IBH index I0, and N is the number of components corresponding to the IBH entry with IBH index I0, which is 6.
[0310] Then, similarly, based on the above formula, the electronic device can calculate the prediction unit and IBH index as I1-I 31The error between the IBH entries.
[0311] It can be seen that in this embodiment, the electronic device can calculate the error between the original value of the pixel point included in the prediction unit and the component value corresponding to each IBH entry in the entry container, and then determine the IBH index corresponding to the prediction unit from the IBH index corresponding to the IBH entry included in the entry container based on the error.
[0312] As an implementation method of the present application, Fig.18 As shown, the step of encoding the current coding unit based on the IBH indexes corresponding to the prediction units to be encoded in the current coding unit may include:
[0313] S1801, obtaining a prediction value corresponding to each prediction unit to be encoded in the current coding unit based on an IBH index corresponding to the prediction unit to be encoded;
[0314] Since each IBH entry corresponds to an IBH index in a one-to-one correspondence in the entry container corresponding to the prediction unit, for each prediction unit to be encoded, when the IBH index corresponding to the prediction unit is determined, the IBH entry corresponding to the prediction unit can be determined, that is, the prediction value of the prediction unit can be obtained. Therefore, the electronic device can obtain the prediction value corresponding to the prediction unit based on the IBH index corresponding to each prediction unit to be encoded in the current coding unit.
[0315] For example, for a prediction unit to be encoded, the IBH index corresponding to the prediction unit is determined to be I 16 , then the electronic device can be based on the IBH index I corresponding to the prediction unit 16 The IBH entry corresponding to the prediction unit is determined, and then the prediction value corresponding to the prediction unit is obtained.
[0316] S1802, for each prediction unit, calculating a difference between a predicted value corresponding to the prediction unit and an original value corresponding to the prediction unit as a residual corresponding to the prediction unit;
[0317] S1803: Encode the current coding unit based on the IBH index and the residual corresponding to the prediction unit, and transmit the encoding result to a decoding device.
[0318] Since there is a certain difference between the predicted value corresponding to the prediction unit and the original value corresponding to the prediction unit, for each prediction unit, the electronic device can calculate the difference between the predicted value corresponding to the prediction unit and the original value corresponding to the prediction unit as the residual corresponding to the prediction unit.
[0319] In order to make the reconstruction degree of the current coding unit higher at the decoding end, when the encoding end transmits the encoded video code stream to the decoding end, the residual corresponding to each prediction unit in the current coding unit is transmitted while the IBH index corresponding to each prediction unit in the current coding unit is transmitted. Then, the electronic device can encode the current coding unit based on the IBH index corresponding to the prediction unit and the residual, and transmit the encoding result to the decoding device.
[0320] For example, following the above example, the electronic device can calculate the difference between the predicted value corresponding to the prediction unit and the original value corresponding to the prediction unit as the residual corresponding to the prediction unit. Then, for each prediction unit, its corresponding residual can be calculated, and then the electronic device can encode the current coding unit based on the IBH indexes and residuals corresponding to each prediction unit in the current coding unit.
[0321] It can be seen that in this embodiment, the electronic device can encode the current coding unit based on the IBH index and residual corresponding to each prediction unit. In this way, when transmitting the video code stream including the IBH index and the residual to the decoding end, the index in units of prediction units can be transmitted, which reduces the cost of transmitting the encoded code stream to be decoded and improves the transmission efficiency. At the same time, transmitting the residual to the decoding end can improve the reconstruction accuracy.
[0322] As an implementation method of the present application, Fig.19 As shown, before the step of encoding the current coding unit based on the IBH index and the residual corresponding to the prediction unit, the method may further include:
[0323] S1901, for the current coding unit, based on the prediction values and residuals corresponding to the prediction units to be encoded in the current coding unit, calculate a reconstructed value corresponding to each prediction unit;
[0324] In the process of encoding the current coding unit, multiple prediction modes may be used to encode the current coding unit. Therefore, the prediction mode with a small rate-distortion cost may be adopted by calculating the rate-distortion costs of different prediction modes.
[0325] For the current coding unit, the electronic device can obtain the prediction value corresponding to the prediction unit through the IBH index corresponding to each prediction unit in the current coding unit, and can calculate the residual corresponding to each prediction unit to be encoded in the current coding unit. Then, based on the prediction value and residual corresponding to each prediction unit to be encoded in the current coding unit, the electronic device can calculate the reconstruction value corresponding to each prediction unit.
[0326] In one embodiment, the residual corresponding to each prediction unit to be encoded in the current coding unit is obtained by calculating the difference between the predicted value corresponding to the prediction unit and the original value corresponding to the prediction unit. Then, based on the predicted value and the residual corresponding to the prediction unit, the reconstructed value corresponding to the prediction unit is calculated, and the reconstructed value corresponding to the prediction unit and the original value corresponding to the prediction unit may be the same.
[0327] S1902, calculating a first coding distortion of the current coding unit based on the reconstructed value and the original value corresponding to the prediction unit;
[0328] After obtaining the reconstructed values corresponding to the prediction units to be encoded in the current coding unit, the first coding distortion of the current coding unit may be calculated based on the reconstructed values corresponding to the prediction units and the original values.
[0329] In one implementation, the electronic device may calculate the sum of errors between the reconstructed value and the original value corresponding to each prediction unit of the current coding unit according to the following formula, that is, obtain the first coding distortion of the current coding unit;
[0330] ErrIbhMode = SumOverCB(Y orig -Y IBH )+SumOverCB(Cb orig -Cb IBH )+SumOverCB(Cr orig -Cr IBH )
[0331] The meanings of the parameters in the formula are shown in the following table.
[0332] Parameter name meaning ErrIbhMode IBH mode coding distortion <![CDATA[Y IBH 、Cb IBH 、Cr IBH ]]> In IBH mode, the reconstruction value corresponding to the prediction unit in the current CU <![CDATA[Y orig 、Cb orig 、Cr orig ]]> The original value corresponding to the prediction unit in the current CU SumOverCB Add in the current CB (Coding Block)
[0333] If the reconstructed value corresponding to the prediction unit is the same as the original value corresponding to the prediction unit, then the first coding distortion of the current coding unit is 0. If the reconstructed value corresponding to the prediction unit is different from the original value corresponding to the prediction unit, then the first coding distortion of the current coding unit is not zero.
[0334] S1903, calculating a second coding distortion of the current coding unit based on a reconstructed value obtained by encoding the prediction unit in a non-IBH mode;
[0335] If a non-IBH mode is used to encode the current coding unit, the electronic device may obtain a reconstructed value based on encoding the prediction unit in the non-IBH mode, and further calculate the second coding distortion of the current coding unit.
[0336] In one implementation, the electronic device may calculate the difference between the reconstructed value obtained by encoding the prediction unit in the current encoding using the preset mode and the original value according to the following formula, that is, obtain the second encoding distortion;
[0337] ErrBestMode = SumOverCB(Y orig -Y Best )+SumOverCB(Cb orig -Cb Best )+SumOverCB(Cr orig -Cr Best )
[0338] The meanings of the parameters in the formula are shown in the following table.
[0339] Parameter name meaning ErrBestMode Coding distortion of the best prediction mode other than IBH <![CDATA[Y Best 、Cb Best 、Cr Best ]]> Reconstructed value of the prediction unit in the current CU in non-IBH optimal prediction mode <![CDATA[Y orig 、Cb orig 、Cr orig ]]> The original value of the prediction unit in the current CU SumOverCB Add in the current CB (Coding Block)
[0340] S1904: Determine, according to the first coding distortion and the second coding distortion, whether the coding mode of the current coding unit is the IBH mode or the non-IBH mode;
[0341] After determining the first coding distortion and the second coding distortion, the electronic device may determine the coding mode of the current coding unit according to the first coding distortion and the second coding distortion according to the following prediction mode selection process.
[0342] lambda=23*dequant_scale[luma_qp&0x07]*lambda_fullness[full_idx] (1)
[0343] shift=19–(luma_qp>>3) (2)
[0344]
[0345] The meanings of the parameters in this selection process are shown in the following table:
[0346] Parameter name meaning ErrIbhMode First coding distortion in IBH mode ErrBestMode Second coding distortion in the best prediction mode without IBH bitsIbhMode Number of bits required to encode IBH mode bitsBestMode Number of bits required to encode the best prediction mode for non-IBH luma_qp Brightness QP (Quantization Parameter) lambda_fullness Full scale mapping table full_idx Full Index
[0347] Steps (1) and (2) of the above process are to obtain the rate weight lambda and the distortion weight shift of the prediction mode rate distortion cost according to the code control module in the encoder;
[0348] According to the calculated bit rate weight lambda, distortion weight shift, first coding distortion and second coding distortion, the rate distortion cost ibhCost of the IBH mode and the rate distortion cost bestCost of the best selection mode in other prediction modes can be calculated;
[0349] After ibhCost and bestCost are calculated, the sizes of ibhCost and bestCost can be compared. If ibhCost is smaller, the current CU selects the IBH mode for encoding, otherwise, selects other prediction modes for encoding.
[0350] S1905: If it is determined that the coding mode of the current coding unit is the IBH mode, perform the step of encoding the current coding unit based on the IBH index and the residual corresponding to the prediction unit;
[0351] S1906: If it is determined that the coding mode of the current coding unit is the non-IBH mode, encode the current coding unit using the non-IBH mode.
[0352] The electronic device can determine the prediction mode for encoding the current coding unit after calculating the rate distortion cost of encoding the current coding unit using different prediction modes. If the current coding mode is determined to be the IBH mode, the current coding unit is encoded based on the IBH index and residual corresponding to the prediction unit.
[0353] If it is determined that the encoding mode of the current encoding unit is a non-IBH mode, the non-IBH mode is adopted to encode the current encoding unit.
[0354] It can be seen that in this embodiment, the electronic device can calculate the rate-distortion cost based on the first coding distortion obtained by encoding the current coding unit using the IBH mode and the second coding distortion obtained by encoding the current coding unit using the non-IBH mode, and then determine the prediction mode used to encode the current coding unit. In this way, when the prediction mode is determined, the entry container corresponding to the prediction unit in the current coding unit can be determined, and then the correspondence between the IBH entry and the IBH index can be determined.
[0355] As an implementation manner of the embodiment of the present application, after the step of encoding the current coding unit, the method may further include:
[0356] The entry container is updated according to the encoding mode corresponding to the current coding unit and the reconstructed value corresponding to the prediction unit.
[0357] The specific manner in which the encoding end updates the entry container is similar to the specific manner in which the decoding end updates the entry container. Please refer to the description of the corresponding part of the decoding end, and will not be repeated here.
[0358] It can be seen that in this embodiment, the electronic device can update the entry container according to the coding mode corresponding to the current coding unit and the reconstruction value corresponding to the prediction unit, so that the entry container stores the correspondence between the most commonly used IBH entries and IBH indexes.
[0359] As an implementation manner of an embodiment of the present application, the step of updating the entry container according to the encoding mode corresponding to the current coding unit and the reconstruction value corresponding to the prediction unit may include:
[0360] If the encoding mode is the IBH mode, determining whether the residual corresponding to the currently traversed prediction unit is 0;
[0361] If the residual is 0, the entry corresponding to the IBH index before the IBH index corresponding to the prediction unit is moved backward by one entry position, and the IBH entry corresponding to the prediction unit is placed at the first entry position of the entry container; or,
[0362] If the residual is not 0, the last IBH entry of the IBH entries belonging to the first preset range in the entry container is discarded, the other IBH entries are shifted back by one entry position, and the IBH entry corresponding to the prediction unit is placed at the first entry position of the entry container.
[0363] When the encoding mode is the IBH mode, the specific way of updating the entry container at the encoding end is similar to the specific way of updating the entry container at the decoding end when the encoding mode is the IBH mode. Please refer to the description of the corresponding part of the decoding end, which will not be repeated here.
[0364] It can be seen that in this embodiment, the electronic device can determine whether the residual corresponding to the currently traversed prediction unit is 0, and then use different update methods to update the entry container so that the entry container stores the correspondence between the most commonly used IBH entries and IBH indexes.
[0365] As an implementation manner of an embodiment of the present application, the step of updating the entry container according to the encoding mode corresponding to the current coding unit and the reconstruction value corresponding to the prediction unit may include:
[0366] If the encoding mode is the non-IBH mode, the last IBH entry of the first preset number of IBH entries in the entry container is discarded, the other IBH entries are shifted back by one entry position, and the IBH entry corresponding to the prediction unit is placed at the first entry position of the entry container.
[0367] When the encoding mode is non-IBH mode, the specific way of updating the entry container at the encoding end is similar to the specific way of updating the entry container at the decoding end when the encoding mode is non-IBH mode. Please refer to the description of the corresponding part of the decoding end, which will not be repeated here.
[0368] It can be seen that in this embodiment, the electronic device can update the entry container in an add-discard update manner when the encoding mode is a non-IBH mode, so that the entry container stores the correspondence between the most commonly used IBH entries and IBH indexes.
[0369] Corresponding to the above-mentioned video decoding method, an embodiment of the present application further provides a video decoding device. The following introduces a video decoding device provided by an embodiment of the present application.
[0370] like Fig. 20 As shown, a video decoding device, the device comprising:
[0371] The decoding result acquisition module 2010 is used to acquire a code stream to be decoded, decode the code stream to be decoded, and obtain a decoding result corresponding to a current decoding unit, wherein the decoding result at least includes an IBH index corresponding to each prediction unit to be decoded included in the current decoding unit;
[0372] An IBH entry determination module 2020 is configured to determine, for each prediction unit to be decoded, an IBH entry corresponding to the prediction unit from a pre-constructed entry container corresponding to the prediction unit based on the IBH index corresponding to the prediction unit, wherein the entry container is used to store the correspondence between the IBH entry and the IBH index of the prediction unit included in the current decoding unit;
[0373] The reconstruction value determination module 2030 is configured to determine the reconstruction value corresponding to each prediction unit to be decoded in the current decoding unit based on the IBH entry corresponding to each prediction unit to be decoded in the current decoding unit.
[0374] It can be seen that in the solution provided in the embodiment of the present application, the electronic device can obtain a code stream to be decoded, decode the code stream to be decoded, and obtain a decoding result corresponding to the current decoding unit, wherein the decoding result at least includes a historical block index mode IBH index corresponding to each prediction unit to be decoded included in the current decoding unit, and for each prediction unit to be decoded, based on the IBH index corresponding to the prediction unit, the IBH entry corresponding to the prediction unit is determined from a pre-constructed entry container corresponding to the prediction unit, wherein the entry container is used to store the correspondence between the IBH entry and the IBH index of the prediction unit included in the current decoding unit, and based on the IBH entry corresponding to each prediction unit to be decoded in the current decoding unit, the reconstruction value corresponding to each prediction unit to be decoded in the current decoding unit is determined. Since the pre-constructed entry container can store the correspondence between the IBH entry and the IBH index of the prediction unit, when the IBH index corresponding to the prediction unit is determined, the current decoding unit can be decoded based on the IBH index corresponding to the prediction unit. In this way, when the encoder transmits the video stream including the index to the decoder, the index in units of the prediction unit can be transmitted without transmitting the index in units of each pixel. Therefore, the cost of transmitting the code stream to be decoded can be reduced and the transmission efficiency can be improved.
[0375] As an implementation of the embodiment of the present application, the above device may further include:
[0376] A coding mode acquisition module, used for acquiring the coding mode of the current decoding unit before the step of decoding the bitstream to be decoded to obtain a decoding result corresponding to the current decoding unit;
[0377] A first construction module, configured to construct an entry container corresponding to the prediction unit if the encoding mode is the IBH mode;
[0378] The reconstruction value acquisition module is used for, if the encoding mode is a non-IBH mode, decoding the prediction unit in the non-IBH mode to obtain a reconstruction value.
[0379] As an implementation of an embodiment of the present application, the first building block may include:
[0380] The prediction unit acquisition submodule is used to divide the current decoding unit according to a preset division method to obtain the prediction unit to be decoded;
[0381] An entry container construction submodule is used to construct an entry container corresponding to the prediction unit based on the color mode corresponding to the current decoding unit, wherein the entry container includes a preset number of IBH entries, each IBH entry corresponds to an IBH index, and each IBH entry is taken from historical pixel block information or reconstructed pixel information.
[0382] As an implementation manner of the embodiment of the present application, when the first row of the current decoding unit is the first row of the slice to which it belongs, the IBH entry corresponding to the prediction unit is taken from the historical pixel block information, wherein the historical pixel block information is the reconstructed pixel information of the decoding unit before the current decoding unit;
[0383] When the first row of the current decoding unit is not the first row of the slice to which it belongs, a first preset number of IBH entries are taken from historical IBH entry information, and a second preset number of IBH entries are taken from reconstructed pixel information, wherein the historical IBH entry information is the IBH entries in the entry container updated based on the reconstructed pixel information of the previous decoding unit.
[0384] As an implementation of an embodiment of the present application, the above-mentioned entry container construction submodule may include:
[0385] A first determining unit is configured to, when the first row of the current decoding unit is the first row of the slice to which it belongs, use the reconstructed pixel information of the decoding unit before the current decoding unit as the IBH entry in the entry container;
[0386] The second determining unit is configured to determine, when the first row of the current decoding unit is a non-first row of the slice to which it belongs, a first preset number of IBH entries in the entry container updated based on the reconstructed pixel information of the previous decoding unit as the IBH entries in the current entry container.
[0387] The third determining unit is used to determine other IBH entries in the current entry container based on the number of pixels included in the prediction unit, the color mode corresponding to the current decoding unit, and the reconstructed pixel information corresponding to the pixel row before the current decoding unit.
[0388] As an implementation manner of the embodiment of the present application, the color mode corresponding to the current decoding unit is the first color mode, and the IBH entry includes 2 luminance components, 1 first chrominance component or 1 second chrominance component;
[0389] When the first row of the current decoding unit is a non-first row of the slice to which it belongs, the brightness components included in other IBH entries in the current entry container are reconstructed brightness components of pixels at preset positions of a previous pixel row of the current decoding unit;
[0390] The first chrominance component included in the other IBH entries in the current entry container is a reconstructed first chrominance component of a pixel point at a preset position of a pixel row on the current decoding unit; or,
[0391] The second chrominance components included in other IBH entries in the current entry container are reconstructed second chrominance components of pixel points at preset positions of two pixel rows on the current decoding unit.
[0392] As an implementation manner of the embodiment of the present application, the color mode corresponding to the current decoding unit is the second color mode, and the IBH entry includes 2 luminance components, 1 first chrominance component and 1 second chrominance component;
[0393] When the first row of the current decoding unit is a non-first row of the slice to which it belongs, the brightness components included in other IBH entries in the current entry container are reconstructed brightness components of pixels at preset positions of a previous pixel row of the current decoding unit;
[0394] The first chrominance component included in the other IBH entries in the current entry container is a reconstructed first chrominance component of a pixel point at a preset position of a previous pixel row of the current decoding unit;
[0395] The second chrominance component included in the other IBH entries in the current entry container is the reconstructed second chrominance component of the pixel point at the preset position of the previous pixel row of the current decoding unit.
[0396] As an implementation manner of the embodiment of the present application, the color mode corresponding to the current decoding unit is the third color mode, and the IBH entry includes 2 luminance components, 2 first chrominance components and 2 second chrominance components;
[0397] When the first row of the current decoding unit is a non-first row of the slice to which it belongs, the brightness components included in other IBH entries in the current entry container are reconstructed brightness components of pixels at preset positions of a previous pixel row of the current decoding unit;
[0398] The first chrominance component included in the other IBH entries in the current entry container is a reconstructed first chrominance component of a pixel point at a preset position of a previous pixel row of the current decoding unit;
[0399] The second chrominance components included in other IBH entries in the current entry container are reconstructed second chrominance components of pixel points at preset positions of a pixel row on the current decoding unit.
[0400] As an implementation of the embodiment of the present application, the color mode corresponding to the current decoding unit is the fourth color mode, the fourth color mode is the RGB 444 mode, and the IBH entry includes 2 R components, 2 G components and 2 B components;
[0401] When the first row of the current decoding unit is not the first row of the slice to which it belongs, the R, G, and B components included in other IBH entries in the current entry container are respectively the reconstructed R, G, and B components of the pixel points at the preset position of the previous pixel row of the current decoding unit.
[0402] As an implementation of the embodiment of the present application, the above device may further include:
[0403] A residual acquisition module, used to acquire the residual corresponding to each prediction unit to be decoded;
[0404] The reconstruction value determination module 2030 may include:
[0405] A prediction value acquisition submodule, configured to obtain a prediction value corresponding to the prediction unit based on the IBH entries corresponding to each prediction unit to be decoded in the current decoding unit;
[0406] The reconstruction value acquisition submodule is used to calculate the reconstruction value corresponding to the prediction unit based on the prediction value and the residual corresponding to the prediction unit.
[0407] As an implementation of the embodiment of the present application, the above device may further include:
[0408] The first updating module is used to update the entry container according to the encoding mode corresponding to the current decoding unit and the reconstructed value corresponding to the prediction unit after the step of calculating the reconstructed value corresponding to each prediction unit based on the prediction value and the residual corresponding to the prediction unit.
[0409] As an implementation of the embodiment of the present application, the first update module may include:
[0410] A first judgment submodule, configured to judge whether the residual corresponding to the currently traversed prediction unit is 0 if the encoding mode is the IBH mode;
[0411] A first updating submodule is configured to, if the residual is 0, move the IBH entry corresponding to the IBH index before the IBH index corresponding to the prediction unit backward by one entry position, and place the IBH entry corresponding to the prediction unit at the first entry position of the entry container; or
[0412] If the residual is not 0, discard the last IBH entry of the first preset number of IBH entries in the entry container, shift the other IBH entries backward by one entry position, and place the IBH entry corresponding to the prediction unit at the first entry position of the entry container.
[0413] As an implementation of the embodiment of the present application, the first update module may include:
[0414] The second updating submodule is used for discarding the last IBH entry of the first preset number of IBH entries in the entry container if the encoding mode is the non-IBH mode, shifting the other IBH entries backward by one entry position, and placing the IBH entry corresponding to the prediction unit at the first entry position of the entry container.
[0415] Corresponding to the above-mentioned video encoding method, an embodiment of the present application further provides a video encoding device. The video encoding device provided by the embodiment of the present application is introduced below.
[0416] like Fig.21 As shown, a video encoding device, the device comprising:
[0417] An IBH index determination module 2110 is configured to determine, for each prediction unit to be encoded, an IBH index corresponding to the prediction unit from a pre-constructed entry container corresponding to the prediction unit, wherein the entry container is used to store the correspondence between the IBH entry and the IBH index of the prediction unit included in the current coding unit;
[0418] The coding unit encoding module 2120 is configured to encode the current coding unit based on the IBH index corresponding to each prediction unit to be encoded in the current coding unit.
[0419] It can be seen that in the solution provided by the embodiment of the present application, the electronic device can determine the IBH index corresponding to the prediction unit from the pre-constructed entry container corresponding to the prediction unit for each prediction unit to be encoded, wherein the entry container is used to store the correspondence between the IBH entry and the IBH index of the prediction unit included in the current coding unit, and encode the current coding unit based on the IBH index corresponding to each prediction unit to be encoded in the current coding unit. Since the IBH index corresponding to the prediction unit can be determined according to the pre-constructed entry container, and then the current coding unit is encoded based on the IBH index corresponding to the prediction unit, in this way, when transmitting the code stream to be decoded including the index to the decoding end, the index in the prediction unit can be transmitted, and there is no need to transmit the index in each pixel. Therefore, the cost of transmitting the code stream to be decoded can be reduced and the transmission efficiency can be improved.
[0420] As an implementation of the embodiment of the present application, the above device may further include:
[0421] A prediction unit acquisition module, in which the user divides the current coding unit according to a preset division method to obtain a prediction unit to be encoded before the step of determining the IBH index corresponding to the prediction unit from the pre-built entry container corresponding to the prediction unit;
[0422] The second construction module is used to construct an entry container corresponding to the prediction unit based on the color mode corresponding to the current coding unit, wherein the entry container includes a preset number of IBH entries, each IBH entry corresponds to an IBH index, and each IBH entry is taken from historical pixel block information or reconstructed pixel information.
[0423] As an implementation manner of an embodiment of the present application, when the first line of the current coding unit is the first line of the slice to which it belongs, the IBH entry corresponding to the prediction unit is taken from historical pixel block information, wherein the historical pixel block information is reconstructed pixel information of the coding unit before the current coding unit;
[0424] When the first row of the current coding unit is not the first row of the slice to which it belongs, a first preset number of IBH entries are taken from historical IBH entry information, and a second preset number of IBH entries are taken from reconstructed pixel information, wherein the historical IBH entry information is the IBH entries in the entry container updated based on the reconstructed pixel information of the previous coding unit.
[0425] As an implementation of an embodiment of the present application, the second building block may include:
[0426] A first determining submodule is used for, when the first line of the current coding unit is the first line of the slice to which it belongs, to use the reconstructed pixel information of each prediction unit included in the previous coding unit as an IBH entry in the entry container;
[0427] A second determining submodule is used to determine, when the first row of the current coding unit is a non-first row of the slice to which it belongs, a first preset number of IBH entries in the entry container updated based on the reconstructed pixel information of the previous coding unit as the IBH entries in the current entry container;
[0428] The third determination submodule is used to determine other IBH entries in the current entry container based on the number of pixels included in the prediction unit, the color mode corresponding to the current coding unit, and the reconstructed pixel information corresponding to the pixel row before the current coding unit.
[0429] As an implementation manner of an embodiment of the present application, the color mode corresponding to the current coding unit is the first color mode, and the IBH entry includes 2 luminance components, 1 first chrominance component or 1 second chrominance component;
[0430] When the first row of the current decoding unit is not the first row of the slice to which it belongs, the luminance component included in other IBH entries in the current entry container is the reconstructed luminance component of the pixel point at the preset position of the previous pixel row of the current decoding unit; the first chrominance component included in other IBH entries in the current entry container is the reconstructed first chrominance component of the pixel point at the preset position of the previous pixel row of the current coding unit; or, the second chrominance component included in other IBH entries in the current entry container is the reconstructed second chrominance component of the pixel point at the preset position of two pixel rows on the current coding unit; or,
[0431] The color mode corresponding to the current coding unit is the second color mode, and the IBH entry includes 2 luminance components, 1 first chrominance component and 1 second chrominance component;
[0432] When the first row of the current coding unit is a non-first row of the slice to which it belongs, the luminance component included in other IBH entries in the current entry container is the reconstructed luminance component of the pixel point at the preset position of the previous pixel row of the current coding unit; the first chrominance component included in other IBH entries in the current entry container is the reconstructed first chrominance component of the pixel point at the preset position of the previous pixel row of the current coding unit; the second chrominance component included in other IBH entries in the current entry container is the reconstructed second chrominance component of the pixel point at the preset position of the previous pixel row of the current coding unit; or,
[0433] The color mode corresponding to the current coding unit is the third color mode, and the IBH entry includes 2 luminance components, 2 first chrominance components, and 2 second chrominance components;
[0434] When the first row of the current coding unit is a non-first row of the slice to which it belongs, the luminance component included in other IBH entries in the current entry container is the reconstructed luminance component of the pixel point at the preset position of the previous pixel row of the current coding unit; the first chrominance component included in other IBH entries in the current entry container is the reconstructed first chrominance component of the pixel point at the preset position of the previous pixel row of the current coding unit; the second chrominance component included in other IBH entries in the current entry container is the reconstructed second chrominance component of the pixel point at the preset position of the previous pixel row of the current coding unit; or,
[0435] The color mode corresponding to the current coding unit is the fourth color mode, the fourth color mode is the RGB444 mode, and the IBH entry includes 2 R components, 2 G components and 2 B components; when the first row of the current coding unit is a non-first row of the slice to which it belongs, the R, G, and B components included in other IBH entries in the current entry container are respectively the reconstructed R, G, and B components of the pixel points at the preset position of the previous pixel row of the current coding unit.
[0436] As an implementation of the embodiment of the present application, the above-mentioned IBH index determination module 2110 may include:
[0437] An IBH entry traversal submodule, used for traversing, for each prediction unit to be encoded, the IBH entries included in the pre-built entry container corresponding to the prediction unit;
[0438] An error calculation submodule, configured to calculate an error between the prediction unit and each IBH entry based on an original value of a pixel point included in the prediction unit and a component value corresponding to each IBH entry;
[0439] The index determination submodule is configured to determine, based on the error, an IBH index corresponding to the prediction unit from the IBH indexes corresponding to the IBH entries included in the entry container.
[0440] As an implementation of the embodiment of the present application, the encoding unit encoding module 2120 may include:
[0441] A first acquisition submodule, configured to obtain a prediction value corresponding to each prediction unit to be encoded in the current coding unit based on an IBH index corresponding to each prediction unit to be encoded;
[0442] A residual calculation submodule, used for calculating, for each prediction unit, a difference between a predicted value corresponding to the prediction unit and an original value corresponding to the prediction unit as a residual corresponding to the prediction unit;
[0443] The coding unit coding submodule is used to encode the current coding unit based on the IBH index and the residual corresponding to the prediction unit, and transmit the encoding result to the decoding device.
[0444] As an implementation of the embodiment of the present application, the above device may further include:
[0445] a reconstruction value calculation module, configured to calculate, for the current coding unit, a reconstruction value corresponding to each prediction unit based on the prediction values and residuals corresponding to each prediction unit to be encoded in the current coding unit, before the step of encoding the current coding unit based on the IBH index and the residual corresponding to the prediction unit;
[0446] A first coding distortion calculation module, configured to calculate a first coding distortion of the current coding unit based on the reconstructed value and the original value corresponding to the prediction unit;
[0447] A second coding distortion calculation module, configured to calculate a second coding distortion of the current coding unit based on a reconstructed value obtained by encoding the prediction unit in a non-IBH mode;
[0448] a mode determination module, configured to determine, according to the first coding distortion and the second coding distortion, whether the coding mode of the current coding unit is the IBH mode or the non-IBH mode;
[0449] A first encoding module, configured to, if it is determined that the encoding mode of the current coding unit is the IBH mode, perform the step of encoding the current coding unit based on the IBH index and the residual corresponding to the prediction unit;
[0450] The second encoding module, if determining that the encoding mode of the current encoding unit is the non-IBH mode, adopts the non-IBH mode to encode the current encoding unit.
[0451] As an implementation of the embodiment of the present application, the above device may further include:
[0452] The second updating module is used to update the entry container according to the encoding mode corresponding to the current coding unit and the reconstruction value corresponding to the prediction unit after the step of encoding the current coding unit.
[0453] The present application also provides a decoding device, such as Fig. 22 As shown, including:
[0454] Memory 2201, used for storing computer programs;
[0455] The processor 2202 is used to implement the video decoding method steps described in any of the above embodiments when executing the program stored in the memory 2201.
[0456] It can be seen that in the solution provided in the embodiment of the present application, the electronic device can obtain a code stream to be decoded, decode the code stream to be decoded, and obtain a decoding result corresponding to the current decoding unit, wherein the decoding result at least includes a historical block index mode IBH index corresponding to each prediction unit to be decoded included in the current decoding unit, and for each prediction unit to be decoded, based on the IBH index corresponding to the prediction unit, the IBH entry corresponding to the prediction unit is determined from a pre-constructed entry container corresponding to the prediction unit, wherein the entry container is used to store the correspondence between the IBH entry and the IBH index of the prediction unit included in the current decoding unit, and based on the IBH entry corresponding to each prediction unit to be decoded in the current decoding unit, the reconstruction value corresponding to each prediction unit to be decoded in the current decoding unit is determined. Since the pre-constructed entry container can store the correspondence between the IBH entry and the IBH index of the prediction unit, when the IBH index corresponding to the prediction unit is determined, the current decoding unit can be decoded based on the IBH index corresponding to the prediction unit. In this way, when the encoder transmits the video stream including the index to the decoder, the index in units of the prediction unit can be transmitted without transmitting the index in units of each pixel. Therefore, the cost of transmitting the code stream to be decoded can be reduced and the transmission efficiency can be improved.
[0457] The present application also provides an encoding device, such as Fig.23 As shown, including:
[0458] Memory 2301, used for storing computer programs;
[0459] The processor 2302 is used to implement the steps of the video encoding method described in any of the above embodiments when executing the program stored in the memory 2301.
[0460] It can be seen that in the solution provided by the embodiment of the present application, the electronic device can determine the IBH index corresponding to the prediction unit from the pre-constructed entry container corresponding to the prediction unit for each prediction unit to be encoded, wherein the entry container is used to store the correspondence between the IBH entry and the IBH index of the prediction unit included in the current coding unit, and encode the current coding unit based on the IBH index corresponding to each prediction unit to be encoded in the current coding unit. Since the IBH index corresponding to the prediction unit can be determined according to the pre-constructed entry container, and then the current coding unit is encoded based on the IBH index corresponding to the prediction unit, in this way, when transmitting the code stream to be decoded including the index to the decoding end, the index in the prediction unit can be transmitted, and there is no need to transmit the index in each pixel. Therefore, the cost of transmitting the code stream to be decoded can be reduced, and the transmission efficiency can be improved.
[0461] Furthermore, the electronic device may further include a communication bus and / or a communication interface, and the processor, the communication interface, and the memory communicate with each other via the communication bus.
[0462] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0463] The communication interface is used for communication between the above electronic device and other devices.
[0464] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0465] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0466] In another embodiment provided in the present application, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned video decoding or video encoding methods are implemented.
[0467] In another embodiment provided in the present application, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute any one of the video decoding or video encoding methods in the above embodiments.
[0468] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a solid-state hard disk Solid State Disk (SSD), etc.
[0469] It should be noted that, in this article, relational terms such as first and second, etc. 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 sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0470] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device, system, image processing device, computer-readable storage medium, and computer program product embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.
[0471] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.
Claims
1. A video decoding method, characterized in that: The method comprises: Acquire a code stream to be decoded, decode the code stream to be decoded, and obtain a decoding result corresponding to a current decoding unit, wherein the decoding result at least includes a historical block index mode IBH index corresponding to each prediction unit to be decoded included in the current decoding unit; For each prediction unit to be decoded, based on the IBH index corresponding to the prediction unit, determine the IBH entry corresponding to the prediction unit from a pre-constructed entry container corresponding to the prediction unit, wherein the entry container is used to store the correspondence between the IBH entry and the IBH index of the prediction unit included in the current decoding unit; Determining, based on the IBH entries corresponding to the prediction units to be decoded in the current decoding unit, a reconstructed value corresponding to each prediction unit to be decoded in the current decoding unit; Wherein, before the step of decoding the to-be-decoded bitstream to obtain a decoding result corresponding to the current decoding unit, the method further includes: Get the encoding mode of the current decoding unit; If the coding mode is the IBH mode, construct an entry container corresponding to the prediction unit; If the encoding mode is a non-IBH mode, decoding the prediction unit using the non-IBH mode to obtain a reconstructed value; The step of constructing an entry container corresponding to the prediction unit includes: Divide the current decoding unit according to a preset division method to obtain a prediction unit to be decoded; Based on the color mode corresponding to the current decoding unit, construct an entry container corresponding to the prediction unit, wherein the entry container includes a preset number of IBH entries, each IBH entry corresponds to an IBH index, and each IBH entry is taken from historical pixel block information or reconstructed pixel information; When the first row of the current decoding unit is the first row of the slice to which it belongs, the IBH entry corresponding to the prediction unit is taken from the historical pixel block information, wherein the historical pixel block information is the reconstructed pixel information of the decoding unit before the current decoding unit; When the first row of the current decoding unit is a non-first row of the slice to which it belongs, a first preset number of IBH entries are taken from historical IBH entry information, and a second preset number of IBH entries are taken from reconstructed pixel information, wherein the historical IBH entry information is the IBH entries in the entry container updated based on the reconstructed pixel information of the previous decoding unit; The step of constructing an entry container corresponding to the prediction unit based on the color mode corresponding to the current decoding unit includes: When the first row of the current decoding unit is the first row of the slice to which it belongs, reconstructed pixel information of the decoding units before the current decoding unit is used as the IBH entry in the entry container; When the first row of the current decoding unit is a non-first row of the slice to which it belongs, a first preset number of IBH entries in the entry container updated based on the reconstructed pixel information of the previous decoding unit are determined as the IBH entries in the current entry container; Based on the number of pixels included in the prediction unit, the color mode corresponding to the current decoding unit, and the reconstructed pixel information corresponding to the pixel row before the current decoding unit, other IBH entries in the current entry container are determined.
2. The method according to claim 1, characterized in that: The color mode corresponding to the current decoding unit is the first color mode, and the IBH entry includes 2 luminance components, 1 first chrominance component or 1 second chrominance component; When the first row of the current decoding unit is a non-first row of the slice to which it belongs, the brightness components included in other IBH entries in the current entry container are reconstructed brightness components of pixels at preset positions of a previous pixel row of the current decoding unit; The first chrominance component included in the other IBH entries in the current entry container is a reconstructed first chrominance component of a pixel point at a preset position of a pixel row on the current decoding unit; or, The second chrominance components included in other IBH entries in the current entry container are reconstructed second chrominance components of pixel points at preset positions of two pixel rows on the current decoding unit.
3. The method according to claim 1, characterized in that The color mode corresponding to the current decoding unit is the second color mode, and the IBH entry includes 2 luminance components, 1 first chrominance component and 1 second chrominance component; When the first row of the current decoding unit is a non-first row of the slice to which it belongs, the brightness components included in other IBH entries in the current entry container are reconstructed brightness components of pixels at preset positions of a previous pixel row of the current decoding unit; The first chrominance component included in the other IBH entries in the current entry container is a reconstructed first chrominance component of a pixel point at a preset position of a previous pixel row of the current decoding unit; The second chrominance components included in other IBH entries in the current entry container are reconstructed second chrominance components of pixels at preset positions of a pixel row on the current decoding unit.
4. The method according to claim 1, characterized in that: The color mode corresponding to the current decoding unit is the third color mode, and the IBH entry includes 2 luminance components, 2 first chrominance components, and 2 second chrominance components; When the first row of the current decoding unit is a non-first row of the slice to which it belongs, the brightness components included in other IBH entries in the current entry container are reconstructed brightness components of pixels at preset positions of a previous pixel row of the current decoding unit; The first chrominance component included in the other IBH entries in the current entry container is a reconstructed first chrominance component of a pixel point at a preset position of a previous pixel row of the current decoding unit; The second chrominance components included in other IBH entries in the current entry container are reconstructed second chrominance components of pixels at preset positions of a pixel row on the current decoding unit.
5. The method according to claim 1, characterized in that The color mode corresponding to the current decoding unit is the fourth color mode, the fourth color mode is the RGB 444 mode, and the IBH entry includes 2 R components, 2 G components, and 2 B components; When the first row of the current decoding unit is not the first row of the slice to which it belongs, the R, G, and B components included in other IBH entries in the current entry container are respectively the reconstructed R, G, and B components of the pixel points at the preset position of the previous pixel row of the current decoding unit.
6. The method according to any one of claims 1 to 5, characterized in that: The method further comprises: Obtaining a residual corresponding to each prediction unit to be decoded; The step of determining the reconstruction value corresponding to each prediction unit to be decoded in the current decoding unit based on the IBH entry corresponding to each prediction unit to be decoded in the current decoding unit comprises: Obtaining a prediction value corresponding to each prediction unit to be decoded in the current decoding unit based on the IBH entries corresponding to the prediction units to be decoded; Based on the prediction value and the residual corresponding to the prediction unit, a reconstruction value corresponding to the prediction unit is calculated.
7. The method according to claim 6, characterized in that After the step of calculating the reconstruction value corresponding to each prediction unit based on the prediction value and the residual corresponding to the prediction unit, the method further includes: The entry container is updated according to the encoding mode corresponding to the current decoding unit and the reconstructed value corresponding to the prediction unit.
8. The method according to claim 7, characterized in that The step of updating the entry container according to the encoding mode corresponding to the current decoding unit and the reconstruction value corresponding to the prediction unit includes: If the encoding mode is the IBH mode, determining whether the residual corresponding to the currently traversed prediction unit is 0; If the residual is 0, the IBH entry corresponding to the IBH index before the IBH index corresponding to the prediction unit is moved backward by one entry position, and the IBH entry corresponding to the prediction unit is placed at the first entry position of the entry container; or, If the residual is not 0, the last IBH entry of the first preset number of IBH entries in the entry container is discarded, the other IBH entries are shifted back by one entry position, and the IBH entry corresponding to the prediction unit is placed at the first entry position of the entry container.
9. The method according to claim 7, characterized in that: The step of updating the entry container according to the encoding mode corresponding to the current decoding unit and the reconstruction value corresponding to the prediction unit includes: If the encoding mode is the non-IBH mode, the last IBH entry of the first preset number of IBH entries in the entry container is discarded, the other IBH entries are shifted back by one entry position, and the IBH entry corresponding to the prediction unit is placed at the first entry position of the entry container.
10. A video encoding method, characterized in that: The method comprises: For each prediction unit to be encoded, determine an IBH index corresponding to the prediction unit from a pre-constructed entry container corresponding to the prediction unit, wherein the entry container is used to store the correspondence between the IBH entry and the IBH index of the prediction unit included in the current coding unit; Encoding the current coding unit based on the IBH index corresponding to each prediction unit to be encoded in the current coding unit; Before the step of determining the IBH index corresponding to the prediction unit from the pre-constructed entry container corresponding to the prediction unit, the method further includes: Divide the current coding unit according to a preset division method to obtain a prediction unit to be encoded; Based on the color mode corresponding to the current coding unit, construct an entry container corresponding to the prediction unit, wherein the entry container includes a preset number of IBH entries, each IBH entry corresponds to an IBH index, and each IBH entry is taken from historical pixel block information or reconstructed pixel information; When the first line of the current coding unit is the first line of the slice to which it belongs, the IBH entry corresponding to the prediction unit is taken from the historical pixel block information, wherein the historical pixel block information is the reconstructed pixel information of the coding unit before the current coding unit; When the first row of the current coding unit is a non-first row of the slice to which it belongs, a first preset number of IBH entries are taken from historical IBH entry information, and a second preset number of IBH entries are taken from reconstructed pixel information, wherein the historical IBH entry information is the IBH entries in the entry container updated based on the reconstructed pixel information of the previous coding unit; The step of constructing an entry container corresponding to the prediction unit based on the color mode corresponding to the current coding unit includes: When the first row of the current coding unit is the first row of the slice to which it belongs, reconstructed pixel information of each prediction unit included in the previous coding unit is used as an IBH entry in the entry container; When the first row of the current coding unit is a non-first row of the slice to which it belongs, a first preset number of IBH entries in the entry container updated based on the reconstructed pixel information of the previous coding unit are determined as the IBH entries in the current entry container; Based on the number of pixels included in the prediction unit, the color mode corresponding to the current coding unit, and the reconstructed pixel information corresponding to the pixel row before the current coding unit, other IBH entries in the current entry container are determined.
11. The method according to claim 10, characterized in that The color mode corresponding to the current coding unit is the first color mode, and the IBH entry includes 2 luminance components, 1 first chrominance component or 1 second chrominance component; When the first row of the current coding unit is not the first row of the slice to which it belongs, the luminance component included in other IBH entries in the current entry container is the reconstructed luminance component of the pixel point at the preset position of the previous pixel row of the current coding unit; the first chrominance component included in other IBH entries in the current entry container is the reconstructed first chrominance component of the pixel point at the preset position of the previous pixel row of the current coding unit; or, the second chrominance component included in other IBH entries in the current entry container is the reconstructed second chrominance component of the pixel point at the preset position of two pixel rows of the current coding unit; or, The color mode corresponding to the current coding unit is the second color mode, and the IBH entry includes 2 luminance components, 1 first chrominance component and 1 second chrominance component; When the first row of the current coding unit is a non-first row of the slice to which it belongs, the luminance component included in other IBH entries in the current entry container is the reconstructed luminance component of the pixel point at the preset position of the previous pixel row of the current coding unit; the first chrominance component included in other IBH entries in the current entry container is the reconstructed first chrominance component of the pixel point at the preset position of the previous pixel row of the current coding unit; the second chrominance component included in other IBH entries in the current entry container is the reconstructed second chrominance component of the pixel point at the preset position of the previous pixel row of the current coding unit; or, The color mode corresponding to the current coding unit is the third color mode, and the IBH entry includes 2 luminance components, 2 first chrominance components, and 2 second chrominance components; When the first row of the current coding unit is a non-first row of the slice to which it belongs, the luminance component included in other IBH entries in the current entry container is the reconstructed luminance component of the pixel point at the preset position of the previous pixel row of the current coding unit; the first chrominance component included in other IBH entries in the current entry container is the reconstructed first chrominance component of the pixel point at the preset position of the previous pixel row of the current coding unit; the second chrominance component included in other IBH entries in the current entry container is the reconstructed second chrominance component of the pixel point at the preset position of the previous pixel row of the current coding unit; or, The color mode corresponding to the current coding unit is the fourth color mode, the fourth color mode is the RGB 444 mode, and the IBH entry includes 2 R components, 2 G components and 2 B components; when the first row of the current coding unit is a non-first row of the slice to which it belongs, the R, G, and B components included in other IBH entries in the current entry container are respectively the reconstructed R, G, and B components of the pixel points at the preset position of the previous pixel row of the current coding unit.
12. The method according to claim 10, characterized in that The step of determining, for each prediction unit to be encoded, from a pre-constructed entry container corresponding to the prediction unit, an IBH index corresponding to the prediction unit comprises: For each prediction unit to be encoded, traverse the IBH entries included in the pre-constructed entry container corresponding to the prediction unit; Calculating an error between the prediction unit and each IBH entry based on an original value of a pixel point included in the prediction unit and a component value corresponding to each IBH entry; Based on the error, an IBH index corresponding to the prediction unit is determined from the IBH indexes corresponding to the IBH entries included in the entry container.
13. The method according to any one of claims 10 to 12, characterized in that: The step of encoding the current coding unit based on the IBH index corresponding to each prediction unit to be encoded in the current coding unit includes: Obtaining a prediction value corresponding to each prediction unit to be encoded in the current coding unit based on the IBH index corresponding to each prediction unit to be encoded; For each prediction unit, calculate the difference between the predicted value corresponding to the prediction unit and the original value corresponding to the prediction unit as the residual corresponding to the prediction unit; Based on the IBH index and the residual corresponding to the prediction unit, the current coding unit is encoded, and the encoding result is transmitted to a decoding device.
14. The method according to claim 13, characterized in that Before the step of encoding the current coding unit based on the IBH index and the residual corresponding to the prediction unit, the method further includes: For the current coding unit, based on the prediction values and residuals corresponding to the prediction units to be encoded in the current coding unit, a reconstructed value corresponding to each prediction unit is calculated; Calculating a first coding distortion of the current coding unit based on the reconstructed value and the original value corresponding to the prediction unit; Calculating a second coding distortion of the current coding unit based on a reconstructed value obtained by encoding the prediction unit in a non-IBH mode; Determining, according to the first coding distortion and the second coding distortion, whether a coding mode of the current coding unit is an IBH mode or a non-IBH mode; If it is determined that the encoding mode of the current coding unit is the IBH mode, performing the step of encoding the current coding unit based on the IBH index and the residual corresponding to the prediction unit; If it is determined that the encoding mode of the current encoding unit is the non-IBH mode, the non-IBH mode is adopted to encode the current encoding unit.
15. The method according to claim 14, characterized in that After the step of encoding the current coding unit, the method further includes: The entry container is updated according to the encoding mode corresponding to the current coding unit and the reconstructed value corresponding to the prediction unit.
16. A video decoding device, characterized in that: The device comprises: A decoding result acquisition module, used to acquire a code stream to be decoded, decode the code stream to be decoded, and obtain a decoding result corresponding to a current decoding unit, wherein the decoding result at least includes an IBH index corresponding to each prediction unit to be decoded included in the current decoding unit; An IBH entry determination module is used to determine, for each prediction unit to be decoded, an IBH entry corresponding to the prediction unit from a pre-constructed entry container corresponding to the prediction unit based on the IBH index corresponding to the prediction unit, wherein the entry container is used to store the correspondence between the IBH entry and the IBH index of the prediction unit included in the current decoding unit; A reconstruction value determination module, configured to determine a reconstruction value corresponding to each prediction unit to be decoded in the current decoding unit based on the IBH entries corresponding to each prediction unit to be decoded in the current decoding unit; Wherein, the device further comprises: A coding mode acquisition module, used for acquiring the coding mode of the current decoding unit before the step of decoding the bitstream to be decoded to obtain a decoding result corresponding to the current decoding unit; A first construction module, configured to construct an entry container corresponding to the prediction unit if the encoding mode is the IBH mode; A reconstruction value acquisition module, configured to, if the encoding mode is a non-IBH mode, decode the prediction unit using the non-IBH mode to obtain a reconstruction value; The first building block comprises: A prediction unit acquisition submodule, configured to divide the current decoding unit according to a preset division method to obtain a prediction unit to be decoded if the encoding mode of the current decoding unit is the IBH mode; An entry container construction submodule, configured to construct an entry container corresponding to the prediction unit based on the color mode corresponding to the current decoding unit, wherein the entry container includes a preset number of IBH entries, each IBH entry corresponds to an IBH index, and each IBH entry is taken from historical pixel block information or reconstructed pixel information; When the first row of the current decoding unit is the first row of the slice to which it belongs, the IBH entry corresponding to the prediction unit is taken from the historical pixel block information, wherein the historical pixel block information is the reconstructed pixel information of the decoding unit before the current decoding unit; When the first row of the current decoding unit is a non-first row of the slice to which it belongs, a first preset number of IBH entries are taken from historical IBH entry information, and a second preset number of IBH entries are taken from reconstructed pixel information, wherein the historical IBH entry information is the IBH entries in the entry container updated based on the reconstructed pixel information of the previous decoding unit; The entry container construction submodule includes: A first determining unit is configured to, when the first row of the current decoding unit is the first row of the slice to which it belongs, use the reconstructed pixel information of the decoding unit before the current decoding unit as the IBH entry in the entry container; A second determining unit is configured to determine, when the first row of the current decoding unit is a non-first row of the slice to which it belongs, a first preset number of IBH entries in the entry container updated based on the reconstructed pixel information of the previous decoding unit as the IBH entries in the current entry container; The third determining unit is used to determine other IBH entries in the current entry container based on the number of pixels included in the prediction unit, the color mode corresponding to the current decoding unit, and the reconstructed pixel information corresponding to the pixel row before the current decoding unit.
17. A video encoding device, characterized in that: The device comprises: An IBH index determination module, configured to determine, for each prediction unit to be encoded, an IBH index corresponding to the prediction unit from a pre-constructed entry container corresponding to the prediction unit, wherein the entry container is used to store the correspondence between the IBH entry and the IBH index of the prediction unit included in the current coding unit; A coding unit encoding module, configured to encode the current coding unit based on the IBH index corresponding to each prediction unit to be encoded in the current coding unit; Wherein, the device further comprises: A prediction unit acquisition module, in which the user divides the current coding unit according to a preset division method to obtain a prediction unit to be encoded before the step of determining the IBH index corresponding to the prediction unit from the pre-built entry container corresponding to the prediction unit; A second construction module is used to construct an entry container corresponding to the prediction unit based on the color mode corresponding to the current coding unit, wherein the entry container includes a preset number of IBH entries, each IBH entry corresponds to an IBH index, and each IBH entry is taken from historical pixel block information or reconstructed pixel information; When the first line of the current coding unit is the first line of the slice to which it belongs, the IBH entry corresponding to the prediction unit is taken from the historical pixel block information, wherein the historical pixel block information is the reconstructed pixel information of the coding unit before the current coding unit; When the first row of the current coding unit is a non-first row of the slice to which it belongs, a first preset number of IBH entries are taken from historical IBH entry information, and a second preset number of IBH entries are taken from reconstructed pixel information, wherein the historical IBH entry information is the IBH entries in the entry container updated based on the reconstructed pixel information of the previous coding unit; The second building block comprises: A first determining submodule, configured to, when the first row of the current coding unit is the first row of the slice to which it belongs, use the reconstructed pixel information of each prediction unit included in the previous coding unit as an IBH entry in the entry container; A second determining submodule is used to determine, when the first row of the current coding unit is a non-first row of the slice to which it belongs, a first preset number of IBH entries in the entry container updated based on the reconstructed pixel information of the previous coding unit as the IBH entries in the current entry container; The third determination submodule is used to determine other IBH entries in the current entry container based on the number of pixels included in the prediction unit, the color mode corresponding to the current coding unit, and the reconstructed pixel information corresponding to the pixel row before the current coding unit.
18. A decoding device, characterized in that: include: Memory, used to store computer programs; A processor, for implementing any of the methods described in claims 1-9 when executing a program stored in a memory.
19. An encoding device, characterized in that: include: Memory, used to store computer programs; A processor, for implementing any of the methods described in claims 10-15 when executing a program stored in a memory.
20. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method described in any one of claims 1 to 9 or claims 10 to 15 is implemented.
