Video coding and decoding method and device

By using de-blocking filtering and sample offset compensation technology in video encoding and decoding, the filtered reconstruction sample matrix is ​​used to generate a predicted sample matrix, which solves the problems of predicted sample value distortion and low encoding efficiency in intra prediction mode, and improves the encoding quality of screen content images.

CN120499385APending Publication Date: 2025-08-15BEIJING SAMSUNG TELECOM R&D CENT +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510487660.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2020-03-17
Publication Date
2025-08-15

AI Technical Summary

Technical Problem

In the existing video encoding and decoding methods, block copy intra prediction in the intra prediction mode has problems such as large distortion of prediction sample values ​​and low encoding efficiency.

Method used

Deblocking filtering and sample value offset compensation technology are used to generate a predicted sample matrix using the sample values ​​in the filtered reconstruction sample matrix, which improves the quality of the prediction block and improves coding efficiency.

Benefits of technology

The predicted sample value distortion is reduced, and the encoding efficiency of block copy intra prediction is improved, especially when processing screen content images, the encoding quality is significantly improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120499385A_ABST
    Figure CN120499385A_ABST
Patent Text Reader

Abstract

The invention provides a coding and decoding method and device. The decoding method comprises the following steps: obtaining a prediction sample matrix of a current prediction block; according to the prediction sample matrix, a reconstruction sample matrix is obtained, and element values of the prediction sample matrix are obtained according to sample values in the reconstruction sample matrix after the current image is filtered.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application is a divisional application of the Chinese invention patent application with the application date of March 17, 2020, application number 202010188807.8, and invention name “Video Coding and Decoding Method and Device”. Technical Field

[0002] The present invention relates to the field of video coding and decoding, and in particular to block copy intra-frame prediction in an intra-frame prediction mode. Background Art

[0003] In video encoding and decoding, an image is typically divided into multiple blocks, which are then encoded or decoded individually. For each block, the encoding steps can be divided into prediction, transform, quantization, and entropy coding. Prediction involves using the reconstructed pixel values of previously encoded blocks (these pixels are called reference pixels) to predict the current block to derive a predicted value. The difference between the actual value of the current block and the predicted value is then encoded into the bitstream. During decoding, the decoder also needs to use the reconstructed pixel values of previously decoded blocks to predict the current block to derive a predicted value. The difference, decoded from the bitstream, is then added to the predicted value to obtain the reconstructed value of the decoded block. To ensure consistency in encoding and decoding, the codec must use the same reference pixels and prediction method for prediction. There are many specific prediction methods. The encoder selects one based on the current block and then writes information about the selected prediction method into the bitstream to inform the decoder, allowing it to use the same prediction method for the current block. Summary of the Invention

[0004] Technical issues

[0005] There is a need for improved techniques for block copy intra prediction for intra prediction modes in video codecs.

[0006] Solution

[0007] A method for encoding is provided, comprising:

[0008] generating a bitstream including an identifier indicating whether to perform deblocking filtering on a current frame;

[0009] When the identifier indicates that deblocking filtering is to be performed:

[0010] When the absolute value of (p0-q0) is greater than or equal to four times the first parameter, the filtering strength is determined to be 0, where p0 is the first sample on the left side or above the boundary, q0 is the first sample on the right side or below the boundary, and the first parameter is calculated based on the quantization parameter and the bit depth;

[0011] When the smoothness of the boundary is equal to 6, based on the absolute value of (p0-p1) being less than or equal to one-quarter of the second parameter, the absolute value of (q0-q1) being less than or equal to one-quarter of the second parameter, the absolute value of (p0-p3) being less than or equal to one-half of the second parameter, the absolute value of (q0-q3) being less than or equal to one-half of the second parameter, and the absolute value of (p0-q0) being less than the first parameter, determining that the filtering strength is equal to 4, wherein p1 is the second sample on the left side or above the boundary, q1 is the second sample on the right side or below the boundary, p3 is the fourth sample on the left side or above the boundary, q3 is the fourth sample on the right side or below the boundary, and the second parameter is calculated based on the quantization parameter and the bit depth;

[0012] When the smoothness of the boundary is equal to 6, the filtering strength is determined to be equal to 3 based on at least one of the following not being true: the absolute value of (p0-p1) is less than or equal to one-quarter of the second parameter, the absolute value of (q0-q1) is less than or equal to one-quarter of the second parameter, the absolute value of (p0-p3) is less than or equal to one-half of the second parameter, the absolute value of (q0-q3) is less than or equal to one-half of the second parameter, and the absolute value of (p0-q0) is less than the first parameter; and

[0013] When the smoothness of the boundary is equal to 5, based on p0 being equal to p1 and q0 being equal to q1 and the absolute value of (p2-q2) being less than the first parameter, the filtering strength is determined to be equal to 3, where p2 is the third sample on the left or above side of the boundary and q2 is the third sample on the right or below side of the boundary.

[0014] An apparatus for encoding is provided, comprising:

[0015] a memory having a computer program stored therein, and

[0016] a processor configured to execute a computer program stored in the memory to:

[0017] generating a bitstream including an identifier indicating whether to perform deblocking filtering on a current frame;

[0018] When the identifier indicates that deblocking filtering is to be performed:

[0019] When the absolute value of (p0-q0) is greater than or equal to four times the first parameter, the filtering strength is determined to be 0, where p0 is the first sample on the left side or above the boundary, q0 is the first sample on the right side or below the boundary, and the first parameter is calculated based on the quantization parameter and the bit depth;

[0020] When the smoothness of the boundary is equal to 6, based on the absolute value of (p0-p1) being less than or equal to one-quarter of the second parameter, the absolute value of (q0-q1) being less than or equal to one-quarter of the second parameter, the absolute value of (p0-p3) being less than or equal to one-half of the second parameter, the absolute value of (q0-q3) being less than or equal to one-half of the second parameter, and the absolute value of (p0-q0) being less than the first parameter, determining that the filtering strength is equal to 4, wherein p1 is the second sample on the left side or above the boundary, q1 is the second sample on the right side or below the boundary, p3 is the fourth sample on the left side or above the boundary, q3 is the fourth sample on the right side or below the boundary, and the second parameter is calculated based on the quantization parameter and the bit depth;

[0021] When the smoothness of the boundary is equal to 6, the filtering strength is determined to be equal to 3 based on at least one of the following not being true: the absolute value of (p0-p1) is less than or equal to one-quarter of the second parameter, the absolute value of (q0-q1) is less than or equal to one-quarter of the second parameter, the absolute value of (p0-p3) is less than or equal to one-half of the second parameter, the absolute value of (q0-q3) is less than or equal to one-half of the second parameter, and the absolute value of (p0-q0) is less than the first parameter; and

[0022] When the smoothness of the boundary is equal to 5, the filtering strength is determined to be equal to 3 based on p0 being equal to p1 and q0 being equal to q1 and the absolute value of (p2-q2) being less than the first parameter, where p2 is the third sample to the left or above the boundary and q2 is the third sample to the right or below the boundary.

[0023] A method for decoding is provided, comprising:

[0024] Obtaining from a bitstream an identifier indicating whether to perform deblocking filtering on prediction-compensated samples of a current coding unit;

[0025] When the identifier indicates that deblocking filtering is to be performed:

[0026] When the absolute value of (p0-q0) is greater than or equal to four times the first parameter, the filtering strength is determined to be 0, where p0 is the first sample on the left side or above the boundary, q0 is the first sample on the right side or below the boundary, and the first parameter is calculated based on the quantization parameter and the bit depth;

[0027] When the smoothness of the boundary is equal to 6, based on the absolute value of (p0-p1) being less than or equal to one-quarter of the second parameter, the absolute value of (q0-q1) being less than or equal to one-quarter of the second parameter, the absolute value of (p0-p3) being less than or equal to one-half of the second parameter, the absolute value of (q0-q3) being less than or equal to one-half of the second parameter, and the absolute value of (p0-q0) being less than the first parameter, determining that the filtering strength is equal to 4, where p1 is the second sample on the left or above side of the boundary, q1 is the second sample on the right or below side of the boundary, p3 is the fourth sample on the left or above side of the boundary, q3 is the fourth sample on the right or below side of the boundary, and the second parameter is calculated according to the quantization parameter and the bit depth;

[0028] When the smoothness of the boundary is equal to 6, based on at least one of the following not being true: the absolute value of (p0-p1) is less than or equal to one-quarter of the second parameter, the absolute value of (q0-q1) is less than or equal to one-quarter of the second parameter, the absolute value of (p0-p3) is less than or equal to one-half of the second parameter, the absolute value of (q0-q3) is less than or equal to one-half of the second parameter, and the absolute value of (p0-q0) is less than the first parameter, determining that the filtering strength is equal to 3; and

[0029] When the smoothness of the boundary is equal to 5, based on p0 being equal to p1 and q0 being equal to q1 and the absolute value of (p2-q2) being less than the first parameter, the filtering strength is determined to be equal to 3, where p2 is the third sample on the left or above side of the boundary and q2 is the third sample on the right or below side of the boundary.

[0030] A device for decoding is provided, comprising:

[0031] a memory having a computer program stored therein, and

[0032] a processor configured to execute a computer program stored in the memory to:

[0033] Obtaining from a bitstream an identifier indicating whether to perform deblocking filtering on prediction-compensated samples of a current coding unit;

[0034] When the identifier indicates that deblocking filtering is to be performed:

[0035] When the absolute value of (p0-q0) is greater than or equal to four times the first parameter, the filtering strength is determined to be 0, where p0 is the first sample on the left side or above the boundary, q0 is the first sample on the right side or below the boundary, and the first parameter is calculated based on the quantization parameter and the bit depth;

[0036] When the smoothness of the boundary is equal to 6, based on the absolute value of (p0-p1) being less than or equal to one-quarter of the second parameter, the absolute value of (q0-q1) being less than or equal to one-quarter of the second parameter, the absolute value of (p0-p3) being less than or equal to one-half of the second parameter, the absolute value of (q0-q3) being less than or equal to one-half of the second parameter, and the absolute value of (p0-q0) being less than the first parameter, determining that the filtering strength is equal to 4, wherein p1 is the second sample on the left side or above the boundary, q1 is the second sample on the right side or below the boundary, p3 is the fourth sample on the left side or above the boundary, q3 is the fourth sample on the right side or below the boundary, and the second parameter is calculated based on the quantization parameter and the bit depth;

[0037] When the smoothness of the boundary is equal to 6, the filtering strength is determined to be equal to 3 based on at least one of the following not being true: the absolute value of (p0-p1) is less than or equal to one-quarter of the second parameter, the absolute value of (q0-q1) is less than or equal to one-quarter of the second parameter, the absolute value of (p0-p3) is less than or equal to one-half of the second parameter, the absolute value of (q0-q3) is less than or equal to one-half of the second parameter, and the absolute value of (p0-q0) is less than the first parameter; and

[0038] When the smoothness of the boundary is equal to 5, the filtering strength is determined to be equal to 3 based on p0 being equal to p1 and q0 being equal to q1 and the absolute value of (p2-q2) being less than the first parameter, where p2 is the third sample to the left or above the boundary and q2 is the third sample to the right or below the boundary.

[0039] Provided is a method for transmitting a bit stream, wherein the bit stream is generated by the encoding method provided by the present disclosure.

[0040] A decoding method is provided, comprising: obtaining a prediction sample matrix of a current prediction block; and obtaining a reconstructed sample matrix based on the prediction sample matrix, wherein element values of the prediction sample matrix are obtained based on sample values in the reconstructed sample matrix after filtering of the current image.

[0041] A decoding device is provided, comprising: a memory storing a computer program, and a processor, which executes the above-mentioned decoding method when running the computer program.

[0042] Provided is a coding method, comprising: determining, based on whether a current frame to be coded is screen content, a flag indicating whether to use deblocking filtering on the current frame; and writing the flag into a bitstream.

[0043] A coding device is provided, comprising: a memory storing a computer program, and a processor, which executes the coding method as described above when running the computer program.

[0044] A method for decoding is provided, comprising: determining whether to perform deblocking filtering on prediction-compensated samples of the current decoding unit according to whether the current decoding unit is screen content; and performing deblocking filtering on the prediction-compensated samples of the current decoding unit according to a result of the determination to obtain reconstructed samples after deblocking filtering.

[0045] A decoding device is provided, comprising: a memory storing a computer program, and a processor, which executes the above-mentioned decoding method when running the computer program.

[0046] A computer-readable storage medium is provided for storing non-transitory computer-readable instructions. When the non-transitory computer-readable instructions are executed by a computer, the computer is caused to perform the method described above.

[0047] Beneficial effects

[0048] The present invention provides an improved technique for block copy intra prediction of intra prediction mode in video coding. For those skilled in the art, other aspects, advantages and salient features of the present invention will become clear from the detailed description of exemplary embodiments of the present invention disclosed below in conjunction with the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] Figure 1 A schematic diagram showing dividing an image into maximum decoding units and decoding units is shown.

[0050] Figure 2 A schematic diagram showing block copy intra prediction mode is shown.

[0051] Figure 3 A flowchart of a decoding method according to an embodiment of the present invention is shown.

[0052] Figure 4 A schematic diagram shows reference blocks at different positions when the filtered reconstructed sample matrix includes decoded prediction-compensated samples in the current maximum decoding unit and samples obtained by deblocking filtering and sample offset compensation of the decoded prediction-compensated samples of the maximum decoding unit.

[0053] Figure 5 A schematic diagram shows reference blocks located at different positions when the filtered reconstructed sample matrix includes samples obtained by deblocking filtering the decoded prediction-compensated samples in the current maximum decoding unit and samples obtained by deblocking filtering and sample offset compensation of the decoded prediction-compensated samples of the maximum decoding unit.

[0054] Figure 6A schematic diagram shows reference blocks at different positions when the filtered reconstructed sample matrix includes prediction-compensated samples decoded in the current maximum decoding unit and samples obtained by sample value offset compensation of prediction-compensated samples of the decoded maximum decoding unit.

[0055] Figure 7 A block diagram of a decoding apparatus according to an embodiment of the present invention is shown.

[0056] Figure 8 A flowchart of an encoding method according to an embodiment of the present invention is shown.

[0057] Figure 9 A schematic diagram showing filtering block boundary samples.

[0058] Figure 10 A block diagram of an encoding apparatus according to an embodiment of the present invention is shown.

[0059] Figure 11 A flowchart of a decoding method according to an embodiment of the present invention is shown.

[0060] Figure 12 A block diagram of a decoding apparatus according to an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0061] The embodiments of the present invention will be described in detail below with reference to the accompanying drawings.

[0062] The terms and words used in the following description are not limited to their literal meanings, but are merely used to enable a clear and consistent understanding of the present invention. Accordingly, it should be understood by those skilled in the art that the following description of exemplary embodiments of the present invention is provided for illustrative purposes only and is not intended to limit the present invention, which is defined by the claims and their equivalents.

[0063] It is to be understood that the singular forms "a" and "an" include plural referents unless the context clearly dictates otherwise.

[0064] Figure 1 FIG. 1 shows a schematic diagram of dividing an image into a maximum decoding unit and decoding units. Figure 1 As shown in the left figure, the image is divided into a series of maximum decoding units, and each maximum decoding unit is decoded in sequence according to the raster scanning order within the slice. Figure 1As shown in the figure on the right, the maximum decoding unit uses a basic block partitioning structure called QT+BT+EQT. QT divides a decoding unit into four sub-decoding units, BT can divide a decoding unit into left and right / upper and lower sub-decoding units, and EQT uses both horizontal and vertical I-shaped partitioning to divide a decoding unit into four sub-decoding units. A prediction unit consists of a luma prediction block and a corresponding chroma prediction block, which are obtained by partitioning the decoding unit. If the decoding unit type of the decoding unit is 'I_2M_2N', 'I_2M_hN', 'I_2M_nU', 'I_2M_nD', 'I_hM_2N', 'I_nL_2N' or 'I_nR_2N', its prediction type is normal intra prediction, and the prediction type of the prediction block contained therein is normal intra prediction; otherwise, if the decoding unit type is 'IBC_2M_2N', its prediction type is block copy intra prediction, and the prediction type of the prediction block contained therein is block copy intra prediction; otherwise, the prediction type of the decoding unit is inter prediction, and the prediction type of the prediction unit and prediction block contained therein is inter prediction.

[0065] For screen content sequences like text and graphics, there are many repetitive textures within the same frame, indicating strong spatial correlation. Being able to reference previously encoded areas of the current frame when encoding the current block can significantly improve coding efficiency (due to the strong spatial correlation of screen images). This technique of referencing previously encoded blocks in the current frame and using them for prediction is called intra block copy (IBC). Figure 2 FIG2 is a schematic diagram of a block copy intra prediction mode. The block copy intra prediction is similar to the inter-frame image prediction, except that the prediction block of the block copy intra prediction is generated by the reconstructed block of the current coded image frame.

[0066] The deblocking filter (DBF) is used to reduce the blocking effect, and the sample adaptive offset (SAO) is used to improve the ringing effect. These two filters can effectively improve the subjective and objective quality of the video.

[0067] In existing methods, the values of the IBC prediction sample matrix elements are derived from the sample values in the unfiltered reconstructed sample matrix of the current image. Unfiltered reconstructed samples are not processed with deblocking filtering and sample offset compensation, which leads to significant distortion of the predicted sample values, resulting in reduced quality of the predicted blocks using IBC and lower coding efficiency.

[0068] To solve the above problems, the present invention proposes a block copy intra prediction method, in which the values of the IBC prediction sample matrix elements are obtained according to the sample values in the reconstructed sample matrix after filtering the current image, so as to further improve the coding efficiency of the screen content image.

[0069] Figure 3 A flowchart of a decoding method according to an embodiment of the present invention is shown. The method includes the following steps: obtaining a prediction sample matrix for a current prediction block (S301); and obtaining a reconstructed sample matrix based on the prediction sample matrix, wherein element values of the prediction sample matrix are obtained based on sample values in the reconstructed sample matrix after filtering the current image (S302). This can reduce distortion of prediction sample values, improve the quality of prediction blocks using IBC, and enhance coding efficiency.

[0070] The element values of the prediction sample matrix are obtained based on the sample values in the reconstructed sample matrix after filtering the current image, including: the element values of the luminance prediction sample matrix are the sample values in the integer-pixel precision sample matrix reconstructed after filtering the current image, and the element values of the chrominance prediction sample matrix are the sample values in the 1 / 2 precision chrominance sample matrix reconstructed after filtering the current image.

[0071] According to one embodiment, the filtered reconstructed sample matrix includes: decoded prediction-compensated samples in the current largest decoding unit, and samples obtained by deblocking filtering and sample offset compensation for the decoded prediction-compensated samples of the largest decoding unit. The prediction-compensated samples are the sum of the prediction samples and the residual samples. This can reduce distortion in the prediction sample values, improve the quality of the predicted blocks using IBC, and enhance coding efficiency.

[0072] Figure 4 A schematic diagram shows reference blocks at different positions when the filtered reconstructed sample matrix includes decoded prediction-compensated samples in the current maximum decoding unit and samples obtained by deblocking filtering and sample offset compensation of the decoded prediction-compensated samples of the maximum decoding unit.

[0073] For example, when the filtered reconstructed sample matrix includes the decoded prediction-compensated samples in the current maximum decoding unit and the samples obtained by deblocking filtering and sample offset compensation of the prediction-compensated samples of the decoded maximum decoding unit, at least one of the following situations exists: if the reference block pointed to by the block vector is completely outside the current maximum decoding unit (that is, located within the decoded maximum decoding unit), then all the element values of the prediction sample matrix are obtained based on the sample values obtained by deblocking filtering and sample offset compensation of the prediction-compensated samples of the decoded maximum decoding unit, such as Figure 4As shown in the left figure; if part of the reference block pointed to by the block vector is located outside the current maximum decoding unit (i.e., within the decoded maximum decoding unit), and the other part is located within the current maximum decoding unit, then part of the element value of the prediction sample matrix is obtained according to the sample value obtained by deblocking filtering and sample offset compensation of the prediction-compensated samples of the decoded maximum decoding unit, and the other part is obtained according to the prediction-compensated sample value decoded in the current maximum decoding unit, as shown in FIG. Figure 4 Alternatively, if the reference block pointed to by the block vector is completely within the current maximum decoding unit, the element values of the prediction sample matrix are all obtained based on the prediction compensation sample values decoded in the current maximum decoding unit, as shown in FIG. Figure 4 As shown in the picture on the right.

[0074] According to another embodiment, the filtered reconstructed sample matrix includes: samples obtained by deblocking the prediction-compensated samples decoded in the current largest decoding unit, and samples obtained by deblocking and sample offset compensation of the prediction-compensated samples of the decoded largest decoding unit. This can reduce distortion of prediction sample values, improve the quality of prediction blocks using IBC, and enhance coding efficiency.

[0075] Figure 5 A schematic diagram shows reference blocks located at different positions when the filtered reconstructed sample matrix includes samples obtained by deblocking filtering the decoded prediction-compensated samples in the current maximum decoding unit and samples obtained by deblocking filtering and sample offset compensation of the decoded prediction-compensated samples of the maximum decoding unit.

[0076] For example, when the filtered reconstructed sample matrix includes samples obtained by deblocking filtering the decoded prediction-compensated samples in the current maximum decoding unit and samples obtained by deblocking filtering and sample offset compensation of the decoded prediction-compensated samples of the maximum decoding unit, at least one of the following situations exists: if the reference block pointed to by the block vector is completely outside the current maximum decoding unit (that is, located within the decoded maximum decoding unit), then all element values of the prediction sample matrix are obtained based on sample values obtained by deblocking filtering and sample offset compensation of the decoded prediction-compensated samples of the maximum decoding unit, such as Figure 5 As shown in the left figure; if a part of the reference block pointed to by the block vector is located outside the current maximum decoding unit (that is, within the decoded maximum decoding unit), and the other part is located within the current maximum decoding unit, then a part of the element value of the prediction sample matrix is obtained according to the sample value obtained by deblocking filtering and sample offset compensation of the prediction-compensated samples of the decoded maximum decoding unit, and the other part is obtained according to the sample value obtained by deblocking filtering of the decoded prediction-compensated samples in the current maximum decoding unit, as shown in FIG. Figure 5Alternatively, if the reference block pointed to by the block vector is completely within the current maximum decoding unit, the element values of the prediction sample matrix are all obtained based on the sample values obtained by deblocking filtering the decoded prediction compensation samples in the current maximum decoding unit, as shown in FIG. Figure 5 As shown in the picture on the right.

[0077] According to an embodiment, the values of the reconstructed samples may or may not be deblocked, as indicated by a frame-level flag obtained from the bitstream indicating whether deblocking filtering is used. Thus, for example, the decoding method further includes obtaining from the bitstream a flag indicating whether deblocking filtering is used for the current frame. For example, 0 indicates that deblocking filtering is not used for all blocks in the current frame to be decoded, and 1 indicates that deblocking filtering is used for all blocks in the current frame to be decoded.

[0078] According to an embodiment, when the flag indicates that deblocking filtering is not used for the current frame (for example, the flag is 0), the filtered reconstructed sample matrix includes: decoded prediction-compensated samples in the current LDU, and samples obtained by sample value offset compensation of the decoded prediction-compensated samples of the LDU. This can reduce distortion of predicted sample values, improve the quality of predicted blocks using IBC, and enhance coding efficiency.

[0079] Figure 6 A schematic diagram shows reference blocks at different positions when the filtered reconstructed sample matrix includes prediction-compensated samples decoded in the current maximum decoding unit and samples obtained by sample value offset compensation of prediction-compensated samples of the decoded maximum decoding unit.

[0080] For example, when the filtered reconstructed sample matrix includes the decoded prediction-compensated samples in the current maximum decoding unit and the samples obtained by sample value offset compensation of the decoded prediction-compensated samples of the maximum decoding unit, at least one of the following situations exists: if the reference block pointed to by the block vector is completely outside the current maximum decoding unit (that is, within the decoded maximum decoding unit), then all element values of the prediction sample matrix are obtained based on the sample values obtained by sample value offset compensation of the decoded prediction-compensated samples of the maximum decoding unit, such as Figure 6 As shown in the left figure; if part of the reference block pointed to by the block vector is located outside the current maximum decoding unit (that is, within the decoded maximum decoding unit), and the other part is located within the current maximum decoding unit, then part of the element value of the prediction sample matrix is obtained according to the sample value obtained by sample value offset compensation of the prediction-compensated samples of the decoded maximum decoding unit, and the other part is obtained according to the prediction-compensated sample value decoded in the current maximum decoding unit, as shown in FIG. Figure 6As shown in the middle figure; or if the reference block pointed to by the block vector is completely located within the current maximum decoding unit, the element values of the prediction sample matrix are all obtained based on the prediction compensation sample values decoded in the current maximum decoding unit, such as Figure 6 As shown in the picture on the right.

[0081] When the flag indicates that deblocking filtering is applied to the current frame (for example, the flag is 1), there are two cases.

[0082] According to one embodiment, when the flag indicates the use of deblocking filtering for the current frame (e.g., the flag is 1), the filtered reconstructed sample matrix includes: decoded prediction-compensated samples in the current LDU, and samples obtained by applying deblocking filtering and sample offset compensation to the decoded prediction-compensated samples of the LDU. As previously mentioned, this can reduce distortion of predicted sample values, improve the quality of predicted blocks using IBC, and enhance coding efficiency. Although deblocking filtering is used at the frame level, the decoding units in the current LDU do not necessarily need to use deblocking filtering.

[0083] As described above, for example, when the filtered reconstructed sample matrix includes the decoded prediction-compensated samples in the current maximum decoding unit and the samples obtained by deblocking filtering and sample offset compensation of the prediction-compensated samples of the decoded maximum decoding unit, at least one of the following situations exists: if the reference block pointed to by the block vector is completely outside the current maximum decoding unit (that is, located within the decoded maximum decoding unit), then all the element values of the prediction sample matrix are obtained based on the sample values obtained by deblocking filtering and sample offset compensation of the prediction-compensated samples of the decoded maximum decoding unit, such as Figure 4 As shown in the left figure; if part of the reference block pointed to by the block vector is located outside the current maximum decoding unit (i.e., within the decoded maximum decoding unit), and the other part is located within the current maximum decoding unit, then part of the element value of the prediction sample matrix is obtained according to the sample value obtained by deblocking filtering and sample offset compensation of the prediction-compensated samples of the decoded maximum decoding unit, and the other part is obtained according to the prediction-compensated sample value decoded in the current maximum decoding unit, as shown in FIG. Figure 4 Alternatively, if the reference block pointed to by the block vector is completely within the current maximum decoding unit, the element values of the prediction sample matrix are all obtained based on the prediction compensation sample values decoded in the current maximum decoding unit, as shown in FIG. Figure 4 As shown in the picture on the right.

[0084] According to another embodiment, when the flag indicates that deblocking filtering is used for the current frame (e.g., the flag is 1), the filtered reconstructed sample matrix includes: samples obtained by deblocking the decoded prediction-compensated samples in the current LDU, and samples obtained by deblocking and sample offset compensation for the decoded prediction-compensated samples of the LDU. As previously described, this can reduce distortion of predicted sample values, improve the quality of predicted blocks using IBC, and enhance coding efficiency.

[0085] As described above, for example, when the filtered reconstructed sample matrix includes samples obtained by deblocking filtering the decoded prediction-compensated samples in the current maximum decoding unit and samples obtained by deblocking filtering and sample offset compensation of the decoded prediction-compensated samples of the maximum decoding unit, at least one of the following situations exists: if the reference block pointed to by the block vector is completely outside the current maximum decoding unit (that is, within the decoded maximum decoding unit), then all element values of the prediction sample matrix are obtained based on sample values obtained by deblocking filtering and sample offset compensation of the decoded prediction-compensated samples of the maximum decoding unit, such as Figure 5 As shown in the left figure; if a part of the reference block pointed to by the block vector is located outside the current maximum decoding unit (that is, within the decoded maximum decoding unit), and the other part is located within the current maximum decoding unit, then a part of the element value of the prediction sample matrix is obtained according to the sample value obtained by deblocking filtering and sample offset compensation of the prediction-compensated samples of the decoded maximum decoding unit, and the other part is obtained according to the sample value obtained by deblocking filtering of the decoded prediction-compensated samples in the current maximum decoding unit, as shown in FIG. Figure 5 Alternatively, if the reference block pointed to by the block vector is completely within the current maximum decoding unit, the element values of the prediction sample matrix are all obtained based on the sample values obtained by deblocking filtering the decoded prediction compensation samples in the current maximum decoding unit, as shown in FIG. Figure 5 As shown in the picture on the right.

[0086] Figure 7 A block diagram of a decoding apparatus according to an embodiment of the present invention is shown. The decoding apparatus 700 comprises a memory (701) storing a computer program, and a processor (702) that, when running the computer program, executes the decoding method described above. Such an apparatus can reduce distortion of predicted sample values, improve the quality of predicted blocks using IBC, and enhance coding efficiency.

[0087] Figure 8A flowchart of an encoding method according to an embodiment of the present invention is provided. This embodiment relates to the aforementioned method for obtaining a frame-level flag indicating whether deblocking filtering is used. The method includes: determining, based on whether the current frame to be encoded is screen content, a flag indicating whether deblocking filtering is used for the current frame (S801); and writing the flag into the bitstream (S802). This improves encoding efficiency.

[0088] Screen content refers to images captured directly from the image display unit of a device such as a computer or mobile terminal. Examples include computer graphics, text images, images that mix natural images with graphics and text, and computer-generated animated images. These types of screen content images are common in applications such as desktop collaboration, desktop sharing, and cloud gaming. The primary difference between screen content images and natural images captured with a camera is that screen content images are noise-free, have discrete tones, and sharp edges, whereas natural images are typically noisy, have continuous tones, and have complex textures. The calculation method for determining whether an image is screen content can be one of the following methods, or other methods are not limited here. One possible implementation method is to construct a hash table for each frame before encoding. For each hash value, calculate whether it corresponds to two or more blocks. If the probability of this occurring is greater than a certain threshold, the current frame is considered screen content. Another possible implementation method is to convolve each frame with a Sobel operator before encoding. If the calculated Sobel value for the entire frame is greater than a certain threshold, the current frame is considered screen content.

[0089] According to an embodiment, step S801 includes at least one of the following: if the current frame to be encoded is screen content, the identifier indicates that deblocking filtering is not used for the current frame (for example, the identifier is 0), or if the current frame to be encoded is not screen content, the identifier indicates that deblocking filtering is used for the current frame (for example, the identifier is 1).

[0090] According to an embodiment, the encoding method further includes: determining whether to perform deblocking filtering on prediction-compensated samples of the current frame to be encoded based on the flag. When the flag indicates that deblocking filtering is not to be performed on the current frame (e.g., the flag is 0), deblocking filtering is not performed on the filter block of the current frame; and when the flag indicates that deblocking filtering is to be performed on the current frame (e.g., the flag is 1), determining whether to perform deblocking filtering on the filter block of the current frame.

[0091] According to an embodiment, the step of determining whether to perform deblocking filtering on the prediction-compensated samples of the current frame to be encoded based on the identifier includes calculating the filtering strength of the filter block boundary, and the calculating of the filtering strength of the filter block boundary includes at least one of the following: if it is determined that the boundary needs to be filtered, then when the absolute value of (p0-q0) is greater than or equal to four times the first parameter, the filtering strength is 0, where p0 is the first sample on the left side or above the boundary, q0 is the first sample on the right side or below the boundary, and the first parameter is calculated based on the quantization parameter and the bit depth; when the smoothness of the boundary is equal to 6, if the absolute value of (p0-p1) is less than or equal to one-quarter of the second parameter and the absolute value of (q0-q1) is less than or equal to one-quarter of the second parameter and (p0- or when the smoothness of the boundary is equal to 5, if p0 is equal to p1 and q0 is equal to q1 and the absolute value of (p2-q2) is less than the first parameter, then the filtering strength is equal to 3, where p2 is the third sample to the left or above the boundary and q2 is the third sample to the right or below the boundary.

[0092] Figure 9 A schematic diagram showing filtering block boundary samples. Figure 9 The thick black line in the middle represents a filter block boundary. The eight samples on either side are denoted as p0, p1, p2, and p3, and q0, q1, q2, and q3, respectively. p0 is the first sample to the left or above the boundary, p1 is the second sample to the left or above the boundary, p2 is the third sample to the left or above the boundary, and p4 is the fourth sample to the left or above the boundary. q0 is the first sample to the right or below the boundary, q1 is the second sample to the right or below the boundary, q2 is the third sample to the right or below the boundary, and q3 is the fourth sample to the right or below the boundary. For each filter block boundary, a determination is made as to whether filtering is required. If filtering is required, the filter strength for each segment of the boundary is calculated. Deblocking filtering is performed based on the filter strength for that segment. Otherwise, the values of the compensated samples are used directly as the values of the deblocking filtered samples.

[0093] For example, the derivation process of the deblocking boundary filter strength Bs is as follows. The larger the boundary filter strength Bs value is, the stronger the filtering strength is. Bs of 0 means no filtering is performed:

[0094] If filtering is required, then when the absolute value of (p0-q0) is greater than or equal to four times the first parameter, Bs is equal to 0, where the first parameter is calculated based on the quantization parameter (QP) and bit depth. Otherwise, the process of calculating the boundary filter strength Bs is as follows:

[0095] ① Calculate the smoothness of the boundary fS:

[0096] If the absolute value of (p0 - p1) is less than the second parameter, the smoothness of the left / top edge of the border is increased by 2. The second parameter is calculated based on the quantization parameter and bit depth. If the absolute value of (p0 - p2) is less than the second parameter, the smoothness of the left / top edge of the border is increased by 1. The smoothness of the right / bottom edge is calculated similarly. The smoothness of the border, fS, is equal to the sum of the smoothness of the left / top and right / bottom edges.

[0097] ②According to the value of the smoothness fS of the boundary, Bs is obtained:

[0098] When fS is equal to 6, if the absolute value of (p0-p1) is less than or equal to one-quarter of the second parameter and the absolute value of (q0-q1) is less than or equal to one-quarter of the second parameter and the absolute value of (p0-p3) is less than or equal to one-half of the second parameter and the absolute value of (q0-q3) is less than or equal to one-half of the second parameter and the absolute value of (p0-q0) is less than the first parameter, then Bs is equal to 4; otherwise, Bs is equal to 3.

[0099] When fS is equal to 5, if p0 is equal to p1 and q0 is equal to q1 and the absolute value of (p2-q2) is less than the first parameter, then Bs is equal to 3; otherwise, Bs is equal to 2.

[0100] Figure 10 A block diagram of an encoding apparatus according to an embodiment of the present invention is shown. The encoding apparatus 1000 comprises: a memory (1001) storing a computer program, and a processor (1002) that, when running the computer program, executes the encoding method described above. The encoding apparatus can improve encoding efficiency.

[0101] Figure 11 A flowchart of a decoding method according to an embodiment of the present invention is provided. The method involves determining whether to use deblocking filtering at the block level. The method includes: determining whether to perform deblocking filtering on prediction-compensated samples of the current decoding unit based on whether the current decoding unit is screen content (S1101); and, based on the determination result, performing deblocking filtering on the prediction-compensated samples of the current decoding unit to obtain reconstructed samples after deblocking filtering (S1102). This can improve decoded image quality.

[0102] According to an embodiment, step S1101 includes at least one of the following: if the current decoded block is not the screen content, determining to use deblocking filtering on the reconstructed sample values of the current decoded block, or if the current decoded block is the screen content, determining not to use deblocking filtering on the reconstructed sample values of the current decoded block.

[0103] The current decoding unit may be a maximum decoding block or a decoding block, which is not limited here.

[0104] The calculation method for determining whether it is screen content can be one of the following methods, or other methods, which are not limited here. One possible implementation method is to convolve the current decoded block with the Sobel operator. When the calculated Sobel value of the current decoded block is greater than a certain threshold, the current decoded block is screen content. Another possible implementation method is to calculate the histogram of the current decoded block. When the calculated sample value type of the current decoded block is less than a certain threshold, the current decoded block is screen content.

[0105] Figure 12 The block diagram of the decoding apparatus according to the embodiment of the present invention is shown. The decoding apparatus 1200 comprises: a memory (1201) in which a computer program is stored, and a processor (1202) which, when running the computer program, executes a reference to Figure 11 The decoding method and the decoding device described can improve the quality of decoded images.

[0106] The present invention also provides a computer-readable storage medium for storing non-transitory computer-readable instructions. When the non-transitory computer-readable instructions are executed by a computer, the computer is caused to perform the method described above.

[0107] The example embodiments described herein are not meant to be limiting. The various aspects of the present disclosure as generally described herein and illustrated in the accompanying drawings may be arranged, substituted, combined, separated, and designed in a variety of different configurations, all of which are contemplated herein. Furthermore, unless the context indicates otherwise, the features shown in each of the accompanying drawings may be used in conjunction with each other. Therefore, the accompanying drawings should be considered as Figure 1 The illustrated features are generally considered as part of one or more general embodiments, but it is understood that not all illustrated features are required for each embodiment.

[0108] Although the present invention has been illustrated and described with reference to specific embodiments thereof, it will be understood by those skilled in the art that various changes and modifications in form and details may be made therein without departing from the spirit and scope of the invention as defined by the claims.

Claims

1. A method for encoding, comprising: generating a bitstream including an identifier indicating whether to perform deblocking filtering on a current frame; When the identifier indicates that deblocking filtering is to be performed: When the absolute value of (p0-q0) is greater than or equal to four times the first parameter, the filtering strength is determined to be 0, where p0 is the first sample on the left side or above the boundary, q0 is the first sample on the right side or below the boundary, and the first parameter is calculated based on the quantization parameter and the bit depth; When the smoothness of the boundary is equal to 6, based on the absolute value of (p0-p1) being less than or equal to one-quarter of the second parameter, the absolute value of (q0-q1) being less than or equal to one-quarter of the second parameter, the absolute value of (p0-p3) being less than or equal to one-half of the second parameter, the absolute value of (q0-q3) being less than or equal to one-half of the second parameter, and the absolute value of (p0-q0) being less than the first parameter, determining that the filtering strength is equal to 4, wherein p1 is the second sample on the left side or above the boundary, q1 is the second sample on the right side or below the boundary, p3 is the fourth sample on the left side or above the boundary, q3 is the fourth sample on the right side or below the boundary, and the second parameter is calculated based on the quantization parameter and the bit depth; When the smoothness of the boundary is equal to 6, the filtering strength is determined to be equal to 3 based on at least one of the following not being true: the absolute value of (p0-p1) is less than or equal to one-quarter of the second parameter, the absolute value of (q0-q1) is less than or equal to one-quarter of the second parameter, the absolute value of (p0-p3) is less than or equal to one-half of the second parameter, the absolute value of (q0-q3) is less than or equal to one-half of the second parameter, and the absolute value of (p0-q0) is less than the first parameter; and When the smoothness of the boundary is equal to 5, based on p0 being equal to p1 and q0 being equal to q1 and the absolute value of (p2-q2) being less than the first parameter, the filtering strength is determined to be equal to 3, where p2 is the third sample on the left or above side of the boundary and q2 is the third sample on the right or below side of the boundary.

2. An apparatus for encoding, comprising: a memory having a computer program stored therein, and a processor configured to execute a computer program stored in the memory to: generating a bitstream including an identifier indicating whether to perform deblocking filtering on a current frame; When the identifier indicates that deblocking filtering is to be performed: When the absolute value of (p0-q0) is greater than or equal to four times the first parameter, the filtering strength is determined to be 0, where p0 is the first sample on the left side or above the boundary, q0 is the first sample on the right side or below the boundary, and the first parameter is calculated based on the quantization parameter and the bit depth; When the smoothness of the boundary is equal to 6, based on the absolute value of (p0-p1) being less than or equal to one-quarter of the second parameter, the absolute value of (q0-q1) being less than or equal to one-quarter of the second parameter, the absolute value of (p0-p3) being less than or equal to one-half of the second parameter, the absolute value of (q0-q3) being less than or equal to one-half of the second parameter, and the absolute value of (p0-q0) being less than the first parameter, determining that the filtering strength is equal to 4, wherein p1 is the second sample on the left side or above the boundary, q1 is the second sample on the right side or below the boundary, p3 is the fourth sample on the left side or above the boundary, q3 is the fourth sample on the right side or below the boundary, and the second parameter is calculated based on the quantization parameter and the bit depth; When the smoothness of the boundary is equal to 6, the filtering strength is determined to be equal to 3 based on at least one of the following not being true: the absolute value of (p0-p1) is less than or equal to one-quarter of the second parameter, the absolute value of (q0-q1) is less than or equal to one-quarter of the second parameter, the absolute value of (p0-p3) is less than or equal to one-half of the second parameter, the absolute value of (q0-q3) is less than or equal to one-half of the second parameter, and the absolute value of (p0-q0) is less than the first parameter; and When the smoothness of the boundary is equal to 5, the filtering strength is determined to be equal to 3 based on p0 being equal to p1 and q0 being equal to q1 and the absolute value of (p2-q2) being less than the first parameter, where p2 is the third sample to the left or above the boundary and q2 is the third sample to the right or below the boundary.

3. A method for decoding, comprising: Obtaining from a bitstream an identifier indicating whether to perform deblocking filtering on prediction-compensated samples of a current coding unit; When the identifier indicates that deblocking filtering is to be performed: When the absolute value of (p0-q0) is greater than or equal to four times the first parameter, the filtering strength is determined to be 0, where p0 is the first sample on the left side or above the boundary, q0 is the first sample on the right side or below the boundary, and the first parameter is calculated based on the quantization parameter and the bit depth; When the smoothness of the boundary is equal to 6, based on the absolute value of (p0-p1) being less than or equal to one-quarter of the second parameter, the absolute value of (q0-q1) being less than or equal to one-quarter of the second parameter, the absolute value of (p0-p3) being less than or equal to one-half of the second parameter, the absolute value of (q0-q3) being less than or equal to one-half of the second parameter, and the absolute value of (p0-q0) being less than the first parameter, determining that the filtering strength is equal to 4, where p1 is the second sample on the left or above side of the boundary, q1 is the second sample on the right or below side of the boundary, p3 is the fourth sample on the left or above side of the boundary, q3 is the fourth sample on the right or below side of the boundary, and the second parameter is calculated according to the quantization parameter and the bit depth; When the smoothness of the boundary is equal to 6, based on at least one of the following not being true: the absolute value of (p0-p1) is less than or equal to one-quarter of the second parameter, the absolute value of (q0-q1) is less than or equal to one-quarter of the second parameter, the absolute value of (p0-p3) is less than or equal to one-half of the second parameter, the absolute value of (q0-q3) is less than or equal to one-half of the second parameter, and the absolute value of (p0-q0) is less than the first parameter, determining that the filtering strength is equal to 3; and When the smoothness of the boundary is equal to 5, based on p0 being equal to p1 and q0 being equal to q1 and the absolute value of (p2-q2) being less than the first parameter, the filtering strength is determined to be equal to 3, where p2 is the third sample on the left or above side of the boundary and q2 is the third sample on the right or below side of the boundary.

4. A device for decoding, comprising: a memory having a computer program stored therein, and a processor configured to execute a computer program stored in the memory to: Obtaining from a bitstream an identifier indicating whether to perform deblocking filtering on prediction-compensated samples of a current coding unit; When the identifier indicates that deblocking filtering is to be performed: When the absolute value of (p0-q0) is greater than or equal to four times the first parameter, the filtering strength is determined to be 0, where p0 is the first sample on the left side or above the boundary, q0 is the first sample on the right side or below the boundary, and the first parameter is calculated based on the quantization parameter and the bit depth; When the smoothness of the boundary is equal to 6, based on the absolute value of (p0-p1) being less than or equal to one-quarter of the second parameter, the absolute value of (q0-q1) being less than or equal to one-quarter of the second parameter, the absolute value of (p0-p3) being less than or equal to one-half of the second parameter, the absolute value of (q0-q3) being less than or equal to one-half of the second parameter, and the absolute value of (p0-q0) being less than the first parameter, determining that the filtering strength is equal to 4, wherein p1 is the second sample on the left side or above the boundary, q1 is the second sample on the right side or below the boundary, p3 is the fourth sample on the left side or above the boundary, q3 is the fourth sample on the right side or below the boundary, and the second parameter is calculated based on the quantization parameter and the bit depth; When the smoothness of the boundary is equal to 6, the filtering strength is determined to be equal to 3 based on at least one of the following not being true: the absolute value of (p0-p1) is less than or equal to one-quarter of the second parameter, the absolute value of (q0-q1) is less than or equal to one-quarter of the second parameter, the absolute value of (p0-p3) is less than or equal to one-half of the second parameter, the absolute value of (q0-q3) is less than or equal to one-half of the second parameter, and the absolute value of (p0-q0) is less than the first parameter; and When the smoothness of the boundary is equal to 5, the filtering strength is determined to be equal to 3 based on p0 being equal to p1 and q0 being equal to q1 and the absolute value of (p2-q2) being less than the first parameter, where p2 is the third sample to the left or above the boundary and q2 is the third sample to the right or below the boundary.

5. A method for transmitting a bit stream, wherein the bit stream is generated by the encoding method according to claim 1.