Encoding and decoding method and electronic equipment
By embedding the difference prediction mode in the intra prediction mode and using the preset mode indication information, the problem of insufficient consistency of the sub-block prediction modes in the coding unit is solved, and the accuracy and compression performance of the intra prediction are improved.
Patent Information
- Application Number
- CN202310280913.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-13
- Publication Date
- 2024-09-13
AI Technical Summary
In the existing technology, intra prediction mode consistency problems caused by differences in content characteristics of different sub-blocks in coding units lead to poor prediction effects of some sub-blocks, thereby affecting compression performance.
The difference prediction mode is nested in the intra prediction mode, and the prediction flexibility of the coding unit is improved through the preset mode indication information, and the appropriate prediction mode is selected according to the characteristics of the sub-block, including the difference prediction mode and the intra prediction mode. Improve forecast accuracy.
By improving the accuracy of intra-frame prediction, the prediction flexibility of the coding unit is enhanced, the compression performance is improved, the bit stream overhead is reduced, and the coding efficiency is improved.
Smart Images

Figure CN118646873A
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of coding and decoding, and in particular to a coding and decoding method and an electronic device. Background Art
[0002] The encoding process usually includes operations such as prediction, quantization, and entropy coding. Among them, prediction is often used to remove redundant information in images or videos to make them easier to compress; therefore, improving the accuracy of prediction is one of the ways to improve compression performance.
[0003] Since there may be sub-blocks with different content characteristics (such as different texture directions) in a coding unit, if the same intra prediction mode is used for all sub-blocks in the coding unit, the prediction effect of some sub-blocks may be poor. Summary of the invention
[0004] In order to solve the above technical problems, the present application provides a coding method and an electronic device. The method can improve the accuracy of intra-frame prediction and thus improve compression performance.
[0005] In a first aspect, an embodiment of the present application provides a decoding method, the method comprising: first, receiving a bit stream, entropy decoding a preset mode indication information of a current sub-block and a first encoding code length corresponding to a prediction residual of the current sub-block from the bit stream; then, based on the first encoding code length, entropy decoding a quantized prediction residual of the current sub-block from the bit stream; thereafter, for the current sub-block, judging whether to use a difference prediction mode to replace an intra-frame prediction mode corresponding to a coding unit CU to which the current sub-block belongs based on the preset mode indication information of the current sub-block; if so, performing a difference prediction on the current sub-block to obtain to the prediction value of the current sub-block; based on the preset constraint method for the first encoding code length, determine the first quantization parameter; based on the first quantization parameter, dequantize the quantized prediction residual to obtain the prediction residual of the current sub-block; if not, perform intra-frame prediction based on the intra-frame prediction mode corresponding to the CU to obtain the prediction value of the current sub-block; based on the second quantization parameter corresponding to the CU, dequantize the quantized prediction residual to obtain the prediction residual of the current sub-block; then, add the prediction residual of the current sub-block to the prediction value of the current sub-block to obtain a reconstructed block of the current sub-block.
[0006] That is, a difference prediction mode (also called DP prediction mode) is nested in any intra prediction mode (except the difference prediction mode), and preset mode indication information is added to indicate the intra prediction mode of each sub-block; in this way, the flexibility of coding unit prediction can be increased, a more fine-grained prediction can be achieved, and the accuracy of prediction can be improved, thereby improving compression performance. In addition, DP prediction is based on the original value of the pixel point (pixel point can also be called sample) inside the sub-block for prediction, and the correlation between the pixel points inside the same sub-block is higher than the correlation between the pixel points of different sub-blocks; thus, the accuracy of prediction can be further improved, and the compression performance can be improved.
[0007] Exemplarily, the preset mode indication information is used to indicate whether the prediction mode of the sub-block is the DP prediction mode.
[0008] Exemplarily, the reconstructed blocks of multiple sub-blocks may be concatenated into a reconstructed block of a CU.
[0009] Exemplarily, the preset mode indication information may be a syntax element newly added in the present application.
[0010] Exemplarily, the second quantization parameter corresponding to the current CU may be determined based on complexity information of the current CU and the number of coded bits of a previous CU.
[0011] Exemplarily, the number of coded bits of the previous CU can be obtained in the process of entropy decoding the bit stream of the previous CU. The complexity information of the current CU can be obtained from the entropy decoding of the bit stream of the current CU.
[0012] Exemplarily, the complexity information may be a complexity level. Exemplarily, the complexity level of the current CU may be determined based on the texture complexity level of the current CU and the IBC complexity level of the current CU; for example, the minimum value of the texture complexity level of the current CU and the IBC complexity level of the current CU may be determined as the complexity level of the current CU.
[0013] Exemplarily, performing DP prediction on the current sub-block to obtain a prediction value of the current sub-block may include: using a difference prediction value entropy decoded from a bitstream as a prediction value of the current sub-block; wherein the difference prediction value is determined by the encoder for the current sub-block based on DP prediction and written into the bitstream.
[0014] According to the first aspect, based on the preset constraint mode for the first encoding code length, the first quantization parameter is determined, including: when the preset constraint mode is the first constraint mode, the first quantization parameter is determined based on the target encoding rate of the current sub-block obtained by entropy decoding from the bit stream, the bit depth of the image to which the current sub-block belongs, and the second encoding code length corresponding to the predicted value of the current sub-block; when the preset constraint mode is the second constraint mode, the second quantization parameter is used as the first quantization parameter; when the preset constraint mode is the third constraint mode, the truncation range of the prediction residual of the current sub-block is determined and the first quantization parameter is determined based on the truncation range. In this way, the constraint mode for the first encoding code length can be flexibly set to meet various scene requirements.
[0015] According to the first aspect, or any implementation method of the first aspect above, the preset mode indication information includes: first indication information and second indication information; for the current sub-block, based on the preset mode indication information of the current sub-block, determine whether to use the difference prediction mode to replace the intra-frame prediction mode corresponding to the coding unit CU to which the current sub-block belongs, including: based on the first indication information, determine whether the CU includes a sub-block whose prediction mode is the difference prediction mode; when it is determined that the CU includes a sub-block whose prediction mode is the difference prediction mode, for the current sub-block, determine whether to use the difference prediction mode to replace the intra-frame prediction mode corresponding to the CU based on the second indication information.
[0016] In this way, when all sub-blocks contained in the entire CU are intra-predicted based on the intra-prediction mode corresponding to the CU, only the first indication information of the CU needs to be written into the bitstream; that is, compared with the preset mode indication information only including the second indication information, when the preset mode indication information includes the first indication information and the second indication information, the number of bits occupied by the preset mode indication information in the bitstream can be reduced, thereby reducing the bitstream overhead.
[0017] According to the first aspect, or any implementation of the first aspect above, the other intra prediction mode is an intra prediction mode of block copy (IBC), and the preset mode indication information is a block vector BV. In this way, no additional information needs to be added to the bit stream, thereby reducing the bit rate overhead.
[0018] In a second aspect, an embodiment of the present application provides a coding method, which includes: first, obtaining a coding unit CU and dividing the CU into multiple sub-blocks; then, for the current sub-block, determining whether to use a differential prediction mode to replace the intra-frame prediction mode corresponding to the CU; if so, setting the preset mode indication information of the current sub-block to the first preset information, and performing differential prediction to determine the prediction value of the current sub-block; determining the prediction value of the current sub-block and the prediction residual of the current sub-block; based on a preset constraint method of a first encoding code length, determining a first quantization parameter, the first encoding code length corresponding to the prediction residual of the current sub-block; based on the first quantization parameter, quantize the prediction residual of the block; perform entropy coding on the quantized prediction residual of the current sub-block to obtain a bit stream of the current sub-block; if not, set the preset mode indication information of the current sub-block to the second preset information, and perform intra-frame prediction corresponding to the CU to determine the prediction value of the current sub-block; determine the prediction value of the current sub-block and the prediction residual of the current sub-block; based on the second quantization parameter corresponding to the CU, quantize the prediction residual of the current sub-block; then, perform entropy coding on the quantized prediction residual of the current sub-block to obtain a bit stream of the current sub-block; then, write the preset mode indication information and the first encoding code length corresponding to the prediction residual of the current sub-block into the bit stream.
[0019] Exemplarily, setting the preset mode indication information of the current sub-block as the first preset information may include:
[0020] In one possible manner, the preset mode indication information includes first indication information and second indication information, the first indication information is used to indicate whether the CU includes a sub-block whose prediction mode is a DP prediction mode, and the second indication information is used to indicate whether the prediction mode of the sub-block is a DP prediction mode; the first preset information includes a first preset value and a second preset value; setting the preset mode indication information of the current sub-block to the first preset information includes: setting the second indication information to the first preset information; wherein the second indication information set to the first preset value is used to indicate that the prediction mode of the current sub-block is a DP prediction mode; setting the first indication information to the second preset value; wherein the first indication information set to the second preset value is used to indicate that the CU includes a sub-block whose prediction mode is a DP prediction mode.
[0021] In one possible manner, the preset mode indication information includes first indication information and second indication information, the first indication information is used to indicate whether the CU includes a sub-block whose prediction mode is a DP prediction mode, and the second indication information is used to indicate whether the prediction mode of the sub-block is a DP prediction mode; the first preset information includes a first preset value and a second preset value; setting the preset mode indication information of the current sub-block to the first preset information includes: setting the second indication information to the first preset value; wherein the second indication information set to the first preset value is used to indicate that the prediction mode of the current sub-block is the DP prediction mode; determining the irrelevance of pixels in the current sub-block; when the second indication information is the first preset value and the irrelevance of pixels in the current sub-block is equal to the preset correlation value, setting the first indication information to the second preset value; wherein the first indication information set to the second preset value is used to indicate that the CU includes a sub-block whose prediction mode is a DP prediction mode.
[0022] In one possible manner, the preset mode indication information only includes the second indication information; thus, setting the preset mode indication information of the current sub-block to the first preset information may include: setting the second indication information of the current sub-block to the first preset value.
[0023] Exemplarily, setting the preset mode indication information of the current sub-block as the second preset information may include:
[0024] In one possible manner, the preset mode indication information includes first indication information and second indication information, the first indication information is used to indicate whether the CU includes a sub-block whose prediction mode is a DP prediction mode, and the second indication information is used to indicate whether the prediction mode of the sub-block is a DP prediction mode; the second preset information includes a third preset value and a fourth preset value; setting the preset mode indication information of the current sub-block to the second preset information includes: setting the second indication information to the third preset value; wherein the second indication information set to the third preset value is used to indicate that the prediction mode of the current sub-block is the intra-frame prediction mode corresponding to the CU; setting the first indication information to the fourth preset value; wherein the first indication information set to the fourth preset value is used to indicate that the CU does not include a sub-block whose prediction mode is a DP prediction mode.
[0025] In one possible manner, the preset mode indication information includes first indication information and second indication information, the first indication information is used to indicate whether the CU includes a sub-block whose prediction mode is the DP prediction mode, and the second indication information is used to indicate whether the prediction mode of the sub-block is the DP prediction mode; the second preset information includes a third preset value and a fourth preset value; setting the preset mode indication information of the current sub-block to the second preset information includes: setting the second indication information to the third preset value; wherein the second indication information set to the third preset value is used to indicate that the prediction mode of the current sub-block is the intra-frame prediction mode corresponding to the CU; determining the irrelevance of pixels in the current sub-block; when the second indication information is the second preset value, and / or the irrelevance of pixels in the current sub-block does not meet the irrelevance condition, setting the first indication information to the fourth preset value; wherein the first indication information set to the fourth preset value is used to indicate that the CU does not include a sub-block whose prediction mode is the DP prediction mode.
[0026] In one possible manner, the preset mode indication information only includes the second indication information; thus, setting the preset mode indication information of the current sub-block to the second preset information may include: setting the second indication information of the current sub-block to a third preset value.
[0027] Among them, the first preset value, the second preset value, the third preset value and the fourth preset value can be set as required, and this application does not limit this. It should be noted that the third preset value is different from the first preset value; for example, if the first preset value is 1, the third preset value can be 0. The fourth preset value is different from the second preset value; for example, if the second preset value is 1, the fourth preset value can be 0.
[0028] Among them, when the sub-blocks contained in the entire CU are intra-predicted based on the intra-prediction mode corresponding to the CU, if the preset mode indication information only includes the second indication information, it is necessary to write the second indication information of each sub-block in the bitstream; and if the preset mode indication information includes the first indication information and the second indication information, it is only necessary to write the first indication information of the CU in the bitstream; that is, compared with the preset mode indication information being the first indication information, when the preset mode indication information includes the first indication information and the second indication information, the number of bits occupied by the preset mode indication information in the bitstream can be reduced, thereby reducing the bitstream overhead.
[0029] According to the second aspect, for the current sub-block, when it is determined to use the difference prediction mode to replace the intra prediction mode corresponding to the CU, the method further includes: truncating the prediction residual of the current sub-block; and quantizing the prediction residual of the current sub-block based on the first quantization parameter, including: quantizing the truncated prediction residual of the current sub-block based on the first quantization parameter. In this way, the number of bits occupied by the prediction reference of the current sub-block in the bitstream can be reduced, and the bit rate overhead can be reduced.
[0030] According to the second aspect, or any implementation method of the second aspect above, the prediction residual of the current sub-block is truncated, including: determining a truncation range based on the target encoding rate of the current sub-block, the bit depth of the image where the current sub-block is located, and the second encoding code length corresponding to the prediction value of the current sub-block; based on the truncation range, truncating the prediction residual of the current sub-block.
[0031] According to the second aspect, or any implementation method of the second aspect above, a first quantization parameter is determined based on a preset constraint method of the first encoding code length, including: when the preset constraint method is the first constraint method, the first quantization parameter is determined based on the target encoding rate of the current sub-block, the bit depth of the image to which the current sub-block belongs, and the second encoding code length corresponding to the predicted value of the current sub-block; when the preset constraint method is the second constraint method, the second quantization parameter is used as the first quantization parameter; when the preset constraint method is the third constraint method, the first quantization parameter is determined based on the truncation range of the prediction residual of the current sub-block.
[0032] According to the second aspect, or any implementation of the second aspect above, the method also includes: writing the target encoding rate of the current sub-block, the bit depth of the image where the current sub-block is located, and the second encoding code length corresponding to the predicted value of the current sub-block into the bit stream of the current sub-block; so that the decoder can determine the first quantization parameter.
[0033] According to the second aspect, or any implementation method of the second aspect above, for the current sub-block, determine whether to use a differential prediction mode to replace the intra-frame prediction mode corresponding to the CU, including: determining the flatness of the current sub-block; and determining whether to use a differential prediction mode to replace the intra-frame prediction mode corresponding to the CU based on the flatness of the current sub-block.
[0034] According to the second aspect, or any implementation of the second aspect, determining the flatness of the current sub-block includes: determining the flatness of the current sub-block based on original values of pixels in the current sub-block.
[0035] According to the second aspect, or any implementation of the second aspect, the other intra prediction mode is a block copy intra prediction IBC mode, and the preset mode indication information is a block vector BV;
[0036] Among them, the BV set to the first preset information is used to indicate that the prediction mode of the current sub-block is the difference prediction mode; the BV set to the second preset information is used to indicate that the prediction mode of the current sub-block is the IBC mode, and the second preset information is the vector absolute value offset value between the current sub-block and the reference block, and the reference block is determined based on the IBC prediction.
[0037] The second aspect and any implementation of the second aspect correspond to the first aspect and any implementation of the first aspect respectively. The technical effects corresponding to the second aspect and any implementation of the second aspect can refer to the technical effects corresponding to the above-mentioned first aspect and any implementation of the first aspect, which will not be repeated here.
[0038] In a third aspect, the present application provides a decoding method, which includes: receiving a bit stream; entropy decoding a block vector BV of a current sub-block from the bit stream, the prediction mode of the coding unit CU to which the current sub-block belongs is a block copy intra-frame prediction IBC mode; for the current sub-block, judging whether to use a difference prediction mode instead of the IBC mode based on the BV of the current sub-block; if so, using the difference prediction value entropy decoded from the bit stream as the prediction value of the current sub-block; if not, performing IBC prediction on the current sub-block based on the BV of the current sub-block to obtain a prediction value of the current sub-block; and reconstructing the current sub-block based on the prediction value of the current sub-block to obtain a reconstructed block of the current sub-block.
[0039] That is to say, BV can not only be the vector absolute value offset between the sub-block and the corresponding reference block, but also can be used to indicate that the prediction mode is other intra-frame prediction modes; since the block vector BV is an existing syntax element in the bitstream for the CU (CodingUnit) whose prediction mode is IBC mode, this application nests the DP prediction mode in the IBC mode, which will not increase the bit rate and the search area for IBC prediction. Secondly, it can also increase the flexibility of coding unit prediction, achieve more fine-grained prediction, improve prediction accuracy, and thus improve compression performance.
[0040] In addition, DP prediction is based on the original values of the pixels within the sub-block (pixels can also be called samples). The correlation between pixels within the same sub-block is higher than the correlation between pixels in different sub-blocks; thus, the accuracy of the prediction can be further improved, and the compression performance can be improved.
[0041] In a fourth aspect, the present application provides a coding method, which includes: obtaining a coding unit CU and dividing the CU into a plurality of sub-blocks, wherein the prediction mode of the CU is a block copy intra prediction IBC mode; for a current sub-block, determining whether to use a differential prediction mode to replace the IBC mode; if so, setting the BV of the current sub-block to the first preset information, and setting the prediction value of the current sub-block to the first prediction value; wherein the BV set to the first preset information is used to indicate that the prediction mode of the current sub-block is a differential prediction mode, and the first prediction value is a differential prediction value determined based on the differential prediction; if not, setting the current sub-block to the first preset information. The block vector BV of the block is set to the second preset information, and the prediction value of the current sub-block is set to the second prediction value; wherein the BV set to the second preset information is used to indicate that the prediction mode of the current sub-block is the IBC mode, the second preset information is the vector absolute value offset value between the current sub-block and the reference block, and the reference block and the second prediction value are determined based on the IBC prediction; the current sub-block is encoded based on the prediction value of the current sub-block to obtain a bit stream of the current sub-block; the BV of the current sub-block is written into the bit stream of the current sub-block, and when it is determined to adopt the difference prediction mode instead of the IBC mode, the difference prediction value is written into the bit stream.
[0042] According to the fourth aspect, for the current sub-block, determining whether to use the DP prediction mode instead of the IBC mode includes: determining the flatness of the current sub-block; for the current sub-block, determining whether to use the DP prediction mode instead of the IBC mode based on the flatness of the current sub-block and the second preset information.
[0043] Exemplarily, for the current sub-block, whether to use the DP prediction mode to replace the IBC mode is determined based on the flatness of the current sub-block and the second preset information, including: determining whether the second preset information is greater than a threshold, and whether the flatness of the current sub-block is equal to 0; if the second preset information is greater than the threshold, and the flatness of the current sub-block is equal to 0, then for the current sub-block, determining to use the DP prediction mode to replace the IBC mode; if the second preset information is less than or equal to the threshold, and / or the flatness of the current sub-block is not equal to 0, then for the current sub-block, determining not to use the DP prediction mode to replace the IBC mode.
[0044] According to the fourth aspect, or any implementation of the fourth aspect, determining the flatness of the current sub-block includes: determining the flatness of the current sub-block based on original values of pixels in the current sub-block.
[0045] The fourth aspect and any implementation of the fourth aspect correspond to the third aspect and any implementation of the third aspect, respectively. The technical effects corresponding to the fourth aspect and any implementation of the fourth aspect can refer to the technical effects corresponding to the third aspect and any implementation of the third aspect, which will not be repeated here.
[0046] In a fifth aspect, an embodiment of the present application provides an electronic device, comprising: a memory and a processor, the memory being coupled to the processor; the memory storing program instructions, which, when executed by the processor, enables the electronic device to execute the decoding method in the first aspect or any possible implementation of the first aspect, and / or execute the decoding method in the third aspect or any possible implementation of the third aspect.
[0047] The fifth aspect and any implementation of the fifth aspect correspond to the first aspect and any implementation of the first aspect, respectively. The technical effects corresponding to the fifth aspect and any implementation of the fifth aspect can refer to the technical effects corresponding to the first aspect and any implementation of the first aspect, which will not be repeated here.
[0048] The fifth aspect and any implementation of the fifth aspect correspond to the third aspect and any implementation of the third aspect, respectively. The technical effects corresponding to the fifth aspect and any implementation of the fifth aspect can refer to the technical effects corresponding to the third aspect and any implementation of the third aspect, which will not be repeated here.
[0049] In a sixth aspect, an embodiment of the present application provides an electronic device, comprising: a memory and a processor, the memory being coupled to the processor; the memory storing program instructions, which, when executed by the processor, enables the electronic device to execute the decoding method in the second aspect or any possible implementation of the second aspect, and / or execute the encoding method in the fourth aspect or any possible implementation of the fourth aspect.
[0050] The sixth aspect and any implementation of the sixth aspect correspond to the second aspect and any implementation of the second aspect, respectively. The technical effects corresponding to the sixth aspect and any implementation of the sixth aspect can refer to the technical effects corresponding to the above-mentioned second aspect and any implementation of the second aspect, which will not be repeated here.
[0051] The sixth aspect and any implementation of the sixth aspect correspond to the fourth aspect and any implementation of the fourth aspect, respectively. The technical effects corresponding to the sixth aspect and any implementation of the sixth aspect can refer to the technical effects corresponding to the fourth aspect and any implementation of the fourth aspect, which will not be repeated here.
[0052] In the seventh aspect, an embodiment of the present application provides a chip, comprising one or more interface circuits and one or more processors; the one or more processors receive or send data through the one or more interface circuits, and when the one or more processors execute computer instructions, the electronic device executes the decoding method in the first aspect or any possible implementation of the first aspect, and / or executes the decoding method in the third aspect or any possible implementation of the third aspect.
[0053] The seventh aspect and any implementation of the seventh aspect correspond to the first aspect and any implementation of the first aspect, respectively. The technical effects corresponding to the seventh aspect and any implementation of the seventh aspect can refer to the technical effects corresponding to the above-mentioned first aspect and any implementation of the first aspect, which will not be repeated here.
[0054] The seventh aspect and any implementation of the seventh aspect correspond to the third aspect and any implementation of the third aspect, respectively. The technical effects corresponding to the seventh aspect and any implementation of the seventh aspect can refer to the technical effects corresponding to the third aspect and any implementation of the third aspect, which will not be repeated here.
[0055] In an eighth aspect, an embodiment of the present application provides a chip comprising one or more interface circuits and one or more processors; the one or more processors receive or send data through the one or more interface circuits, and when the one or more processors execute computer instructions, the electronic device executes the decoding method in the second aspect or any possible implementation of the second aspect, and / or executes the encoding method in the fourth aspect or any possible implementation of the fourth aspect.
[0056] The eighth aspect and any implementation of the eighth aspect correspond to the second aspect and any implementation of the second aspect, respectively. The technical effects corresponding to the eighth aspect and any implementation of the eighth aspect can refer to the technical effects corresponding to the above-mentioned second aspect and any implementation of the second aspect, which will not be repeated here.
[0057] The eighth aspect and any implementation of the eighth aspect correspond to the fourth aspect and any implementation of the fourth aspect, respectively. The technical effects corresponding to the eighth aspect and any implementation of the eighth aspect can refer to the technical effects corresponding to the fourth aspect and any implementation of the fourth aspect, which will not be repeated here.
[0058] In the ninth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program runs on a computer or a processor, the computer or the processor executes the decoding method in the first aspect or any possible implementation of the first aspect, and / or executes the decoding method in the third aspect or any possible implementation of the third aspect.
[0059] The ninth aspect and any implementation of the ninth aspect correspond to the first aspect and any implementation of the first aspect, respectively. The technical effects corresponding to the ninth aspect and any implementation of the ninth aspect can refer to the technical effects corresponding to the first aspect and any implementation of the first aspect, which will not be repeated here.
[0060] The ninth aspect and any implementation of the ninth aspect correspond to the third aspect and any implementation of the third aspect, respectively. The technical effects corresponding to the ninth aspect and any implementation of the ninth aspect can refer to the technical effects corresponding to the third aspect and any implementation of the third aspect, which will not be repeated here.
[0061] In the tenth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program runs on a computer or a processor, the computer or the processor executes the decoding method in the second aspect or any possible implementation of the second aspect, and / or executes the encoding method in the fourth aspect or any possible implementation of the fourth aspect.
[0062] The tenth aspect and any implementation of the tenth aspect correspond to the second aspect and any implementation of the second aspect, respectively. The technical effects corresponding to the tenth aspect and any implementation of the tenth aspect can refer to the technical effects corresponding to the above-mentioned second aspect and any implementation of the second aspect, which will not be repeated here.
[0063] The tenth aspect and any implementation of the tenth aspect correspond to the fourth aspect and any implementation of the fourth aspect, respectively. The technical effects corresponding to the tenth aspect and any implementation of the tenth aspect can refer to the technical effects corresponding to the fourth aspect and any implementation of the fourth aspect, which will not be repeated here.
[0064] In the eleventh aspect, an embodiment of the present application provides a computer program product, which includes computer instructions. When the computer instructions are executed by a computer or a processor, the computer or the processor executes the decoding method in the first aspect or any possible implementation of the first aspect, and / or executes the decoding method in the third aspect or any possible implementation of the third aspect.
[0065] The eleventh aspect and any implementation of the eleventh aspect correspond to the first aspect and any implementation of the first aspect, respectively. The technical effects corresponding to the eleventh aspect and any implementation of the eleventh aspect can refer to the technical effects corresponding to the above-mentioned first aspect and any implementation of the first aspect, which will not be repeated here.
[0066] The eleventh aspect and any implementation of the eleventh aspect correspond to the third aspect and any implementation of the third aspect, respectively. The technical effects corresponding to the eleventh aspect and any implementation of the eleventh aspect can refer to the technical effects corresponding to the third aspect and any implementation of the third aspect, which will not be repeated here.
[0067] In the twelfth aspect, an embodiment of the present application provides a computer program product, which includes computer instructions. When the computer instructions are executed by a computer or a processor, the computer or the processor executes the decoding method in the second aspect or any possible implementation of the second aspect, and / or executes the encoding method in the fourth aspect or any possible implementation of the fourth aspect.
[0068] The twelfth aspect and any implementation of the twelfth aspect correspond to the second aspect and any implementation of the second aspect, respectively. The technical effects corresponding to the twelfth aspect and any implementation of the twelfth aspect can refer to the technical effects corresponding to the above-mentioned second aspect and any implementation of the second aspect, which will not be repeated here.
[0069] The twelfth aspect and any implementation of the twelfth aspect correspond to the fourth aspect and any implementation of the fourth aspect, respectively. The technical effects corresponding to the twelfth aspect and any implementation of the twelfth aspect can refer to the technical effects corresponding to the above-mentioned fourth aspect and any implementation of the fourth aspect, which will not be repeated here.
[0070] In the thirteenth aspect, an embodiment of the present application provides a device for storing a bit stream, the device comprising: a receiver and at least one storage medium, the receiver is used to receive the bit stream; the at least one storage medium is used to store the bit stream; the bit stream is generated according to the second aspect and any one of the implementation methods of the second aspect, and / or, generated according to the fourth aspect and any one of the implementation methods of the fourth aspect.
[0071] The thirteenth aspect and any implementation of the thirteenth aspect correspond to the second aspect and any implementation of the second aspect, respectively. The technical effects corresponding to the thirteenth aspect and any implementation of the thirteenth aspect can refer to the technical effects corresponding to the above-mentioned second aspect and any implementation of the second aspect, which will not be repeated here.
[0072] The thirteenth aspect and any implementation of the thirteenth aspect correspond to the fourth aspect and any implementation of the fourth aspect, respectively. The technical effects corresponding to the thirteenth aspect and any implementation of the thirteenth aspect can refer to the technical effects corresponding to the above-mentioned fourth aspect and any implementation of the fourth aspect, which will not be repeated here.
[0073] In the fourteenth aspect, an embodiment of the present application provides a device for transmitting a bit stream, the device comprising: a transmitter and at least one storage medium, the at least one storage medium is used to store the bit stream, the bit stream is generated according to the second aspect and any one of the implementation methods of the second aspect, and / or, is generated according to the fourth aspect and any one of the implementation methods of the fourth aspect; the transmitter is used to obtain the bit stream from the storage medium and send the bit stream to the terminal side device through the transmission medium.
[0074] The fourteenth aspect and any implementation of the fourteenth aspect correspond to the second aspect and any implementation of the second aspect, respectively. The technical effects corresponding to the fourteenth aspect and any implementation of the fourteenth aspect can refer to the technical effects corresponding to the above-mentioned second aspect and any implementation of the second aspect, which will not be repeated here.
[0075] The fourteenth aspect and any implementation of the fourteenth aspect correspond to the fourth aspect and any implementation of the fourth aspect, respectively. The technical effects corresponding to the fourteenth aspect and any implementation of the fourteenth aspect can refer to the technical effects corresponding to the above-mentioned fourth aspect and any implementation of the fourth aspect, which will not be repeated here.
[0076] In a fifteenth aspect, an embodiment of the present application provides a system for distributing bitstreams, the system comprising: at least one storage medium for storing at least one bitstream, the at least one bitstream being generated according to the second aspect and any one of the implementation methods of the second aspect, and / or generated according to the fourth aspect and any one of the implementation methods of the fourth aspect, a streaming media device for obtaining a target bitstream from the at least one storage medium and sending the target bitstream to an end-side device, wherein the streaming media device comprises a content server or a content distribution server.
[0077] The fifteenth aspect and any implementation of the fifteenth aspect correspond to the second aspect and any implementation of the second aspect, respectively. The technical effects corresponding to the fifteenth aspect and any implementation of the fifteenth aspect can refer to the technical effects corresponding to the above-mentioned second aspect and any implementation of the second aspect, which will not be repeated here.
[0078] The fifteenth aspect and any implementation of the fifteenth aspect correspond to the fourth aspect and any implementation of the fourth aspect, respectively. The technical effects corresponding to the fifteenth aspect and any implementation of the fifteenth aspect can refer to the technical effects corresponding to the fourth aspect and any implementation of the fourth aspect, which will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0079] Figure 1a is a schematic diagram of an application scenario shown as an example;
[0080] Figure 1b is a schematic diagram of the structure of an encoder and a decoder shown as an example;
[0081] Figure 2a is a schematic diagram of an exemplary encoding process;
[0082] Figure 2b is a schematic diagram of an exemplary encoding process;
[0083] Figure 3a is a schematic diagram of an exemplary decoding process;
[0084] Figure 3b is a schematic diagram of an exemplary decoding process;
[0085] Figure 4a is a schematic diagram of an exemplary encoding process;
[0086] Figure 4b is a schematic diagram of an exemplary encoding process;
[0087] Figure 4c A schematic diagram of a search area for IBC prediction is shown as an example;
[0088] Figure 5a is a schematic diagram of an exemplary decoding process;
[0089] Figure 5b is a schematic diagram of an exemplary decoding process;
[0090] Figure 6 Schematic diagram of the structure of the device shown as an example. DETAILED DESCRIPTION
[0091] 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 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 without creative work are within the scope of protection of this application.
[0092] The term "and / or" in this article is merely a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone.
[0093] The terms "first" and "second" in the description and claims of the embodiments of the present application are used to distinguish different objects rather than to describe a specific order of objects. For example, a first target object and a second target object are used to distinguish different target objects rather than to describe a specific order of target objects.
[0094] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0095] In the description of the embodiments of the present application, unless otherwise specified, the meaning of "multiple" refers to two or more than two. For example, multiple processing units refer to two or more processing units; multiple systems refer to two or more systems.
[0096] The encoding and decoding method of the present application can be applied to various video service scenarios, such as video conferencing scenarios, video call scenarios, online education scenarios, remote tutoring scenarios, low-latency live broadcast scenarios, cloud gaming scenarios, wireless screen projection scenarios, and wireless extended screen scenarios, etc., but the embodiments of the present application are not limited to this.
[0097] Figure 1a The figure is a schematic diagram of an exemplary application scenario.
[0098] Reference Figure 1a , exemplarily, the first device may include a video acquisition module, an encoding module (or encoder) and a sending module. Exemplarily, the encoding module may be a software module or a hardware module, which is not limited in the present application embodiment. It should be understood that, Figure 1a This is only an example of the first device. In other embodiments of the present application, the first device has a Figure 1aMore modules are shown, and the embodiments of the present application are not limited to this.
[0099] Reference Figure 1a , exemplarily, the second device may include a display module, a decoding module (or decoder) and a receiving module. Exemplarily, the decoding module may be a software module or a hardware module, which is not limited in the present application embodiment. It should be understood that, Figure 1a This is only an example of the second device. In other embodiments of the present application, the second device has Figure 1a More modules are shown, and the embodiments of the present application are not limited to this.
[0100] Continue to refer to Figure 1a , exemplarily, after the video acquisition module of the first device acquires the original video data, the process of sending the acquired original video data to the second device for display is as follows: the video acquisition module can output the acquired original video data to the encoding module; then, the encoding module can encode the original video data to obtain a bit stream (wherein the bit stream can also be called a bit stream or a code stream), and output the encoded bit stream to the sending module; then, the sending module can send the bit stream to the second device. Subsequently, the receiving module of the second device can receive the bit stream; then, the bit stream is output to the decoding module; then, the decoding module can decode the bit stream to obtain reconstructed video data and output the reconstructed video data to the display module, and the display module displays the reconstructed video data.
[0101] Exemplarily, the first device includes, but is not limited to: a server, a PC (Personal Computer), a laptop, a tablet computer, a mobile phone, and a watch.
[0102] Exemplarily, the second device includes but is not limited to: a PC, a laptop, a tablet computer, a mobile phone, and a watch.
[0103] For example, in a video conferencing scenario, the first device may be a PC or a laptop, and the second device may be a PC or a laptop.
[0104] For example, in an online education scenario, the first device may be a PC or a laptop, and the second device may be a tablet computer.
[0105] For example, in a cloud gaming scenario, the first device may be a server, and the second device may be a tablet computer, a PC, a laptop computer, or a mobile phone.
[0106] It should be understood that the present application can also be applied to scenarios for image encoding and decoding, and the present application does not limit this.
[0107] Figure 1b The schematic diagram of the structure of the encoder and decoder is shown as an example.
[0108] Reference Figure 1b (1), exemplarily, the encoder may include a prediction module, a quantization module and an entropy coding module. Among them, the preset module may be used for coding prediction (such as inter-frame prediction, intra-frame prediction); the quantization module may perform quantization based on a quantization parameter; the entropy coding module may be used for entropy coding (such as arithmetic coding, Huffman coding, etc.). Exemplarily, after the image to be coded is input to the encoder, the encoder sequentially inputs the image to be coded into the prediction module, the quantization module and the entropy coding module for processing, and outputs a bit stream.
[0109] It should be understood that the encoder of the present application may include Figure 1b (1) More modules are shown, for example, the encoder may also include a bit rate control module (which adjusts the output bit rate by changing the encoding quantization parameter, encoding mode, etc.), etc., and the present application does not limit this.
[0110] Reference Figure 1b (2) Exemplarily, the decoder may include a prediction module, an inverse quantization module, and an entropy decoding module. The entropy decoding module is used for entropy decoding; the inverse quantization module is used for inverse quantization based on quantization parameters; and the prediction module is used for decoding prediction. Exemplarily, after the bitstream is input to the decoder, it is processed by the entropy decoding, inverse quantization module, and prediction module in sequence, and a reconstructed image is output.
[0111] It should be understood that the decoder of the present application may include Figure 1b (2) More modules are shown, for example, the decoder may also include a rate control module (for determining a quantization parameter), etc., which is not limited in the present application.
[0112] The following Figure 1b Taking the prediction module in (2) as an example for intra-frame prediction, the encoding and decoding process (i.e., intra-frame encoding process and intra-frame decoding process) is explained.
[0113] In order to solve the problem that the existing technology uses the same intra-frame prediction mode for prediction of different sub-blocks in the same coding unit, resulting in poor prediction effect of some sub-blocks, the present application proposes a coding and decoding method for a coding unit whose prediction mode is any intra-frame prediction mode. One of its concepts is to nest the difference prediction mode (also called DP prediction mode) in any intra-frame prediction mode (except the difference prediction mode), and add preset mode indication information to indicate the intra-frame prediction mode of each sub-block; in this way, the flexibility of coding unit prediction can be increased, more fine-grained prediction can be achieved, and the accuracy of prediction can be improved, thereby improving compression performance. In addition, DP prediction is based on the original value of the pixel point (pixel point can also be called sample) inside the sub-block for prediction. The correlation between the pixel points inside the same sub-block is higher than the correlation between the pixel points of different sub-blocks; thus, the accuracy of prediction can be further improved, and the compression performance can be improved.
[0114] The encoding and decoding method of the present application is described below by taking encoding and decoding an image as an example.
[0115] Figure 2a The figure is a schematic diagram of an exemplary encoding process.
[0116] Reference Figure 2a , for example, after the image to be encoded is input into the encoder, the encoder can divide the image to be encoded into multiple coding units (CodingUnit, CU), for example, CU1, CU2, ... Then, after performing prediction, quantization and entropy coding operations on CU1 in sequence, the bit stream of CU1 can be obtained; after performing prediction, quantization and entropy coding operations on CU2 in sequence, the bit stream of CU2 can be obtained; and so on, after completing the encoding of all CUs of the image to be encoded, the bit streams of all CUs are connected in series to obtain the bit stream of the image to be encoded.
[0117] Exemplarily, for each CU, the encoder can divide the CU into multiple sub-blocks, and perform prediction, quantization, and entropy coding operations on each sub-block in turn to obtain a bit stream for each sub-block; after completing the encoding of all sub-blocks in the CU, the bit streams of the sub-blocks are concatenated to obtain the bit stream of the CU.
[0118] In the process of encoding each sub-block in the CU, when the prediction mode of the sub-block is the DP prediction mode, the first quantization parameter can be determined according to the constraint of the coding code length (the coding code length corresponding to the prediction residual of the sub-block); and then quantization is performed according to the first quantization parameter. When the prediction mode of the sub-block is the intra-frame prediction mode corresponding to the CU, the complexity information (such as the complexity level) of the current CU can be determined according to the image content of the current CU. Then, based on the number of coded bits of the previous CU and the complexity level of the current CU, the code rate control is performed (that is, based on the analysis of the number of coded bits of the previous CU and the complexity level of the current CU, the output code rate is adjusted by changing the quantization parameter of the coding, the coding mode, etc.) to obtain the second quantization parameter. Afterwards, quantization can be performed based on the second quantization parameter determined by the code rate control. In the encoder, the complexity information of the CU can also be written into the bit stream of the CU so that the decoder obtains the complexity information of the CU from the bit stream to determine the second quantization parameter required for inverse quantization.
[0119] In the encoding process for CU1, for the sub-block whose prediction mode is the intra-frame prediction mode corresponding to CU1, the second quantization parameter is a preset quantization parameter.
[0120] The following takes a CU as an example to illustrate the encoding process.
[0121] Figure 2b FIG. 1 is a schematic diagram of an exemplary encoding process.
[0122] S201, obtaining a coding unit CU and dividing the CU into multiple sub-blocks.
[0123] Exemplarily, the intra prediction mode corresponding to the CU obtained in the present application may be any intra prediction mode except the DP prediction mode; for example, an intra prediction mode (Intra block copy, IBC) mode, a vertical prediction mode, an angular prediction mode and a direct current (Direct Current, DC) prediction mode, etc., which is not limited in the present application.
[0124] Exemplarily, after the encoder obtains the CU, the CU may be divided into multiple sub-blocks; the present application does not limit the number of sub-blocks and the size of the sub-blocks. For example, the decoder may divide the CU into multiple sub-blocks of the same size.
[0125] The following description takes one sub-block as an example.
[0126] S202: for the current sub-block, determine whether to use the difference prediction mode to replace the intra prediction mode corresponding to the CU.
[0127] Exemplarily, first, the flatness of the current sub-block may be determined; then, based on the flatness of the current sub-block, it may be determined whether to use the DP prediction mode to replace the intra prediction mode corresponding to the CU.
[0128] Exemplarily, the flatness of the current sub-block may be determined based on original values of pixels in the current sub-block.
[0129] In one possible approach, the process of determining the flatness of the current sub-block may be as follows: first, the difference between the original value of each pixel in the current sub-block and the average of the original values of all pixels in the current sub-block may be calculated to obtain a plurality of difference values; then, the absolute values of the plurality of difference values may be added together to obtain the flatness of the current sub-block.
[0130] Exemplarily, a flatness threshold TH1 may be pre-set; wherein TH1 = X0*(1<<(BitDepth–8))×the number of pixels included in the sub-block, BitDepth is the bit depth of the image where the current sub-block is located, and X0 represents the difference between the original values of two adjacent pixels. X0 may be set as required, such as X0=2, and this application does not limit this.
[0131] Next, the flatness of the current sub-block can be compared with the flatness threshold TH1. When the flatness of the current sub-block is less than the flatness threshold TH1, for the current sub-block, it is determined not to use the DP prediction mode to replace the intra-frame prediction mode corresponding to the CU; when the flatness of the current sub-block is greater than or equal to the flatness threshold TH1, for the current sub-block, it is determined to use the DP prediction mode to replace the intra-frame prediction mode corresponding to the CU.
[0132] Exemplarily, if it is determined to use the DP prediction mode to replace the intra-frame prediction mode corresponding to the CU for the current sub-block, the following S203 to S208 can be executed: If it is determined not to use the DP prediction mode to replace the intra-frame prediction mode corresponding to the CU for the current sub-block, the following S209 to S213 can be executed.
[0133] S203: Set the preset mode indication information of the current sub-block as first preset information.
[0134] Exemplarily, when it is determined to adopt the DP prediction mode to replace the intra prediction mode corresponding to the CU, the preset mode indication information of the current sub-block may be set to the first preset information.
[0135] The preset mode indication information is used to indicate whether the prediction mode of the sub-block is the DP prediction mode. The preset mode indication information set as the first preset information is used to indicate that the prediction mode of the sub-block is the DP prediction mode.
[0136] In one possible manner, the preset mode indication information includes first indication information and second indication information, the first indication information is used to indicate whether the CU includes a sub-block whose prediction mode is the DP prediction mode, and the second indication information is used to indicate whether the prediction mode of the sub-block is the DP prediction mode; the first preset information includes a first preset value and a second preset value; setting the preset mode indication information of the current sub-block to the first preset information may include: setting the second indication information to the first preset information; wherein the second indication information set to the first preset value is used to indicate that the prediction mode of the current sub-block is the DP prediction mode; setting the first indication information to the second preset value; wherein the first indication information set to the second preset value is used to indicate that the CU includes a sub-block whose prediction mode is the DP prediction mode.
[0137] Among them, the first preset value and the second preset value can be set according to needs, and this application does not impose any restrictions on this; for example, the first preset value is 1, and the second preset value is 1.
[0138] In one possible manner, the preset mode indication information includes first indication information and second indication information, the first indication information is used to indicate whether the CU includes a sub-block whose prediction mode is a DP prediction mode, and the second indication information is used to indicate whether the prediction mode of the sub-block is a DP prediction mode; the first preset information includes a first preset value and a second preset value; setting the preset mode indication information of the current sub-block to the first preset information includes: setting the second indication information to the first preset value; wherein the second indication information set to the first preset value is used to indicate that the prediction mode of the current sub-block is the DP prediction mode; determining the irrelevance of pixels in the current sub-block; when the second indication information is the first preset value and the irrelevance of pixels in the current sub-block is equal to the preset correlation value, setting the first indication information to the second preset value; wherein the first indication information set to the second preset value is used to indicate that the CU includes a sub-block whose prediction mode is a DP prediction mode.
[0139] In one possible approach, the process of calculating the irrelevance of pixels in the current sub-block may be as follows:
[0140] First, the vertical relevance RelevanV of the current sub-block is calculated. Specifically, the difference between the original value of each pixel in the current sub-block and the reconstructed value of the corresponding first reference pixel is calculated to obtain multiple difference values; the sum of the absolute values of the multiple difference values is used as the vertical relevance RelevanV of the current sub-block. The first reference pixel point may refer to a pixel point at the same horizontal coordinate (also referred to as a horizontal coordinate) in the previous row of the current sub-block in the CU to which the current sub-block belongs.
[0141] Next, the horizontal correlation RelevanH of the current sub-block is calculated. Specifically, the difference between the original value of each pixel in the current sub-block and the original value of the corresponding second reference pixel is used to obtain multiple difference values; the sum of the absolute values of the multiple difference values is used as the horizontal correlation RelevanH of the current sub-block. The second reference pixel point may refer to a pixel point at the same ordinate (also referred to as a vertical coordinate) on the left side of the current sub-block in the current sub-block CU.
[0142] Afterwards, the irrelevance CompSbRelevant of the pixels in the current sub-block is determined based on the vertical relevance RelevanV of the current sub-block and the horizontal relevance RelevanH of the current sub-block. In one possible manner, the minimum value of the vertical relevance RelevanV of the current sub-block and the horizontal relevance RelevanH of the current sub-block can be selected as the irrelevance CompSbRelevant of the pixels in the current sub-block.
[0143] Exemplarily, if the irrelevance CompSbRelevant of the pixel points in the current sub-block is less than the relevance threshold TH2, the irrelevance CompSbRelevant of the pixel points in the current sub-block is set to 0; wherein TH2 = X1 × (1 << (BitDepth-8)) × the number of pixels contained in the sub-block; X1 is used to represent the difference between the original values of two adjacent pixels, which can be set as required, for example, X1 = 4; this application does not limit this. Among them, "0" can also be replaced by other values.
[0144] If the irrelevance CompSbRelevant of the pixel points in the current sub-block is greater than the irrelevance threshold TH3, the irrelevance CompSbRelevant of the pixel points in the current sub-block can be set to 2 (i.e., the preset relevance value); wherein TH3 = X2 × (1 << (BitDepth–8)) × the number of pixels contained in the sub-block; X2 is used to represent the difference between the original values of two adjacent pixels, which can be set as required, for example, X2 = 12; this application does not limit this. Among them, "2" can also be replaced by other values.
[0145] Otherwise, the irrelevance degree CompSbRelevant of the pixel points in the current sub-block is set to 1. Here, "1" may also be replaced by other values.
[0146] In one possible manner, the preset mode indication information only includes the second indication information; thus, setting the preset mode indication information of the current sub-block to the first preset information may include: setting the second indication information of the current sub-block to the first preset value.
[0147] S204: Perform DP prediction to determine a prediction value of the current sub-block.
[0148] Exemplarily, DP prediction may be performed on the current sub-block to determine a prediction value of the current sub-block.
[0149] In one possible approach, performing DP prediction on the current sub-block to determine the prediction value of the current sub-block may include: calculating the mean of the original values of all pixels in the current sub-block, and using the mean as the prediction value of the current sub-block (also referred to as a differential prediction value).
[0150] In one possible manner, the process of performing DP prediction on the current sub-block to determine the prediction value of the current sub-block may include: taking the original value of any pixel in the current sub-block as the prediction value of the current sub-block (also referred to as a differential prediction value).
[0151] It should be understood that the present application does not limit the manner in which DP prediction determines the prediction value.
[0152] It should be noted that the present application does not limit the execution order of S203 and S204.
[0153] S205: Determine a prediction residual between the prediction value of the current sub-block and the current sub-block.
[0154] Exemplarily, the prediction residual of the current sub-block may be obtained by calculating the difference between the prediction value of the current sub-block and the current sub-block.
[0155] S206: Determine a first quantization parameter based on a preset constraint of the first encoding code length.
[0156] The first encoding code length corresponds to the prediction residual of the current sub-block.
[0157] Exemplarily, the first encoding code length may be constrained so as to adjust the reconstruction quality and code rate in real time according to demand and channel status.
[0158] In one possible manner, the preset constraint mode for the first encoding code length may be by adjusting the quantization parameter constraint (which may be referred to as the first constraint mode). In this case, the first quantization parameter may be determined based on the target encoding rate of the current sub-block, the bit depth of the image where the current sub-block is located, and the second encoding code length (i.e., the encoding code length corresponding to the predicted value of the current sub-block).
[0159] For example, the target encoding rate of the current sub-block is 8, the bit depth of the image where the current sub-block is located is 8, and the second encoding code length is 8; then the first quantization parameter can be set to 3.
[0160] In one possible manner, when the second encoding code length is equal to the bit depth of the image where the current sub-block is located, only the bit depth of the image where the current sub-block is located and the target encoding rate of the current sub-block can be written into the bit stream. In this way, during the decoding process, the bit depth of the image where the current sub-block is located can be reused as the second encoding code length, so that the decoding end can determine the first quantization parameter.
[0161] In one possible approach, when the second encoding code length is not equal to the bit depth of the image where the current sub-block is located, the second encoding code length, the bit depth of the image where the current sub-block is located, and the target encoding bit rate of the current sub-block can be written into the bit stream; so that the decoding end can determine the first quantization parameter.
[0162] S207: quantize the prediction residual of the current sub-block based on the first quantization parameter.
[0163] Exemplarily, for the current sub-block, when it is determined to adopt the DP prediction mode to replace the intra prediction mode corresponding to the CU, the prediction residual of the current sub-block may be quantized based on the first quantization parameter.
[0164] S208: Perform entropy coding on the quantized prediction residual of the current sub-block to obtain a bit stream of the current sub-block.
[0165] Next, entropy encoding may be performed on the quantized prediction residual of the current sub-block to obtain a bit stream of the current sub-block.
[0166] S209: Set the preset mode indication information of the current sub-block as second preset information.
[0167] In one possible manner, the preset mode indication information includes first indication information and second indication information, the first indication information is used to indicate whether the CU includes a sub-block whose prediction mode is the DP prediction mode, and the second indication information is used to indicate whether the prediction mode of the sub-block is the DP prediction mode; the second preset information includes a third preset value and a fourth preset value; setting the preset mode indication information of the current sub-block to the second preset information includes: setting the second indication information to the third preset value; wherein the second indication information set to the third preset value is used to indicate that the prediction mode of the current sub-block is the intra-frame prediction mode corresponding to the CU; setting the first indication information to the fourth preset value; wherein the first indication information set to the fourth preset value is used to indicate that the CU does not include a sub-block whose prediction mode is the DP prediction mode. For details, please refer to the description above, which will not be repeated here.
[0168] In one possible manner, the preset mode indication information includes first indication information and second indication information, the first indication information is used to indicate whether the CU includes a sub-block whose prediction mode is the DP prediction mode, and the second indication information is used to indicate whether the prediction mode of the sub-block is the DP prediction mode; the second preset information includes a third preset value and a fourth preset value; setting the preset mode indication information of the current sub-block to the second preset information includes: setting the second indication information to the third preset value; wherein the second indication information set to the third preset value is used to indicate that the prediction mode of the current sub-block is the intra-frame prediction mode corresponding to the CU; determining the irrelevance of pixels in the current sub-block; when the second indication information is the second preset value, and / or the irrelevance of pixels in the current sub-block does not meet the irrelevance condition, setting the first indication information to the fourth preset value; wherein the first indication information set to the fourth preset value is used to indicate that the CU does not include a sub-block whose prediction mode is the DP prediction mode.
[0169] In one possible manner, the preset mode indication information only includes the second indication information; thus, setting the preset mode indication information of the current sub-block to the second preset information may include: setting the second indication information of the current sub-block to a third preset value.
[0170] The third preset value and the fourth preset value can be set as required, and this application does not limit this. It should be noted that the third preset value is different from the first preset value; for example, if the first preset value is 1, the third preset value can be 0. The fourth preset value is different from the second preset value; for example, if the second preset value is 1, the fourth preset value can be 0.
[0171] Among them, when the sub-blocks contained in the entire CU are intra-predicted based on the intra-prediction mode corresponding to the CU, if the preset mode indication information only includes the second indication information, it is necessary to write the second indication information of each sub-block in the bitstream; and if the preset mode indication information includes the first indication information and the second indication information, it is only necessary to write the first indication information of the CU in the bitstream; that is, compared with the preset mode indication information being the second indication information, when the preset mode indication information includes the first indication information and the second indication information, the number of bits occupied by the preset mode indication information in the bitstream can be reduced, thereby reducing the bitstream overhead.
[0172] S210, performing intra prediction corresponding to the CU to determine a prediction value of the current sub-block.
[0173] Exemplarily, based on the intra prediction mode corresponding to the CU, intra prediction corresponding to the CU is performed on the current sub-block to determine a prediction value of the current sub-block.
[0174] It should be noted that the present application does not limit the execution order of S209 and S210.
[0175] S211, determining a prediction residual between a prediction value of a current sub-block and the current sub-block.
[0176] S212: quantize the prediction residual of the current sub-block based on the second quantization parameter corresponding to the CU.
[0177] Exemplarily, the second quantization parameter corresponding to the CU can be determined according to the complexity information of the current CU and the number of coded bits of the previous CU; then, based on the second quantization parameter, the prediction value of the current sub-block and the prediction residual between the current sub-block are quantized.
[0178] In one possible manner, the complexity information of the current CU to which the current sub-block belongs may be a complexity level. Exemplarily, the complexity level of the current CU may be determined based on the texture complexity level of the current CU and the IBC complexity level of the current CU; for example, the minimum value of the texture complexity level of the current CU and the IBC complexity level of the current CU may be determined as the complexity level of the current CU.
[0179] S213: Perform entropy coding on the quantized prediction residual of the current sub-block to obtain a bit stream of the current sub-block.
[0180] Exemplarily, entropy encoding may be performed on the quantized prediction reference to obtain a bit stream of the current sub-block.
[0181] S214, writing the first encoding code length and the preset mode indication information into the bit stream.
[0182] Exemplarily, the preset mode indication information is added to the bitstream as a new syntax element so that the decoder can know the prediction mode of the current sub-block.
[0183] Exemplarily, no matter whether the DP prediction mode is used to replace the intra prediction mode corresponding to the CU, the first encoding code length is written into the bit stream.
[0184] Exemplarily, when the prediction value of the current sub-block is determined based on DP prediction, since the prediction value of the current sub-block is determined based on the original value of the pixel in the current sub-block, the prediction value of the current sub-block (i.e., the difference prediction value) can be written into the bitstream.
[0185] Exemplarily, when the prediction value of the current sub-block is determined based on the intra-frame prediction corresponding to the CU, it is not necessary to write the prediction value of the current sub-block into the bitstream.
[0186] Exemplarily, the bit streams of multiple sub-blocks included in a CU may be concatenated into the bit stream of the CU.
[0187] Optionally, for the current sub-block, when it is determined to adopt the DP prediction mode to replace the intra prediction mode corresponding to the CU, the prediction residual of the current sub-block may be truncated before quantizing the prediction residual of the current sub-block (ie, before executing S207).
[0188] Exemplarily, the truncation range of the prediction residual can be set based on the target encoding rate of the current sub-block, the bit depth of the image where the current sub-block is located, and the second encoding code length corresponding to the prediction value of the current sub-block. The truncation range of the prediction residual is (X4, X3); X3 is the upper limit of the prediction residual, X4 is the lower limit of the prediction residual, and X3 is greater than or equal to X4. Then, based on the truncation range, the prediction residual of the current sub-block is truncated.
[0189] Exemplarily, based on the truncation range, the process of truncating the prediction residual of the current sub-block can be as follows: for each pixel point of the current sub-block, if the prediction residual of the pixel point is greater than the prediction residual upper limit X3, the prediction residual of the pixel point is set to X3; if the prediction residual of the pixel point is less than the prediction residual lower limit X4, the prediction residual of the pixel point is set to X3; if the prediction residual of the pixel point is between X4 and X3, the prediction residual of the pixel point is not adjusted.
[0190] Exemplarily, in the case of truncating the prediction residual, in one possible manner, the first encoding code length preset constraint mode for the prediction residual may be to adjust the truncation range constraint of the prediction residual (which may be referred to as the second constraint mode). For example, the prediction residual lower limit X4 is set to -15, and the prediction residual upper limit X3 is set to 16. In this case, the second quantization parameter corresponding to the CU may be used as the first quantization parameter.
[0191] Exemplarily, in the case of truncating the prediction residual, in one possible manner, the preset constraint mode for the first encoding code length of the prediction residual may be a constraint (which may be referred to as a third constraint mode) by adjusting the quantization parameter and adjusting the truncation range of the prediction residual. In this case, the first quantization parameter of the current sub-block may be set based on the prediction residual truncation range and the bit depth of the image where the current sub-block is located. For example, the prediction residual lower limit X4 is set to -3, the prediction residual upper limit X3 is set to 4, and the first quantization parameter is set to 0.
[0192] Exemplarily, when the prediction mode corresponding to the CU is the IBC mode, the preset mode indication information may be a block vector (BlockVector, BV); in this way, the bit rate overhead can be reduced. In this case, the BV set to the first preset information is used to indicate that the prediction mode of the current sub-block is the difference prediction mode; the BV set to the second preset information is used to indicate that the prediction mode of the current sub-block is the IBC mode, and the second preset information is the vector absolute value offset value between the current sub-block and the reference block, and the reference block is determined based on the IBC prediction.
[0193] Figure 3a FIG. 4 is a schematic diagram of an exemplary decoding process.
[0194] Reference Figure 3a For example, after the bit stream of CU1 is input into the decoder, the decoder can sequentially perform entropy decoding, inverse quantization, and prediction operations to output the reconstructed image of CU1. Then, after the bit stream of CU2 is input into the decoder, the decoder can sequentially perform entropy decoding, inverse quantization, and prediction operations to output the reconstructed image of CU2; and so on, after completing the decoding of all CUs of the same image, the reconstructed images of all CUs can be spliced to obtain a complete image.
[0195] Among them, in the process of decoding each sub-block in the CU, when the prediction mode of the sub-block is the DP prediction mode, the first quantization parameter can be determined according to the constraint of the decoding code length (the decoding code length of the prediction residual of the sub-block); then inverse quantization is performed according to the first quantization parameter. When the prediction mode of the sub-block is the intra-frame prediction mode corresponding to the CU, the code rate control can be performed based on the complexity level of the current CU obtained by entropy decoding from the bit stream (such as the complexity level) and the number of decoded bits of the previous CU (that is, based on the analysis of the number of decoded bits of the previous CU and the complexity level of the current CU, the output code rate is adjusted by changing the decoding quantization parameter, decoding mode, etc.) to obtain the second quantization parameter. Afterwards, inverse quantization can be performed based on the second quantization parameter determined by the code rate control.
[0196] In the decoding process for CU1, for the sub-block whose prediction mode is the intra-frame prediction mode corresponding to CU1, the second quantization parameter is a preset quantization parameter.
[0197] Figure 3b FIG. 4 is a schematic diagram showing an exemplary decoding process.
[0198] S301, receiving a bit stream.
[0199] S302, entropy decoding is performed from a bit stream to obtain preset mode indication information of the current sub-block and a first encoding code length corresponding to a prediction residual of the current sub-block.
[0200] S303 , based on the first encoding code length, entropy decode the quantized prediction residual of the current sub-block from the bit stream.
[0201] S304 , for the current sub-block, determine whether to use the difference prediction mode to replace the intra prediction mode corresponding to the CU to which the current sub-block belongs based on the preset mode indication information of the current sub-block.
[0202] Exemplarily, by determining whether the preset mode indication information of the current sub-block is the first preset information, it can be determined whether to use the difference prediction mode to replace the intra-frame prediction mode corresponding to the CU for the current sub-block based on the preset mode indication information of the current sub-block. When the preset mode indication information of the current sub-block is the first preset information, it can be determined that the difference prediction mode is used to replace the intra-frame prediction mode corresponding to the CU for the current sub-block, that is, the prediction mode of the current sub-block is the DP prediction mode; at this time, S305 can be executed. When the preset mode indication information of the current sub-block is not the first preset information, that is, the preset mode indication information of the current sub-block is the second preset information, it can be determined that the difference prediction mode is not used to replace the intra-frame prediction mode corresponding to the CU for the current sub-block, that is, the prediction mode of the current sub-block is the intra-frame prediction mode corresponding to the CU to which the current sub-block belongs; at this time, S308 can be executed.
[0203] S305 , performing DP prediction on the current sub-block to obtain a prediction value of the current sub-block.
[0204] Exemplarily, a differential prediction value may be obtained from entropy decoding in the bit stream, and then the differential prediction value may be used as the prediction value of the current sub-block.
[0205] S306: Determine a first quantization parameter based on a preset constraint method for the first encoding code length.
[0206] Exemplarily, the decoder may entropy decode the target encoding rate of the current sub-block, the bit depth of the image to which the current sub-block belongs, and the second encoding code length corresponding to the predicted value of the current sub-block from the bit stream. When the preset constraint mode for the first encoding code length is the first constraint mode, the first quantization parameter may be determined based on the target encoding rate of the current sub-block, the bit depth of the image to which the current sub-block belongs, and the second encoding code length.
[0207] Exemplarily, the decoder may obtain the target encoding rate of the current sub-block and the bit depth of the image to which the current sub-block belongs from the bit stream by entropy decoding; in this case, the bit depth of the image to which the current sub-block belongs may be used as the second encoding code length corresponding to the prediction value of the current sub-block. When the preset constraint mode for the first encoding code length is the first constraint mode, the first quantization parameter may be determined based on the target encoding rate of the current sub-block, the bit depth of the image to which the current sub-block belongs, and the second encoding code length.
[0208] For example, the target encoding rate of the current sub-block is 8, the bit depth of the image where the current sub-block is located is 8, and the second encoding code length is 8; then the first quantization parameter may be 3.
[0209] Exemplarily, when the encoder truncates the prediction residual of the current sub-block, if the preset constraint mode for the first encoding code length is the second constraint mode, the second quantization parameter corresponding to the CU can be used as the first quantization parameter. If the preset constraint mode for the first encoding code length is the third constraint mode, the truncation range of the prediction residual can be determined based on the target encoding bit rate of the current sub-block, the bit depth of the image where the current sub-block is located, and the second encoding code length corresponding to the prediction value of the current sub-block; then, the first quantization parameter is determined based on the truncation range of the prediction residual and the bit depth of the image where the current sub-block is located.
[0210] S307 : Dequantize the quantized prediction residual based on the first quantization parameter to obtain a prediction residual of the current sub-block.
[0211] S308 , performing intra prediction based on the intra prediction mode corresponding to the CU to obtain a prediction value of the current sub-block.
[0212] Exemplarily, for the current sub-block, when determining the intra-frame prediction mode corresponding to the CU that is not replaced by the DP prediction mode, intra-frame prediction can be performed based on the intra-frame prediction mode corresponding to the coding unit CU to which the current sub-block belongs to obtain a prediction value of the current sub-block.
[0213] S309 , dequantize the quantized prediction residual based on the second quantization parameter corresponding to the CU to obtain the prediction residual of the current sub-block.
[0214] The method for generating the second quantization parameter may refer to the description of the above embodiment and will not be described again here.
[0215] S310: Add the prediction residual of the current sub-block to the prediction value of the current sub-block to obtain a reconstructed block of the current sub-block.
[0216] Exemplarily, when the encoder truncates the prediction residual of the current sub-block, the prediction residual of the current sub-block in S310 is actually the truncated prediction residual (it should be understood that the truncated prediction residual determined by the decoder is different from the truncated prediction residual determined by the encoder.)
[0217] Exemplarily, when the encoder does not truncate the prediction residual of the current sub-block, the prediction residual of the current sub-block in S310 is actually the untruncated prediction residual (it should be understood that the untruncated prediction residual determined by the decoder is different from the untruncated prediction residual determined by the encoder.)
[0218] Exemplarily, the reconstructed blocks of multiple sub-blocks included in the CU can be spliced into a reconstructed image of the CU.
[0219] Figure 4a The figure is a schematic diagram of an exemplary encoding process.
[0220] Reference Figure 4a , for example, after the image to be encoded is input into the encoder, the encoder can divide the image to be encoded into multiple coding units (CodingUnit, CU), for example, CU1, CU2, ... Then, after performing prediction, quantization and entropy coding operations on CU1 in sequence, the bit stream of CU1 can be obtained; after performing prediction, quantization and entropy coding operations on CU2 in sequence, the bit stream of CU2 can be obtained; and so on, after completing the encoding of all CUs of the image to be encoded, the bit streams of all CUs are connected in series to obtain the bit stream of the image to be encoded.
[0221] In the process of encoding CU1, quantization can be performed according to preset quantization parameters. In the process of encoding other subsequent CUs, the complexity information (such as complexity level) of the current CU can be determined based on the image content of the current CU. Then, based on the number of coded bits of the previous CU and the complexity level of the current CU, rate control is performed (that is, based on the analysis of the number of coded bits of the previous CU and the complexity level of the current CU, the output bit rate is adjusted by changing the quantization parameters of the coding, the coding mode, etc.) to obtain the quantization parameters. Afterwards, the quantization module can perform quantization based on the quantization parameters determined by the rate control. In the process of encoding other subsequent CUs, the complexity information of the current CU can be determined based on the image content of the current CU. Then, based on the number of coded bits of the previous CU and the complexity level of the current CU, the rate control is performed to obtain the quantization parameters.
[0222] The following takes a CU whose prediction mode is the IBC mode as an example to illustrate the encoding process.
[0223] Figure 4b FIG. 1 is a schematic diagram of an exemplary encoding process.
[0224] S401, obtaining a coding unit CU and dividing the CU into a plurality of sub-blocks, wherein the prediction mode of the CU is an IBC mode.
[0225] For example, for a CU whose prediction mode is IBC mode, the encoder may divide the CU into multiple sub-blocks; the present application does not limit the number of sub-blocks and the size of the sub-blocks. For example, the decoder may divide the CU into multiple sub-blocks of the same size.
[0226] The following description takes one sub-block as an example.
[0227] S402: for the current sub-block, determine whether to use the DP prediction mode instead of the IBC mode.
[0228] Exemplarily, for the current sub-block, it can be determined whether to still use the IBC mode for intra-frame prediction or to use the DP prediction mode for intra-frame prediction, that is, to determine whether to use the DP prediction mode to replace the IBC mode.
[0229] In a possible manner, S402 may include the following S4021 to S4022:
[0230] S4021, determine the flatness of the current sub-block.
[0231] In one possible manner, the difference between the original value of all non-upper left corner pixels in the current sub-block and the original value of the upper left corner pixel can be calculated to obtain multiple difference values; and the absolute values of the multiple difference values are added to obtain the first intermediate information. Figure 4c In the current sub-block, the upper left pixel is "1", and the non-upper left pixels are "2", "3" and "4".
[0232] In one possible manner, the difference between the original value of each pixel in the current sub-block and the average original value of all pixels in the current sub-block can be calculated to obtain multiple differences; the absolute values of the multiple differences are added to obtain the first intermediate information.
[0233] Exemplarily, when the first intermediate information is less than the flatness threshold TH4, the flatness of the current sub-block can be set to 0; otherwise, the flatness of the current sub-block is set to 2. Wherein, TH4 = X6 × (1 << (BitDepth-8)) × the number of pixels contained in the sub-block. Wherein, X6 represents the difference between the original values of two adjacent pixels, and X6 can be set as required, for example, X6 = 2.
[0234] S4022: Based on the flatness of the current sub-block and the second preset information, determine whether to use the DP prediction mode instead of the IBC mode.
[0235] Exemplarily, IBC prediction may be performed on the current sub-block to determine a reference block; then, the sum of absolute errors between the current sub-block and the reference block is calculated to obtain SDA_IBC.
[0236] Exemplarily, the IBC preset means taking the left area of the current sub-block as the search area, searching for a reference block matching the current sub-block from the search area; and determining the prediction value of the current sub-block based on the reconstruction value of the reference block matching the current sub-block. Exemplarily, the reconstruction value of the reference block matching the current sub-block can be used as the prediction value of the current sub-block.
[0237] Reference Figure 4c , exemplary, Figure 4cThe size of each sub-block is 2*2; the gray sub-block is the encoded sub-block, the white sub-block is the uncoded sub-block, and the sub-block in the dotted box is the current sub-block; wherein, the area to the left of the current sub-block can be used as the search area.
[0238] Exemplarily, the search area may include n candidate reference blocks (n can be set as required, and the present application does not impose any restrictions on this). Among them, the vector absolute value offset value between the first candidate reference block and the current sub-block can be set to X1 (the first candidate reference block can be called the candidate reference block corresponding to X1); the vector absolute value offset value between the second candidate reference block and the current sub-block can be set to X2 (the second candidate reference block can be called the candidate reference block corresponding to X2); and so on, the vector absolute value offset value between the nth candidate reference block and the current sub-block can be set to Xn (the nth candidate reference block can be called the candidate reference block corresponding to Xn). It should be understood that the n values of X1~Xn can be set as required, and X1~Xn are all different. For example, X1=1, X2=2,..., Xn=n.
[0239] Exemplarily, the sum of absolute errors between the candidate reference block corresponding to X1 and the current sub-block can be calculated to obtain SDA_X1; the sum of absolute errors between the candidate reference block corresponding to X2 and the current sub-block can be calculated to obtain SDA_X2; ...; and the sum of absolute errors between the candidate reference block corresponding to Xn and the current sub-block can be calculated to obtain SDA_Xn. Then, according to SDA_X1, SDA_X2, ..., SDA_Xn, the second preset information can be selected from the range of X1 to Xn. Specifically, SDA_X1, SDA_X2, ..., SDA_Xn can be compared to select the candidate reference block with the smallest sum of absolute errors as the reference block. Assuming that the SDA_Xm of the mth (m∈[1,n], m is an integer) candidate reference block is the smallest, then Xm is selected from the range of X1 to Xn as the second preset information, that is, the second preset information = Xm.
[0240] Exemplarily, it is determined whether the second preset information is greater than a threshold value, and whether the flatness of the current sub-block is equal to 0. When the second preset information is greater than the threshold value, and the flatness of the current sub-block is equal to 0, it is determined that the DP prediction mode is used to replace the IBC mode for the current sub-block. If the second preset information is less than or equal to the threshold value, and / or the flatness of the current sub-block is not equal to 0, it is determined that the DP prediction mode is not used to replace the IBC mode for the current sub-block.
[0241] The threshold may refer to the upper limit of the prediction residual of the sub-block under IBC prediction, and TH5 may be used; wherein TH5 = X7 × (1 << (BitDepth–8)) × the number of pixels contained in the sub-block. X7 is used to indicate the upper limit of the distance between the predicted value and the original value of each pixel in the sub-block; it may be set according to the requirements, and this application does not limit this.
[0242] Exemplarily, when it is determined that the DP prediction mode is used to replace the IBC mode for the current sub-block, S403 may be executed; when it is determined that the DP prediction mode is not used to replace the IBC mode for the current sub-block, S405 may be executed.
[0243] S403: Set the BV of the current sub-block to first preset information.
[0244] Exemplarily, for the current sub-block, when it is determined to use the DP prediction mode instead of the IBC mode, the BV of the current sub-block can be set to the first preset information; in this case, the BV set to the first preset information can be used to indicate that the prediction mode of the current sub-block is the DP prediction mode.
[0245] S404: Set the prediction value of the current sub-block as the first prediction value.
[0246] For example, when it is determined to use the DP prediction mode instead of the IBC mode for the current sub-block, DP prediction can be performed on the current sub-block to obtain a first prediction value (also referred to as a difference prediction value). Specific details can be referred to in the above description, which will not be repeated here.
[0247] It should be noted that the present application does not limit the execution order of S403 and S404.
[0248] S405: Set the block vector BV of the current sub-block to second preset information.
[0249] Exemplarily, for the current sub-block, when it is determined that the DP prediction mode is not used to replace the IBC mode, the vector absolute value offset value between the current sub-block and the reference block (which can be represented by the second preset information) can be used as the BV of the current sub-block. The reference block is determined by performing IBC prediction on the current sub-block. In this case, the BV set as the second preset information can be used to indicate that the prediction mode of the current sub-block is the IBC mode.
[0250] The second preset information may be obtained by calculating the absolute value of the difference between the horizontal coordinate of the current sub-block and the horizontal coordinate of the reference block.
[0251] S406: Set the prediction value of the current sub-block as the second prediction value.
[0252] Exemplarily, for the current sub-block, when it is determined that the DP prediction mode is not to be used instead of the IBC mode, the prediction value of the current sub-block can be set to the second prediction value. In the process of S402, the candidate reference block with the smallest absolute error is selected from SDA_X1, SDA_X2, ..., SDA_Xn as the reference block. Then, the reconstructed value of the reference block can be determined as the second prediction value.
[0253] It should be noted that the second preset information is different from the first preset information.
[0254] It should be noted that the present application does not limit the execution order of S405 and S406.
[0255] S407 , encoding the current sub-block based on the prediction value of the current sub-block to obtain a bit stream of the current sub-block.
[0256] Exemplarily, a prediction residual between a prediction value of a current sub-block and the current sub-block may be calculated; then, the prediction residual may be quantized based on a quantization parameter; thereafter, the quantized prediction residual may be entropy encoded to obtain a bit stream of the current sub-block.
[0257] S408, writing the BV of the current sub-block into the bit stream.
[0258] S409: When it is determined that the DP prediction mode is used instead of the IBC mode, the differential prediction value is written into the bitstream.
[0259] Exemplarily, in order to enable the decoding end to determine the prediction mode of the current sub-block, the BV of the current sub-block may be written into the bitstream.
[0260] Exemplarily, when the prediction value of the current sub-block is determined based on DP prediction, since the prediction value of the current sub-block is determined based on the original value of the pixel in the current sub-block, the prediction value of the current sub-block (i.e., the difference prediction value) can be written into the bitstream.
[0261] Exemplarily, when the prediction value of the current sub-block is determined based on the intra prediction corresponding to the CU, it is not necessary to write the prediction value of the current sub-block into the bitstream.
[0262] Exemplarily, the bit streams of multiple sub-blocks included in a CU may be concatenated into the bit stream of the CU.
[0263] Figure 5a FIG. 4 is a schematic diagram of an exemplary decoding process.
[0264] Reference Figure 5aFor example, after the bit stream of CU1 is input to the decoder, the decoder can perform entropy decoding, dequantization, prediction and other operations in sequence, and output the reconstructed image of CU1. Then, after the bit stream of CU2 is input to the encoder, the decoder can perform entropy decoding, dequantization, prediction and other operations in sequence, and output the reconstructed image of CU2; and so on, after completing the decoding of all CUs of the same image, the reconstructed images of all CUs can be spliced to obtain a complete image.
[0265] Among them, in the process of decoding CU1, inverse quantization can be performed according to the preset quantization parameter; in the process of decoding other subsequent CUs, rate control can be performed based on the complexity information (such as complexity level) obtained by entropy decoding from the bit stream of the current CU and the number of encoding bits of the previous CU to determine the quantization parameter; thereafter, the inverse quantization module can perform inverse quantization based on the quantization parameter determined by the rate control.
[0266] The decoding process is described below by taking a sub-block of a CU whose prediction mode is the IBC mode as an example.
[0267] Figure 5b FIG. 1 is a schematic diagram of an exemplary decoding process. Figure 5b The decoding process and Figure 4b The encoding process corresponds to .
[0268] S501, receiving a bit stream.
[0269] S502, parse the BV of the current sub-block from the bit stream, and the intra prediction mode of the coding unit CU to which the current sub-block belongs is the block copy intra prediction IBC mode.
[0270] Exemplarily, the encoder writes the BV of the current sub-block into the bitstream, and then, after receiving the bitstream, the decoder can parse (ie, entropy decode) the BV of the current sub-block from the bitstream.
[0271] S503 : for the current sub-block, determine whether to use the difference prediction mode instead of the IBC mode based on the BV of the current sub-block.
[0272] Exemplarily, since the encoder nests the DP coding mode in the IBC mode, after the decoder parses the BV of the current sub-block from the bit stream, it can determine whether the prediction mode of the current sub-block is the IBC mode or the DP prediction mode based on the BV of the current sub-block; that is, for the current sub-block, determine whether to use DP prediction instead of IBC prediction.
[0273] Exemplarily, by determining that the BV of the current sub-block is the first preset information, it can be determined whether to use DP prediction instead of IBC prediction for the current sub-block. If the BV of the current sub-block is the first preset information, it can be determined that the prediction mode of the current sub-block is the DP prediction mode, that is, for the current sub-block, it is determined to use DP prediction instead of IBC prediction. If the BV of the current sub-block is not the first preset information, it can be determined that the BV of the current sub-block is the second preset information. At this time, it can be determined that the prediction mode of the current sub-block is the IBC mode, that is, for the current sub-block, it is determined not to use DP prediction instead of IBC prediction.
[0274] S504: Use the difference prediction value obtained by entropy decoding from the bit stream as the prediction value of the current sub-block.
[0275] Exemplarily, if the BV of the current sub-block is the first preset information, the DP prediction can be performed on the current sub-block to obtain the prediction value of the current sub-block. Specifically, the difference prediction value can be obtained from the entropy decoding of the bit stream, and then the difference prediction value can be used as the prediction value of the current sub-block.
[0276] S505 , performing IBC prediction on the current sub-block based on the BV of the current sub-block to obtain a prediction value of the current sub-block.
[0277] Exemplarily, if the BV of the current sub-block is the second preset information, IBC prediction may be performed on the current sub-block based on the second preset information to obtain a predicted value of the current sub-block.
[0278] Exemplarily, based on the position coordinates of the current subblock and the second preset information, a reference block of the current subblock may be determined from the decoded subblocks; and a reconstructed value of the reference block of the current subblock may be used as a prediction value of the current subblock.
[0279] S506: reconstruct the current sub-block based on the predicted value of the current sub-block to obtain a reconstructed block of the current sub-block.
[0280] Exemplarily, after receiving the bit stream, the decoder can also parse (i.e., entropy decoding) the bit stream to obtain a quantized prediction residual; then, the quantized prediction residual is dequantized to obtain a prediction residual of the current sub-block. After that, the prediction value of the current sub-block can be added to the prediction residual of the current sub-block to obtain a reconstructed block of the current sub-block.
[0281] Exemplarily, the reconstructed blocks of multiple sub-blocks included in the CU can be spliced into a reconstructed image of the CU.
[0282] In this way, according to Figure 4b The encoding method in the embodiment and Figure 5bThe decoding method in is used for encoding and decoding, which does not increase the bit rate or the search area, and can also increase the flexibility of coding unit prediction, achieve finer-grained prediction, improve prediction accuracy, and thus improve compression efficiency.
[0283] It should be understood that when the prediction mode of the CU is the IBC mode, in the encoding and decoding process of the sub-block whose prediction mode is the DP prediction mode in the CU, the first quantization parameter can also be determined in accordance with the method in the above embodiment; then quantization or dequantization is performed based on the first quantization parameter; the present application does not limit the method for determining the quantization parameter in the encoding and decoding process when the prediction mode of the CU is the IBC mode.
[0284] In one example, Figure 6 A schematic block diagram of a device 600 according to an embodiment of the present application is shown. The device 600 may include: a processor 601 and a transceiver / transceiver pin 602 , and optionally, a memory 603 .
[0285] The components of the device 600 are coupled together via a bus 604, wherein the bus 604 includes a power bus, a control bus, and a status signal bus in addition to a data bus. However, for the sake of clarity, all buses are referred to as bus 604 in the figure.
[0286] Optionally, the memory 603 may be used to store instructions in the aforementioned method embodiment. The processor 601 may be used to execute instructions in the memory 603, and control the receiving pin to receive a signal, and control the sending pin to send a signal.
[0287] The apparatus 600 may be the electronic device or a chip of the electronic device in the above method embodiment.
[0288] Exemplarily, the electronic device may be a terminal device or a server.
[0289] Among them, all relevant contents of each step involved in the above method embodiment can be referred to the functional description of the corresponding functional module, and will not be repeated here.
[0290] The embodiment of the present application also provides a chip, including one or more interface circuits and one or more processors; the one or more processors receive or send data through the one or more interface circuits, and when the one or more processors execute computer instructions, the electronic device implements the encoding and decoding method in the above embodiment in the above related method steps. The interface circuit is a transceiver / transceiver pin 602.
[0291] This embodiment further provides a computer-readable storage medium, in which computer instructions are stored. When the computer instructions are executed on an electronic device, the electronic device executes the above-mentioned related method steps to implement the encoding and decoding method in the above-mentioned embodiment.
[0292] This embodiment further provides a computer program product, which includes computer instructions. When the computer instructions are executed by a computer or a processor, the computer executes the above-mentioned related steps to implement the encoding and decoding method in the above-mentioned embodiment.
[0293] In addition, an embodiment of the present application also provides a device, which can specifically be a chip, component or module, and the device may include a connected processor and memory; wherein the memory is used to store computer-executable instructions, and when the device is running, the processor can execute the computer-executable instructions stored in the memory so that the chip executes the encoding and decoding methods in the above-mentioned method embodiments.
[0294] Among them, the electronic device, computer-readable storage medium, computer program product or chip provided in this embodiment are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above and will not be repeated here.
[0295] Through the description of the above implementation methods, technical personnel in the relevant field can understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0296] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0297] The units described as separate components may or may not be physically separated, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0298] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0299] Any content of each embodiment of the present application, as well as any content of the same embodiment, can be freely combined. Any combination of the above content is within the scope of the present application.
[0300] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.
[0301] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
[0302] The steps of the method or algorithm described in conjunction with the disclosure of the embodiments of the present application can be implemented in a hardware manner, or can be implemented by a processor executing a software instruction. The software instruction can be composed of corresponding software modules, and the software module can be stored in a random access memory (Random Access Memory, RAM), a flash memory, a read-only memory (Read Only Memory, ROM), an erasable programmable read-only memory (Erasable Programmable ROM, EPROM), an electrically erasable programmable read-only memory (Electrically EPROM, EEPROM), a register, a hard disk, a mobile hard disk, a read-only compact disk (CD-ROM) or any other form of storage medium known in the art. An exemplary storage medium is coupled to a processor so that the processor can read information from the storage medium and can write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an ASIC.
[0303] Those skilled in the art should be aware that in one or more of the above examples, the functions described in the embodiments of the present application can be implemented with hardware, software, firmware, or any combination thereof. When implemented using software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium. Computer-readable media include computer-readable storage media and communication media, wherein the communication media include any media that facilitates the transmission of a computer program from one place to another. The storage medium can be any available medium that a general or special-purpose computer can access.
[0304] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A decoding method, characterized in that: The method comprises: Receive a bit stream, and entropy decode from the bit stream to obtain preset mode indication information of a current sub-block and a first encoding code length corresponding to a prediction residual of the current sub-block; Based on the first encoding code length, entropy decoding the quantized prediction residual of the current sub-block from the bit stream; For the current sub-block, based on the preset mode indication information of the current sub-block, determining whether to use the difference prediction mode to replace the intra prediction mode corresponding to the coding unit CU to which the current sub-block belongs; If so, performing difference prediction on the current sub-block to obtain a prediction value of the current sub-block; determining a first quantization parameter based on a preset constraint mode for the first encoding code length; and dequantizing the quantized prediction residual based on the first quantization parameter to obtain a prediction residual of the current sub-block; If not, performing intra-frame prediction based on the intra-frame prediction mode corresponding to the CU to obtain a prediction value of the current sub-block; dequantizing the quantized prediction residual based on the second quantization parameter corresponding to the CU to obtain a prediction residual of the current sub-block; The prediction residual of the current sub-block is added to the prediction value of the current sub-block to obtain a reconstructed block of the current sub-block.
2. The method according to claim 1, characterized in that The determining the first quantization parameter based on a preset constraint mode for the first encoding code length includes: When the preset constraint mode is the first constraint mode, determining the first quantization parameter based on a target encoding bit rate of the current sub-block obtained by entropy decoding from the bit stream, a bit depth of an image to which the current sub-block belongs, and a second encoding code length corresponding to a predicted value of the current sub-block; When the preset constraint mode is the second constraint mode, using the second quantization parameter as the first quantization parameter; When the preset constraint mode is the third constraint mode, a truncation range of the prediction residual of the current sub-block is determined, and the first quantization parameter is determined based on the truncation range.
3. The method according to claim 1 or 2, characterized in that: The preset mode indication information includes: first indication information and second indication information; the determining, for the current sub-block, based on the preset mode indication information of the current sub-block, whether to use the difference prediction mode to replace the intra prediction mode corresponding to the coding unit CU to which the current sub-block belongs, includes: Based on the first indication information, determining whether the CU includes a sub-block whose prediction mode is a difference prediction mode; When it is determined that the CU includes a subblock whose prediction mode is a difference prediction mode, for the current subblock, it is determined based on the second indication information whether to use the difference prediction mode to replace the intra prediction mode corresponding to the CU.
4. The method according to claim 1 or 2, characterized in that: The other intra prediction mode is a block copy intra prediction IBC mode, and the preset mode indication information is a block vector BV.
5. A coding method, characterized in that: The method comprises: Obtain a coding unit CU and divide the CU into a plurality of sub-blocks; For the current sub-block, determine whether to use the difference prediction mode to replace the intra prediction mode corresponding to the CU; If yes, setting the preset mode indication information of the current sub-block to the first preset information, and performing the difference prediction to determine the prediction value of the current sub-block; determining the prediction value of the current sub-block and the prediction residual of the current sub-block; determining a first quantization parameter based on a preset constraint mode of a first encoding code length, the first encoding code length corresponding to the prediction residual of the current sub-block; quantizing the prediction residual of the current sub-block based on the first quantization parameter; performing entropy coding on the quantized prediction residual of the current sub-block to obtain a bit stream of the current sub-block; If not, setting the preset mode indication information of the current sub-block to the second preset information, and performing intra-frame prediction corresponding to the CU to determine a prediction value of the current sub-block; determining a prediction value of the current sub-block and a prediction residual of the current sub-block; quantizing the prediction residual of the current sub-block based on a second quantization parameter corresponding to the CU; and entropy encoding the quantized prediction residual of the current sub-block to obtain a bit stream of the current sub-block; The preset mode indication information and a first encoding code length corresponding to the prediction residual of the current sub-block are written into the bit stream.
6. The method according to claim 5, characterized in that When determining, for the current sub-block, to use the difference prediction mode to replace the intra prediction mode corresponding to the CU, the method further includes: Truncating the prediction residual of the current sub-block; The quantizing the prediction residual of the current sub-block based on the first quantization parameter includes: The truncated prediction residual of the current sub-block is quantized based on the first quantization parameter.
7. The method according to claim 6, characterized in that The truncating the prediction residual of the current sub-block includes: Determine a truncation range based on a target encoding rate of the current sub-block, a bit depth of an image where the current sub-block is located, and a second encoding code length corresponding to a predicted value of the current sub-block; Based on the truncation range, the prediction residual of the current sub-block is truncated.
8. The method according to any one of claims 5 to 7, characterized in that: The determining of the first quantization parameter based on the preset constraint mode of the first encoding code length includes: When the preset constraint mode is the first constraint mode, determining the first quantization parameter based on a target encoding bit rate of the current sub-block, a bit depth of an image to which the current sub-block belongs, and a second encoding code length corresponding to a predicted value of the current sub-block; When the preset constraint mode is the second constraint mode, using the second quantization parameter as the first quantization parameter; When the preset constraint mode is the third constraint mode, the first quantization parameter is determined based on a truncation range of the prediction residual of the current sub-block.
9. The method according to claim 7 or 8, characterized in that: The method further comprises: The target encoding rate of the current sub-block, the bit depth of the image where the current sub-block is located, and the second encoding code length corresponding to the prediction value of the current sub-block are written into the bit stream of the current sub-block.
10. The method according to any one of claims 5 to 9, characterized in that: The determining, for the current sub-block, whether to use the difference prediction mode to replace the intra prediction mode corresponding to the CU includes: Determining the flatness of the current sub-block; According to the flatness of the current sub-block, it is determined whether to use the difference prediction mode to replace the intra prediction mode corresponding to the CU.
11. The method according to claim 10, characterized in that The determining the flatness of the current sub-block includes: The flatness of the current sub-block is determined based on original values of pixels in the current sub-block.
12. The method according to any one of claims 5 to 11, characterized in that The other intra prediction mode is a block copy intra prediction IBC mode, and the preset mode indication information is a block vector BV; Among them, the BV set to the first preset information is used to indicate that the prediction mode of the current sub-block is the difference prediction mode; the BV set to the second preset information is used to indicate that the prediction mode of the current sub-block is the IBC mode, and the second preset information is the vector absolute value offset value between the current sub-block and the reference block, and the reference block is determined based on the IBC prediction.
13. A decoding method, characterized in that: The method comprises: receiving a bit stream; Obtaining a block vector BV of a current sub-block by entropy decoding from the bit stream, wherein the prediction mode of a coding unit CU to which the current sub-block belongs is a block copy intra prediction IBC mode; For the current sub-block, judging whether to adopt the difference prediction mode to replace the IBC mode based on the BV of the current sub-block; If yes, using the difference prediction value obtained by entropy decoding from the bit stream as the prediction value of the current sub-block; If not, performing IBC prediction on the current sub-block based on the BV of the current sub-block to obtain a predicted value of the current sub-block; The current sub-block is reconstructed based on the prediction value of the current sub-block to obtain a reconstructed block of the current sub-block.
14. A coding method, characterized in that: The method comprises: Obtain a coding unit CU and divide the CU into a plurality of sub-blocks, wherein the prediction mode of the CU is a block copy intra prediction IBC mode; For the current sub-block, determining whether to adopt the difference prediction mode to replace the IBC mode; If yes, the block vector BV of the current sub-block is set to the first preset information, and the prediction value of the current sub-block is set to the first prediction value; the BV set to the first preset information is used to indicate that the prediction mode of the current sub-block is the difference prediction mode, and the first prediction value is a difference prediction value determined based on the difference prediction; If not, the BV of the current sub-block is set to the second preset information, and the prediction value of the current sub-block is set to the second prediction value; the BV set to the second preset information is used to indicate that the prediction mode of the current sub-block is the IBC mode, the second preset information is the vector absolute value offset value between the current sub-block and the reference block, and the reference block and the second prediction value are determined based on the IBC prediction; Encoding the current sub-block based on the prediction value of the current sub-block to obtain a bit stream of the current sub-block; The BV of the current sub-block is written into a bitstream of the current sub-block, and when it is determined to adopt the differential prediction mode instead of the IBC mode, the differential prediction value is written into the bitstream.
15. The method according to claim 14, characterized in that The determining, for the current sub-block, whether to use the difference prediction mode to replace the IBC mode includes: Determining the flatness of the current sub-block; For the current sub-block, based on the flatness of the current sub-block and the second preset information, it is determined whether to adopt the difference prediction mode to replace the IBC mode.
16. The method according to claim 15, characterized in that The determining the flatness of the current sub-block includes: The flatness of the current sub-block is determined based on original values of pixels in the current sub-block.
17. An electronic device, characterized in that: include: a memory and a processor, the memory being coupled to the processor; The memory stores program instructions, and when the program instructions are executed by the processor, the electronic device executes the decoding method according to any one of claims 1 to 4, or executes the decoding method according to claim 13.
18. An electronic device, characterized in that: include: a memory and a processor, the memory being coupled to the processor; The memory stores program instructions, and when the program instructions are executed by the processor, the electronic device executes the encoding method according to any one of claims 5 to 12, or executes the encoding method according to any one of claims 14 to 16.
19. A chip, characterized in that: It comprises one or more interface circuits and one or more processors; the one or more processors receive or send data through the one or more interface circuits, and when the one or more processors execute computer instructions, the electronic device executes the decoding method as described in any one of claims 1 to 4, or executes the decoding method as described in claim 13.
20. A chip, characterized in that: The electronic device comprises one or more interface circuits and one or more processors; the one or more processors receive or send data through the one or more interface circuits, and when the one or more processors execute computer instructions, the electronic device executes the encoding method as described in any one of claims 5 to 12, or executes the encoding method as described in any one of claims 14 to 16.
21. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program runs on a computer or a processor, the computer or the processor executes the method according to any one of claims 1 to 16.
22. A computer program product, characterized in that The computer program product comprises computer instructions, and when the computer instructions are executed by a computer or a processor, the steps of the method according to any one of claims 1 to 16 are performed.
23. A device for storing a bit stream, characterized in that: The device comprises: a receiver and at least one storage medium, The receiver is used to receive a bit stream; The at least one storage medium is used to store the bit stream; The bit stream is generated according to the encoding method according to any one of claims 5 to 12, or the encoding method according to any one of claims 14 to 16.
24. A device for transmitting a bit stream, characterized in that: The device comprises: a transmitter and at least one storage medium, The at least one storage medium is used to store a bit stream, wherein the bit stream is generated according to the encoding method according to any one of claims 5 to 12, or the encoding method according to any one of claims 14 to 16; The transmitter is used to obtain the bit stream from the storage medium and send the bit stream to the terminal side device through a transmission medium.
25. A system for distributing a bit stream, characterized in that The system comprises: At least one storage medium for storing at least one bit stream, wherein the at least one bit stream is generated according to the encoding method according to any one of claims 5 to 12, or the encoding method according to any one of claims 14 to 16; The streaming media device is used to obtain a target bit stream from the at least one storage medium and send the target bit stream to a terminal side device, wherein the streaming media device includes a content server or a content distribution server.
Citation Information
Cited By
Coding method, decoding method, and electronic device
EP4664883A1
Coding method, decoding method, and electronic device
WO2024188145A1
