Video coding method and apparatus, and video decoding method and apparatus
By combining multiple sub-block partitioning methods and transform kernels in video coding, the problem of mismatched energy distribution in inter-frame prediction residuals is solved, improving the efficiency and effectiveness of video coding and achieving more efficient data compression.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- HISENSE VISUAL TECH CO LTD
- Filing Date
- 2025-08-27
- Publication Date
- 2026-06-25
Smart Images

Figure CN2025117348_25062026_PF_FP_ABST
Abstract
Description
Video encoding method, video decoding method and apparatus
[0001] This disclosure claims priority to patent application No. 202510773936.6, filed on June 10, 2025, and patent application No. 202411864977.8, filed on December 17, 2024, the contents of which are incorporated herein by reference. Technical Field
[0002] This disclosure relates to the field of video coding technology, and in particular to a video coding and decoding method, apparatus, chip, computer equipment, computer-readable storage medium, and computer program product. Background Technology
[0003] In the video coding process, based on the characteristics of the residual of the current coding unit (CU) using inter-frame prediction—the inter-frame prediction residual is concentrated in a certain region—in order to improve the coding performance, sub-block transformation (SBT) is allowed for the coding unit using inter-frame prediction.
[0004] In SBT mode, only the inter-frame prediction residual of one sub-block of the coding unit needs to be transformed and quantized; the other parts are set to zero and no further processing is performed. When a coding unit using inter-frame prediction uses SBT mode, the corresponding sub-block partitioning method needs to be transmitted in the bitstream to indicate the sub-block partitioning type and location information.
[0005] The sub-block partitioning method used in related technologies is designed for situations where the energy of the inter-frame prediction residual is concentrated on one side. SBT mode can only be used on coding units employing inter-frame prediction when the energy distribution of the inter-frame prediction residual matches the existing sub-block partitioning method. If the energy distribution of the inter-frame prediction residual is of another type and does not match the existing sub-block partitioning method, then only transformation and quantization processing of the entire inter-frame prediction residual can be performed, which may result in less than ideal coding performance for the coding unit. Summary of the Invention
[0006] Therefore, it is necessary to provide a video encoding and decoding method, device, chip, computer equipment, computer-readable storage medium, and computer program product that can improve the encoding effect in response to the above-mentioned technical problems.
[0007] This disclosure provides a video encoding method in some embodiments, including:
[0008] Determine the target sub-block partitioning method and target transform kernel of the current coding unit, wherein the sub-block partitioning method corresponds to the transform kernel;
[0009] According to the target sub-block partitioning method, sub-blocks are partitioned from the current coding unit;
[0010] The target transform kernel is used to perform sub-block transformation on the inter-frame prediction residuals corresponding to the sub-block to obtain the transform coefficients;
[0011] The bitstream of the current coding unit is obtained based on the transform coefficients;
[0012] The target sub-block partitioning method is one of a variety of sub-block partitioning methods, and the variety of sub-block partitioning methods includes at least the following two categories:
[0013] The sub-block is located in the middle region of the vertical direction of the current coding unit, and the pixel height of the sub-block is the pixel height of the current coding unit, and the pixel width of the sub-block is 1 / 2 of the pixel width of the current coding unit; or, the sub-block is located in the middle region of the horizontal direction of the current coding unit, and the pixel width of the sub-block is the pixel width of the current coding unit, and the pixel height of the sub-block is 1 / 2 of the pixel height of the current coding unit.
[0014] The sub-block is located in the middle region of the current coding unit in the vertical direction, and the pixel height of the sub-block is the pixel height of the current coding unit, and the pixel width of the sub-block is 1 / 4 of the pixel width of the current coding unit. Alternatively, the sub-block is located in the middle region of the current coding unit in the horizontal direction, and the pixel width of the sub-block is the pixel width of the current coding unit, and the pixel height of the sub-block is 1 / 4 of the pixel height of the current coding unit. Attached Figure Description
[0015] Figure 1 is a schematic diagram of the encoder framework provided in some embodiments of this disclosure;
[0016] Figure 2 is a schematic diagram of the framework of a decoder provided in some embodiments of this disclosure;
[0017] Figure 3 is a schematic diagram of the SBT mode provided in some embodiments of this disclosure;
[0018] Figure 4 is a schematic diagram of the SBT steps provided in some embodiments of this disclosure;
[0019] Figure 5 is a flowchart illustrating a video encoding method provided in some embodiments of this disclosure;
[0020] Figure 6 is a schematic diagram of the sub-block division method provided in some embodiments of this disclosure;
[0021] Figure 7 is a schematic diagram of the sub-block division method provided in some embodiments of this disclosure;
[0022] Figure 8 is a schematic diagram of the transformation kernels corresponding to the six seed block partitioning methods provided in some embodiments of this disclosure;
[0023] Figure 9 is an application environment diagram of the video encoding method and / or video decoding method provided in some embodiments of this disclosure;
[0024] Figure 10 is a flowchart illustrating a video decoding method provided in some embodiments of this disclosure. Detailed Implementation
[0025] To make the objectives and implementation methods of this disclosure clearer, the exemplary embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings of the exemplary embodiments of this disclosure. Obviously, the exemplary embodiments described are only some embodiments of this disclosure, and not all embodiments.
[0026] Figure 1 is a schematic diagram of the encoder framework provided in some embodiments of this disclosure. Referring to Figure 1, the input of the encoder 10 is the frame to be encoded 101, which is divided into coding units (CUs), and video encoding is performed on a unit-by-unit basis. In the embodiments of this disclosure, the encoder 10 is used to implement compression encoding and video frame reconstruction.
[0027] In some embodiments, the encoder 10 includes an intra-prediction mode selection module 102. The intra-prediction mode selection module 102 is used to determine the intra-prediction mode of the current coding unit when an intra-prediction coding mode is employed.
[0028] In some embodiments, the encoder 10 includes an intra-frame prediction module 103. The intra-frame prediction module 103 is used to perform intra-frame prediction on the coding units in the intra-frame prediction frame, that is, to use the already encoded pixel values in the intra-frame prediction frame to predict the uncoded pixel values.
[0029] In some embodiments, the encoder 10 includes a motion estimation module 104. The motion estimation module 104 is used to determine a matching block in a reference frame of the frame to be encoded 101 that matches the current coding unit when an inter-frame predictive coding mode is used, and to calculate the position offset between the position of the current coding unit in the frame to be encoded and the position of the matching block in the reference frame, i.e., the motion vector, which indicates the position offset of the current coding unit in the reference frame.
[0030] In some embodiments, the encoder 10 includes a motion compensation module 105, which is used to perform motion compensation on the matching block in the reference frame according to the motion vector, that is, to determine the prediction block corresponding to the current coding unit from the reference frame according to the motion vector.
[0031] In some embodiments, the encoder 10 includes a transform and quantization module 106, which is used to subtract the current coding unit from the prediction block corresponding to the current coding unit to obtain a residual, and then transform the residual using a transform kernel to obtain transform coefficients. The transform coefficients include low-frequency components and high-frequency components of the residual. The low-frequency components represent the background part in the frame to be encoded, which usually changes little. The high-frequency components represent the contour part in the frame to be encoded, which usually changes much. By transforming, the energy of the data can be concentrated on a few transform coefficients.
[0032] In some embodiments, the transformation and quantization module 106 is further configured to quantize the transformation coefficients to obtain quantized transformation coefficients, i.e., quantized coefficients. Effective data compression is achieved through transformation and quantization.
[0033] In some embodiments, the transformation and quantization module 106 is used to quantize the low-frequency components of the residual with higher quantization precision and the high-frequency components of the residual with lower quantization precision to obtain quantization coefficients.
[0034] In some embodiments, the encoder 10 includes an encoding control module 107, which performs encoding control to obtain encoding control information. For example, the encoding control information may include indication information indicating the prediction mode used by the current coding unit. In some embodiments, the prediction mode is an inter-frame prediction coding mode or an intra-frame prediction coding mode. For example, the encoding control information may include quantization parameters used for quantization.
[0035] In some embodiments, the encoder 10 includes an entropy encoding module 108, which performs entropy encoding on the encoding control information, quantization coefficients, and motion vectors to obtain a bitstream, i.e., a binary bitstream. Encoding the motion vectors is performed to reconstruct the current encoding unit during decoding.
[0036] In some embodiments, the encoder 10 includes a filtering tool module 110. The filtering tool module 110 includes filters for filtering the reconstructed frames, including filters for deblocking and sample adaptive compensation (SAO).
[0037] In some embodiments, the encoder 10 includes a filter parameter control module 109. The filter parameter control module 109 is used to control the filter parameters of these filters, which can reduce block artifacts generated during the encoding process and improve image quality.
[0038] When using inter-frame predictive coding mode to perform inter-frame predictive coding on the current coding unit, the reference frame is the reconstructed frame corresponding to a previously encoded frame. In some embodiments, a matching frame can be selected as the reference frame from the reconstructed frames corresponding to multiple previously encoded frames. Because during the inter-frame compression coding of the coding unit, edge discontinuities may occur in the reconstructed frame due to transform, quantization, and entropy coding, causing distortion of the reconstructed frame, it is necessary to use the filtering tool module 110 and the filtering parameter control module 109 to filter the reconstructed frame to obtain the final reconstructed frame 112. The final reconstructed frame 112 can be output to a display device for image display and also serves as a reference frame for subsequent frames to be encoded for subsequent inter-frame prediction. Filtering can smooth these edges, reduce blockiness, and thus improve video quality.
[0039] In some embodiments, the encoder 10 includes an inverse quantization and inverse module 111, which is used to inverse quantize the quantized residual coefficients (i.e., quantization coefficients) to reconstruct the transform coefficients and obtain the reconstructed transform coefficients.
[0040] In some embodiments, the inverse quantization and inverse transform module 111 is further configured to perform an inverse transform on the reconstructed transform coefficients to reconstruct the residuals and obtain the reconstructed residuals. For inter-frame predictive coding mode, the reconstructed residuals are added to the prediction block to obtain the reconstructed block corresponding to the current coding unit, and the reconstructed frame can be obtained based on the reconstructed block. The reconstructed frame can be filtered using the filtering tool module 110 and the filtering parameter control module 109 to obtain the final reconstructed frame.
[0041] Figure 2 is a schematic diagram of the framework of a decoder 20 provided in some embodiments of this disclosure. Referring to Figure 2, the input of the decoder 20 is a bitstream, and the output is a video signal. In some embodiments, the decoder 20 includes an entropy decoding module 201, which is used to perform entropy decoding on the bitstream of the current decoding unit to obtain at least one of the control information, quantization coefficients, and motion vectors used by the current decoding unit during encoding.
[0042] In some embodiments, the decoder 20 includes an inverse quantization module 202, which is used to inverse quantize the quantization coefficients obtained by entropy decoding to obtain transform coefficients.
[0043] In some embodiments, the decoder 20 includes an inverse transform module 203, which is used to perform an inverse transform on the transform coefficients to reconstruct the residuals and obtain the reconstructed residuals.
[0044] In some embodiments, the decoder 20 includes an intra-frame prediction module 204. The intra-frame prediction module 204 is used to perform intra-frame prediction on the current decoding unit, that is, to use the intra-frame predicted decoded pixel values to predict the undecoded pixel values.
[0045] In some embodiments, the decoder 20 includes a motion compensation module 205. The motion compensation module 205 is used to perform motion compensation on the matching block of the current decoding unit in the reference frame based on the motion vector obtained by the entropy decoding described above, that is, to determine the prediction block corresponding to the current decoding unit from the reference frame based on the motion vector.
[0046] In some embodiments, the decoder 20 includes a loop filtering module 206 for filtering the reconstructed frame to obtain the final reconstructed frame; wherein each reconstructed block in the reconstructed frame is a prediction block corresponding to the current decoding unit in the reference frame determined according to the motion vector, and the prediction block is added to the reconstructed residual to obtain the reconstructed block corresponding to the current coding unit.
[0047] In some embodiments, the decoder 20 includes a buffer module 207 for buffering the final reconstructed frame obtained after filtering. The buffered reconstructed frame can be used as a reference frame for subsequent frames to be decoded.
[0048] The sub-block partitioning method provided in this disclosure can be applied to at least one of the transform and quantization module and the inverse quantization and inverse transform module in the encoder; it can also be applied to at least one of the inverse quantization and inverse transform modules in the decoder.
[0049] Figure 3 is a schematic diagram of the SBT mode in some embodiments of this disclosure. Referring to Figure 3, for a coding unit 30, based on the characteristics of inter-frame prediction residuals, a portion of the residuals in coding unit 30 are very small and can be considered as 0. In this case, the current coding unit is divided into two sub-blocks, and sub-block transformation is performed only on one sub-block 301, while no sub-block transformation is performed on the other sub-block 302. The sub-block transformation includes: transforming and quantizing the inter-frame prediction residuals corresponding to the sub-block. Not transforming the sub-block includes: setting the inter-frame prediction residuals corresponding to the sub-block to zero and not processing them further.
[0050] For the current coding unit, a transform kernel can be determined based on the corresponding sub-block partitioning method.
[0051] Figure 4 is a schematic diagram of the steps of SBT in some embodiments of this disclosure, including two steps:
[0052] Step 1: Sub-block partitioning; Step 2: Transform kernel determination.
[0053] Sub-block partitioning refers to the process of determining the target sub-block partitioning method of the current coding unit, so as to partition sub-blocks from the current coding unit according to the target sub-block partitioning method.
[0054] Transformation involves converting data described in spatial domain pixel form to the transform domain using a transform kernel, resulting in transform coefficients. This allows data described in spatial domain pixel form to be represented as transform coefficients, concentrating the energy of a video frame on a few transform coefficients, thus achieving compression. Different transform kernels have different effects on the same residual. Transform kernels include DCT-2, DCT-8, and DST-7, where DCT stands for Discrete Cosine Transform and DST stands for Discrete Fourier Transform. The transform kernel used for sub-block transformation after sub-block partitioning is implicitly determined by the sub-block partitioning method; that is, the transform kernel corresponds to the sub-block partitioning method.
[0055] Figure 5 is a flowchart illustrating a video encoding method provided in some embodiments of this disclosure, which can be executed by the encoder 10 shown in Figure 1. In some embodiments, the encoder can be applied to a computer device. As shown in Figure 5, the video encoding method includes the following steps:
[0056] Step 502: Determine the target sub-block partitioning method and target transform kernel of the current coding unit; wherein the sub-block partitioning method and the transform kernel correspond to each other.
[0057] A coding unit is a basic coded block into which a video frame is divided. Coding units determine how video data is compressed and encoded. A video frame is divided into multiple coding tree units, and each coding tree unit can be further divided into one or more coding units. The size of a coding unit can range from 64×64 to 8×8 pixels, depending on the encoding settings and the video content.
[0058] Step 504: Divide the current coding unit into sub-blocks according to the target sub-block division method.
[0059] Step 506: Perform sub-block transformation using the target transform kernel on the inter-frame prediction residuals corresponding to the sub-block to obtain the transform coefficients.
[0060] Among them, the inter-frame prediction residual is the residual between the current coding unit and the corresponding prediction block generated by the inter-frame prediction of the current coding unit, and the inter-frame prediction residual corresponding to the sub-block is the inter-frame prediction residual corresponding to that part of the sub-block in the current coding unit.
[0061] Step 508: Obtain the bitstream of the current coding unit based on the transform coefficients;
[0062] The target sub-block partitioning method is one of several sub-block partitioning methods, which include at least the following: the sub-block is located in the middle region of the vertical direction of the current coding unit, and the pixel height of the sub-block is the same as the pixel height of the current coding unit, and the pixel width of the sub-block is less than the pixel width of the current coding unit; or, the sub-block is located in the middle region of the horizontal direction of the current coding unit, and the pixel width of the sub-block is the same as the pixel width of the current coding unit, and the pixel height of the sub-block is less than the pixel height of the current coding unit.
[0063] In some embodiments, the pixel width of the sub-block is less than the pixel width of the current coding unit, which can be 1 / n of the pixel width of the current coding unit. In some embodiments, n can be 2, 4, or 8.
[0064] In some embodiments, the pixel height of the sub-block is less than the pixel height of the current coding unit, which can be 1 / m of the pixel width of the current coding unit. In some embodiments, the value of m can be 2, 4, or 8.
[0065] In some embodiments, the encoder may use a Rate Distortion Optimized (RDO) strategy, wherein the RDO strategy is used to select whether to transform the entire residual of the current coding unit or to transform the residual of a subset of sub-blocks of the current coding unit. The residual of a subset of sub-blocks refers to the residual corresponding to the sub-blocks divided by the selected sub-block partitioning method, which is one of a variety of sub-block partitioning methods that satisfy the corresponding constraints of the current coding unit.
[0066] Specifically, the encoder can iterate through various transformation methods for the current coding unit, and each transformation method includes at least one of the following:
[0067] Transformation method 1) is a method of transforming the entire inter-frame prediction residual of the current coding unit;
[0068] Transformation method 2) is a method of dividing sub-blocks from the current coding unit according to each sub-block division method and transforming the inter-frame prediction residuals of the corresponding sub-blocks.
[0069] The encoder calculates the rate distortion for each transformation mode and selects the transformation mode with the lowest rate distortion as the transformation mode for the current coding unit.
[0070] It is evident that if the energy distribution of the inter-frame prediction residual of the current coding unit does not match the N seed block partitioning method well, then the final approach may be to transform the entire inter-frame prediction residual of the current coding unit. If the entire inter-frame prediction residual is still transformed, the energy cannot be effectively concentrated, resulting in low transformation efficiency.
[0071] To accommodate more diverse inter-frame prediction residual distributions, some embodiments also provide a 6-seed block partitioning method. The 6-seed block partitioning method is divided into two categories.
[0072] Figure 6 is a schematic diagram of the sub-block partitioning method provided in some embodiments of this disclosure. Referring to Figure 6, the first type of the above six sub-block partitioning methods is: the sub-block is located in the middle region of the vertical direction of the current coding unit, and the pixel height of the sub-block is the pixel height of the current coding unit, and the pixel width of the sub-block is 1 / 2 of the pixel width of the current coding unit; or, the sub-block is located in the middle region of the horizontal direction of the current coding unit, and the pixel width of the sub-block is the pixel width of the current coding unit, and the pixel height of the sub-block is 1 / 2 of the pixel height of the current coding unit.
[0073] Figure 7 is a schematic diagram of the sub-block partitioning method provided in some embodiments of this disclosure. Referring to Figure 7, the second type of the above six sub-block partitioning methods is: the sub-block is located in the middle region of the vertical direction of the current coding unit, and the pixel height of the sub-block is the pixel height of the current coding unit, and the pixel width of the sub-block is 1 / 4 of the pixel width of the current coding unit; or, the sub-block is located in the middle region of the horizontal direction of the current coding unit, and the pixel width of the sub-block is the pixel width of the current coding unit, and the pixel height of the sub-block is 1 / 4 of the pixel height of the current coding unit.
[0074] The pixel width of the current coding unit is denoted as W, and the pixel height is denoted as H.
[0075] Referring to Figure 6, the first sub-block from left to right is located in the middle area of the vertical direction of the current coding unit, and the pixel height of the sub-block is the pixel height of the current coding unit, and the pixel width of the sub-block is 1 / 2 of the pixel width of the current coding unit. Taking the top left corner pixel of the current coding unit as the origin of the pixel coordinates, the coordinates of the top left corner pixel of the sub-block are (W*1 / 4, 0).
[0076] Referring to Figure 6, the second sub-block from left to right is located in the middle area of the horizontal direction of the current coding unit, and the pixel width of the sub-block is the pixel width of the current coding unit, and the pixel height of the sub-block is 1 / 2 of the pixel height of the current coding unit. Taking the top left corner pixel of the current coding unit as the origin of the pixel coordinates, the coordinates of the top left corner pixel of the sub-block are (0, H*1 / 4).
[0077] Referring to Figure 7, the first sub-block from left to right is located to the left of the middle region in the vertical direction of the current coding unit, and the pixel height of the sub-block is the pixel height of the current coding unit, and the pixel width of the sub-block is 1 / 4 of the pixel width of the current coding unit. Taking the top left corner pixel of the current coding unit as the origin of the pixel coordinates, the coordinates of the top left corner pixel of the sub-block are (W*1 / 4, 0).
[0078] Referring to Figure 7, the second sub-block from left to right is located to the right of the middle region in the vertical direction of the current coding unit, and the pixel height of the sub-block is the pixel height of the current coding unit, and the pixel width of the sub-block is 1 / 4 of the pixel width of the current coding unit. Taking the top left corner pixel of the current coding unit as the origin of the pixel coordinates, the coordinates of the top left corner pixel of the sub-block are (W*1 / 2, 0).
[0079] Referring to Figure 7, the third sub-block from left to right is located above the middle area in the horizontal direction of the current coding unit, and the pixel width of the sub-block is the pixel width of the current coding unit, and the pixel height of the sub-block is 1 / 4 of the pixel height of the current coding unit. Taking the top left corner pixel of the current coding unit as the origin of the pixel coordinates, the coordinates of the top left corner pixel of the sub-block are (0, H*1 / 4).
[0080] Referring to Figure 7, the fourth sub-block from left to right is located below the middle area in the horizontal direction of the current coding unit, and the pixel width of the sub-block is the pixel width of the current coding unit, and the pixel height of the sub-block is 1 / 4 of the pixel height of the current coding unit. Taking the top left corner pixel of the current coding unit as the origin of the pixel coordinates, the coordinates of the top left corner pixel of the sub-block are (0, H*1 / 2).
[0081] In some embodiments, after determining that a certain seed block partitioning method is used for sub-block transformation of the current coding unit, the encoder may introduce indication information to indicate which specific sub-block partitioning method was used. It should be noted that the naming of the syntax elements described below is for illustrative purposes only, and can be based on actual needs in practical applications.
[0082] In some embodiments, the position of the selected sub-block can be implicitly encoded to indicate the position of the currently selected sub-block: that is, whether the selected sub-block is located to the left or right of the middle region in the vertical direction of the current coding unit, or whether the selected sub-block is located above or below the middle region in the horizontal direction of the current coding unit. For example, if the number of pixels with even residuals in the current coding unit is odd, the selected sub-block is located to the left of the middle region in the vertical direction of the current coding unit or above the middle region in the horizontal direction of the current coding unit; if the number of pixels with even residuals in the current coding unit is even, the selected sub-block is located to the right of the middle region in the vertical direction of the current coding unit or below the middle region in the horizontal direction of the current coding unit.
[0083] For example, if the number of pixels with even residuals in the current coding unit is even, the selected sub-block is located to the left of the middle region in the vertical direction of the current coding unit or above the middle region in the horizontal direction of the current coding unit. If the number of pixels with even residuals in the current coding unit is odd, the selected sub-block is located to the right of the middle region in the vertical direction of the current coding unit or below the middle region in the horizontal direction of the current coding unit.
[0084] For example, if the number of pixels with odd residuals in the current coding unit is odd, the selected sub-block is located to the left of the middle region in the vertical direction of the current coding unit or above the middle region in the horizontal direction of the current coding unit. If the number of pixels with odd residuals in the current coding unit is even, the selected sub-block is located to the right of the middle region in the vertical direction of the current coding unit or below the middle region in the horizontal direction of the current coding unit.
[0085] In some embodiments, the introduced syntax element may be combined with or reuse at least one of the existing syntax elements sbt_quad_flag, sbt_dir_flag, and sbt_pos_flag to distinguish which of the six sub-block partitioning methods is used.
[0086] For example, in a specific case, a new flag5a is added, and sbt_quad_flag and sbt_dir_flag are reused to distinguish which of the six sub-block partitioning methods is used. Specifically, if one of the six sub-block partitioning methods is used for the inter-frame prediction residual of the current coding unit, the encoder can set the syntax element flag5a to 1 to indicate that one of the six sub-block partitioning methods shown in Figures 6 and 7 is used; otherwise, if one of the six sub-block partitioning methods shown in Figures 6 and 7 is not used, the encoder can set the syntax element flag5a to 0. When any of the two sub-block partitioning methods in Figure 6 is used, the encoder can set the syntax element sbt_quad_flag to 1; when any of the four sub-block partitioning methods in Figure 7 is used, the syntax element sbt_quad_flag can be set to 0. When the encoder uses the first seed block partitioning method shown in Figure 6, the encoder can set the syntax element sbt_dir_flag to 1; otherwise, when the encoder uses the second seed block partitioning method shown in Figure 6, the syntax element sbt_dir_flag can be set to 0. When the encoder uses one of the first two sub-block partitioning methods shown in Figure 7, the encoder can set the syntax element sbt_dir_flag to 0; otherwise, when the encoder uses one of the latter two sub-block partitioning methods shown in Figure 7, the syntax element sbt_dir_flag can be set to 1. When the number of pixels with even residuals in the current coding unit is odd, the selected sub-block is located to the left of the middle region in the vertical direction of the current coding unit or above the middle region in the horizontal direction of the current coding unit, i.e., using the first or third seed block partitioning method shown in Figure 7. When the number of pixels with even residuals in the current coding unit is even, the selected sub-block is located to the right of the middle region in the vertical direction of the current coding unit or below the middle region in the horizontal direction of the current coding unit, i.e., using the second or fourth seed block partitioning method shown in Figure 7.
[0087] In some embodiments, when the pixel width of the current coding unit is greater than or equal to 8, it is permissible to divide the middle region of the current coding unit in the vertical direction into a sub-block with a pixel height equal to the pixel height of the current coding unit and a pixel width equal to half the pixel width of the current coding unit.
[0088] In some embodiments, when the pixel height of the current coding unit is greater than or equal to 8, it is permissible to divide the middle region of the current coding unit in the horizontal direction into a sub-block with a pixel width equal to the pixel width of the current coding unit and a pixel height equal to half the pixel height of the current coding unit.
[0089] In some embodiments, when the pixel width of the current coding unit is greater than or equal to 16, it is permissible to divide the middle region of the current coding unit in the vertical direction into a sub-block with a pixel height equal to the pixel height of the current coding unit and a pixel width equal to 1 / 4 of the pixel width of the current coding unit.
[0090] In some embodiments, when the pixel height of the current coding unit is greater than or equal to 16, it is permissible to divide the middle region of the current coding unit in the horizontal direction into a sub-block with a pixel width equal to the pixel width of the current coding unit and a pixel height equal to 1 / 4 of the pixel height of the current coding unit.
[0091] In some embodiments, when the encoder selects any one of the eight sub-block partitioning methods, the encoder can determine first indication information, which indicates that a sub-block transformation should be performed on the current coding unit; determine second indication information, which indicates that the target sub-block partitioning method is one of the two types; determine third indication information, which indicates that the sub-block is located in the middle region of the vertical direction or the middle region of the horizontal direction of the current coding unit, and the first indication information, the second indication information and the third indication information jointly determine the target sub-block partitioning method; and obtain the bitstream of the current coding unit based on the transform coefficients, including: encoding according to the first indication information, the second indication information and the third indication information and the transform coefficients to obtain the bitstream of the current coding unit.
[0092] In the video encoding method provided in the embodiments of this disclosure, the above-mentioned multiple sub-block partitioning methods include at least the six sub-block partitioning methods shown in FIG6 and FIG7.
[0093] After sub-block partitioning, the transformation kernel used for sub-block transformation is implicitly determined by the sub-block partitioning method and the selected sub-block position.
[0094] Figure 8 is a schematic diagram of the transform kernel corresponding to the six-segment block partitioning method provided in some embodiments of this disclosure. When any of the six-segment block partitioning methods shown in Figures 6 and 7 is used for the current coding unit, the corresponding transform kernel can be as shown in Figure 8. Referring to Figure 8:
[0095] When the divided sub-block is located in the middle region of the vertical direction of the current coding unit, and the pixel height of the sub-block is the pixel height of the current coding unit, the pixel width of the sub-block is 1 / 2 of the pixel width of the current coding unit, and the coordinates of the top left pixel of the sub-block are (W*1 / 4, 0), the transform kernel for horizontal transformation is DCT8, and the transform kernel for vertical transformation is DST7.
[0096] When the divided sub-block is located in the middle area of the horizontal direction of the current coding unit, and the pixel width of the sub-block is the pixel width of the current coding unit, the pixel height of the sub-block is 1 / 2 of the pixel height of the current coding unit, and the coordinates of the top left pixel of the sub-block are (0, H*1 / 4), the transform kernel for the horizontal transformation is DST7, and the transform kernel for the vertical transformation is DCT8.
[0097] When the divided sub-block is located in the middle region of the vertical direction of the current coding unit, and the pixel height of the sub-block is the pixel height of the current coding unit, the pixel width of the sub-block is 1 / 4 of the pixel width of the current coding unit, and the coordinates of the top left pixel of the sub-block are (W*1 / 4, 0), the transform kernel for horizontal transformation is DST7, and the transform kernel for vertical transformation is DCT8.
[0098] When the divided sub-block is located in the middle region of the vertical direction of the current coding unit, and the pixel height of the sub-block is the pixel height of the current coding unit, the pixel width of the sub-block is 1 / 4 of the pixel width of the current coding unit, and the coordinates of the top left pixel of the sub-block are (W*1 / 2, 0), the transform kernel for the horizontal transformation is DST7, and the transform kernel for the vertical transformation is DST7.
[0099] When the divided sub-block is located in the middle area of the horizontal direction of the current coding unit, and the pixel width of the sub-block is the pixel width of the current coding unit, the pixel height of the sub-block is 1 / 4 of the pixel height of the current coding unit, and the coordinates of the top left pixel of the sub-block are (0, H*1 / 4), the transform kernel for the horizontal transformation is DCT8, and the transform kernel for the vertical transformation is DST7.
[0100] When the divided sub-block is located in the middle area of the horizontal direction of the current coding unit, and the pixel width of the sub-block is the pixel width of the current coding unit, the pixel height of the sub-block is 1 / 4 of the pixel height of the current coding unit, and the coordinates of the top left pixel of the sub-block are (0, H*1 / 2), the transform kernel for the horizontal transformation is DST7, and the transform kernel for the vertical transformation is DST7.
[0101] It should be noted that since DST7 and DCT8 only support a maximum of 32-point transformation, when the pixel width or pixel height of a sub-block is greater than 32, DCT-2 transformation is used in that horizontal or vertical direction.
[0102] In one specific embodiment, a video encoding method is provided, comprising the following steps:
[0103] The encoder obtains the current coding unit from the frame to be encoded, which uses inter-frame predictive coding mode. The encoder iterates through various transformation methods for the current coding unit. These transformation methods include: transforming the entire inter-frame prediction residual of the current coding unit; and dividing the current coding unit into sub-blocks according to each of the various sub-block partitioning methods and transforming the inter-frame prediction residuals of the sub-blocks. These various sub-block partitioning methods include at least the six sub-block partitioning methods shown in Figures 6 and 7. Of course, each sub-block partitioning method has requirements on the size of the current coding unit, and the current coding unit must meet the constraints of the corresponding sub-block partitioning method. The encoder calculates the rate-distortion corresponding to each transformation method and selects the transformation method with the lowest rate-distortion as the transformation method for the current coding unit, thereby determining a specific sub-block partitioning method, i.e., the target sub-block partitioning method. The encoder can determine the target transform kernel corresponding to the target sub-block partitioning method, and divide the current coding unit into sub-blocks according to the target sub-block partitioning method. The encoder generates indication information to identify that the sub-block partitioning method is the target sub-block partitioning method. The encoder performs sub-block transformation on the inter-frame prediction residual corresponding to the sub-block using the target transform kernel to obtain transform coefficients. The transform coefficients are quantized to obtain quantization coefficients. The quantization coefficients, indication information, and coding control information are entropy encoded to obtain the bitstream of the current coding unit.
[0104] Figure 9 illustrates the application environment of the video encoding method provided in some embodiments of this disclosure. Referring to Figure 9, terminal 102 communicates with server 104 via a network. A data storage system can store the data that server 104 needs to process. The data storage system can be integrated on server 104 or placed on a cloud or other network server. In some embodiments, an encoder is configured on terminal 102. Terminal 102 determines the target sub-block partitioning method and target transform kernel of the current encoding unit, wherein the sub-block partitioning method corresponds to the transform kernel; according to the target sub-block partitioning method, sub-blocks are partitioned from the current encoding unit; for the inter-frame prediction residuals corresponding to the sub-blocks, the target transform kernel is used to perform sub-block transform to obtain transform coefficients; based on the transform coefficients, the bitstream of the current encoding unit is obtained, wherein the target sub-block partitioning method is one of multiple sub-block partitioning methods, and the multiple sub-block partitioning methods include at least the following two categories:
[0105] The sub-block is located in the middle region of the vertical direction of the current coding unit, and the pixel height of the sub-block is the pixel height of the current coding unit, and the pixel width of the sub-block is 1 / 2 of the pixel width of the current coding unit; or, the sub-block is located in the middle region of the horizontal direction of the current coding unit, and the pixel width of the sub-block is the pixel width of the current coding unit, and the pixel height of the sub-block is 1 / 2 of the pixel height of the current coding unit.
[0106] The sub-block is located in the middle region of the current coding unit in the vertical direction, and the pixel height of the sub-block is the same as the pixel height of the current coding unit, and the pixel width of the sub-block is 1 / 4 of the pixel width of the current coding unit. Alternatively, the sub-block is located in the middle region of the current coding unit in the horizontal direction, and the pixel width of the sub-block is the same as the pixel width of the current coding unit, and the pixel height of the sub-block is 1 / 4 of the pixel height of the current coding unit.
[0107] Terminal 102 can send the bitstream to server 104, which is equipped with a decoder to decode the bitstream and obtain image data.
[0108] The terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can include smart speakers, smart TVs, smart air conditioners, smart in-vehicle systems, and projection devices. Portable wearable devices can include smartwatches, smart bracelets, and head-mounted displays. Head-mounted displays can be virtual reality (VR) devices, augmented reality (AR) devices, and smart glasses. The server 104 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.
[0109] The video decoding method provided in this disclosure can be applied to the application environment shown in Figure 9. For example, server 104 can parse the target sub-block partitioning method of the current decoding unit and the quantization coefficients of the inter-frame prediction residuals of the sub-blocks in the unit to be decoded from the bitstream from terminal 102, perform inverse quantization on the quantization coefficients to obtain the transform coefficients of the inter-frame prediction residuals of the sub-blocks; according to the target transform kernel corresponding to the target sub-block partitioning method, perform inverse sub-block transform on the transform coefficients of the inter-frame prediction residuals of the sub-blocks to obtain the inter-frame prediction residuals, and obtain the image data of the unit to be decoded based on the inter-frame prediction residuals and the target sub-block partitioning method; wherein, the target sub-block partitioning method is one of a variety of sub-block partitioning methods, and the variety of sub-block partitioning methods includes at least the following two categories:
[0110] The sub-block is located in the middle area of the vertical direction of the current decoding unit, and the pixel height of the sub-block is the pixel height of the current decoding unit, and the pixel width of the sub-block is 1 / 2 of the pixel width of the current decoding unit; or, the sub-block is located in the middle area of the horizontal direction of the current decoding unit, and the pixel width of the sub-block is the pixel width of the current decoding unit, and the pixel height of the sub-block is 1 / 2 of the pixel height of the current decoding unit.
[0111] The sub-block is located in the middle area of the current decoding unit in the vertical direction, and the pixel height of the sub-block is the pixel height of the current decoding unit, and the pixel width of the sub-block is 1 / 4 of the pixel width of the current decoding unit. Alternatively, the sub-block is located in the middle area of the current decoding unit in the horizontal direction, and the pixel width of the sub-block is the pixel width of the current decoding unit, and the pixel height of the sub-block is 1 / 4 of the pixel height of the current decoding unit.
[0112] Figure 10 is a schematic flowchart of a video decoding method provided in some embodiments of this disclosure. The video decoding method can be executed by the decoder 10 shown in Figure 2. In some embodiments, the decoder can be applied to a computer device, and the video decoding method includes the following steps:
[0113] Step 1002: Parse the target sub-block partitioning method of the current decoding unit and the quantization coefficients of the inter-frame prediction residuals of the sub-blocks in the unit to be decoded from the bitstream, and perform inverse quantization on the quantization coefficients to obtain the transform coefficients of the inter-frame prediction residuals of the sub-blocks.
[0114] Step 1004: According to the target transform kernel corresponding to the target sub-block partitioning method, perform sub-block inverse transform on the transform coefficients of the inter-frame prediction residual of the sub-block to obtain the inter-frame prediction residual. Based on the inter-frame prediction residual and the target sub-block partitioning method, obtain the image data of the unit to be decoded.
[0115] The target sub-block partitioning method is one of several sub-block partitioning methods, which include at least the following two categories:
[0116] The sub-block is located in the middle area of the vertical direction of the current decoding unit, and the pixel height of the sub-block is the pixel height of the current decoding unit, and the pixel width of the sub-block is 1 / 2 of the pixel width of the current decoding unit; or, the sub-block is located in the middle area of the horizontal direction of the current decoding unit, and the pixel width of the sub-block is the pixel width of the current decoding unit, and the pixel height of the sub-block is 1 / 2 of the pixel height of the current decoding unit.
[0117] The sub-block is located in the middle area of the current decoding unit in the vertical direction, and the pixel height of the sub-block is the pixel height of the current decoding unit, and the pixel width of the sub-block is 1 / 4 of the pixel width of the current decoding unit. Alternatively, the sub-block is located in the middle area of the current decoding unit in the horizontal direction, and the pixel width of the sub-block is the pixel width of the current decoding unit, and the pixel height of the sub-block is 1 / 4 of the pixel height of the current decoding unit.
[0118] Some embodiments of this disclosure also provide a video encoding method, which includes the following steps:
[0119] Step 111: If the current coding unit has performed a sub-block transformation, determine whether the current coding unit supports the SBT modes in the first SBT mode set.
[0120] It should be noted that if the current encoding unit does not perform sub-block transformation, the syntax element used to identify whether the current encoding unit has performed sub-block transformation is assigned a first preset value and the syntax element is encoded. Only when the current encoding unit performs sub-block transformation will the video encoding method provided in this embodiment be further executed.
[0121] In some embodiments, the first SBT mode set includes: a first SBT mode, a second SBT mode, a third SBT mode, a fourth SBT mode, a fifth SBT mode, a sixth SBT mode, a seventh SBT mode, and an eighth SBT mode. Specifically, the first, second, third, fourth, fifth, sixth, seventh, and eighth SBT modes are used to select the first, second, third, fourth, fifth, sixth, seventh, and eighth sub-blocks as non-zero residual transform units, respectively. The width and height of the first, second, third, and fourth sub-blocks are both 1 / 2 of the current coding unit, and the width and height of the fifth, sixth, seventh, and eighth sub-blocks are both 1 / 4 of the current coding unit. The first and fifth sub-blocks are located at the upper left corner of the current coding unit, the second and sixth sub-blocks are located at the upper right corner of the current coding unit, the third and seventh sub-blocks are located at the lower left corner of the current coding unit, and the fourth and eighth sub-blocks are located at the lower right corner of the current coding unit.
[0122] In step 111 above, if the current coding unit supports the SBT modes in the first SBT mode set, then step 112 is executed as follows:
[0123] Step 112: Assign a value to the first syntax element based on whether the SBT mode of the current coding unit belongs to the first SBT mode set, and generate the first coding data of the current coding unit.
[0124] The first syntax element is used to identify whether the SBT mode of the current coding unit belongs to the first SBT mode set, and the first coding data includes the first syntax element.
[0125] For example, the first syntax element can be: ctx_sbt_ext_idx flag.
[0126] For example, the first preset value and the second preset value can be 0 and 1, respectively. That is, if the SBT mode of the current coding unit does not belong to the first SBT mode set, the first syntax element is assigned a value of 0, and if the SBT mode of the current coding unit belongs to the first SBT mode set, the first syntax element is assigned a value of 1.
[0127] In step 111 above, if the current coding unit does not support the SBT modes in the first SBT mode set, then step 113 is executed as follows:
[0128] Step 113: Generate the second encoded data of the current encoding unit, wherein the second encoded data does not include the first syntax element.
[0129] The video encoding method provided in some embodiments of this disclosure, when performing sub-block transformation on the current encoding unit, first determines whether the current encoding unit supports the SBT modes in the first SBT mode set when encoding the current encoding unit. If the current encoding unit supports the SBT modes in the first SBT mode set, a first syntax element is assigned a value according to whether the SBT mode of the current encoding unit belongs to the first SBT mode set, and first encoded data of the current encoding unit including the first syntax element is generated. If the current encoding unit does not support the SBT modes in the first SBT mode set, second encoded data of the current encoding unit is generated that does not include the first syntax element. Since the video encoding method provided in this disclosure only includes a first syntax element in the encoding data of the current encoding unit to identify whether the SBT mode of the current encoding unit belongs to the first SBT mode set when the current encoding unit supports the SBT mode in the first SBT mode set, and does not include the first syntax element in the encoding data of the current encoding unit when the current encoding unit does not support the SBT mode in the first SBT mode set, this disclosure embodiment can reduce the amount of data information identifying the SBT mode used by the current encoding unit, thereby improving video encoding efficiency.
[0130] As an extension and refinement of the above embodiments, this disclosure also provides another video encoding method, which includes the following steps:
[0131] Step 1201: If SBT is performed in the current coding unit, determine whether the width and height of the current coding unit are both greater than or equal to 8.
[0132] In step 1201 above, if the width and height of the current coding unit are both greater than or equal to 8, then steps 1202 and 1203 are executed as follows:
[0133] Step 1202: Determine that the current coding unit supports the SBT modes in the first sub-block transform SBT mode set.
[0134] Since the SBT modes in the first SBT mode set are subject to the following restrictions: when the sub-block size is 1 / 2 CU width × 1 / 2 CU height, the width and height of the CU must be greater than or equal to 8; when the sub-block size is 1 / 4 CU width × 1 / 4 CU height, the width and height of the CU must be greater than or equal to 16, if the width and height of the current coding unit are both greater than or equal to 8, then the current coding unit can support at least the first SBT mode, the second SBT mode, the third SBT mode, and the fourth SBT mode in the first SBT mode set. Therefore, it is determined that the current coding unit supports the SBT modes in the first sub-block transform SBT mode set.
[0135] Step 1203: Determine whether the SBT mode of the current coding unit belongs to the first SBT mode set, and assign a value to the first syntax element according to whether the SBT mode of the current coding unit belongs to the first SBT mode set.
[0136] In step 1203 above, if the SBT mode of the current coding unit belongs to the first SBT mode set, then the following steps 1204 to 1206 are executed:
[0137] Step 1204: Determine whether the current encoding unit simultaneously supports the SBT modes in the first subset of the first SBT mode set and the SBT modes in the second subset of the first SBT mode set.
[0138] The first subset is a set consisting of the first SBT mode, the second SBT mode, the third SBT mode, and the fourth SBT mode; the second subset is a set consisting of the fifth SBT mode, the sixth SBT mode, the seventh SBT mode, and the eighth SBT mode.
[0139] In some embodiments, determining whether the current coding unit simultaneously supports SBT modes in a first subset of the first SBT mode set and SBT modes in a second subset of the first SBT mode set includes: determining whether the width and height of the current coding unit are both greater than or equal to 16; if the width and height of the current coding unit are both greater than or equal to 16, then the current coding unit is determined to simultaneously support SBT modes in a first subset of the first SBT mode set and SBT modes in a second subset of the first SBT mode set; if the width and height of the current coding unit and / or the width are both less than 16, then the current coding unit is determined to only support SBT modes in a second subset of the first SBT mode set (not simultaneously supporting SBT modes in a first subset of the first SBT mode set and SBT modes in a second subset of the first SBT mode set).
[0140] In step 1204 above, if the current encoding unit simultaneously supports SBT modes in the first subset of the first SBT mode set and SBT modes in the second subset of the first SBT mode set, then step 1205 is executed as follows:
[0141] Step 1205: Assign values to the second and third syntax elements according to the SBT mode of the current encoding unit, and encode the first, second, and third syntax elements to generate the first encoded data.
[0142] The second syntax element is used to identify whether the SBT mode of the current coding unit belongs to the first subset of the first SBT mode set; the third syntax element is used to identify whether the sub-block selected by the SBT mode of the current coding unit is located to the left of the current coding unit.
[0143] In some embodiments, the method further includes:
[0144] The seventh syntax element is assigned a value according to the SBT mode of the current coding unit, and the seventh syntax element is implicitly encoded. The seventh syntax element is used to identify the position of the sub-block selected by the SBT mode of the current coding unit.
[0145] In the above embodiments, when the SBT mode of the current coding unit belongs to the first SBT mode set, the second syntax element can identify whether the SBT mode of the current coding unit belongs to the first subset or the second subset of the first SBT mode set. The third syntax element can identify whether the sub-block selected by the SBT mode of the current coding unit is located to the left or right of the current coding unit. However, it cannot further distinguish between the first SBT mode and the third SBT mode, the second SBT mode and the fourth SBT mode, the fifth SBT mode and the seventh SBT mode, or the sixth SBT mode and the eighth SBT mode. Therefore, it is necessary to further assign a value to the seventh syntax element according to the SBT mode of the current coding unit to further uniquely identify the SBT mode of the current coding unit.
[0146] In some embodiments, assigning a value to the seventh syntax element according to the SBT mode of the current coding unit includes: if the sub-block selected by the SBT mode of the current coding unit is located above the current coding unit (first SBT mode, second SBT mode, fifth SBT mode, sixth SBT mode), then the seventh syntax element is assigned a first preset value; and if the sub-block selected by the SBT mode of the current coding unit is located below the current coding unit (third SBT mode, fourth SBT mode, seventh SBT mode, eighth SBT mode), then the seventh syntax element is assigned a second preset value.
[0147] The implicit coding in this embodiment refers to representing the seventh syntax element (whether the sub-block selected by the SBT mode of the current coding unit is located above or below the current coding unit) through the video data itself, rather than indicating it by directly adding the seventh syntax element to the encoded data. This can reduce the bits occupied by the identifier, thereby reducing the amount of data in the bitstream.
[0148] In step 1204 above, if the current encoding unit does not simultaneously support SBT modes in the first subset of the first SBT mode set and SBT modes in the second subset of the first SBT mode set (only supports SBT modes in the first subset of the first SBT mode set), then the following step 1206 is executed:
[0149] Step 1206: Assign a value to the third syntax element according to the SBT mode of the current coding unit, and encode the first syntax element and the third syntax element to generate the first encoded data.
[0150] In some embodiments, the method further includes:
[0151] The seventh syntax element is assigned a value according to the SBT mode of the current coding unit, and the seventh syntax element is implicitly encoded. The seventh syntax element is used to identify the position of the sub-block selected by the SBT mode of the current coding unit.
[0152] In the above embodiments, the second syntax element is assigned a value and carried in the encoded data of the current encoding unit only when the current encoding unit simultaneously supports SBT modes in both the first subset and the second subset of the first SBT mode set. When the current encoding unit only supports SBT modes in the first subset of the first SBT mode set, the second syntax element is not assigned a value and is not carried in the encoded data of the previous encoding unit. Therefore, the above embodiments can further reduce the amount of data identifying the SBT mode used by the current encoding unit, thereby improving video encoding efficiency.
[0153] In step 1203 above, if the SBT mode of the current coding unit does not belong to the first SBT mode set, then step 1207 is executed as follows:
[0154] Step 1207: Determine whether the SBT mode of the current coding unit belongs to the second SBT mode set, and assign a value to the fourth syntax element based on whether the SBT mode of the current coding unit belongs to the second SBT mode set.
[0155] The fourth syntax element is used to identify whether the SBT mode of the current coding unit belongs to the second SBT mode set.
[0156] In some embodiments, the second SBT mode set includes the ninth, tenth, eleventh, twelfth, thirteenth, and fourteenth SBT modes. The ninth, tenth, eleventh, twelfth, thirteenth, and fourteenth SBT modes are used to select the ninth, tenth, eleventh, twelfth, thirteenth, and fourteenth sub-blocks as non-zero residual transform units, respectively. The width of the ninth sub-block is half that of the current coding unit, and its height is the same as the current coding unit. The midpoints of the upper and lower edges of the ninth sub-block coincide with the midpoints of the upper and lower edges of the current coding unit, respectively. The height of the tenth sub-block is half that of the current coding unit, and its width is the same as the current coding unit. The midpoints of the left and right edges of the tenth sub-block coincide with the midpoints of the left and right edges of the current coding unit, respectively. The eleventh and twelfth sub-blocks have different widths. The width of the eleventh and twelfth sub-blocks is the same as that of the current coding unit. The midpoints of the upper and lower edges of the eleventh sub-block coincide with the first quarter-division points of the upper and lower edges of the current coding unit, respectively. The midpoints of the upper and lower edges of the twelfth sub-block coincide with the third quarter-division points of the upper and lower edges of the current coding unit, respectively. The width of the thirteenth and fourteenth sub-blocks is the same as that of the current coding unit. The height of the thirteenth and fourteenth sub-blocks is 1 / 4 of that of the current coding unit. The midpoints of the left and right edges of the thirteenth sub-block coincide with the first quarter-division points of the left and right edges of the current coding unit, respectively. The midpoints of the left and right edges of the fourteenth sub-block coincide with the third quarter-division points of the left and right edges of the current coding unit, respectively.
[0157] In some embodiments, assigning a value to the fourth syntax element based on whether the SBT mode of the current coding unit belongs to the second SBT mode set includes: if the SBT mode of the current coding unit does not belong to the second SBT mode set, then assigning the fourth syntax element a first preset value; if the SBT mode of the current coding unit belongs to the second SBT mode set, then assigning the fourth syntax element a second preset value.
[0158] In step 1207 above, if it is determined that the SBT mode of the current coding unit belongs to the second SBT mode set, then step 1208 is executed as follows:
[0159] Step 1208: Generate the first encoded data based on the first syntax element and the fourth syntax element.
[0160] Generating the first encoded data based on the first syntax element and the fourth syntax element can include the following four implementation methods:
[0161] Implementation method 1: Encode the first syntax element and the fourth syntax element to generate the second encoded data.
[0162] Implementation Method 2: Assign a value to the fifth syntax element according to the SBT mode of the current coding unit, and encode the first syntax element, the fourth syntax element, and the fifth syntax element to generate the first encoded data. The fifth syntax element is used to identify the division direction of the SBT mode of the current coding unit.
[0163] Implementation Method 3: Assign a value to the sixth syntax element according to the SBT mode of the current coding unit, and encode the first syntax element, the fourth syntax element, and the sixth syntax element to generate the first encoded data. The sixth syntax element is used to identify the division ratio of the SBT mode of the current coding unit.
[0164] Implementation method 4: Assign a value to the fifth syntax element according to the SBT mode of the current coding unit, and encode the first syntax element, the fourth syntax element, the fifth syntax element and the sixth syntax element to generate the first encoded data; wherein, the fifth syntax element is used to identify the division direction of the SBT mode of the current coding unit, and the sixth syntax element is used to identify the division ratio of the SBT mode of the current coding unit.
[0165] In some embodiments, assigning a value to the fifth syntax element according to the SBT mode of the current encoding unit includes: if the TU partitioning method of the current encoding SBT mode is horizontal, then the fifth syntax element is assigned a first preset value; and if the TU partitioning method of the current encoding SBT mode is vertical, then the fifth syntax element is assigned a second preset value.
[0166] In some embodiments, assigning a value to the sixth syntax element according to the SBT mode of the current coding unit includes: if the size of the sub-block selected by the current SBT mode of the current coding unit is 1 / 2 of the current coding unit, then the sixth syntax element is assigned a first preset value; and if the size of the sub-block selected by the current SBT mode of the current coding unit is 1 / 4 of the current coding unit, then the sixth syntax element is assigned a second preset value.
[0167] The four implementations of generating the first encoded data based on the first and fourth syntax elements in the above embodiments are different implementations obtained by permutation and combination of whether or not the fifth and sixth syntax elements are encoded. Whether or not the fifth and sixth syntax elements are encoded can be determined according to the width and height of the current encoding unit and the SBT mode supported by the current encoding unit. This disclosure does not limit this.
[0168] In some embodiments, the method further includes:
[0169] The seventh syntax element is assigned a value according to the SBT mode of the current coding unit, and the seventh syntax element is implicitly encoded. The seventh syntax element is used to identify the position of the sub-block selected by the SBT mode of the current coding unit.
[0170] In step 1207 above, if it is determined that the SBT mode of the current coding unit does not belong to the second SBT mode set, then step 1209 is executed as follows:
[0171] Step 1209: Assign values to the fifth and sixth syntax elements according to the SBT mode of the current coding unit, and encode the first, fourth, fifth, and sixth syntax elements to generate the first encoded data.
[0172] The fifth syntax element is used to identify the SBT mode partitioning direction of the current coding unit, and the sixth syntax element is used to identify the SBT mode partitioning ratio of the current coding unit.
[0173] Since the SBT mode of the current coding unit does not belong to the first SBT mode set or the second SBT mode set, and the current coding unit has also performed sub-block transformation SBT, the SBT mode of the current coding unit belongs to the first SBT mode set composed of SBT mode 1, SBT mode 2, SBT mode 3, SBT mode 4, SBT mode 5, SBT mode 6, SBT mode 7, and SBT mode 8. Therefore, the fifth and sixth syntax elements are assigned values according to the SBT mode of the current coding unit, and the first, fourth, fifth, and sixth syntax elements are encoded to generate the first encoded data.
[0174] In some embodiments, the method further includes:
[0175] The seventh syntax element is assigned a value according to the SBT mode of the current coding unit, and the seventh syntax element is implicitly encoded. The seventh syntax element is used to identify the position of the sub-block selected by the SBT mode of the current coding unit.
[0176] The fifth syntax element can identify whether the SBT mode of the current coding unit is divided horizontally or vertically. It can also identify whether the size of the selected sub-block of the current coding unit is 1 / 2 or 1 / 4 of the current coding unit. However, it cannot further distinguish between the fifteenth and sixteenth SBT modes, the seventeenth and eighteenth SBT modes, the nineteenth and twentieth SBT modes, or the twenty-first and twenty-second SBT modes. Therefore, it is necessary to further assign a value to the seventh syntax element according to the SBT mode of the current coding unit to uniquely identify the SBT mode of the current coding unit.
[0177] In step 1201 above, if the current coding unit width and height and / or width is less than 8, then steps 1210 and 1211 are executed as follows:
[0178] Step 1210: Determine that the current coding unit does not support the SBT modes in the first sub-block transform SBT mode set.
[0179] Since the SBT modes in the first SBT mode set are subject to the following restrictions: when the sub-block size is 1 / 2 CU width × 1 / 2 CU height, the width and height of the CU must be greater than or equal to 8; when the sub-block size is 1 / 4 CU width × 1 / 4 CU height, the width and height of the CU must be greater than or equal to 16, if the width and height of the current coding unit and / or the width is less than 8, then the current coding unit does not support any of the SBT modes in the first SBT mode set. Therefore, it is determined that the current coding unit does not support the SBT modes in the first sub-block transform SBT mode set.
[0180] Step 1211: Determine whether the SBT mode of the current coding unit belongs to the second SBT mode set, and assign a value to the fourth syntax element based on whether the SBT mode of the current coding unit belongs to the second SBT mode set.
[0181] The fourth syntax element is used to identify whether the SBT mode of the current coding unit belongs to the second SBT mode set.
[0182] In step 1211 above, if the SBT mode of the current coding unit belongs to the second SBT mode set, then step 1212 is executed as follows:
[0183] Step 1212: Generate the second encoded data based on the fourth syntax element.
[0184] In some embodiments, generating the second encoded data based on the fourth syntax element includes:
[0185] The fourth syntax element is encoded to generate the second encoded data; or, the fifth syntax element is assigned a value according to the SBT mode of the current encoding unit, and the fourth and fifth syntax elements are encoded to generate the second encoded data; or, the sixth syntax element is assigned a value according to the SBT mode of the current encoding unit, and the fourth and sixth syntax elements are encoded to generate the second encoded data; or, the fifth syntax element is assigned a value according to the SBT mode of the current encoding unit, and the fourth, fifth, and sixth syntax elements are encoded to generate the second encoded data.
[0186] The fifth syntax element is used to identify the SBT mode partitioning direction of the current coding unit, and the sixth syntax element is used to identify the SBT mode partitioning ratio of the current coding unit.
[0187] In step 1211 above, if the SBT mode of the current coding unit does not belong to the second SBT mode set, then step 1213 is executed as follows:
[0188] Step 1213: Assign values to the fifth and sixth syntax elements according to the SBT mode of the current encoding unit, and encode the fourth, fifth, and sixth syntax elements to generate the second encoded data.
[0189] The fifth syntax element is used to identify the SBT mode partitioning direction of the current coding unit, and the sixth syntax element is used to identify the SBT mode partitioning ratio of the current coding unit.
[0190] This disclosure also provides a video decoding method, which includes the following steps:
[0191] Step 131: If the current coding unit has performed a sub-block transformation, determine whether the current coding unit supports the SBT modes in the first SBT mode set.
[0192] In some embodiments, it can be determined whether the current coding unit has performed SBT by using syntax elements that identify whether the current coding unit has performed SBT.
[0193] In step 131 above, if the current coding unit supports the SBT modes in the first SBT mode set, then step 132 is executed as follows:
[0194] Step 132: Obtain the first syntax element based on the encoding data of the current encoding unit, and determine whether the SBT mode of the current encoding unit belongs to the first SBT mode set based on the first syntax element.
[0195] If step 132 above determines that the current coding unit belongs to the first SBT mode set, then step 133 is executed as follows:
[0196] Step 133: Determine the SBT mode of the current coding unit from the first SBT mode set based on the encoded data.
[0197] If step 131 above determines that the current coding unit does not support the SBT modes in the first SBT mode set, or if step 132 above determines that the SBT mode of the current coding unit does not belong to the first SBT mode set, then the following step 134 is executed:
[0198] Step 134: Determine the SBT mode of the current coding unit from other SBT mode sets based on the encoded data.
[0199] Where the first syntax element is not included in the encoded data if the current encoding unit does not support the SBT modes in the first SBT mode set.
[0200] The video decoding method provided in some embodiments of this disclosure, when the current coding unit performs a sub-block transform, first determines whether the current coding unit supports SBT modes in a first SBT mode set; if the current coding unit supports SBT modes in the first SBT mode set, it obtains a first syntax element based on the coding data of the current coding unit, and determines whether the SBT mode of the current coding unit belongs to the first SBT mode set based on the first syntax element; if the current coding unit belongs to the first SBT mode set, it determines the SBT mode of the current coding unit from the first SBT mode set based on the coding data; if the current coding unit does not support SBT modes in the first SBT mode set or the SBT mode of the current coding unit does not belong to the first SBT mode set, it determines the SBT mode of the current coding unit from other SBT mode sets based on the coding data; and if the current coding unit does not support SBT modes in the first SBT mode set, the coding data does not include the first syntax element. Since the video decoding method provided in this disclosure only needs to include a first syntax element in the encoding data of the current encoding unit to identify whether the SBT mode of the current encoding unit belongs to the first SBT mode set when the current encoding unit supports the SBT mode in the first SBT mode set, and does not need to include the first syntax element in the encoding data of the current encoding unit when the current encoding unit does not support the SBT mode in the first SBT mode set, this disclosure embodiment can reduce the amount of data information identifying the SBT mode used by the current encoding unit, thereby improving video encoding efficiency.
[0201] As an extension and refinement of the above embodiments, this disclosure also provides a video decoding method, which includes the following steps:
[0202] Step 1401: If SBT is performed in the current coding unit, determine whether the width and height of the current coding unit are both greater than or equal to 8.
[0203] In step 1401 above, if the width and height of the current encoding unit are both greater than or equal to 8, then steps 1402 and 1403 are executed as follows:
[0204] Step 1402: Determine that the current coding unit supports the SBT modes in the first sub-block transform SBT mode set.
[0205] In some embodiments, the first SBT mode set includes: a first SBT mode, a second SBT mode, a third SBT mode, a fourth SBT mode, a fifth SBT mode, a sixth SBT mode, a seventh SBT mode, and an eighth SBT mode.
[0206] Step 1403: Obtain the first syntax element based on the encoding data of the current coding unit, and determine whether the SBT mode of the current coding unit belongs to the first SBT mode set based on the first syntax element.
[0207] If step 1403 above determines that the SBT mode of the current coding unit belongs to the first SBT mode set, then the following steps 1404 to 1406 are executed:
[0208] Step 1404: Determine whether the current coding unit simultaneously supports the SBT modes in the first subset of the first SBT mode set and the SBT modes in the second subset of the first SBT mode set.
[0209] If step 1404 above determines that the current coding unit simultaneously supports SBT modes in the first subset of the first SBT mode set and SBT modes in the second subset of the first SBT mode set, then step 1405 is executed as follows:
[0210] Step 1405: Obtain the second syntax element and the third syntax element based on the encoding data of the current coding unit, and determine the SBT mode of the current coding unit from the first SBT mode set based on the second syntax element and the third syntax element.
[0211] The second syntax element is used to identify whether the SBT mode of the current coding unit belongs to the first subset of the first SBT mode set; the third syntax element is used to identify whether the sub-block selected by the SBT mode of the current coding unit is located to the left of the current coding unit.
[0212] In some embodiments, determining the SBT mode of the current coding unit from the first SBT mode set based on the second and third syntax elements includes:
[0213] The seventh syntax element is obtained according to the implicit decoding rules and the encoded data. The SBT mode of the current coding unit is determined from the first SBT mode set according to the second syntax element, the third syntax element and the seventh syntax element.
[0214] The seventh syntax element is used to identify the position of the sub-block selected by the SBT mode of the current coding unit.
[0215] If step 1404 above determines that the current coding unit only supports SBT modes in the first subset of the first SBT mode set, then step 1406 is executed as follows:
[0216] Step 1406: Obtain the third syntax element based on the encoding data of the current coding unit, and determine the SBT mode of the current coding unit from the first SBT mode set based on the third syntax element.
[0217] In some embodiments, determining the SBT mode of the current coding unit from the first SBT mode set based on the third syntax element includes:
[0218] The seventh syntax element is obtained according to the implicit decoding rules and the encoded data. The SBT mode of the current coding unit is determined from the first SBT mode set according to the third syntax element and the seventh syntax element.
[0219] If the width and / or height of the current coding unit in step 1401 above are both less than 8, then proceed to step 1407 as follows:
[0220] Step 1407: Determine whether the current coding unit does not support the SBT modes in the first SBT mode set.
[0221] If the current coding unit does not support the SBT modes in the first SBT mode set (after executing step 1407 above), or if step 1403 above determines that the SBT mode of the current coding unit does not belong to the first SBT mode set, then the following step 1408 is executed:
[0222] Step 1408: Obtain the fourth syntax element based on the encoding data of the current coding unit, and determine whether the SBT mode of the current coding unit belongs to the second SBT mode set based on the fourth syntax element.
[0223] The fourth syntax element is used to identify whether the SBT mode of the current coding unit belongs to the second SBT mode set.
[0224] If step 1408 above determines that the SBT mode of the current coding unit belongs to the second SBT mode set, then step 1409 is executed as follows:
[0225] Step 1409: Determine the SBT mode of the current coding unit from the second SBT mode set based on the encoded data.
[0226] In some embodiments, determining the SBT mode of the current coding unit from the second SBT mode set based on the encoded data includes the following steps a and b:
[0227] Step a: Obtain the fifth and sixth syntax elements.
[0228] The fifth syntax element is used to identify the SBT mode partitioning direction of the current coding unit, and the sixth syntax element is used to identify the SBT mode partitioning ratio of the current coding unit.
[0229] In some embodiments, obtaining the fifth and sixth syntax elements includes: obtaining the fifth and sixth syntax elements from the encoded data.
[0230] In some embodiments, obtaining the fifth and sixth syntax elements includes: obtaining the fifth syntax element from the encoded data, and obtaining the sixth syntax element based on the height and width of the current encoding unit and the supported SBT modes.
[0231] In some embodiments, obtaining the fifth and sixth syntax elements includes: obtaining the sixth syntax element from the encoded data, and obtaining the fifth syntax element based on the height and width of the current encoding unit and the supported SBT modes.
[0232] In some embodiments, obtaining the fifth and sixth syntax elements includes: obtaining the fifth and sixth syntax elements based on the height and width of the current coding unit and the supported SBT modes.
[0233] Step b: Determine the SBT mode of the current coding unit from the second SBT mode set based on the fifth and sixth syntax elements.
[0234] In some embodiments, determining the SBT mode of the current coding unit from the second SBT mode set based on the fifth syntax element and the sixth syntax element includes:
[0235] The seventh syntax element is obtained according to the implicit decoding rules and the encoded data, and the SBT mode of the current coding unit is determined from the second SBT mode set according to the fifth syntax element, the sixth syntax element and the seventh syntax element.
[0236] The seventh syntax element is used to identify the position of the sub-block selected by the SBT mode of the current coding unit.
[0237] If step 1408 above determines that the SBT mode of the current coding unit does not belong to the second SBT mode set, then it can be determined that the SBT mode of the current coding unit belongs to the third SBT mode set, and therefore step 1410 is executed as follows:
[0238] Step 1410: Determine the SBT mode of the current coding unit from the third SBT mode set based on the encoded data.
[0239] In some embodiments, determining the SBT mode of the current coding unit from the third SBT mode set based on the encoded data includes the following steps 1 and 2:
[0240] Step 1: Obtain the fifth and sixth syntax elements.
[0241] The fifth syntax element is used to identify the SBT mode partitioning direction of the current coding unit, and the sixth syntax element is used to identify the SBT mode partitioning ratio of the current coding unit.
[0242] Step 2: Determine the SBT mode of the current coding unit from the third SBT mode set based on the fifth and sixth syntax elements.
[0243] In some embodiments, determining the SBT mode of the current coding unit from the third SBT mode set based on the fifth syntax element and the sixth syntax element includes:
[0244] The seventh syntax element is obtained according to the implicit decoding rules and the encoded data. The SBT mode of the current coding unit is determined from the third SBT mode set according to the fifth syntax element, the sixth syntax element and the seventh syntax element.
[0245] In some embodiments, this disclosure provides a video decoding apparatus, which includes a memory and a processor. The memory stores a computer program, and the processor is configured to execute the computer program to implement the video decoding method described in any of the above embodiments.
[0246] In some embodiments, this disclosure provides a video encoding apparatus, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the computer program to implement the video encoding method described in any of the above embodiments.
[0247] In some embodiments, this disclosure provides a computer-readable storage medium storing a computer program that, when executed by a computing device, causes the computing device to implement the video encoding or video decoding method described in any of the above embodiments.
[0248] In some embodiments, this disclosure provides a computer program product that, when run on a computer, enables the computer to implement the video encoding method or video decoding method described in any of the above embodiments.
[0249] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this disclosure, and are not intended to limit them. Although this disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this disclosure.
[0250] For ease of explanation, the above description has been provided in conjunction with specific embodiments. However, the above exemplary discussion is not intended to be exhaustive or to limit the embodiments to the specific forms disclosed above. Various modifications and variations can be obtained based on the above teachings. The selection and description of the above embodiments are for the purpose of better explaining the principles and practical applications, thereby enabling those skilled in the art to better utilize the described embodiments and various different variations of embodiments suitable for specific use considerations.
Claims
1. A video encoding method, comprising: Determine the target sub-block partitioning method and target transform kernel of the current coding unit, wherein the sub-block partitioning method corresponds to the transform kernel; According to the target sub-block partitioning method, sub-blocks are partitioned from the current coding unit; For the inter-frame prediction residuals corresponding to the sub-block, the target transform kernel is used to perform sub-block transform to obtain transform coefficients; The bitstream of the current coding unit is obtained based on the transform coefficients; The target sub-block partitioning method is one of a variety of sub-block partitioning methods, and the variety of sub-block partitioning methods includes at least the following two categories: The sub-block is located in the middle region of the vertical direction of the current coding unit, and the pixel height of the sub-block is the pixel height of the current coding unit, and the pixel width of the sub-block is 1 / 2 of the pixel width of the current coding unit; or, the sub-block is located in the middle region of the horizontal direction of the current coding unit, and the pixel width of the sub-block is the pixel width of the current coding unit, and the pixel height of the sub-block is 1 / 2 of the pixel height of the current coding unit. The sub-block is located in the middle region of the current coding unit in the vertical direction, and the pixel height of the sub-block is the pixel height of the current coding unit, and the pixel width of the sub-block is 1 / 4 of the pixel width of the current coding unit. Alternatively, the sub-block is located in the middle region of the current coding unit in the horizontal direction, and the pixel width of the sub-block is the pixel width of the current coding unit, and the pixel height of the sub-block is 1 / 4 of the pixel height of the current coding unit.
2. The method according to claim 1, wherein, The pixel width of the current encoding unit is W, the pixel height of the current encoding unit is H, and the top left pixel of the current encoding unit is the origin of the pixel coordinates. When the sub-block is located in the middle region of the vertical direction of the current encoding unit, and the pixel height of the sub-block is the pixel height of the current encoding unit, and the pixel width of the sub-block is 1 / 2 of the pixel width of the current encoding unit, the coordinates of the top left pixel of the sub-block are (W*1 / 4, 0). When the sub-block is located in the middle of the horizontal direction of the current encoding unit, and the pixel width of the sub-block is the same as the pixel width of the current encoding unit, and the pixel height of the sub-block is half of the pixel height of the current encoding unit, the coordinates of the top left pixel of the sub-block are (0, H*1 / 4).
3. The method according to claim 2, wherein, The target transformation kernel includes a transformation kernel for horizontal transformation and a transformation kernel for vertical transformation, wherein, When the divided sub-block is located in the middle region of the vertical direction of the current coding unit, and the pixel height of the sub-block is the pixel height of the current coding unit, the pixel width of the sub-block is 1 / 2 of the pixel width of the current coding unit, and the coordinates of the top left pixel of the sub-block are (W*1 / 4, 0), the transform kernel of the horizontal transformation is DCT8, and the transform kernel of the vertical transformation is DST7. When the divided sub-block is located in the middle region of the horizontal direction of the current coding unit, and the pixel width of the sub-block is the pixel width of the current coding unit, the pixel height of the sub-block is 1 / 2 of the pixel height of the current coding unit, and the coordinates of the upper left corner pixel of the sub-block are (0, H*1 / 4), the transform kernel of the horizontal transformation is DST7, and the transform kernel of the vertical transformation is DCT8.
4. The method according to claim 1, wherein, The pixel width of the current encoding unit is W, the pixel height of the current encoding unit is H, and the top left pixel of the current encoding unit is the origin of the pixel coordinates. When the sub-block is located in the middle region of the vertical direction of the current encoding unit, and the pixel height of the sub-block is the pixel height of the current encoding unit, and the pixel width of the sub-block is 1 / 4 of the pixel width of the current encoding unit, the coordinates of the top left pixel of the sub-block are (W*1 / 4, 0) or (W*1 / 2, 0). When the sub-block is located in the middle of the horizontal direction of the current coding unit, and the pixel width of the sub-block is the pixel width of the current coding unit, and the pixel height of the sub-block is 1 / 4 of the pixel height of the current coding unit, the coordinates of the top left pixel of the sub-block are (0, H*1 / 4) or (0, H*1 / 2).
5. The method according to claim 4, wherein, The target transformation kernel includes a transformation kernel for horizontal transformation and a transformation kernel for vertical transformation, wherein, When the divided sub-block is located in the middle region of the vertical direction of the current coding unit, and the pixel height of the sub-block is the pixel height of the current coding unit, the pixel width of the sub-block is 1 / 4 of the pixel width of the current coding unit, and the coordinates of the top left pixel of the sub-block are (W*1 / 4, 0), the transform kernel of the horizontal transformation is DST7, and the transform kernel of the vertical transformation is DCT8. When the divided sub-block is located in the middle region of the vertical direction of the current coding unit, and the pixel height of the sub-block is the pixel height of the current coding unit, the pixel width of the sub-block is 1 / 4 of the pixel width of the current coding unit, and the coordinates of the top left pixel of the sub-block are (W*1 / 2, 0), the transform kernel of the horizontal transformation is DST7, and the transform kernel of the vertical transformation is DST7. When the divided sub-block is located in the middle region of the horizontal direction of the current coding unit, and the pixel width of the sub-block is the pixel width of the current coding unit, the pixel height of the sub-block is 1 / 4 of the pixel height of the current coding unit, and the coordinates of the top left corner pixel of the sub-block are (0, H*1 / 4), the transform kernel of the horizontal transformation is DCT8, and the transform kernel of the vertical transformation is DST7. When the divided sub-block is located in the middle area of the horizontal direction of the current coding unit, and the pixel width of the sub-block is the pixel width of the current coding unit, the pixel height of the sub-block is 1 / 4 of the pixel height of the current coding unit, and the coordinates of the upper left corner pixel of the sub-block are (0, H*1 / 2), the transform kernel of the horizontal transformation is DST7, and the transform kernel of the vertical transformation is DST7.
6. The method according to claim 1, wherein, The method further includes: When the pixel width of the current coding unit is greater than or equal to 8, it is permissible to divide the middle region of the current coding unit in the vertical direction into a sub-block with a pixel height equal to the pixel height of the current coding unit and a pixel width equal to 1 / 2 of the pixel width of the current coding unit. When the pixel height of the current coding unit is greater than or equal to 8, it is permissible to divide the middle region of the current coding unit in the horizontal direction into a sub-block with a pixel width equal to the pixel width of the current coding unit and a pixel height equal to 1 / 2 of the pixel height of the current coding unit. When the pixel width of the current coding unit is greater than or equal to 16, it is permissible to divide the middle region of the current coding unit in the vertical direction into a sub-block with a pixel height equal to the pixel height of the current coding unit and a pixel width equal to 1 / 4 of the pixel width of the current coding unit. When the pixel height of the current coding unit is greater than or equal to 16, it is permissible to divide the middle region of the current coding unit in the horizontal direction into a sub-block with a pixel width equal to the pixel width of the current coding unit and a pixel height equal to 1 / 4 of the pixel height of the current coding unit.
7. The method according to any one of claims 1 to 6, wherein, The method further includes: A first indication is determined, which indicates that a sub-block transformation should be performed on the current coding unit; Determine the second indication information, which indicates that the target sub-block is divided into one of the two types; A third indication is determined, which indicates that the sub-block is located in the middle region of the vertical direction or the middle region of the horizontal direction of the current coding unit. The first indication, the second indication, and the third indication together determine the target sub-block division method. The step of obtaining the bitstream of the current coding unit based on the transform coefficients includes: The code stream of the current coding unit is obtained by encoding based on the first indication information, the second indication information, the third indication information, and the transformation coefficients.
8. A video decoding method, comprising: The target sub-block partitioning method of the current decoding unit and the quantization coefficients of the inter-frame prediction residuals of the sub-blocks in the unit to be decoded are parsed from the bitstream. The quantization coefficients are dequantized to obtain the transform coefficients of the inter-frame prediction residuals of the sub-blocks. According to the target transform kernel corresponding to the target sub-block partitioning method, perform sub-block inverse transform on the transform coefficients of the inter-frame prediction residual of the sub-block to obtain the inter-frame prediction residual. Based on the inter-frame prediction residual and the target sub-block partitioning method, obtain the image data of the unit to be decoded. The target sub-block partitioning method is one of a variety of sub-block partitioning methods, and the variety of sub-block partitioning methods includes at least the following two categories: The sub-block is located in the middle region of the current decoding unit in the vertical direction, and the pixel height of the sub-block is the pixel height of the current decoding unit, and the pixel width of the sub-block is 1 / 2 of the pixel width of the current decoding unit; or, the sub-block is located in the middle region of the current decoding unit in the horizontal direction, and the pixel width of the sub-block is the pixel width of the current decoding unit, and the pixel height of the sub-block is 1 / 2 of the pixel width of the current decoding unit. The sub-block is located in the middle region of the current decoding unit in the vertical direction, and the pixel height of the sub-block is the pixel height of the current decoding unit, and the pixel width of the sub-block is 1 / 4 of the pixel width of the current decoding unit. Alternatively, the sub-block is located in the middle region of the current decoding unit in the horizontal direction, and the pixel width of the sub-block is the pixel width of the current decoding unit, and the pixel height of the sub-block is 1 / 4 of the pixel height of the current decoding unit.
9. A video decoding method, comprising: If the current coding unit has performed Subblock Transform (SBT), determine whether the current coding unit supports the SBT modes in the first SBT mode set. If so, the first syntax element is obtained based on the encoding data of the current encoding unit, and the SBT mode of the current encoding unit is determined based on the first syntax element to determine whether it belongs to the first SBT mode set. If the current encoding unit belongs to the first SBT mode set, the SBT mode of the current encoding unit is determined from the first SBT mode set based on the encoding data. If the current coding unit does not support the SBT modes in the first SBT mode set or the SBT mode of the current coding unit does not belong to the first SBT mode set, then the SBT mode of the current coding unit is determined from other SBT mode sets based on the coding data. Where the first syntax element is not included in the encoded data if the current encoding unit does not support the SBT modes in the first SBT mode set.
10. The method according to claim 9, wherein, The first SBT mode set includes: the first SBT mode, the second SBT mode, the third SBT mode, the fourth SBT mode, the fifth SBT mode, the sixth SBT mode, the seventh SBT mode, and the eighth SBT mode; Specifically, the first, second, third, fourth, fifth, sixth, seventh, and eighth SBT modes are used to select the first, second, third, fourth, fifth, sixth, seventh, and eighth sub-blocks as non-zero residual transform units, respectively. The width and height of the first, second, third, and fourth sub-blocks are both 1 / 2 of the current coding unit, and the width and height of the fifth, sixth, seventh, and eighth sub-blocks are both 1 / 4 of the current coding unit. The first and fifth sub-blocks are located at the upper left corner of the current coding unit, the second and sixth sub-blocks are located at the upper right corner of the current coding unit, the third and seventh sub-blocks are located at the lower left corner of the current coding unit, and the fourth and eighth sub-blocks are located at the lower right corner of the current coding unit.
11. The method according to claim 10, wherein, Determining the SBT mode of the current coding unit from the first SBT mode set based on the encoded data includes: Determine whether the current coding unit simultaneously supports SBT modes in a first subset of the first SBT mode set and SBT modes in a second subset of the first SBT mode set. The first subset is a set consisting of the first SBT mode, the second SBT mode, the third SBT mode, and the fourth SBT mode; the second subset is a set consisting of the fifth SBT mode, the sixth SBT mode, the seventh SBT mode, and the eighth SBT mode. If so, obtain the second syntax element and the third syntax element based on the encoded data of the current coding unit, and determine the SBT mode of the current coding unit from the first SBT mode set based on the second syntax element and the third syntax element. If not, obtain the third syntax element based on the encoded data of the current coding unit, and determine the SBT mode of the current coding unit from the first SBT mode set based on the third syntax element. The second syntax element is used to identify whether the SBT mode of the current coding unit belongs to the first subset of the first SBT mode set; the third syntax element is used to identify whether the sub-block selected by the SBT mode of the current coding unit is located to the left of the current coding unit.
12. The method according to claim 9, wherein, The step of determining the SBT mode of the current coding unit from other SBT mode sets based on the encoded data includes: The fourth syntax element is obtained based on the encoded data of the current coding unit, and the SBT mode of the current coding unit is determined based on the fourth syntax element to determine whether it belongs to the second SBT mode set. The fourth syntax element is used to identify whether the SBT mode of the current coding unit belongs to the second SBT mode set. If the current coding unit belongs to the second SBT mode set, the SBT mode of the current coding unit is determined from the second SBT mode set based on the coding data; If the current coding unit does not belong to the second SBT mode set, the SBT mode of the current coding unit is determined from the third SBT mode set based on the coding data.
13. The method according to claim 12, wherein, The step of determining the SBT mode of the current coding unit from the second SBT mode set based on the encoded data includes: Obtain the fifth syntax element and the sixth syntax element, wherein the fifth syntax element is used to identify the SBT mode partitioning direction of the current coding unit, and the sixth syntax element is used to identify the SBT mode partitioning ratio of the current coding unit. The SBT mode of the current coding unit is determined from the second SBT mode set based on the fifth and sixth syntax elements.
14. The method according to claim 13, wherein, Determining the SBT mode of the current coding unit from the second SBT mode set based on the fifth and sixth syntax elements includes: The seventh syntax element is obtained according to the implicit decoding rules and the encoded data. The seventh syntax element is used to identify the position of the sub-block selected by the SBT mode of the current coding unit. The SBT mode of the current coding unit is determined from the second SBT mode set based on the fifth, sixth, and seventh syntax elements.
15. The method according to claim 12, wherein, The step of determining the SBT mode of the current coding unit from the third SBT mode set based on the encoded data includes: Obtain the fifth syntax element and the sixth syntax element, wherein the fifth syntax element is used to identify the SBT mode partitioning direction of the current coding unit, and the sixth syntax element is used to identify the SBT mode partitioning ratio of the current coding unit. The SBT mode of the current coding unit is determined from the third SBT mode set based on the fifth and sixth syntax elements.
16. The method according to any one of claims 12-15, wherein, The second SBT pattern set includes: the ninth SBT pattern, the tenth SBT pattern, the eleventh SBT pattern, the twelfth SBT pattern, the thirteenth SBT pattern, and the fourteenth SBT pattern; Specifically, the ninth, tenth, eleventh, twelfth, thirteenth, and fourteenth SBT modes are used to select the ninth, tenth, eleventh, twelfth, thirteenth, and fourteenth sub-blocks as non-zero residual transform units, respectively. The width of the ninth sub-block is half that of the current coding unit, and its height is the same as the current coding unit. The midpoints of the upper and lower edges of the ninth sub-block coincide with the midpoints of the upper and lower edges of the current coding unit, respectively. The height of the tenth sub-block is half that of the current coding unit, and its width is the same as the current coding unit. The midpoints of the left and right edges of the tenth sub-block coincide with the midpoints of the left and right edges of the current coding unit, respectively. The eleventh and twelfth sub-blocks have different widths. The width of the eleventh and twelfth sub-blocks is the same as that of the current coding unit. The midpoints of the upper and lower edges of the eleventh sub-block coincide with the first quarter-division points of the upper and lower edges of the current coding unit, respectively. The midpoints of the upper and lower edges of the twelfth sub-block coincide with the third quarter-division points of the upper and lower edges of the current coding unit, respectively. The width of the thirteenth and fourteenth sub-blocks is the same as that of the current coding unit. The height of the thirteenth and fourteenth sub-blocks is 1 / 4 of that of the current coding unit. The midpoints of the left and right edges of the thirteenth sub-block coincide with the first quarter-division points of the left and right edges of the current coding unit, respectively. The midpoints of the left and right edges of the fourteenth sub-block coincide with the third quarter-division points of the left and right edges of the current coding unit, respectively.
17. A video coding method, comprising: If the current coding unit has performed Subblock Transform (SBT), determine whether the current coding unit supports the SBT modes in the first SBT mode set. If so, the first syntax element is assigned a value according to whether the SBT mode of the current coding unit belongs to the first SBT mode set, and the first coding data of the current coding unit is generated. The first syntax element is used to identify whether the SBT mode of the current coding unit belongs to the first SBT mode set, and the first coding data includes the first syntax element. If not, then generate second encoded data for the current encoding unit, which does not include the first syntax element.
18. A video decoding apparatus, comprising: A memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the computer program to implement the method as described in any one of claims 8, 9-16.
19. A video encoding apparatus, comprising: A memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the computer program to implement the method as described in any one of claims 1-7 and 17.