Coding method, decoding method, and electronic device
By nesting other intra prediction modes in the block copy intra prediction mode, and using block vectors to determine the prediction mode, the problem of high search cost for the coding unit in the block copy intra prediction mode is solved, and the compression performance and prediction accuracy are improved.
Patent Information
- Application Number
- PCT/CN2024/080497
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-03-13
- Filing Date
- 2024-03-07
- Publication Date
- 2024-09-19
AI Technical Summary
In the prior art, coding units whose prediction mode is block copy intra prediction mode have high search costs during the encoding process, resulting in poor compression performance.
Nest other intra prediction modes in the block copy intra prediction mode, and use the block vector (BV) to determine whether to use other intra prediction modes to reduce search costs and improve compression performance.
By nesting other intra prediction modes, the search cost in the encoding process is reduced, and the prediction accuracy and compression performance are improved without increasing the code rate or search area.
Smart Images

Figure CN2024080497_19092024_PF_FP_ABST
Abstract
Description
Coding and decoding method and electronic device
[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office of China on March 13, 2023, with application number 202310284038.5 and application name “Encoding and Decoding Method and Electronic Device”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] 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
[0003] The encoding process typically includes operations such as prediction, quantization, and entropy coding. Prediction is often used to remove redundant information from images or videos to facilitate compression; therefore, improving prediction accuracy is one way to improve compression performance.
[0004] Since a coding unit may contain sub-blocks with different content characteristics (such as different texture directions), if the same intra-frame prediction mode is used for all sub-blocks in the coding unit, the prediction effect of some sub-blocks may be poor. Therefore, the existing technology proposes a solution of increasing the search area for coding units with the intra block copy (IBC) mode to improve the prediction effect of each sub-block in the coding block, but the search cost is high.
[0005] Summary of the Invention
[0006] In order to solve the above technical problems, the present application provides a coding and decoding method that can reduce the search cost in the prediction process and improve the compression performance.
[0007] It should be noted that the present application is a coding and decoding method for CU whose prediction mode is IBC mode; by extending the function of the block vector (BV) of each sub-block, other intra-frame prediction modes are nested in the IBC mode; so as to reduce the search cost in the prediction process and improve the compression performance.
[0008] In a first aspect, an embodiment of the present application provides a decoding method, which includes: receiving a bit stream; then, parsing 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; then, for the current sub-block, judging whether to use other intra-frame prediction modes to replace the IBC mode based on the BV of the current sub-block; if so, performing other intra-frame predictions on the current sub-block to obtain a 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; thereafter, 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.
[0009] In other words, BV can not only be the vector absolute value offset between the sub-block and the corresponding reference block, but can also 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 whose prediction mode is IBC mode, this application nests other intra-frame prediction modes in IBC mode without increasing the bit rate or the search area for IBC prediction. In addition, it can also increase the flexibility of coding unit prediction, achieve more fine-grained prediction, improve prediction accuracy, and thus improve compression performance.
[0010] Exemplarily, IBC prediction involves searching for a reference block matching the current sub-block in the search area to the left of the current sub-block; and determining a prediction value for the current sub-block based on a reconstructed value of the reference block matching the current sub-block. Exemplarily, the reconstructed value of the reference block matching the current sub-block can be used as the prediction value for the current sub-block.
[0011] Exemplarily, other intra prediction modes may refer to intra prediction modes other than the IBC mode.
[0012] It should be noted that the other intra-frame prediction modes in this application refer to modes in which the encoding end does not need to transmit additional information, and the decoding end can implement intra-frame prediction using decoded information and pre-agreed parameters.
[0013] Exemplarily, the quantized prediction residual of the current sub-block can also be parsed from the bit stream; then, the quantized prediction residual of the current sub-block is inversely quantized to obtain the prediction residual of the current sub-block; then, the prediction value of the current sub-block and the residual of the current sub-block are added to obtain the reconstructed block of the current sub-block.
[0014] Exemplarily, for the current sub-block, when it is determined not to use other intra-frame prediction modes to replace the IBC mode, the reference block of the current sub-block can be determined based on the BV of the current sub-block and the position of the current sub-block; and then the prediction value of the current sub-block can be determined based on the reconstructed value of the reference block of the current sub-block.
[0015] Exemplarily, the BV set to the first preset information can be used to indicate that the prediction mode of the current sub-block is other intra-frame prediction modes; the BV set to the second preset information can be used to indicate that the prediction mode of the current sub-block is the IBC mode; and then, by judging whether the BV of the current sub-block is the first preset information, it can be judged whether to use other intra-frame prediction modes to replace the IBC mode for the current sub-block. If the BV of the current sub-block is the first preset information, then for the current sub-block, it is determined to use other intra-frame prediction modes to replace the IBC mode. If the BV of the current sub-block is not the first preset information, that is, when the BV of the current sub-block is the second preset information, then for the current sub-block, it is determined not to use other intra-frame prediction modes to replace the IBC mode.
[0016] Exemplarily, the reconstructed blocks of multiple sub-blocks may be concatenated into a reconstructed block of a CU.
[0017] According to the first aspect, the other intra-frame prediction mode is a vertical prediction mode, and performing other intra-frame prediction on the current sub-block to obtain a predicted value of the current sub-block includes: performing vertical prediction on the current sub-block to obtain a predicted value of the current sub-block. In this way, the vertical prediction mode can be nested in the IBC mode.
[0018] According to the first aspect, or any implementation method of the first aspect above, other intra-frame predictions are performed on the current sub-block to obtain a prediction value of the current sub-block, including: selecting other intra-frame prediction modes corresponding to the BV of the current sub-block from R other intra-frame prediction modes; and performing intra-frame prediction on the current sub-block based on the other intra-frame prediction modes corresponding to the BV of the current sub-block to obtain a prediction value of the current sub-block.
[0019] In this way, when the encoding end performs intra-frame prediction on the current sub-block based on one of the R other intra-frame prediction modes, the decoding end can select the other intra-frame prediction mode corresponding to the encoding end from the R other intra-frame prediction modes based on the BV of the current sub-block for intra-frame prediction.
[0020] For example, the encoder may use one of the vertical prediction mode, the angular prediction mode, or the direct current (DC) prediction mode to perform intra-frame prediction on the current sub-block. When the encoder performs vertical prediction on the current sub-block, the decoder may also perform vertical prediction on the current sub-block. When the encoder performs angular prediction on the current sub-block, the decoder may also perform angular prediction on the current sub-block. When the encoder performs DC prediction on the current sub-block, the decoder may also perform DC prediction on the current sub-block.
[0021] According to the first aspect, or any implementation of the first aspect above, when it is determined that another intra-frame prediction mode is used to replace the IBC mode for the current sub-block, the method further includes: determining the flatness of the current sub-block; determining a quantization parameter QP_intra corresponding to the current sub-block based on the flatness of the current sub-block; 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, including: based on the quantization parameter QP_intra corresponding to the current sub-block, dequantizing the quantized prediction residual obtained by parsing in the bitstream to obtain a prediction residual of the current sub-block; and adding the prediction value of the current sub-block and the prediction residual of the current sub-block to obtain the reconstructed block of the current sub-block.
[0022] That is to say, in the process of decoding the sub-blocks in the CU that use other intra-frame prediction modes instead of the IBC mode, the quantization parameter QP_intra determined based on the flatness of the current sub-block is used for inverse quantization; in this way, the subjective quality of the sub-blocks that use other intra-frame prediction modes instead of the IBC mode can be improved.
[0023] According to the first aspect, or any implementation of the first aspect above, determining the quantization parameter QP_intra corresponding to the current sub-block based on the flatness of the current sub-block includes: parsing the complexity information of the CU from the bitstream and determining the quantization parameter QP_IBC corresponding to the CU; determining the quantization parameter QP_intra corresponding to the current sub-block based on the flatness, complexity information and quantization parameter QP_IBC of the current sub-block.
[0024] Exemplarily, the quantization parameter QP_IBC corresponding to the CU may be determined by a rate control module in the decoder.
[0025] In one possible approach, the rate control module may perform rate control according to the number of coded bits of the previous CU (or buffer fullness) and output a quantization parameter QP_IBC.
[0026] In one possible approach, the rate control module may perform rate control and output a quantization parameter QP_IBC based on the number of coded bits of the previous CU (or buffer fullness) and the complexity information of the current CU.
[0027] That is to say, this application does not limit the way in which the rate control module determines the quantization parameter QP_IBC.
[0028] 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.
[0029] Exemplarily, the number of coded bits of the previous CU may be obtained during the process of entropy decoding the bit stream of the previous CU.
[0030] According to the first aspect, or any implementation of the first aspect above, determining a quantization parameter QP_intra corresponding to the current sub-block based on the flatness, complexity information, and quantization parameter QP_IBC of the current sub-block includes: when the flatness and complexity information of the current sub-block meet a first preset condition, determining the quantization parameter QP_intra corresponding to the current sub-block based on the quantization parameter QP_IBC and a first preset step size; when the flatness and complexity information of the current sub-block meet a second preset condition, determining the quantization parameter QP_intra corresponding to the current sub-block based on the quantization parameter QP_IBC and the second preset step size; and when the flatness and complexity information of the current sub-block meet a third preset condition, using the quantization parameter QP_IBC as the quantization parameter QP_intra corresponding to the current sub-block.
[0031] For example, the first preset condition is: the flatness is less than or equal to (QpRefineTh0<<(bdIdx>>1)), and the complexity level of the coding unit is greater than or equal to BwqComplexTh; the first quantization parameter is determined as follows: QP_intra=Max(QP_IBC-S0,0). Among them, QpRefineTh0 is the 0th gradient threshold for quantization parameter adjustment, BwqComplexTh is the complexity threshold for sub-block quantization parameter adjustment, S0 is the adjustment step corresponding to the 0th gradient threshold (that is, the first preset step, for example, S0=2), bdIdx=Clip3(0,S2,BitDepth-S3), BitDepth is the bit depth of the image. Among them, S2 represents the maximum bit depth difference, for example, S2=8; it can be set according to requirements, and this application does not impose any restrictions on this. In addition, S3 can be preset according to requirements, and this application does not impose any restrictions on this. Among them, Clip3 is a clamping function.
[0032] For example, the second preset condition is: {flatness is less than or equal to (QpRefineTh1<<(bdIdx>>1))}, and, {flatness is greater than (QpRefineTh0<<(bdIdx>>1)), and / or, the complexity level of the coding unit is less than BwqComplexTh}; the second quantization parameter is determined as: QP_intra=Max(QP_IBC–S1,0). QpRefineTh1 is the first gradient threshold for quantization parameter adjustment, and S1 is the adjustment step size corresponding to the first gradient threshold (i.e., the second preset step size, e.g., S1=1). QpRefineTh0 is less than QpRefineTh1.
[0033] For example, the third preset condition is: the flatness is greater than (QpRefineTh1<<(bdIdx>>1)); and the third quantization parameter determination method is: QP_intra=QP_IBC.
[0034] According to the first aspect, or any implementation of the first aspect above, determining the flatness of the current sub-block includes: determining the flatness of the current sub-block based on reconstructed sub-blocks adjacent to the current sub-block.
[0035] Exemplarily, the difference between the reconstructed values of adjacent pixels in a row on the current sub-block may be calculated to obtain a plurality of difference values; and the absolute values of the plurality of difference values may be added together to obtain the flatness of the current sub-block.
[0036] 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, the prediction mode of the CU is a block copy intra-frame prediction IBC mode; then, for the current sub-block, determining whether to use other intra-frame prediction modes 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 other intra-frame prediction modes, and the first prediction value is based on its if not, setting the block vector BV of the current sub-block to the second preset information, and setting the prediction value of the current sub-block 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; subsequently, 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; thereafter, writing the BV of the current sub-block into the bit stream of the current sub-block.
[0037] Exemplarily, a prediction residual between the prediction value of the current sub-block and the current sub-block may be calculated; then, entropy coding is performed on the prediction residual to obtain a bit stream of the current sub-block.
[0038] Exemplarily, the first preset information and the second preset information are different.
[0039] Exemplarily, the first preset information can be set as required. For example, when the other intra-frame prediction mode is a vertical prediction mode, the first preset information can be a preset value Y1; for example, when the other intra-frame prediction mode is an angular prediction mode, the first preset information can be a preset value Y2; for example, when the other intra-frame prediction mode is a DC prediction mode, the first preset information can be a preset value Y3.
[0040] Exemplarily, 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.
[0041] For example, 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.
[0042] For example, the image to be encoded may be divided into multiple CUs, and the encoding method of the second aspect may be used for the CU whose prediction mode is IBC mode, wherein the bit streams of the multiple sub-blocks included in the CU may be concatenated into the bit stream of the CU.
[0043] According to the second aspect, for the current sub-block, determining whether to use other intra-frame prediction modes to replace the IBC mode includes: performing IBC prediction on the current sub-block to determine a reference block; calculating the sum of absolute errors between the current sub-block and the reference block to obtain SDA_IBC; performing other intra-frame predictions on the current sub-block to obtain a first prediction value; calculating the sum of absolute errors between the current sub-block and the first prediction value to obtain SDA_intra; for the current sub-block, based on SDA_IBC and SDA_intra, determining whether to use other intra-frame prediction modes to replace the IBC mode.
[0044] According to the second aspect, or any implementation of the second aspect above, for the current sub-block, based on SDA_IBC and SDA_intra, it is determined whether to use other intra-frame prediction modes to replace the IBC mode, including: determining the sum of SDA_IBC and a preset bias, where the preset bias is the bias for other intra-frame prediction modes; determining whether SDA_intra is less than the sum; when SDA_intra is less than the sum, determining to use other intra-frame prediction modes to replace the IBC mode for the current sub-block. The preset bias can be set as required; in this way, the bias of the vertical prediction mode can be flexibly set according to the encoding scenario, so that a more optimal intra-frame prediction mode can be selected for each sub-block in the CU, thereby improving prediction accuracy.
[0045] According to the second aspect, or any implementation of the second aspect above, determining whether to use another intra-frame prediction mode instead of the IBC mode based on SDA_IBC and SDA_intra further includes: when SDA_intra is less than the sum value, determining whether SDA_intra is less than SDA_TH, where SDA_TH is the maximum upper limit of the sum of absolute errors corresponding to other intra-frame prediction modes; and when SDA_intra is less than SDA_TH, determining to use another intra-frame prediction mode instead of the IBC mode for the current sub-block. In this way, the prediction accuracy of other intra-frame prediction modes can be improved, thereby improving compression performance.
[0046] According to the second aspect, or any implementation of the second aspect, the other intra prediction mode is a vertical prediction mode, and the first prediction value is determined based on the vertical prediction.
[0047] According to the second aspect, or any implementation method of the second aspect above, the sum of absolute errors between the current sub-block and the first prediction value is determined to obtain SDA_intra, including: calculating the sum of absolute errors between the current sub-block and R first prediction values to obtain R SDA_Rs; wherein, a first prediction value is determined based on another intra-frame prediction mode, and R is a positive integer; the SDA_R with the smallest value is used as SDA_intra; the method also includes: based on the other intra-frame prediction mode corresponding to the SDA_R with the smallest value, selecting a preset value from R preset values as the first preset information; wherein the R preset values correspond one-to-one to the R other intra-frame prediction modes; the BV set as the first preset information is used to indicate the prediction mode of the current sub-block, which is the other intra-frame prediction mode corresponding to the SDA_R with the smallest value; the first prediction value is determined based on the other intra-frame prediction corresponding to the SDA_R with the smallest value.
[0048] In other words, the encoder can select one of the R other intra-frame prediction modes and determine whether to use the selected intra-frame prediction mode instead of the IBC mode for the current sub-block. This allows any one or more of the R other intra-frame coding modes to be nested within the IBC mode, further improving the flexibility of CU prediction and, in turn, the accuracy of prediction.
[0049] According to the second aspect, or any implementation of the second aspect above, when it is determined to use other intra-frame prediction modes instead of the IBC mode, the method also includes: determining the flatness of the current sub-block; determining the quantization parameter QP_intra corresponding to the current sub-block based on the flatness of the current sub-block; 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, including: quantizing the prediction residual between the current sub-block and the prediction value of the current sub-block based on the quantization parameter QP_intra corresponding to the current sub-block; and entropy encoding the quantized prediction residual to obtain the bit stream of the current sub-block.
[0050] According to the second aspect, or any implementation of the second aspect above, based on the flatness of the current sub-block, determining the quantization parameter QP_intra corresponding to the current sub-block includes: determining the complexity information of the CU and the quantization parameter QP_IBC corresponding to the CU; determining the quantization parameter QP_intra corresponding to the current sub-block based on the flatness, complexity information and quantization parameter QP_IBC of the current sub-block.
[0051] According to the second aspect, or any implementation of the second aspect above, determining the quantization parameter QP_intra corresponding to the current sub-block based on the flatness, complexity information, and quantization parameter QP_IBC of the current sub-block includes: when the flatness and complexity information of the current sub-block meet a first preset condition, determining the quantization parameter QP_intra corresponding to the current sub-block based on the quantization parameter QP_IBC and a first preset step size; when the flatness and complexity information of the current sub-block meet a second preset condition, determining the quantization parameter QP_intra corresponding to the current sub-block based on the quantization parameter QP_IBC and the second preset step size; when the flatness and complexity information of the current sub-block meet a third preset condition, using the quantization parameter QP_IBC as the quantization parameter QP_intra corresponding to the current sub-block.
[0052] According to the second aspect, or any implementation of the second aspect above, determining the flatness of the current sub-block includes: determining the flatness of the current sub-block based on reconstructed sub-blocks adjacent to the current sub-block.
[0053] 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 be referred to the technical effects corresponding to the first aspect and any implementation of the first aspect, and will not be repeated here.
[0054] In a third 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.
[0055] The third aspect and any implementation of the third aspect correspond to the first aspect and any implementation of the first aspect, respectively. The technical effects corresponding to the third aspect and any implementation of the third aspect can be referred to the technical effects corresponding to the first aspect and any implementation of the first aspect, and will not be repeated here.
[0056] In a fourth aspect, an embodiment of the present application provides an electronic device comprising: a memory and a processor, wherein the memory is 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 in the second aspect or any possible implementation of the second aspect.
[0057] The fourth aspect and any implementation of the fourth aspect correspond to the second aspect and any implementation of the second aspect, respectively. The technical effects corresponding to the fourth aspect and any implementation of the fourth aspect can be referred to the technical effects corresponding to the above-mentioned second aspect and any implementation of the second aspect, and will not be repeated here.
[0058] In a fifth 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.
[0059] 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 be referred to the technical effects corresponding to the first aspect and any implementation of the first aspect, and will not be repeated here.
[0060] In a sixth 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 enables the electronic device to execute the encoding method in the second aspect or any possible implementation of the second aspect.
[0061] 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 be referred to the technical effects corresponding to the above-mentioned second aspect and any implementation of the second aspect, and will not be repeated here.
[0062] In the seventh 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.
[0063] 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 be referred to the technical effects corresponding to the first aspect and any implementation of the first aspect, and will not be repeated here.
[0064] In an eighth 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 encoding method in the second aspect or any possible implementation of the second aspect.
[0065] 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 be referred to the technical effects corresponding to the above-mentioned second aspect and any implementation of the second aspect, and will not be repeated here.
[0066] In the ninth 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.
[0067] 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 be referred to the technical effects corresponding to the first aspect and any implementation of the first aspect, and will not be repeated here.
[0068] In the tenth 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 encoding method in the second aspect or any possible implementation of the second aspect.
[0069] 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 be referred to the technical effects corresponding to the above-mentioned second aspect and any implementation of the second aspect, and will not be repeated here.
[0070] In the eleventh 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 being used to receive the bit stream; the at least one storage medium being used to store the bit stream; the bit stream being generated according to the second aspect and any one of the implementation methods of the second aspect.
[0071] The eleventh aspect and any implementation of the eleventh aspect correspond to the second aspect and any implementation of the second aspect, respectively. The technical effects corresponding to the eleventh aspect and any implementation of the eleventh aspect can be referred to the technical effects corresponding to the above-mentioned second aspect and any implementation of the second aspect, and will not be repeated here.
[0072] In the twelfth 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 being used to store the bit stream, the bit stream being generated according to the second aspect and any one of the implementation methods of the second aspect; the transmitter being used to obtain the bit stream from the storage medium and send the bit stream to the end-side device through the transmission medium.
[0073] 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 be referred to the technical effects corresponding to the above-mentioned second aspect and any implementation of the second aspect, and will not be repeated here.
[0074] In the thirteenth 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, 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.
[0075] 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 be referred to the technical effects corresponding to the above-mentioned second aspect and any implementation of the second aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0076] FIG1a is a schematic diagram of an exemplary application scenario;
[0077] FIG1b is a schematic diagram showing the structure of an encoder and a decoder;
[0078] FIG2a is a schematic diagram of an exemplary encoding process;
[0079] FIG2 b is a schematic diagram illustrating an exemplary encoding process;
[0080] FIG3a is a schematic diagram illustrating an exemplary decoding process;
[0081] FIG3 b is a schematic diagram illustrating an exemplary decoding process;
[0082] FIG4a is a schematic diagram illustrating an exemplary encoding process;
[0083] FIG4 b is a schematic diagram showing an exemplary search area for IBC prediction;
[0084] FIG4c is a schematic diagram illustrating an exemplary reference block for vertical prediction;
[0085] FIG5 is a schematic diagram illustrating an exemplary decoding process;
[0086] FIG6 is a schematic diagram illustrating an exemplary encoding process;
[0087] FIG7 is a schematic diagram illustrating an exemplary decoding process;
[0088] FIG8a is a schematic diagram illustrating an exemplary encoding process;
[0089] FIG8b is a schematic diagram illustrating an exemplary encoding process;
[0090] FIG9a is a schematic diagram illustrating an exemplary decoding process;
[0091] FIG9 b is a schematic diagram illustrating an exemplary decoding process;
[0092] FIG10 is a schematic structural diagram of an exemplary device. DETAILED DESCRIPTION
[0093] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0094] The term "and / or" in this article is merely a description of the association relationship between 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.
[0095] In the description and claims of the embodiments of this application, the terms "first" and "second" are used to distinguish different objects, rather than to describe a specific order of objects. For example, the terms "first target object" and "second target object" are used to distinguish different objects, rather than to describe a specific order of objects.
[0096] In the embodiments of this 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 this application should not be interpreted as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner.
[0097] In the description of the embodiments of this application, unless otherwise specified, "multiple" means two or more. For example, "multiple processing units" means two or more processing units; "multiple systems" means two or more systems.
[0098] 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. The embodiments of the present application do not limit this.
[0099] FIG1a is a schematic diagram showing an exemplary application scenario.
[0100] Referring to Figure 1a, illustratively, 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 this embodiment of the present application. It should be understood that Figure 1a is only an example of the first device. In other embodiments of the present application, the first device may have more modules than those shown in Figure 1a, which is not limited in this embodiment of the present application.
[0101] Referring to Figure 1a, illustratively, 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 this embodiment of the present application. It should be understood that Figure 1a is only an example of a second device, and the second device in other embodiments of the present application may have more modules than shown in Figure 1a, which is not limited in this embodiment of the present application.
[0102] Continuing with FIG1a , illustratively, after the video capture module of the first device captures raw video data, the process of sending the captured raw video data to the second device for display is as follows: the video capture module can output the captured raw video data to the encoding module; then, the encoding module can encode the raw video data to obtain a bitstream (wherein the bitstream can also be referred to as a bitstream or codestream), and output the encoded bitstream to the sending module; then, the sending module can send the bitstream to the second device. Subsequently, the receiving module of the second device can receive the bitstream; then, the bitstream can be output to the decoding module; then, the decoding module can decode the bitstream to obtain reconstructed video data, and output the reconstructed video data to the display module, which then displays the reconstructed video data.
[0103] 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.
[0104] Exemplarily, the second device includes but is not limited to: a PC, a laptop, a tablet computer, a mobile phone, and a watch.
[0105] 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.
[0106] 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.
[0107] For example, in a cloud gaming scenario, the first device may be a server, and the second device may be a tablet, a PC, a laptop, or a mobile phone.
[0108] 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.
[0109] FIG1b is a schematic diagram showing the structures of an encoder and a decoder.
[0110] Referring to FIG1b (1), the encoder may include a prediction module, a quantization module, and an entropy coding module. The prediction module may be used for coding prediction (e.g., inter-frame prediction, intra-frame prediction); the quantization module may perform quantization based on a quantization parameter; and the entropy coding module may be used for entropy coding (e.g., 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.
[0111] It should be understood that the encoder of the present application may include more modules than those shown in FIG1b(1). For example, the encoder may also include a bit rate control module (which adjusts the output bit rate by changing the encoding quantization parameters, encoding mode, etc.), etc. The present application does not impose any restrictions on this.
[0112] Referring to Figure 1b(2), 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. After the bitstream is input to the decoder, it is processed sequentially by the entropy decoding module, the inverse quantization module, and the prediction module to output a reconstructed image.
[0113] It should be understood that the decoder of the present application may include more modules than those shown in FIG1b(2). For example, the decoder may also include a rate control module (for determining quantization parameters), etc. This application does not impose any restrictions on this.
[0114] The following describes the encoding and decoding process (ie, the intra-frame encoding process and the intra-frame decoding process) by taking the prediction module in FIG. 1 b used for intra-frame prediction as an example.
[0115] In order to solve the problem of high search cost (such as low search efficiency, high computing power requirement and high hardware cost) for coding units with IBC prediction mode in the prior art, the present application proposes a coding and decoding method for coding units with IBC prediction mode. One of its ideas is to nest other intra-frame prediction modes in the IBC mode and use the block vector (Block Vector, BV) of each sub-block for identification, that is, BV can not only be the vector absolute value offset value 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; in this way, neither the bit rate nor the search area of IBC prediction will be increased, and the flexibility of coding unit prediction can be increased, thereby achieving finer-grained prediction, improving prediction accuracy, and thus improving compression performance.
[0116] Among them, other intra-frame prediction modes may refer to intra-frame prediction modules other than the IBC mode, for example, a vertical prediction mode, an angular prediction mode, and a direct current (DC) prediction mode, etc., which is not limited in this application.
[0117] The encoding and decoding method of the present application is described below by taking encoding and decoding an image as an example.
[0118] FIG2 a is a schematic diagram showing an exemplary encoding process.
[0119] Referring to Figure 2a, illustratively, after an image to be encoded is input into an encoder, the encoder may divide the image to be encoded into multiple coding units (CUs), such as CU1, CU2, etc. Subsequently, prediction, quantization, and entropy coding operations are sequentially performed on CU1 to obtain a bitstream for CU1; prediction, quantization, and entropy coding operations are sequentially performed on CU2 to obtain a bitstream for CU2; and so on. After encoding all CUs of the image to be encoded, the bitstreams of all CUs are concatenated to obtain the bitstream for the image to be encoded.
[0120] 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 coding bits of the previous CU and the complexity level of the current CU, rate control is performed (rate control is performed by the rate control module, that is, based on the analysis of the number of coding bits of the previous CU and the complexity level of the current CU, by changing the encoding quantization parameters, encoding mode, etc., it plays a role in adjusting the output bit rate) 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 coding bits of the previous CU and the complexity level of the current CU, the rate control is performed based on the number of coding bits of the previous CU and the complexity level of the current CU.
[0121] It should be understood that the rate control module can also perform rate control and output a quantization parameter based solely on the number of coded bits of the previous CU (or the buffer fullness); that is, this application does not limit the manner in which the rate control module determines the quantization parameter. This application uses the example of the rate control module performing rate control based on the number of coded bits of the previous CU and the complexity information of the current CU as an example.
[0122] The following describes the encoding process by taking a CU in the IBC prediction mode as an example.
[0123] FIG2 b is a schematic diagram illustrating an exemplary encoding process.
[0124] S201 , obtaining a coding unit CU and dividing the CU into multiple sub-blocks, where the prediction mode of the CU is the IBC mode.
[0125] For example, for a CU whose prediction mode is IBC mode, the encoder may divide the CU into multiple sub-blocks; this application does not limit the number of sub-blocks or the size of the sub-blocks. For example, the decoder may divide the CU into multiple sub-blocks of the same size.
[0126] The following description takes a sub-block as an example.
[0127] S202 : For the current sub-block, determine whether to use another intra prediction mode to replace the IBC mode.
[0128] For example, for the current sub-block, it can be determined whether to continue using the IBC mode for intra-frame prediction or to use another intra-frame prediction mode for intra-frame prediction, that is, for the current sub-block, it can be determined whether to use another intra-frame prediction mode instead of the IBC mode. The specific determination method will be described later.
[0129] Exemplarily, for the current sub-block, when it is determined that other intra-frame prediction modes are used to replace the IBC mode, S203 may be executed; for the current sub-block, when it is determined that other intra-frame prediction modes are not used to replace the IBC mode, S205 may be executed.
[0130] S203 , setting the BV of the current sub-block to first preset information; wherein the BV set to the first preset information is used to indicate that the prediction mode of the current sub-block is other intra-frame prediction modes.
[0131] Exemplarily, when it is determined to use other intra-frame prediction modes 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 other intra-frame prediction modes.
[0132] The first preset information can be set as required. For example, when the other intra-frame prediction mode is a vertical prediction mode, the first preset information can be a preset value Y1; for example, when the other intra-frame prediction mode is an angular prediction mode, the first preset information can be a preset value Y2; for example, when the other intra-frame prediction mode is a DC prediction mode, the first preset information can be a preset value Y3.
[0133] S204 , setting the prediction value of the current sub-block to a first prediction value; wherein the first prediction value is determined based on other intra-frame predictions.
[0134] Exemplarily, when it is determined to adopt other intra-frame prediction modes instead of the IBC mode, the prediction value of the current sub-block may also be set to the first prediction value determined based on other intra-frame predictions performed on the current sub-block.
[0135] S205, setting the BV of the current sub-block to the second preset information; 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 is determined based on the IBC prediction.
[0136] For example, when it is determined that another intra-frame prediction mode is not to be used in place of the IBC mode, the vector absolute value offset 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.
[0137] S206 , setting the prediction value of the current sub-block to a second prediction value; wherein the second prediction value is determined based on the IBC prediction.
[0138] Exemplarily, when it is determined that other intra prediction modes are not to be used to replace the IBC mode for the current subblock, the prediction value of the current subblock may be set to the second prediction value determined based on the IBC prediction for the current subblock.
[0139] It should be noted that the search area corresponding to the IBC prediction in this application is the area to the left of the current sub-block (excluding the upper left corner of the current sub-block), and the second prediction value is determined based on the reconstructed value of the reference block. The reconstructed value of the reference block is the second prediction value.
[0140] 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.
[0141] It should be noted that the second preset information is different from the first preset information.
[0142] S207 : Encode the current sub-block based on the prediction value of the current sub-block to obtain a bit stream of the current sub-block.
[0143] Exemplarily, a prediction residual between the prediction value of the 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.
[0144] S208 , writing the BV of the current sub-block into the bitstream.
[0145] 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.
[0146] Exemplarily, the bit streams of multiple sub-blocks included in a CU may be concatenated into the bit stream of the CU.
[0147] FIG3 a is a schematic diagram illustrating an exemplary decoding process.
[0148] Referring to Figure 3a, for example, after CU1's bitstream is input to the decoder, the decoder can sequentially perform entropy decoding, dequantization, and prediction operations to output a reconstructed image of CU1. Next, after CU2's bitstream is input to the encoder, the decoder can sequentially perform entropy decoding, dequantization, and prediction operations to output a reconstructed image of CU2. This continues in this manner until all CUs of the same image are decoded, and the reconstructed images of all CUs can be spliced together to form a complete image.
[0149] 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, the bit rate control can be performed based on the complexity information (such as complexity level) obtained by parsing the bit stream of the current CU (i.e., entropy decoding) and the number of coding 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 bit rate control.
[0150] The decoding process is described below by taking a sub-block of a CU in the IBC prediction mode as an example.
[0151] FIG3 b is a schematic diagram illustrating an exemplary decoding process, wherein the decoding process of FIG3 b corresponds to the encoding process of FIG2 b .
[0152] S301, receiving a bit stream.
[0153] S302 , parsing the BV of the current sub-block from the bit stream, where the intra prediction mode of the coding unit CU to which the current sub-block belongs is the IBC mode.
[0154] Exemplarily, the encoder writes the BV of the current sub-block into the bitstream; further, after receiving the bitstream, the decoder can parse (ie, perform entropy decoding) the BV of the current sub-block from the bitstream.
[0155] S303 : For the current sub-block, determine whether to use another intra prediction mode to replace the IBC mode based on the BV of the current sub-block.
[0156] For example, since the encoder nests other intra-frame coding modes 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 other intra-frame prediction modes based on the BV of the current sub-block; that is, for the current sub-block, it is determined whether other intra-frame prediction modes are used to replace the IBC mode based on the BV of the current sub-block.
[0157] For example, whether to use another intra-frame prediction mode instead of the IBC mode for the current sub-block can be determined by determining whether the BV of the current sub-block is the first preset information. If the BV of the current sub-block is the first preset information, then it can be determined that another intra-frame prediction mode is used instead of the IBC mode for the current sub-block; in this case, S304 can be executed. If the BV of the current sub-block is not the first preset information, then it can be determined that the BV of the current sub-block is the second preset information. In this case, it can be determined that another intra-frame prediction mode is not used instead of the IBC mode for the current sub-block; in this case, S305 can be executed.
[0158] S304: Perform other intra-frame prediction on the current sub-block to obtain a prediction value of the current sub-block.
[0159] For example, when it is determined that other intra-frame prediction modes are used to replace the IBC mode for the current sub-block, other intra-frame predictions may be performed on the current sub-block to obtain a prediction value of the current sub-block.
[0160] S305 , 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.
[0161] Exemplarily, for the current subblock, when it is determined not to use other intra prediction modes instead of the IBC mode, IBC prediction can be performed on the current subblock based on the BV (ie, the second preset information) of the current subblock to obtain a predicted value of the current subblock.
[0162] Exemplarily, a reference block of the current subblock may be determined from decoded subblocks based on the position coordinates of the current subblock and the second preset information; and a reconstructed value of the reference block of the current subblock may be used as a prediction value of the current subblock.
[0163] S306 : 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.
[0164] For example, after receiving the bitstream, the decoder can parse (i.e., entropy decode) the bitstream to obtain a quantized prediction residual. The quantized prediction residual is then dequantized to obtain a prediction residual for the current sub-block. The prediction value for the current sub-block is then added to the prediction residual for the current sub-block to obtain a reconstructed block for the current sub-block.
[0165] Exemplarily, the reconstructed blocks of the multiple sub-blocks included in the CU can be spliced into a reconstructed image of the CU.
[0166] In this way, encoding and decoding are performed according to the encoding method in the embodiment of Figure 2b and the decoding method in Figure 3b, which will not increase the bit rate or the search area of the IBC prediction, and can also increase the flexibility of the coding unit prediction, achieve finer-grained prediction, improve the accuracy of the prediction, and thus improve the compression efficiency.
[0167] The encoding and decoding process is described below by taking the vertical prediction mode as an example.
[0168] FIG4 a is a schematic diagram illustrating an exemplary encoding process.
[0169] S401 , obtaining a coding unit CU and dividing the CU into multiple sub-blocks, where the prediction mode of the CU is the IBC mode.
[0170] For example, S401 may refer to the description of S201 above, which will not be repeated here.
[0171] S402 : For the current sub-block, determine whether to use the vertical prediction mode instead of the IBC mode.
[0172] For example, for the current sub-block, it can be determined whether to still use the IBC mode for intra-frame prediction or to use the vertical prediction mode for intra-frame prediction, that is, for the current sub-block, it can be determined whether to use the vertical prediction mode instead of the IBC mode. The specific determination process can be as follows S4021 to S4023:
[0173] S4021 , performing IBC prediction on the current sub-block to determine a reference block; calculating the Sum of Absolute Difference (SDA) between the current sub-block and the reference block to obtain SDA_IBC.
[0174] For example, the search area corresponding to the IBC prediction of this application is the area to the left of the current sub-block. Referring to Figure 4b , each sub-block is 2*2 in size; gray sub-blocks are coded sub-blocks, white sub-blocks are uncoded sub-blocks, and the sub-block in the dashed box is the current sub-block. The area to the left of the current sub-block can be used as the search area, as shown in Figure 4b .
[0175] Exemplarily, the search area may include n candidate reference blocks (n is a positive integer and can be set as required, and this application does not impose any restrictions on this). 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 referred to as 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 referred to as 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 referred to as the candidate reference block corresponding to Xn). It should be understood that the n values of X1 to Xn can be set as required, and X1 to Xn are all different. For example, X1=1, X2=2, ..., Xn=n.
[0176] For example, 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, based on SDA_X1, SDA_X2, ..., SDA_Xn, 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 from the multiple candidate reference blocks as the reference block. Assuming that the sum of absolute errors SDA_Xm of the mth (m∈[1,n], where 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, i.e., the second preset information = Xm. Accordingly, SDA_IBC between the current sub-block and the reference block = SDA_Xm.
[0177] S4022: Perform vertical prediction on the current sub-block to obtain a first prediction value; calculate the sum of absolute errors between the current sub-block and the first prediction value to obtain SDA_intra.
[0178] Exemplarily, during the vertical prediction process, a pixel point (a pixel point may also be referred to as a sample) in a row above the current sub-block and having the same horizontal coordinate as the current sub-block may be determined as a reference block of the current sub-block; then, based on the reconstructed value of the reference block of the current sub-block, a first prediction value of the current sub-block may be determined; then, the sum of absolute errors between the current sub-block and the first prediction value may be calculated to obtain SDA_intra.
[0179] Referring to Figure 4c, in the example, in Figure 4c, the size of each sub-block is 2*2; the gray sub-block is the coded sub-block, the white sub-block is the uncoded sub-block, and the sub-block in the dotted box is the current sub-block. The vertical prediction process can be as follows: the 1*2 area above the current sub-block can be used as the reference block; then, the reconstructed value of the pixel corresponding to "1" is used as the first predicted value of the pixel corresponding to "A"; the reconstructed value of the pixel corresponding to "2" is used as the first predicted value of the pixel corresponding to "B"; the first predicted value of the pixel corresponding to "A" is used as the first predicted value of the pixel corresponding to "C"; and the first predicted value of the pixel corresponding to "B" is used as the first predicted value of the pixel corresponding to "D".
[0180] Exemplarily, the preset value Y1 can be used as the first preset information; wherein, the preset value Y1 is different from the above X1 to Xn; wherein, the preset value Y1 can be set as required, such as 0, and this application does not impose any restrictions on this.
[0181] S4023 : For the current sub-block, based on SDA_IBC and SDA_intra, determine whether to use other intra prediction modes to replace the IBC mode.
[0182] Afterwards, for the current sub-block, it can be determined whether to use other intra-frame prediction modes instead of the IBC mode by comparing SDA_IBC and SDA_intra.
[0183] In one possible approach, the sum of SDA_IBC and a preset bias degree may be determined, where the preset bias degree is the bias degree for the vertical prediction mode; and whether SDA_intra is less than the sum value may be determined; when SDA_intra is less than the sum value, it may be determined that other intra-frame prediction modes are used to replace the IBC mode for the current sub-block; and when SDA_intra is greater than or equal to the sum value, it may be determined that other intra-frame prediction modes are not used to replace the IBC mode for the current sub-block.
[0184] Exemplarily, the prediction bias can be represented by M1, where M1 is an integer and can be set as needed. This is not a limitation of this application. In this way, the bias of the vertical prediction mode can be flexibly set according to the encoding scenario, so that a better intra-frame prediction mode can be selected for each sub-block in the CU, thereby improving the prediction accuracy. The larger M1 is, the higher the bias for the vertical prediction mode; vice versa. In one example, M1 = 0. In another example, M1 = 2.
[0185] In one possible approach, the sum of SDA_IBC and a preset bias can be determined, where the preset bias is the bias for the vertical prediction mode; whether SDA_intra is less than the sum is determined; when SDA_intra is less than the sum, whether SDA_intra is less than SDA_TH is determined; when SDA_intra is less than SDA_TH, for the current sub-block, it can be determined that the vertical prediction mode is used instead of the IBC mode; when SDA_intra is greater than or equal to the sum, or when SDA_intra is greater than SDA_TH, for the current sub-block, it can be determined that the vertical prediction mode is not used instead of the IBC mode.
[0186] Wherein, SDA_TH is the maximum upper limit of the sum of absolute errors corresponding to other intra-frame prediction modes; SDA_TH can be set as needed, for example, based on parameters such as bit depth, encoding format, number of sub-block pixels, etc. This can improve the prediction effect of vertical prediction.
[0187] Exemplarily, for the current sub-block, when it is determined that the vertical prediction mode is not to be used instead of the IBC mode, S403 may be executed; when it is determined that the vertical prediction mode is to be used instead of the IBC mode, S405 may be executed.
[0188] S403 : Setting the BV of the current sub-block to first preset information; wherein the BV set to the first preset information is used to indicate that the prediction mode of the current sub-block is a vertical prediction mode.
[0189] S404 : Set the prediction value of the current sub-block to a first prediction value; wherein the first prediction value is determined based on vertical prediction.
[0190] S405, setting the block vector BV of the current sub-block to the second preset information; 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 is determined based on the IBC prediction.
[0191] S406 , setting the prediction value of the current sub-block to a second prediction value; wherein the second prediction value is determined based on the IBC prediction.
[0192] Illustratively, in the above-mentioned S402 process, IBC prediction is performed on the current sub-block to determine the reference block of the current sub-block; the reconstructed value of the reference block can be used as the second prediction value.
[0193] For example, S405 to S406 may refer to the description of S205 to S206 above, which will not be repeated here.
[0194] S407 : Encode the current sub-block based on the prediction value of the current sub-block to obtain a bit stream of the current sub-block.
[0195] S408 , writing the BV of the current sub-block into the bitstream.
[0196] For example, S407 to S408 may refer to the description of S207 to S208 above, which will not be repeated here.
[0197] Figure 5 is a schematic diagram illustrating an exemplary decoding process. The encoding process in Figure 5 corresponds to the encoding process in Figure 4a.
[0198] S501: Receive a bit stream.
[0199] S502 , parsing the BV of the current sub-block from the bit stream, where the intra prediction mode of the coding unit CU to which the current sub-block belongs is the block copy intra prediction IBC mode.
[0200] For example, S501 to S502 may refer to the description of S201 to S202 above, which will not be repeated here.
[0201] S503: Determine whether the BV of the current sub-block is the first preset information.
[0202] Exemplarily, if the BV of the current sub-block is the first preset information, S504 may be executed; if the BV of the current sub-block is not the first preset information, S505 may be executed.
[0203] S504: Perform vertical prediction on the current sub-block to obtain a prediction value of the current sub-block.
[0204] For example, the process of performing vertical prediction on the current sub-block in S504 can refer to the above description and will not be repeated here.
[0205] S505 , 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.
[0206] 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.
[0207] For example, S505 to S506 may refer to the description of S305 to S306 above, which will not be repeated here.
[0208] Exemplarily, one other intra-frame prediction mode may be selected from R other intra-frame prediction modes, and for the current sub-block, it may be determined whether to adopt the selected other intra-frame prediction mode to replace the IBC mode; wherein R is a positive integer.
[0209] FIG6 is a schematic diagram illustrating an exemplary encoding process.
[0210] S601 , obtaining a coding unit CU and dividing the CU into multiple sub-blocks, where the prediction mode of the CU is the IBC mode.
[0211] For example, S601 may refer to the description of S201 above, which will not be repeated here.
[0212] For example, one other intra-frame prediction mode may be selected from R other intra-frame prediction modes. Then, for the current sub-block, it may be determined whether to adopt the selected other intra-frame prediction mode to replace the IBC mode. The specific determination process may be as follows S602 to S606:
[0213] S602 , performing IBC prediction on the current sub-block to determine a reference block; calculating the sum of absolute differences between the current sub-block and the reference block to obtain SDA_IBC.
[0214] For example, S602 may refer to the description of S4021 above, which will not be repeated here.
[0215] S603 , performing R other intra-frame predictions on the current sub-block to determine R first prediction values; calculating the sum of absolute errors between the current sub-block and the R first prediction values to obtain R SDA_Rs.
[0216] For example, R other intra-frame predictions may be performed on the current sub-block to determine R first prediction values, where each first prediction value is determined based on one of the other intra-frame predictions for the current sub-block. Subsequently, the sum of absolute differences between the R first prediction values and the current sub-block may be calculated to obtain R SDA_Rs. Each of the R SDA_Rs corresponds to one of the other intra-frame prediction modes.
[0217] S604: Take the SDA_R with the smallest value as SDA_intra.
[0218] Afterwards, the SDA_R with the smallest value can be selected from the R SDA_Rs.
[0219] S605 , based on other intra prediction modes corresponding to the SDA_R having the smallest value, select a preset value from R preset values as first preset information.
[0220] Exemplarily, corresponding R preset values may be set in advance for R other intra-frame prediction modes; wherein the R preset values correspond one-to-one to the R other intra-frame prediction modes, and different other intra-frame prediction modes correspond to different preset values.
[0221] Assuming that the SDA_R with the smallest value is the i-th SDA_R among the R SDA_Rs, the i-th SDA_R can be used as SDA_intra. The i-th SDA_R is the sum of absolute errors between the current sub-block and the i-th first prediction value determined based on the i-th other intra-frame prediction. The i-th preset value corresponds to the i-th other intra-frame prediction mode, and i is an integer between 1 and R (including 1 and R). Furthermore, the preset value corresponding to the i-th other intra-frame prediction mode can also be used as the first preset information.
[0222] For example, R=3, and the three other intra-frame prediction modes include: vertical prediction mode, angular prediction mode, and DC prediction mode; wherein the vertical prediction mode corresponds to a preset value Y1, the angular prediction mode corresponds to a preset value Y2, and the DC prediction mode corresponds to a preset value Y3.
[0223] The sum of absolute errors between the current sub-block and the first prediction value determined based on the vertical prediction is calculated to obtain SDA1_intra. The sum of absolute errors between the current sub-block and the first prediction value determined based on the angular prediction is calculated to obtain SDA2_intra. The sum of absolute errors between the current sub-block and the third prediction value determined based on the DC prediction is calculated to obtain SDA3_intra.
[0224] Next, the first preset information and SDA_intra can be determined based on SDA1_intra, SDA2_intra, and SDA3_intra. When SDA1_intra is minimum, the preset value Y1 is used as the first preset information, and SDA1_intra is used as SDA_intra. When SDA2_intra is minimum, the preset value Y2 is used as the first preset information, and SDA2_intra is used as SDA_intra. When SDA3_intra is minimum among SDA1_intra, SDA2_intra, and SDA3_intra, the preset value Y3 is used as the first preset information, and SDA3_intra is used as SDA_intra.
[0225] S606 , for the current sub-block, based on SDA_IBC and SDA_intra, determine whether to use other intra prediction modes to replace the IBC mode.
[0226] For example, S606 may refer to the description of S4023 above, which will not be repeated here.
[0227] Exemplarily, for the current sub-block, when it is determined not to use other intra prediction modes to replace the IBC mode, S607 may be executed; for the current sub-block, when it is determined to use other intra prediction modes to replace the IBC mode, S609 may be executed.
[0228] S607 , setting the BV of the current sub-block to the first preset information; wherein the BV set to the first preset information is used to indicate the prediction mode of the current sub-block, which is other intra-frame prediction modes corresponding to the SDA_R with the smallest value.
[0229] S608 , setting the prediction value of the current sub-block to a first prediction value; wherein the first prediction value is determined based on other intra-frame predictions corresponding to the SDA_R having the smallest value.
[0230] S609, setting the block vector BV of the current sub-block to the second preset information; 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 second prediction value is determined based on the IBC prediction.
[0231] S610 , setting the prediction value of the current sub-block to a second prediction value; wherein the second prediction value is determined based on IBC prediction.
[0232] S611 : Encode the current sub-block based on the prediction value of the current sub-block to obtain a bit stream of the current sub-block.
[0233] S612: Write the BV of the current sub-block into the bitstream.
[0234] For example, S607 to S612 may refer to the description of S403 to S408 above, which will not be repeated here.
[0235] FIG7 is a schematic diagram illustrating an exemplary decoding process.
[0236] S701: Receive a bit stream.
[0237] S702 , parsing the BV of the current sub-block from the bitstream, where the intra prediction mode of the coding unit CU to which the current sub-block belongs is the block copy intra prediction IBC mode.
[0238] For example, S701 to S702 may refer to the description of S301 to S302 above, which will not be repeated here.
[0239] S703: Determine whether the BV of the current sub-block is the first preset information.
[0240] Exemplarily, if the BV of the current sub-block is the first preset information, S704 may be executed; if the BV of the current sub-block is not the first preset information, S706 may be executed.
[0241] S704 : Select another intra-frame prediction mode corresponding to the first preset information from R other intra-frame prediction modes.
[0242] S705 : Perform intra-frame prediction on the current sub-block based on other intra-frame prediction modes corresponding to the first preset information to obtain a prediction value of the current sub-block.
[0243] For example, when the BV of the current sub-block is the first preset information and the first preset information is the preset value Y1, vertical prediction may be performed on the current sub-block to obtain a predicted value of the current sub-block.
[0244] For example, when the BV of the current sub-block is the first preset information and the first preset information is the preset value Y2, angle prediction may be performed on the current sub-block to obtain a predicted value of the current sub-block.
[0245] For example, when the BV of the current sub-block is the first preset information and the first preset information is the preset value Y3, DC prediction may be performed on the current sub-block to obtain a predicted value of the current sub-block.
[0246] S706 : Perform IBC prediction on the current sub-block based on the second preset information to obtain a prediction value of the current sub-block.
[0247] S707 : 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.
[0248] For example, S706 to S707 may refer to the description of S305 to S306 above, which will not be repeated here.
[0249] For example, to improve the subjective quality of sub-blocks in a CU that use other intra-frame prediction modes instead of the IBC mode, during the encoding and decoding process for sub-blocks in the CU that use other intra-frame prediction modes instead of the IBC mode, the quantization parameter QP_intra is calculated based on the flatness of these sub-blocks; then, quantization or inverse quantization is performed based on the quantization parameter QP_intra. For sub-blocks in the CU whose prediction mode is the IBC mode, quantization or inverse quantization can be performed based on the quantization parameter QP_IBC.
[0250] Figure 8a is a schematic diagram of an exemplary encoding process. Figure 8a shows the process of encoding a CU (ie, CU2) of the image to be encoded. In the embodiment of Figure 8a, the complexity information is a complexity level.
[0251] Referring to Figure 8a, illustratively, after the encoder performs prediction, quantization, and entropy coding operations on CU2 in sequence, the bitstream of CU2 can be obtained. In the process of encoding sub-blocks in CU2 that use other intra-frame prediction modes instead of the IBC mode, the quantization parameter QP_intra corresponding to each sub-block is calculated based on the flatness of each sub-block; then, based on the quantization parameter QP_intra corresponding to each sub-block, the prediction residual of each sub-block is quantized. For sub-blocks in CU2 whose prediction mode is the IBC mode, the prediction residual of each sub-block is quantized based on the quantization parameter QP_IBC.
[0252] FIG8 b is a schematic diagram illustrating an exemplary encoding process.
[0253] S801 , obtaining a current CU and dividing the current CU into multiple sub-blocks, where the prediction mode of the current CU is the IBC mode.
[0254] S802: For the current sub-block, determine whether to use another intra prediction mode to replace the IBC mode.
[0255] For example, when it is determined that other intra prediction modes are not used to replace the IBC mode for the current sub-block, S803 may be executed; when it is determined that other intra prediction modes are used to replace the IBC mode for the current sub-block, S807 may be executed.
[0256] S803, setting the block vector BV of the current sub-block to the second preset information; 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 second prediction value is determined based on the IBC prediction.
[0257] S804 , setting the prediction value of the current sub-block to a second prediction value; wherein the second prediction value is determined based on the IBC prediction.
[0258] S805 : Determine a quantization parameter QP_IBC corresponding to the current sub-block based on the complexity information of the current CU and the number of coded bits of the previous CU.
[0259] In one possible approach, 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.
[0260] Exemplarily, the process of calculating the texture complexity level of the current CU may be as follows:
[0261] First, for each sub-block in the current CU, the differences between adjacent pixel values are calculated horizontally, vertically, and diagonally to obtain multiple difference values. Then, the absolute values of these differences are summed to obtain the complexity value corresponding to the sub-block.
[0262] Next, the complexity value is compared with multiple complexity thresholds to obtain the complexity level of the sub-block. For example, the multiple complexity thresholds are A1, A2, A3, and A4; there are five complexity levels, namely K1, K2, K3, K4, and K5. When the complexity value of the sub-block is less than A1, the complexity level of the sub-block can be determined to be K1; when the complexity value of the sub-block is greater than A1 and less than A2, the complexity level of the sub-block can be determined to be K2; when the complexity value of the sub-block is greater than A2 and less than A3, the complexity level of the sub-block is K3; when the complexity value of the sub-block is greater than A3 and less than A4, the complexity level of the sub-block can be determined to be K4; when the complexity value of the sub-block is greater than A4, the complexity level of the sub-block can be determined to be K5.
[0263] Afterwards, the complexity level of each sub-block is subjected to a regular operation to obtain the texture complexity level of the current CU coding unit. For example, the current CU includes 10 sub-blocks, of which 8 sub-blocks have a complexity level of K4, then the complexity level of the current CU can be K4. For another example, the current CU includes 10 sub-blocks, of which 5 sub-blocks have a complexity level of K4 and 5 sub-blocks have a complexity level of K2, then the complexity level of the current CU can be K3. In other words, the above-mentioned rules for determining the texture complexity level of the current CU can be set as required, and this application does not impose any restrictions on this.
[0264] Exemplarily, the process of calculating the IBC complexity level of the current CU can be as follows: for each sub-block of the current CU, perform similar IBC prediction on each sub-block and determine the IBC similarity prediction value (also called similar sample matrix) of each sub-block. Then, calculate the difference between the IBC similarity prediction value and the original value of each pixel point in each sub-block to obtain multiple differences; and sum the absolute values of these multiple differences to obtain the sub-block absolute error sum; compare the sub-block absolute error sum with multiple complexity thresholds to obtain the complexity level of the sub-block; for details, please refer to the above description and will not be repeated here. Afterwards, the complexity levels of each sub-block are subjected to regular operations to obtain the IBC complexity level of the current CU coding unit; for details, please refer to the above description and will not be repeated here.
[0265] Among them, similar IBC prediction is: when the search area is a pixel point outside the current sub-block (also called a reconstructed sample), if it is an upper pixel point (including the upper left corner pixel point of the current sub-block), the reconstructed value of the upper pixel point is used for IBC prediction; if it is a left pixel point (excluding the upper left corner pixel point of the current coding block), the original value of the left pixel point is used for IBC prediction.
[0266] S806 , quantizing the prediction residual between the current sub-block and the prediction value of the current sub-block based on the quantization parameter QP_IBC corresponding to the current sub-block.
[0267] S807 , setting the BV of the current sub-block to the first preset information; wherein the BV set to the first preset information is used to indicate that the prediction mode of the current sub-block is other intra-frame prediction modes.
[0268] S808 , setting the prediction value of the current sub-block to a first prediction value; wherein the first prediction value is determined based on other intra-frame predictions.
[0269] S809: Determine the flatness of the current sub-block.
[0270] The process of determining the flatness of the current sub-block will be described later.
[0271] S810 : Determine a quantization parameter QP_intra corresponding to the current sub-block according to the flatness of the current sub-block.
[0272] Illustratively, S810 may include the following S8101 to S8102:
[0273] S8101, determine the quantization parameter QP_IBC based on the complexity information of the current CU and the number of coded bits of the previous CU;
[0274] S8102 : Determine the quantization parameter QP_intra corresponding to the current sub-block according to the flatness and complexity information of the current sub-block and the quantization parameter QP_IBC.
[0275] Exemplarily, when the flatness and complexity information of the current sub-block meets the first preset condition, the quantization parameter QP_intra corresponding to the current sub-block is determined according to the quantization parameter QP_IBC and the first preset step size; when the flatness and complexity information of the current sub-block meets the second preset condition, the quantization parameter QP_intra corresponding to the current sub-block is determined according to the quantization parameter QP_IBC and the second preset step size; when the flatness and complexity information of the current sub-block meets the third preset condition, the quantization parameter QP_IBC is used as the quantization parameter QP_intra corresponding to the current sub-block.
[0276] S8101 to S8102 may refer to the description in the subsequent embodiment of FIG9b .
[0277] S811 , quantizing a prediction residual between the current sub-block and a prediction value of the current sub-block based on a quantization parameter QP_intra corresponding to the current sub-block.
[0278] S812, performing entropy coding on the quantized prediction residual to obtain a bit stream of the current sub-block;
[0279] S813, write the BV of the current sub-block into the bitstream.
[0280] Figure 9a is a schematic diagram of an exemplary decoding process. Figure 9a shows the decoding process for a CU (ie, CU2). The complexity information in Figure 9a is the complexity level.
[0281] 9a, exemplarily, after the decoder performs entropy decoding, inverse quantization, and prediction operations on the bitstream of CU2 in sequence, a reconstructed image of CU2 can be obtained. In the process of decoding the sub-blocks in CU2 that use other intra-frame prediction modes instead of the IBC mode, the corresponding quantization parameter QP_intra of each sub-block is calculated based on the flatness of each sub-block; then, based on the quantization parameter QP_intra of each sub-block, the quantized prediction residual of each sub-block obtained by parsing (i.e., entropy decoding) is inverse quantized. For the sub-blocks in CU2 whose prediction mode is the IBC mode, the quantized prediction residual of each sub-block obtained by parsing (i.e., entropy decoding) is inverse quantized based on the quantization parameter QP_IBC.
[0282] FIG9 b is a schematic diagram illustrating an exemplary decoding process.
[0283] S901: Receive a bit stream.
[0284] S902 , parse the bitstream to obtain a block vector BV of the current sub-block, where the prediction mode of the current CU to which the current sub-block belongs is a block copy intra prediction IBC mode.
[0285] S903: Determine whether the BV of the current sub-block is the first preset information.
[0286] Exemplarily, when it is determined that the BV of the current sub-block is the second preset information, S904 may be executed; when it is determined that the BV of the current sub-block is the first preset information, S908 may be executed.
[0287] S904: Perform IBC prediction on the current sub-block based on the second preset information to obtain a prediction value of the current sub-block.
[0288] S905 : Determine a quantization parameter QP_IBC corresponding to the current sub-block according to the complexity information of the current CU and the number of coded bits of the previous CU.
[0289] S906 : Based on the quantization parameter QP_IBC corresponding to the current sub-block, inverse quantize the quantized prediction residual obtained by parsing the bitstream to obtain the prediction residual of the current sub-block.
[0290] S907 , performing other intra-frame prediction on the current sub-block to obtain a prediction value of the current sub-block.
[0291] For example, S904 to S907 may refer to the above description and will not be repeated here.
[0292] S908: Determine the flatness of the current sub-block.
[0293] Exemplarily, the flatness of the current sub-block can be determined based on reconstructed blocks adjacent to the current sub-block. Exemplarily, the difference between reconstructed values of adjacent pixels in the reconstructed blocks adjacent to the current sub-block can be calculated to obtain multiple difference values; after summing these multiple difference values, the flatness of the current sub-block can be obtained.
[0294] Specifically, assume that the horizontal index of the top-left pixel in the current subblock is x and the vertical index is y within the current coding block, and I represents the reconstruction matrix of the image corresponding to the current coding unit to which the current subblock belongs (the reconstruction matrix includes the reconstruction values of the reconstructed pixels). If the other intra-frame prediction mode is a vertical prediction mode, the difference between adjacent pixels in the previous row of the current subblock can be calculated to obtain multiple difference values; the absolute values of these multiple differences can be summed to obtain the flatness of the current subblock. For example, assuming the current subblock is a 2x2 subblock, then = Abs(I[x][y–1]–I[x+1][y–1]).
[0295] If the other intra prediction mode is angular prediction mode or DC prediction mode, the differences between adjacent pixels in some or all reconstructed pixels in the previous row of the current sub-block are calculated to obtain multiple difference values. The absolute values of the multiple differences are summed to obtain the flatness of the current sub-block. For example, if the current sub-block is a 2x2 sub-block and the prediction mode of the current sub-block is DC prediction mode, then = Abs(I[x][y–1]–I[x+1][y–1])+Abs(I[x+1][y–1]–I[x+2][y–1])+Abs(I[x+2][y–1]–I[x+3][y–1]).
[0296] S909 : Determine a quantization parameter QP_intra corresponding to the current sub-block based on the flatness of the current sub-block.
[0297] Next, the quantization parameter QP_intra corresponding to the current sub-block may be determined according to the flatness of the current sub-block.
[0298] In one possible approach, the quantization parameter QP_IBC can be determined based on the complexity information of the current CU and the number of coded bits of the previous CU. For details, please refer to the above description and will not be repeated here. Then, the quantization parameter QP_intra corresponding to the current sub-block is determined based on the flatness, complexity information, and quantization parameter QP_IBC of the current sub-block.
[0299] Exemplarily, multiple preset conditions may be set according to the quantization parameter adjustment gradient threshold, the quantization parameter adjustment complexity threshold, and the bit depth of the image; and for each preset condition, a corresponding quantization parameter determination method may be set.
[0300] Among them, the preset conditions may include a first preset condition, a second preset condition and a third preset condition. Correspondingly, the quantization parameter determination method may include: a first quantization parameter determination method, a second quantization parameter determination method and a third quantization parameter determination method.
[0301] For example, the first preset condition is: the flatness is less than or equal to (QpRefineTh0<<(bdIdx>>1)), and the complexity level of the coding unit is greater than or equal to BwqComplexTh; the first quantization parameter is determined as follows: QP_intra=Max(QP_IBC-S0,0). Among them, QpRefineTh0 is the 0th gradient threshold for quantization parameter adjustment, BwqComplexTh is the complexity threshold for sub-block quantization parameter adjustment, S0 is the adjustment step corresponding to the 0th gradient threshold (that is, the first preset step, for example, S0=2), bdIdx=Clip3(0,S2,BitDepth-S3), BitDepth is the bit depth of the image. Among them, S2 represents the maximum bit depth difference, for example, S2=8; it can be set according to requirements, and this application does not impose any restrictions on this. In addition, S3 can be preset according to requirements, and this application does not impose any restrictions on this. Among them, Clip3 is a clamping function.
[0302] For example, the second preset condition is: {flatness is less than or equal to (QpRefineTh1<<(bdIdx>>1))}, and, {flatness is greater than (QpRefineTh0<<(bdIdx>>1)), and / or, the complexity level of the coding unit is less than BwqComplexTh}; the second quantization parameter is determined as: QP_intra=Max(QP_IBC–S1,0). QpRefineTh1 is the first gradient threshold for quantization parameter adjustment, and S1 is the adjustment step size corresponding to the first gradient threshold (i.e., the second preset step size, e.g., S1=1). QpRefineTh0 is less than QpRefineTh1.
[0303] For example, the third preset condition is: the flatness is greater than (QpRefineTh1<<(bdIdx>>1)); and the third quantization parameter determination method is: QP_intra=QP_IBC.
[0304] Thus, when the flatness and complexity information of the current sub-block meet the first preset condition, the quantization parameter QP_intra corresponding to the current sub-block is determined according to the quantization parameter QP_IBC and the first preset step size; for example, the first quantization parameter determination method described above may be referred to.
[0305] When the flatness and complexity information of the current sub-block meet the second preset condition, the quantization parameter QP_intra corresponding to the current sub-block is determined according to the quantization parameter QP_IBC and the second preset step size; for example, the second quantization parameter determination method described above may be referred to.
[0306] When the flatness and complexity information of the current sub-block meet the third preset condition, the quantization parameter QP_IBC is used as the quantization parameter QP_intra corresponding to the current sub-block. For example, the third quantization parameter determination method described above may be referred to.
[0307] S910 , based on the quantization parameter QP_intra corresponding to the current sub-block, inversely quantize the quantized prediction residual obtained by parsing the bitstream to obtain the prediction residual of the current sub-block.
[0308] S911 , adding the prediction value of the current sub-block and the prediction residual of the current sub-block to obtain a reconstructed block of the current sub-block.
[0309] In an example, FIG10 shows a schematic block diagram of a device 1000 according to an embodiment of the present application. The device 1000 may include: a processor 1001 and a transceiver / transceiver pin 1002 , and optionally, a memory 1003 .
[0310] The various components of the device 1000 are coupled together via a bus 1004. The bus 1004 includes a data bus, a power bus, a control bus, and a status signal bus. However, for clarity, all buses are referred to as bus 1004 in the figure.
[0311] Optionally, the memory 1003 may be used to store instructions in the aforementioned method embodiment. The processor 1001 may be used to execute the instructions in the memory 1003 and control the receiving pin to receive a signal and control the transmitting pin to send a signal.
[0312] The apparatus 1000 may be the electronic device or a chip of the electronic device in the above method embodiment.
[0313] Exemplarily, the electronic device may be a terminal device or a server.
[0314] 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.
[0315] The present application also provides a chip comprising one or more interface circuits and one or more processors; the one or more processors receive or send data via the one or more interface circuits, and when the one or more processors execute computer instructions, the electronic device implements the synchronization method described in the above embodiment in the above-mentioned related method steps. The interface circuit is a transceiver / transceiver pin 1002.
[0316] This embodiment further provides a computer-readable storage medium, which stores computer instructions. 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.
[0317] 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.
[0318] 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 to enable the chip to execute the encoding and decoding methods in the above-mentioned method embodiments.
[0319] 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.
[0320] 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 distributed and completed by 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.
[0321] In the several embodiments provided in this 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 merely schematic. For example, the division of modules or units is only a logical function division. In actual implementation, there may be other division methods, 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.
[0322] Units described as separate components may or may not be physically separate, and 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 places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0323] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0324] Any content of each embodiment of this 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 this application.
[0325] 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 and includes several instructions for enabling a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to execute all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0326] 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 this application, ordinary technicians in this field can also make many forms without departing from the purpose of this application and the scope of protection of the claims, all of which are within the protection of this application.
[0327] 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 disc (CD-ROM) or any other form of storage medium well known in the art. An exemplary storage medium is coupled to the 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.
[0328] Those skilled in the art will appreciate that in one or more of the above examples, the functions described in the embodiments of the present application can be implemented using 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 communication media include any media that facilitates the transmission of computer programs from one place to another. The storage medium can be any available medium that can be accessed by a general-purpose or special-purpose computer.
[0329] 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 this application, ordinary technicians in this field can also make many forms without departing from the purpose of this application and the scope of protection of the claims, all of which are within the protection of this application.
Claims
1. A decoding method, characterized in that: The method comprises: receiving a bit stream; Parsing a block vector BV of a current sub-block from the bit stream, wherein a 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 other intra-frame prediction modes to replace the IBC mode based on the BV of the current sub-block; If yes, perform other intra-frame prediction on the current sub-block to obtain a 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.
2. The method according to claim 1, characterized in that: The other intra-frame prediction mode is a vertical prediction mode, and the performing other intra-frame prediction on the current sub-block to obtain a prediction value of the current sub-block includes: Perform vertical prediction on the current sub-block to obtain a prediction value of the current sub-block.
3. The method according to claim 1, characterized in that The performing other intra-frame prediction on the current sub-block to obtain a prediction value of the current sub-block includes: Selecting another intra-frame prediction mode corresponding to the BV of the current sub-block from R other intra-frame prediction modes; Based on other intra-frame prediction modes corresponding to the BV of the current sub-block, intra-frame prediction is performed on the current sub-block to obtain a prediction value of the current sub-block.
4. The method according to any one of claims 1 to 3, characterized in that: When determining to use the other intra prediction mode to replace the IBC mode for the current sub-block, the method further includes: Determining the flatness of the current sub-block; Determine, based on the flatness of the current sub-block, a quantization parameter QP_intra corresponding to the current sub-block; The reconstructing the current sub-block based on the predicted value of the current sub-block to obtain a reconstructed block of the current sub-block includes: Based on a quantization parameter QP_intra corresponding to the current sub-block, inverse quantizing the quantized prediction residual obtained by parsing the bitstream to obtain a prediction residual of the current sub-block; The prediction value of the current sub-block and the prediction residual of the current sub-block are added to obtain a reconstructed block of the current sub-block.
5. The method according to claim 4, characterized in that The determining, based on the flatness of the current sub-block, a quantization parameter QP_intra corresponding to the current sub-block includes: Parsing complexity information of the CU from the bitstream and determining a quantization parameter QP_IBC corresponding to the CU; A quantization parameter QP_intra corresponding to the current sub-block is determined according to the flatness of the current sub-block, the complexity information and the quantization parameter QP_IBC.
6. The method according to claim 5, characterized in that The determining, according to the flatness of the current sub-block, the complexity information and the quantization parameter QP_IBC, a quantization parameter QP_intra corresponding to the current sub-block includes: When the flatness of the current sub-block and the complexity information meet a first preset condition, determining a quantization parameter QP_intra corresponding to the current sub-block according to the quantization parameter QP_IBC and a first preset step size; When the flatness of the current sub-block and the complexity information meet a second preset condition, determining a quantization parameter QP_intra corresponding to the current sub-block according to the quantization parameter QP_IBC and a second preset step size; When the flatness of the current sub-block and the complexity information meet a third preset condition, the quantization parameter QP_IBC is used as the quantization parameter QP_intra corresponding to the current sub-block.
7. The method according to any one of claims 4 to 6, characterized in that: The determining the flatness of the current sub-block includes: The flatness of the current sub-block is determined based on reconstructed sub-blocks adjacent to the current sub-block.
8. 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 use other intra prediction modes to replace the IBC mode; If so, the 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; wherein the BV set to the first preset information is used to indicate that the prediction mode of the current sub-block is the other intra-frame prediction mode, and the first prediction value is determined based on the other intra-frame prediction; If not, setting the block vector BV of the current sub-block to the second preset information, and setting the prediction value of the current sub-block 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; 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 the bitstream of the current sub-block.
9. The method according to claim 8, characterized in that The determining, for the current sub-block, whether to use another intra prediction mode to replace the IBC mode includes: Performing IBC prediction on the current sub-block to determine the reference block; calculating the sum of absolute errors between the current sub-block and the reference block to obtain SDA_IBC; Performing other intra-frame prediction on the current sub-block to obtain the first prediction value; calculating the sum of absolute errors between the current sub-block and the first prediction value to obtain SDA_intra; For the current sub-block, it is determined whether to use the other intra prediction modes to replace the IBC mode based on the SDA_IBC and the SDA_intra.
10. The method according to claim 9, characterized in that The determining, for the current sub-block, based on the SDA_IBC and the SDA_intra, whether to use the other intra prediction mode to replace the IBC mode includes: Determine a sum of the SDA_IBC and a preset bias, where the preset bias is a bias for the other intra prediction modes; Determine whether the SDA_intra is less than the sum value; When the SDA_intra is smaller than the sum value, for the current sub-block, it is determined to adopt the other intra prediction mode to replace the IBC mode.
11. The method according to claim 10, characterized in that The determining, for the current sub-block, based on the SDA_IBC and the SDA_intra, whether to use the other intra prediction mode to replace the IBC mode further includes: When the SDA_intra is less than the sum value, determining whether the SDA_intra is less than SDA_TH, where SDA_TH is a maximum upper limit value of the sum of absolute errors corresponding to the other intra prediction modes; When the SDA_intra is less than SDA_TH, for the current sub-block, it is determined to adopt the other intra prediction mode to replace the IBC mode.
12. The method according to any one of claims 9 to 11, characterized in that: The other intra prediction mode is a vertical prediction mode, and the first prediction value is determined based on the vertical prediction.
13. The method according to any one of claims 9 to 11, characterized in that: The determining the sum of absolute errors between the current sub-block and the first prediction value to obtain SDA_intra comprises: Calculating the sum of absolute errors between the current sub-block and R first prediction values to obtain R SDA_Rs; wherein one first prediction value is determined based on another intra-frame prediction mode, and R is a positive integer; Take the SDA_R with the smallest value as SDA_intra; The method further comprises: Based on other intra prediction modes corresponding to the SDA_R having the smallest value, selecting a preset value from R preset values as the first preset information; Among them, the R preset values correspond one-to-one to R other intra-frame prediction modes; BV set as the first preset information is used to indicate the prediction mode of the current sub-block, which is the other intra-frame prediction mode corresponding to the SDA_R with the smallest numerical value; the first prediction value is determined based on the other intra-frame prediction corresponding to the SDA_R with the smallest numerical value.
14. The method according to any one of claims 8 to 13, characterized in that When it is determined to use another intra prediction mode to replace the IBC mode, the method further includes: Determining the flatness of the current sub-block; Determine, based on the flatness of the current sub-block, a quantization parameter QP_intra corresponding to the current sub-block; The encoding of the current sub-block based on the prediction value of the current sub-block to obtain a bit stream of the current sub-block includes: quantizing a prediction residual between the current sub-block and a prediction value of the current sub-block based on a quantization parameter QP_intra corresponding to the current sub-block; Entropy encoding is performed on the quantized prediction residual to obtain a bit stream of the current sub-block.
15. The method according to claim 14, characterized in that The determining, based on the flatness of the current sub-block, a quantization parameter QP_intra corresponding to the current sub-block includes: Determine the complexity information of the CU and a quantization parameter QP_IBC corresponding to the CU; A quantization parameter QP_intra corresponding to the current sub-block is determined according to the flatness of the current sub-block, the complexity information and the quantization parameter QP_IBC.
16. The method according to claim 15, characterized in that The determining, according to the flatness of the current sub-block, the complexity information and the quantization parameter QP_IBC, a quantization parameter QP_intra corresponding to the current sub-block includes: When the flatness of the current sub-block and the complexity information meet a first preset condition, determining a quantization parameter QP_intra corresponding to the current sub-block according to the quantization parameter QP_IBC and a first preset step size; When the flatness of the current sub-block and the complexity information meet a second preset condition, determining a quantization parameter QP_intra corresponding to the current sub-block according to the quantization parameter QP_IBC and a second preset step size; When the flatness of the current sub-block and the complexity information meet a third preset condition, the quantization parameter QP_IBC is used as the quantization parameter QP_intra corresponding to the current sub-block.
17. The method according to any one of claims 14 to 16, characterized in that: The determining the flatness of the current sub-block includes: The flatness of the current sub-block is determined based on reconstructed sub-blocks adjacent to the current sub-block.
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 decoding method according to any one of claims 1 to 7.
19. 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 8 to 17.
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 method as described in any one of claims 1 to claim 7.
21. 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 method as described in any one of claims 8 to claim 17.
22. 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 17.
23. 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 17 are performed.
24. 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 8 to 17.
25. 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 8 to 17; 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.
26. 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 8 to 17; 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
Patent Citations
Encoding and decoding method and electronic equipment
CN118646866A
Depth prediction method and device based on VVC intra-frame coding and storage medium
CN111246220A
Method and apparatus for video coding
CN111726622A
Method and apparatus for block vector prediction with integer offsets in intra picture block compensation
CN113348668A
Coding method based on IBC mode, electronic equipment and storage medium
CN115633172A
Cited By
Decoding method and apparatus, coding method and apparatus, electronic device, and storage medium
WO2026228469A1
