Video decoding method, video coding method and related equipment
By determining transformation information for current coding blocks using adjacent blocks, the method reduces bit rate consumption and enhances decoding efficiency in video encoding and decoding processes.
Patent Information
- Application Number
- CN202310709242.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-14
- Publication Date
- 2024-12-17
AI Technical Summary
Existing video coding technologies consume high bit rates due to the encoding of transformation information for coding blocks, which is inefficient.
Determine transformation information for a current coding block based on adjacent coding blocks, enabling transform inheritance mode and using spatial and temporal domain information to reduce bit rate consumption.
Reduces bit rate consumption in the video encoding and decoding process by leveraging adjacent coding block information, thereby improving decoding efficiency.
Smart Images

Figure CN119155456A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of audio and video technology, and specifically to a video decoding method, a video encoding method, a video decoding device, a video encoding device, a computer device, a computer-readable storage medium, and a computer program product. Background Art
[0002] In the existing video coding technology, the original video frame can be divided into a series of coding blocks, and combined with video coding methods such as prediction, transformation and entropy coding to achieve video compression. Among them, there are many transformation methods for transforming the coding block, such as using various transformation division methods (such as residual quad tree mode (RQT), position based transform mode (PBT), etc.) for transformation; for example, various transformation combinations (DCT discrete cosine transform kernel, DST discrete sine transform kernel) can be used, etc. Different transformation methods will obtain different transformation information. When the encoding end transforms the coding block, it also needs to encode the transformation information, which usually results in higher bit rate consumption. Summary of the invention
[0003] The embodiments of the present application provide a video decoding method, a video encoding method and related devices, which can reduce the bit rate consumption in the video encoding and decoding process.
[0004] On the one hand, an embodiment of the present application provides a video decoding method, the method comprising:
[0005] Determine a current coding block in a video bitstream, and determine adjacent coding blocks of the current coding block;
[0006] Determine transformation information of a current coding block according to coding information of adjacent coding blocks;
[0007] Based on the determined transformation information of the current coding block, a decoding process is performed on the current coding block.
[0008] On the one hand, an embodiment of the present application provides a video encoding method, the method comprising:
[0009] Determine a current coding block in the video, and determine adjacent coding blocks of the current coding block;
[0010] Determine transformation information of a current coding block according to coding information of adjacent coding blocks;
[0011] Based on the determined transformation information of the current coding block, the current coding block is coded to obtain a video code stream.
[0012] In one embodiment, the adjacent coding block includes a spatial domain adjacent coding block and / or a temporal domain adjacent coding block;
[0013] The spatially adjacent coding block refers to a coding block adjacent to the current coding block in the current frame of the video; the current frame refers to the video frame where the current coding block is located; the current coding block refers to the coding block being encoded in the current frame;
[0014] The temporally adjacent coding block refers to a coding block adjacent to the reference coding block in the reference frame; the reference frame is any video frame or a specified video frame in the video except the current frame; the position of the reference coding block in the reference frame is the same as the position of the current coding block in the current frame.
[0015] In one embodiment, the coding information of the adjacent coding block includes transformation information of the adjacent coding block; and determining the transformation information of the current coding block according to the coding information of the adjacent coding block includes:
[0016] Determining the transformation information of the adjacent coding block as the transformation information of the current coding block;
[0017] Among them, the transformation information includes transformation division method and / or transformation combination; the transformation division method includes at least one of the following: residual quadtree mode, position-based transformation mode, sub-block transformation mode; the transformation combination includes a transformation kernel of horizontal transformation and a transformation kernel of vertical transformation, and the transformation kernel includes at least one of the following: discrete cosine transform kernel, discrete sine transform kernel, skip transform.
[0018] In one embodiment, the method further comprises:
[0019] Determine whether the current encoding block enables transform inheritance mode;
[0020] If the transformation inheritance mode is enabled for the current coding block, the step of determining the transformation information of the adjacent coding block as the transformation information of the current coding block is performed.
[0021] In one embodiment, the enabling control method of the transformation inheritance mode includes at least one of the following:
[0022] A transform inheritance mode flag is set in the video bitstream. When the current coding block enables the transform inheritance mode, the transform inheritance mode flag is set to a first preset value. When the current coding block disables the transform inheritance mode, the transform inheritance mode flag is set to a second preset value.
[0023] Set the enabling condition of the transform inheritance mode. When the current coding block meets the enabling condition, the current coding block is instructed to enable the transform inheritance mode; when the current coding block does not meet the enabling condition, the current coding block is instructed to turn off the transform inheritance mode;
[0024] The enabling conditions include size conditions and / or prediction conditions.
[0025] In one embodiment, the setting position of the transform inheritance mode flag in the video bit stream includes at least one of the following:
[0026] The transform inheritance mode flag is set in the sequence header of the video. When the transform inheritance mode flag in the sequence header is a first preset value, it indicates that all coding blocks in all video frames of the video enable the transform inheritance mode; when the transform inheritance mode flag in the sequence header is a second preset value, it indicates that all coding blocks in all video frames of the video disable the transform inheritance mode.
[0027] The transform inheritance mode flag is set in the frame header of the current frame of the video. When the transform inheritance mode flag in the frame header is a first preset value, it indicates that all coding blocks in the current frame enable the transform inheritance mode; when the transform inheritance mode flag in the frame header of the current frame is a second preset value, it indicates that all coding blocks in the current frame disable the transform inheritance mode.
[0028] The transform inheritance mode flag is set in the slice header of the slice where the current coding block is located. When the transform inheritance mode flag in the slice header is a first preset value, it indicates that all coding blocks in the slice enable the transform inheritance mode; when the transform inheritance mode flag in the slice header is a second preset value, it indicates that all coding blocks in the slice disable the transform inheritance mode;
[0029] The transform inheritance mode flag is set in the coding tree unit where the current coding block is located. When the transform inheritance mode flag in the coding tree unit is a first preset value, it indicates that all coding blocks in the coding tree unit enable the transform inheritance mode; when the transform inheritance mode flag in the coding tree unit is a second preset value, it indicates that all coding blocks in the coding tree unit turn off the transform inheritance mode.
[0030] The transform inheritance mode flag is set in the current coding block. When the transform inheritance mode flag in the current coding block is a first preset value, it indicates that the current coding block enables the transform inheritance mode; when the transform inheritance mode flag in the current coding block is a second preset value, it indicates that the current coding block turns off the transform inheritance mode.
[0031] In one embodiment, the enabling condition includes a size condition, and the size condition is used to define a preset width threshold or a preset height threshold for enabling the transformation inheritance mode;
[0032] The current encoding block meets the enabling conditions, including any of the following:
[0033] When the size condition defines a preset width threshold, the width of the current coding block is greater than the preset width threshold;
[0034] When the size condition defines a preset height threshold, the height of the current encoding block is greater than the preset height threshold;
[0035] When the size condition defines a preset width threshold, the width of the current coding block is less than the preset width threshold;
[0036] When the size condition defines a preset height threshold, the height of the current coding block is less than the preset height threshold.
[0037] In one embodiment, the enabling condition includes a prediction condition; the current coding block satisfies the enabling condition, including: the adjacent coding block is a prediction reference coding block of the current coding block.
[0038] In one embodiment, the number of adjacent coding blocks is greater than 1; determining the transformation information of the adjacent coding blocks as the transformation information of the current coding block includes:
[0039] Perform deduplication processing on adjacent coding blocks to obtain N adjacent coding blocks after deduplication, where N is an integer greater than or equal to 1;
[0040] Determine a target adjacent coding block from N adjacent coding blocks;
[0041] The transformation information of the target adjacent coding block is determined as the transformation information of the current coding block.
[0042] In one embodiment, a method for determining a target adjacent coding block includes at least one of the following:
[0043] Determine a target adjacent coding block from N adjacent coding blocks according to a rate-distortion optimization rule;
[0044] If the N adjacent coding blocks include at least one prediction reference coding block of the current coding block, and the prediction mode of the current coding block is coupled with the transform inheritance mode, then the prediction reference coding block selected by the prediction mode of the current coding block is selected as the target adjacent coding block;
[0045] The prediction mode includes at least one of the following: an inter-frame merge mode, an intra-frame block copy merge mode, an intra-frame template matching merge mode, and an intra-frame prediction mode.
[0046] In one embodiment, the video code stream includes a selection flag, and the method further includes: setting an identifier of an adjacent coding block to be inherited in the selection flag.
[0047] In one embodiment, the encoding information of the adjacent coding block includes the residual or transformation coefficient of the adjacent coding block; the transformation information of the current coding block includes the position residual mode flag of the current coding block in the sub-block transformation mode; based on the determined transformation information of the current coding block, the current coding block is encoded to obtain a video code stream, including:
[0048] Derived one or more context index information according to the coding information of the adjacent coding block, each context index information corresponds to an entropy coding mode;
[0049] Determining an entropy coding method according to the derived context index information;
[0050] The residual position mode flag of the current coding block in the sub-block transform mode is entropy-encoded according to the determined entropy encoding method to obtain a video code stream.
[0051] In one embodiment, one or more context index information is derived according to the coding information of the adjacent coding block, including:
[0052] Obtain a first adjacent coding block and a second adjacent coding block of a current coding block, where the first adjacent coding block refers to an adjacent coding block located in a first direction of the current coding block; and the second adjacent coding block refers to an adjacent coding block located in a second direction of the current coding block;
[0053] Obtaining a first quantity ratio in a first adjacent coding block; the first quantity ratio refers to a ratio between the number of non-zero residual basic units in the first adjacent coding block and the total number of all residual basic units in the first adjacent coding block;
[0054] Obtaining a second quantity ratio in a second adjacent coding block; the second quantity ratio refers to a ratio between the number of non-zero residual basic units in the second adjacent coding block and the total number of all residual basic units in the second adjacent coding block;
[0055] Determining context index information according to a magnitude relationship between the first quantity ratio and the second quantity ratio;
[0056] Among them, if the first quantity ratio is greater than the second quantity ratio, the context index information is the first index information; if the first quantity ratio is equal to the second quantity ratio, the context index information is the second index information; if the first quantity ratio is less than the second quantity ratio, the context index information is the third index information.
[0057] In one embodiment, the coding information of the adjacent coding block includes the residual or transformation coefficient of the adjacent coding block; the transformation information of the current coding block includes the residual position mode of the current coding block in the sub-block transformation mode, and the transformation information of the current coding block is determined according to the coding information of the adjacent coding block, including:
[0058] Reordering candidate residual position modes under the sub-block transform mode according to coding information of adjacent coding blocks to obtain a reordering list;
[0059] The residual position mode of the current coding block in the sub-block transform mode is selected from the reordering list.
[0060] In one embodiment, the reordering list includes candidate residual position modes arranged in order and their corresponding index information, and based on the determined transformation information of the current coding block, the current coding block is coded to obtain a video bit stream, including:
[0061] Determine the index information of the selected residual position mode in the reordered list;
[0062] The index information of the selected residual position mode in the reordering list is entropy encoded to obtain a video bit stream.
[0063] In one embodiment, the candidate residual position modes under the sub-block transform mode are reordered according to the coding information of the adjacent coding block to obtain a reordering list, including:
[0064] Obtain index information of each candidate residual position mode under the sub-block transform mode;
[0065] The candidate residual position modes under the sub-block transform mode are reordered in descending order of index information to obtain a reordered list.
[0066] In one embodiment, each candidate residual position mode in the sub-block transform mode corresponds to a sub-block transform region at a different position; obtaining index information of each candidate residual position mode in the sub-block transform mode includes:
[0067] Obtain a first adjacent coding block and a second adjacent coding block of a current coding block, where the first adjacent coding block refers to an adjacent coding block located in a first direction of the current coding block; and the second adjacent coding block refers to an adjacent coding block located in a second direction of the current coding block;
[0068] Obtaining a first quantity ratio in a first adjacent coding block; the first quantity ratio refers to a ratio between the number of non-zero residual basic units in the first adjacent coding block and the total number of all residual basic units in the first adjacent coding block;
[0069] Obtaining a second quantity ratio in a second adjacent coding block; the second quantity ratio refers to a ratio between the number of non-zero residual basic units in the second adjacent coding block and the total number of all residual basic units in the second adjacent coding block;
[0070] Allocating index information to each candidate residual position mode in the sub-block transform mode according to a size relationship between the first quantity ratio and the second quantity ratio;
[0071] Wherein, if the first quantity ratio is greater than or equal to the second quantity ratio, the index information assigned to the candidate residual position mode where the sub-block transformation region is located in the first direction is greater than the index information assigned to the candidate residual position mode where the sub-block transformation region is located in the second direction;
[0072] If the first quantity ratio is smaller than the second quantity ratio, the index information assigned to the candidate residual position mode whose sub-block transform region is located in the second direction is greater than the index information assigned to the candidate residual position mode whose sub-block transform region is located in the first direction.
[0073] On the one hand, an embodiment of the present application provides a video decoding device, the device comprising:
[0074] A processing unit, configured to determine a current coding block in a video bitstream;
[0075] The processing unit is further used to determine an adjacent coding block of a current coding block;
[0076] The processing unit is further used to determine the transformation information of the current coding block according to the coding information of the adjacent coding blocks;
[0077] The decoding unit is used to perform decoding processing on the current coding block based on the determined transformation information of the current coding block.
[0078] On the one hand, an embodiment of the present application provides a video encoding device, the device comprising:
[0079] a processing unit for determining a current coding block in the video;
[0080] The processing unit is further configured to determine an adjacent coding block of the current coding block;
[0081] The processing unit is further configured to determine the transformation information of the current coding block according to the coding information of the adjacent coding block;
[0082] The encoding unit is used to encode the current encoding block based on the determined transformation information of the current encoding block to obtain a video code stream.
[0083] In one aspect, an embodiment of the present application provides a computer device, the computer device comprising:
[0084] a processor suitable for executing a computer program;
[0085] A computer-readable storage medium, wherein a computer program is stored in the computer-readable storage medium. When the computer program is executed by a processor, the above-mentioned video decoding method or the above-mentioned video encoding method is implemented.
[0086] On the one hand, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program, and the computer program is loaded by a processor and executed such as the above-mentioned video decoding method or the above-mentioned video encoding method.
[0087] On the one hand, an embodiment of the present application provides a computer program product, which includes a computer program or computer instructions, and when the computer program or computer instructions are executed by a processor, the above-mentioned video decoding method or the above-mentioned video encoding method is implemented.
[0088] In the embodiment of the present application, the current coding block in the video code stream is determined, and the adjacent coding blocks of the current coding block are determined; the transformation information of the current coding block is determined according to the coding information of the adjacent coding blocks; and the current coding block is decoded based on the determined transformation information of the current coding block. It can be seen that in the decoding process of the video, the transformation information of the current coding block can be determined based on the coding information of the adjacent coding blocks, which can reduce the coding cost consumed by encoding the transformation information of the current coding block, thereby reducing the bit rate consumption in the entire encoding and decoding process, and thus improving the decoding efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0089] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0090] Figure 1 A basic working flow diagram of a video encoder provided for an exemplary embodiment of the present application;
[0091] Figure 2 A schematic diagram of a residual quadtree partitioning mode provided for an exemplary embodiment of the present application;
[0092] Figure 3 A schematic diagram of a position-based sub-block transformation provided for an exemplary embodiment of the present application;
[0093] Figure 4a A schematic diagram of a sub-block transformation provided for an exemplary embodiment of the present application;
[0094] Figure 4b A schematic diagram of a transformation combination corresponding to each of 12 residual position modes provided as an exemplary embodiment of the present application;
[0095] Figure 5 An architecture diagram of a video encoding and decoding system provided for an exemplary embodiment of the present application;
[0096] Figure 6 A schematic diagram of a flow chart of a video decoding method provided for an exemplary embodiment of the present application;
[0097] Figure 7a A schematic diagram of a transform block adjacent to a current coding block provided as an exemplary embodiment of the present application;
[0098] Figure 7b A schematic diagram of a transform block adjacent to a current coding block provided by another exemplary embodiment of the present application;
[0099] Figure 8 A schematic diagram of the position relationship between a first adjacent coding block and a second adjacent coding block and a current coding block, provided as an exemplary embodiment of the present application;
[0100] Fig. 9 A schematic diagram of a video encoding method provided as a flow chart of an exemplary embodiment of the present application;
[0101] Fig.10 A schematic diagram of the structure of a video decoding device provided for an exemplary embodiment of the present application;
[0102] Fig.11 A schematic structural diagram of a video encoding device provided for another exemplary embodiment of the present application;
[0103] Fig.12 A schematic structural diagram of a computer device is provided for another exemplary embodiment of the present application. DETAILED DESCRIPTION
[0104] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, ordinary technicians in this field can
[0105] The following is an introduction to the technical terms involved in this application:
[0106] 1. Video Encoding
[0107] A video can be composed of one or more video frames, each of which contains part of the video signal of the video. The video signal can be obtained by camera or computer generated. Due to the different statistical characteristics corresponding to different acquisition methods, the compression encoding method of the video may also be different.
[0108] In mainstream video coding technologies, such as HEVC (High Efficiency Video Coding, international video coding standard HEVC / H.265), VVC (versatile video coding, international video coding standard VVC / H.266), and AVS (Audio Video Coding Standard, China's national video coding standard), a hybrid coding framework is adopted, under which the following series of operations and processing on the video are allowed:
[0109] 1) Block partition structure: According to the size of the video frame, the video frame can be divided into several non-overlapping processing units, and each processing unit will perform similar compression operations. This processing unit is called CTU (coding tree unit) or LCU (Largest Coding Unit). The CTU can be further divided into more refined units to obtain one or more basic coding units, called CU (coding unit or coding block). The coding block is the most basic element in a coding link. The subsequent embodiments of this application describe various encoding and decoding processing flows that may be used for each coding block.
[0110] 2) Prediction coding: including prediction modes such as intra-frame prediction and inter-frame prediction. The original video signal contained in the coding block in the video frame is predicted by the reconstructed video signal in the selected coding block to obtain the residual. Among them, the encoder needs to select a suitable prediction mode for the current coding block from many possible prediction modes for encoding, and inform the decoder of the selected prediction mode. Here, the current coding block can be the coding block being encoded, and the prediction mode can include:
[0111] a. Intra-frame prediction (Intra (picture) Prediction): The reconstructed video signal used for prediction comes from the area that has been encoded and reconstructed in the same video frame, that is, the current coding block and the predicted reference coding block referenced by the current coding block are located in the same video frame. Among them, the basic idea of intra-frame prediction is to use the correlation between adjacent pixels in the same video frame to remove spatial redundancy. In video coding, adjacent pixels refer to the reconstructed pixels of the encoded coding blocks around the current coding block in the same video frame.
[0112] b. Inter-picture prediction: The reconstructed video signal used for prediction comes from other video frames that have been encoded and are different from the current frame. That is, the current coding block and the prediction reference coding block referred to by the current coding block are located in different video frames respectively. The current frame refers to the video frame where the current coding block is located.
[0113] 3) Transform & Quantization: The residual can be converted to the transform domain through DFT (Discrete Fourier Transform), DCT (Discrete Cosine Transform), DST (Discrete Sine Transform) and other transformation operations. The residual in the transform domain is called the transform coefficient. The residual in the transform domain is further subjected to lossy quantization operations, which loses some information, making the quantized signal conducive to compression expression.
[0114] In some video coding standards, there may be more than one transform method to choose from. Therefore, the encoder also needs to select one of the transform methods for the current coding block and inform the decoder. The degree of quantization is usually determined by QP (Quantization Parameters). When the QP value is large, the transform coefficients representing a larger value range will be quantized to the same output, which usually results in greater distortion and lower bitrate. On the contrary, when the QP value is small, the transform coefficients representing a smaller value range will be quantized to the same output, which usually results in less distortion and a higher bitrate.
[0115] 4) Entropy Coding or Statistical Coding: The quantized transform domain signal will be statistically encoded according to the frequency of occurrence of each value, and finally output as a binary (0 or 1) video stream. At the same time, the encoding will generate other information, such as the selected prediction mode, motion vector, etc. These other information also need to be entropy encoded to reduce the bit rate. Among them, statistical coding is a lossless coding method that can effectively reduce the bit rate required to express the same signal. Common statistical coding methods include variable length coding (VLC) or context-based binary arithmetic coding (CABAC).
[0116] 5) Loop Filtering: The encoded coding block can be reconstructed into a decoded image corresponding to the coding block after inverse quantization, inverse transformation and prediction compensation (the reverse operation of 2) to 4) above. Compared with the original image, the reconstructed decoded image has some information different from the original image due to the influence of quantization, resulting in distortion. Therefore, a filter can be used to filter the reconstructed decoded image to effectively reduce the degree of distortion caused by quantization. The filter can be, for example, a deblocking filter, SAO (sample adaptive offset) or ALF (adaptive loop filter), etc. Since these reconstructed decoded images after filtering will be used as prediction reference coding blocks for other coding blocks that need to be encoded later and applied to the prediction process of other coding blocks, the above filtering operation is also called loop filtering, and filtering operation within the coding loop.
[0117] Based on the above description of steps 1)-5), the present application embodiment provides a basic workflow diagram of a video encoder. Figure 1 , Figure 1 A basic working flow diagram of a video encoder provided for an exemplary embodiment of the present application. Figure 1 The current coding block is the kth coding block in the current frame (current image) (such as Figure 1 The shown k [x, y]) is used as an example for illustration, k is a positive integer, and k is less than or equal to the total number of coding blocks contained in the current frame. k [x, y] represents the pixel point (referred to as pixel) with coordinates [x, y] in the kth coding block, where x represents the horizontal coordinate of the pixel and y represents the vertical coordinate of the pixel; s k [x, y] can obtain a prediction signal after motion compensation or intra-frame prediction. and the original signal s k Subtract [x, y] to get the residual u k [x, y]; then the residual u k [x, y] is transformed and quantized. The output data of the quantization process has two different destinations, A and B:
[0118] A: The data output by the quantization process can be sent to an entropy encoder for entropy encoding to obtain an encoded video stream, and the video stream is output to a buffer for storage and waiting to be transmitted.
[0119] B. The data output by quantization processing can also be dequantized and inversely transformed to obtain the residual u′ after inverse transformation. k [x, y]. Then, the inverse transformed residual u′ k [x, y] and prediction signal Add together to get a new prediction signal And the new prediction signal The new prediction signal can then be sent to the current image buffer for storage. After intra-frame prediction processing, we get The new prediction signal After loop filtering, the reconstructed signal s′ can be obtained k [x, y], and the reconstructed signal s′ k [x, y] is sent to the decoded image buffer for storage to generate the reconstructed video. Reconstructed signal s′ k [x, y] is obtained through motion compensation prediction processing in It can represent the prediction reference coding block referenced by the current coding block, m x and m y Respectively represent the horizontal and vertical components of the motion vector of the prediction reference coding block referenced by the current encoding.
[0120] Among them, since the prediction methods used in the predictive coding process (such as intra-frame prediction and inter-frame prediction) have large errors, the residual needs to be transmitted to compensate for the predicted video frame (ie, image), thereby improving the quality of the reconstructed video frame (ie, decoded image). Therefore, residual processing is an important processing process in the hybrid coding framework.
[0121] like Figure 1 As shown, in the hybrid coding framework, the residual is the difference between the original signal (i.e., the original video frame) and the predicted signal (i.e., the predicted video frame):
[0122]
[0123] In the HEVC, VVC and AVS3 video coding standards, residual processing includes the following two processing methods (1) and (2):
[0124] (1) Transformation and quantization:
[0125] By utilizing the correlation of the residuals, the residuals are transformed to concentrate the energy so that the energy is concentrated in fewer low-frequency transform coefficients. That is to say, after the residuals of most coding blocks are transformed, the transform coefficients corresponding to the residuals of most coding blocks are smaller. The so-called correlation of residuals means that the residuals between coding blocks are correlated. Schematically, the residuals of a coding block will refer to the residuals of its adjacent coding blocks. Then, after subsequent quantization processing, the smaller transform coefficients will become zero values, greatly reducing the cost of the coding residuals. Taking the traditional DCT as an example, the transformation is shown below, which realizes a two-dimensional discrete transformation through two separate one-dimensional discrete transformations (horizontal transformation and vertical transformation).
[0126] Co k =CU k C T
[0127] Among them, Co k Represents the transform coefficient after the residual transform of the current coding block, U k represents the residual, C represents the transformation kernel of the vertical transformation; C T Transform kernel representing the horizontal transform.
[0128] Due to the diversity of residual distribution, a single DCT cannot adapt to all residual characteristics. Therefore, transform kernels such as DST7 and DCT8 are introduced into the transform process, so that in the process of transforming the residual, a transform combination can be introduced to solve the problem that a single DCT cannot adapt to all residual characteristics. Among them, the transform combination can refer to a combination of a transform kernel for horizontal transform and a transform kernel for vertical transform, and the horizontal transform and the vertical transform can use the same or different transform kernels. Transform kernels include but are not limited to: DCT2, DCT8, DST7, etc. Among them, DCT2 and DCT8 refer to different DCT transform methods, and DST7 refers to a transform method of DST.
[0129] Taking AMT (Adaptive Multi-core Transform) technology as an example, the possible transform combinations for a transform block (i.e., the residual block to be transformed) are as follows: (DCT2, DCT2), (DCT8, DCT8), (DCT8, DST7), (DST7, DCT8), (DST7, DST7). Among them, taking (DCT2, DCT2) as an example, DCT2 represents the transform kernel of the horizontal transform, and DCT2 represents the transform kernel of the vertical transform. By analogy, it can be understood that (DCT8, DCT8), (DCT8, DST7), (DST7, DCT8), (DST7, DST7).
[0130] It should be understood that for a transform block, the specific choice of transform combination needs to be decided by using the RDO (Rate-distortion optimization) rule at the encoding end. Although the adaptive multi-core transform can improve the adaptability of the transform module to the residual, the problem that comes with it is the encoding cost of the transform kernel index (used to indicate which transform kernel to use).
[0131] (2) Transform skip (TS): There are some residuals in the video encoding process whose correlation is weak. For these residuals, skipping the transformation based on (1) can improve the encoding efficiency. That is, skipping the transformation process of these residuals and directly quantizing them.
[0132] 2. Common transformation division methods
[0133] In the embodiment of the present application, when transforming the coding block, multiple common transform division methods are involved. Indicatively, the transform division method may include but is not limited to: RQT (Residual Quad Tree), PBT (position based transform), SBT (sub-block transform), etc. Next, RQT, PBT, and SBT are respectively described.
[0134] ①RQT
[0135] In the HEVC standard, RQT uses a recursive quadtree to divide the coding block and encodes the best division information in the video bitstream. Figure 2 , is a schematic diagram of a residual quadtree partitioning mode provided by an exemplary embodiment of the present application. Figure 2 In the figure, the left side is a schematic diagram of the coding block being divided, and the right side is the tree structure of the coding block after being processed by the quadtree, where 1 indicates division and 0 indicates no division. Figure 2 In the example, coding block 10 corresponds to 1, that is, coding block 10 is quad-divided into 4 sub-blocks (i.e. Figure 2). The first sub-block (i.e., sub-block 11) corresponds to 1, that is, sub-block 11 is divided into 4 sub-blocks (sub-block 111, sub-block 112, sub-block 113, and sub-block 114) by four forks; the second sub-block (i.e., sub-block 12) corresponds to 0, and the third sub-block (sub-block 13) corresponds to 0, that is, sub-block 12 and sub-block 13 will not be divided again. The fourth sub-block (i.e., sub-block 14) corresponds to 1, and sub-block 14 is divided into 4 sub-blocks (sub-block 141, sub-block 142, sub-block 143, and sub-block 144) by four forks; then, sub-blocks 111, 112, and 113 all correspond to 0, which means that sub-blocks 111, 112, and 113 will not be divided again. Subblock 114 corresponds to 1, which means that subblock 114 is divided into 4 subblocks (subblock 1141, subblock 1142, subblock 1143 and subblock 1144) by four forks; subblock 1141, subblock 1142, subblock 1143 and subblock 1144 all correspond to 0, which means that subblock 1141, subblock 1142, subblock 1143 and subblock 1144 are no longer divided. Subblock 141 corresponds to 1, which means that subblock 141 is divided into 4 subblocks (subblock 1411, subblock 1412, subblock 1413 and subblock 1414) by four forks; subblock 1411, subblock 1412, subblock 1413 and subblock 1414 all correspond to 0, which means that subblock 1411, subblock 1412, subblock 1413 and subblock 1414 are no longer divided.
[0136] from Figure 2 It can be seen from the figure that if RQT is used to transform and divide the coding block, the transform and division method of the coding block requires more bits (ie, a longer coding code length) to represent it.
[0137] ②PBT
[0138] See also Figure 3 , is a schematic diagram of a position-based sub-block transformation provided by an exemplary embodiment of the present application. Figure 3 In the AVS3 standard, the position-based sub-block transform can divide the coding block into four sub-blocks (i.e. Figure 3 The transform combination may include a transform core of a horizontal transform and a transform core of a vertical transform. The transform core of the horizontal transform and the transform core of the vertical transform may be the same or different.
[0139] Indicative, such as Figure 3 As shown, the transform combination of sub-block 31 is (DCT8, DCT8), the transform combination of sub-block 32 is (DST7, DCT8), the transform combination of sub-block 33 is (DCT8, DST7), and the transform combination of sub-block 33 is (DST7, DST7).
[0140] Among them, whether any coding block (such as the current coding block) adopts PBT can be adaptively identified by using a flag bit. In one implementation, if the flag bit is a first value (such as 1), the current coding block uses PBT; if the flag bit is a second value (such as 0), the current coding block does not use PBT.
[0141] ③SBT
[0142] See also Figure 4a , is a schematic diagram of a sub-block transformation provided by an exemplary embodiment of the present application. Figure 4a As shown, SBT corresponds to 12 residual position modes (i.e. Figure 4a The residual position mode a~l in the figure, each residual position mode transforms only part of the sub-block area. Schematically, the residual position mode a transforms only the sub-block area 41 marked by color, the residual position mode b transforms only the sub-block area 42 marked by color; the residual position mode c transforms only the sub-block area 43 marked by color; the residual position mode d transforms only the sub-block area 44 marked by color, the residual position mode e transforms only the sub-block area 45 marked by color; the residual position mode f transforms only the sub-block area 46 marked by color, and the residual position mode f transforms only the sub-block area 47 marked by color. The sub-block area 46 marked by color is transformed, and the residual position mode g only transforms the sub-block area 47 marked by color; the residual position mode h only transforms the sub-block area 48 marked by color; the residual position mode i only transforms the sub-block area 49 marked by color, and the residual position mode j only transforms the sub-block area 410 marked by color; the residual position mode k only transforms the sub-block area 411 marked by color, and the residual position mode l only transforms the sub-block area 412 marked by color.
[0143] In specific implementation, in each residual position mode, the sub-block area that needs to be transformed is no longer divided, but directly transformed and quantized; while the sub-block area that does not need to be transformed is cleared. Figure 4a In the above method, only the sub-block region 41 in the residual position mode a is transformed, and the regions other than the sub-block region 41 in the residual position mode a are cleared. It should be understood that the sub-block region to be transformed can be referred to as a sub-block transformation region, and the 12 residual position modes correspond to sub-block transformation regions at different positions.
[0144] The size of the sub-block transformation area can be 1, 1 / 2 or 1 / 4 of the size of the corresponding direction of the coding block. The size includes width and height, and the corresponding direction of the coding block can include at least one of the following: the direction corresponding to the width of the coding block and the direction corresponding to the height. In an exemplary manner, let the width of the coding block be W and the height be H. Figure 4a The size of the sub-block transform area corresponding to the first row in is 1 / 2 of the size of the corresponding direction of the coding block. Figure 4a For the residual position mode a in , the width of the sub-block transformation area is equal to the width of the coding block, and the height of the sub-block transformation area is equal to 1 / 2 of the height of the coding block, that is, the height of the sub-block transformation area is H / 2; for another example, Figure 4a For the residual position mode c in , the width of the sub-block transformation area is equal to 1 / 2 of the coding block width, that is, the width of the sub-block transformation area is W / 2, and the height of the sub-block transformation area is equal to the height of the coding block.
[0145] exist Figure 4a The size of the sub-block transform area corresponding to the second and third rows in is 1 / 4 of the size of the corresponding direction of the coding block. For example, Figure 4a For the residual position mode e in , the width of the sub-block transformation area is equal to the width of the coding block, and the height of the sub-block transformation area is equal to 1 / 4 of the height of the coding block, that is, the height of the sub-block transformation area is H / 4; for another example, Figure 4a For the residual position mode k in , the width of the sub-block transformation area is equal to 1 / 2 of the coding block width, that is, the width of the sub-block transformation area is W / 2, and the height of the sub-block transformation area is equal to 1 / 2 of the coding block height, that is, the height of the sub-block transformation area is H / 2.
[0146] In the embodiment of the present application, for the 12 residual position modes corresponding to SBT, each residual position mode can be set with a corresponding transformation combination. Figure 4b FIG. 1 is a schematic diagram of a transformation combination corresponding to each of the 12 residual position modes provided by an exemplary embodiment of the present application. Figure 4b , the transform combination corresponding to the residual position mode a may be (DST7, DCT8); the transform combination corresponding to the residual position mode b may be (DST7, DST7), the transform combination corresponding to the residual position mode c may be (DCT8, DST7), and the transform combination corresponding to the residual position mode d may be (DST7, DST7); the transform combination corresponding to the residual position mode e may be (DST7, DCT8), and the transform combination corresponding to the residual position mode f may be (DST7, DST7); the transform combination corresponding to the residual position mode g may be (DCT8, DST7), and the transform combination corresponding to the residual position mode h may be (DST7, DST7); the transform combination corresponding to the residual position mode i may be (DCT8, DCT8), and the transform combination corresponding to the residual position mode j may be (DST7, DCT8); the transform combination corresponding to the residual position mode k may be (DCT8, DST7), and the transform combination corresponding to the residual position mode l may be (DST7, DST7).
[0147] It should be understood that, taking the transform combination corresponding to the residual position mode a as (DST7, DCT8) as an example, DST7 in (DST7, DCT8) is the transform kernel for the horizontal transform, and DCT8 is the transform kernel for the vertical transform. The remaining residual position modes can be understood with reference to the residual position mode a and will not be described in detail here. At the decoding end, it is only necessary to decode the transform information of the sub-block transform area, and perform inverse transform and inverse quantization based on the transform information of the sub-block transform area; the residual corresponding to the sub-block area other than the sub-block transform area (i.e., the sub-block area that has not been transformed) is set to 0 by default.
[0148] from Figure 4a and Figure 4b It can be seen that SBT corresponds to a variety of residual position modes, and also requires more bits to identify the residual position mode used by the current coding block, which will also result in a large amount of bit rate consumption to a certain extent.
[0149] It should be noted that when performing residual transform on the coding block, there will be some sub-block areas in the coding block whose transform coefficients after residual transform are 0, and other sub-block areas whose transform coefficients after residual transform are not 0. The residual transform corresponding to the transform coefficient not being 0 can be called a non-zero transform.
[0150] 3. Video Decoding
[0151] At the decoding end, for each coding block, after obtaining the video bitstream, on the one hand, the video bitstream is first entropy decoded to obtain information on various prediction modes and quantized transform coefficients, and then each transform coefficient is dequantized and inversely transformed to obtain the residual. On the other hand, based on the known prediction mode information, the prediction signal corresponding to the coding block can be obtained, and the residual and the prediction signal are added to obtain a reconstructed video signal, which can be used to reconstruct the decoded image corresponding to the coding block. Finally, the reconstructed video signal needs to undergo a loop filtering operation to generate the final output signal.
[0152] Based on the above related description, the embodiment of the present application provides a video encoding scheme and a video decoding scheme, which can be applied to a video codec (such as a video codec using sub-block transform technology) or a video compression product. The general principle of the video encoding scheme is as follows:
[0153] At the encoding end: the current coding block being encoded in the video can be determined, and the adjacent coding blocks of the current coding block can be determined; then, based on the coding information of the adjacent coding blocks, the transformation information of the current coding block can be determined; and then, based on the determined transformation information of the current coding block, the current coding block is encoded to obtain a video stream, and the video stream is sent to the decoding end.
[0154] The general principle of the video decoding scheme is as follows: At the decoding end: After receiving the video code stream, determine the current coding block being decoded in the video code stream, and determine the adjacent coding blocks of the current coding block, and then determine the transformation information of the current coding block based on the coding information of the adjacent coding blocks, and then decode the current coding block based on the determined transformation information of the current coding block.
[0155] From the perspective of the encoding and decoding ends, during the encoding and decoding process of the video, the transformation information of the current coding block is determined directly based on the encoding information of the adjacent coding blocks. This can reduce the encoding cost consumed for encoding the transformation information of the current coding block, thereby reducing the bit rate consumption in the entire encoding and decoding process, and thus improving the encoding and decoding efficiency.
[0156] Next, the video encoding and decoding system provided by the embodiment of the present application is described. Figure 5 , Figure 5 A schematic diagram of the architecture of a video encoding and decoding system provided for an embodiment of the present application. The video encoding and decoding system 50 may include an encoding device 501 and a decoding device 502. The encoding device 501 is located at the encoding end, and the decoding device is located at the decoding end. The encoding device 501 can be a terminal or a server, and the decoding device 502 can be a terminal or a server, and a communication connection can be established between the encoding device 501 and the decoding device 502. Among them, the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, a car terminal, a smart TV, etc., but is not limited to this. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and basic cloud computing services such as big data and artificial intelligence platforms.
[0157] (1) For the encoding device 501:
[0158] The encoding device 501 can obtain a video to be encoded, which can be obtained by shooting with a camera or generated by a computer. The camera can be a hardware component provided in the encoding device 501, for example, the camera can be a common camera, a stereo camera, a light field camera, etc. provided in a terminal. The camera can also refer to a hardware device connected to the encoding device 501, such as a camera connected to a server.
[0159] Wherein, a video includes one or more video frames, and the encoding device 501 can divide each video frame into one or more coding blocks, and encode each coding block. When encoding any coding block, the adjacent coding blocks of the coding block being encoded (hereinafter referred to as the current coding block) can be determined, and the adjacent coding blocks of the current coding block can be determined, and then the transformation information of the current coding block is determined based on the coding information of the adjacent coding blocks. Wherein, the adjacent coding block refers to the coding block after the transformation division processing has been performed. The coding information of the adjacent coding block may include at least one of the following: the transformation information of the adjacent coding block (such as the transformation division method, the transformation combination, etc.), the residual of the adjacent coding block, the transformation coefficient of the adjacent coding block, etc. At this time, the transformation information of the current coding block can be determined based on the coding information of the adjacent coding block. The following two methods can be used:
[0160] ① The coding information of the adjacent coding blocks includes: the transformation information of the adjacent coding blocks. Under this implementation method, the current coding block can directly inherit the transformation information of the adjacent coding blocks. The so-called inheritance means directly determining the transformation information of the adjacent coding blocks as the transformation information of the current coding block.
[0161] ② The coding information of the adjacent coding block includes the residual or transform coefficient of the adjacent coding block, and the transform information of the current coding block includes the residual position mode of the current coding block under SBT. In this implementation, the coding device 501 can derive the residual position mode of the transform coding residual of the current coding block under SBT mode according to the residual or transform coefficient of the adjacent coding block. Among them, the residual position mode of the transform coding residual of the current coding block under SBT mode is derived according to the residual or transform coefficient of the adjacent coding block. It is described in the subsequent embodiments and will not be repeated here.
[0162] Then, after determining the transformation information of the current coding block, the encoding device 501 can perform encoding processing on the current coding block based on the determined transformation information of the current coding block to obtain a video code stream. Schematically, the transformation information of the current coding block includes a transformation partitioning method, and the encoding device 501 can perform transformation partitioning on the current coding block based on the transformation partitioning method to obtain the transformation coefficients of the current coding block, and then perform quantization, entropy coding and other operations on the transformation coefficients of the current coding block to obtain a video code stream.
[0163] After the video code stream is obtained, the video code stream may be sent to the decoding device 502 so that the decoding device 502 performs decoding processing on the video code stream.
[0164] (2) For the decoding device 502:
[0165] After receiving the video code stream sent by the encoding device 501, the decoding device 502 can determine the current coding block in the video code stream, where the current coding block refers to the coding block being decoded; then, determine the adjacent coding blocks of the current coding block, and determine the transformation information of the current coding block based on the coding information of the adjacent coding blocks.
[0166] The coding information of the adjacent coding block may include at least one of the following: transformation information of the adjacent coding block (such as transformation division mode, transformation combination, etc.), residual of the adjacent coding block, transformation coefficient of the adjacent coding block, etc. At this time, the decoding device may determine the transformation information of the current coding block based on the coding information of the adjacent coding block in the following two ways:
[0167] ① The coding information of the adjacent coding block includes: the transformation information of the adjacent coding block. Under this implementation method, the current coding block can directly inherit the transformation information of the adjacent coding block.
[0168] ② The coding information of the adjacent coding block includes the residual or transform coefficient of the adjacent coding block, and the transform information of the current coding block includes the residual position mode of the current coding block under SBT. In this implementation, the decoding device 502 can derive the residual position mode of the transform coding residual of the current coding block under SBT mode according to the residual or transform coefficient of the adjacent coding block. Among them, the residual position mode of the transform coding residual of the current coding block under SBT mode is derived according to the residual or transform coefficient of the adjacent coding block. It is described in the subsequent embodiments and will not be repeated here.
[0169] Then, after determining the transformation information of the current coding block, the decoding device 502 can decode the current coding block based on the determined transformation information of the current coding block to reconstruct the video frame where the current coding block is located. As an implementation method, the transformation information of the current coding block includes a transformation division method, and the decoding device 502 can perform an inverse transformation process on the current coding block based on the transformation division method to obtain the residual of the current coding block, and the residual of the current coding block can be used to reconstruct the video frame where the current coding block is located. As another implementation method, the transformation information of the current coding block includes a residual position mode of the transformation coding residual of the current coding block in the SBT mode, and the decoding device 502 can perform an inverse transformation process on the current coding block based on the residual position mode to obtain the residual of the current coding block, and the residual of the current coding block can be used to reconstruct the video frame where the current coding block is located.
[0170] In an embodiment of the present application, during the encoding and decoding process of the video, the transformation information of the current coding block is determined directly based on the encoding information of the adjacent coding blocks. This can reduce the encoding cost consumed for encoding the transformation information of the current coding block, thereby reducing the bit rate consumption in the entire encoding and decoding process, and further improving the encoding and decoding efficiency.
[0171] Next, the video decoding method provided by the embodiment of the present application is described. Figure 6 , Figure 6 A schematic flow chart of a video decoding method provided for an exemplary embodiment of the present application. The video decoding method may be executed by the decoding device 502 in the above-mentioned video encoding and decoding system. The video decoding method described in this embodiment may include the following steps S601-S604:
[0172] S601: Determine a current coding block in a video code stream.
[0173] The video bitstream contains one or more video frames, each of which may contain one or more coding blocks. The current coding block refers to the coding block being decoded in the video bitstream.
[0174] S602: Determine an adjacent coding block of a current coding block.
[0175] The adjacent coding blocks include spatial domain adjacent coding blocks and / or temporal domain adjacent coding blocks.
[0176] i. A spatially adjacent coding block refers to a coding block adjacent to a current coding block in a current frame of a video. The current frame refers to a video frame in which the current coding block is located. The current coding block refers to a coding block being decoded in the current frame.
[0177] Determining the adjacent coding blocks of the current coding block may include: searching for coding blocks adjacent to the current coding block in the current frame of the video, and determining the coding blocks adjacent to the current coding block as spatially adjacent coding blocks of the current coding block. Adjacent here may mean: there is at least one vertex or edge overlap between the coding block and the current coding block, and the number of spatially adjacent coding blocks may be one or more.
[0178] Among them, searching for a coding block adjacent to a current coding block in a current frame of a video may include: searching for a transform block adjacent to the current coding block in the current frame of a video, and determining the coding block where the transform block adjacent to the current coding block is located as the coding block adjacent to the current coding block. A transform block refers to a small block obtained by dividing a coding block using a residual basic unit, and the residual basic unit may include a 4×4 pixel block, an 8×8 pixel block, etc., that is, a transform block may be a 4×4 small block, an 8×8 small block, etc. in a coding block. Schematically, as Figure 7a FIG. 1 is a schematic diagram of a transform block adjacent to a current coding block provided by an exemplary embodiment of the present application. Figure 7aIn the figure, A, B, C, D, and E are transform blocks, and A, B, C, D, E and the current coding block are all located in the current frame. In the current frame of the video, transform blocks adjacent to the current coding block are found to include A, B, C, D, and E. At this time, the coding block where the transform blocks A to E are located can be determined as the spatially adjacent coding block of the current coding block.
[0179] ii. A temporally adjacent coding block refers to a coding block adjacent to a reference coding block in a reference frame of a video; the number of temporally adjacent coding blocks may be one or more; a reference frame is any video frame or a specified video frame in the video except the current frame. As an implementation, an embodiment of the present application provides a reference frame list, which includes one or more video frames of a video. The reference frame may be any video frame in the reference frame list. Schematically, the video frames in the reference frame list are arranged in order, and the reference frame may be the first video frame in the reference frame list. As another implementation, the reference frame may be a video frame specified in a sequence header of the video code stream or in a frame header of a current frame where the current coding block is located.
[0180] The position of the reference coding block in the reference frame is the same as the position of the current coding block in the current frame. Schematically, if the current coding block is at position A in the current frame, then the position of the reference coding block in the reference frame is the same as position A.
[0181] In one implementation, determining an adjacent coding block of a current coding block may include: determining a reference frame corresponding to a current frame, and mapping a current coding block in the current frame to the reference frame, obtaining a reference coding block having the same position as the current coding block in the reference frame, and then searching for a coding block adjacent to the reference coding block in the reference frame, and determining the found coding block adjacent to the reference coding block as a time-domain adjacent coding block of the current coding block.
[0182] The method of searching for the coding block adjacent to the reference coding block in the reference frame may be: searching for the transform block adjacent to the reference coding block in the reference frame, and determining the coding block where the transform block adjacent to the reference coding block is located as the coding block adjacent to the reference coding block, and the transform block may be a 4×4 small block, an 8×8 small block, etc. in the coding block. Schematically, as Figure 7b FIG. 1 is a schematic diagram of a transform block adjacent to a current coding block provided by another exemplary embodiment of the present application. Figure 7b In the process, the current coding block in the current frame is mapped to the reference frame to obtain a reference coding block having the same position as the current coding block in the reference frame, and then the transform block adjacent to the reference coding block is found in the reference frame, such as Figure 7b In the reference frame, transform blocks A and B are found to be adjacent to the reference coding block. At this time, the coding block where transform block A is located and the coding block where transform block B is located can be determined as the time domain adjacent coding blocks of the current coding block.
[0183] S603: Determine transformation information of a current coding block according to coding information of adjacent coding blocks.
[0184] The coding information includes at least one of the following: transformation information, residual, and transformation coefficient. The transformation information includes at least one of a transformation division method and a transformation combination. The transformation division method includes at least one of the following: RQT, PBT, and SBT; the transformation combination includes a transformation kernel for horizontal transformation and a transformation kernel for vertical transformation, and the transformation kernel includes at least one of the following: discrete cosine transform kernel (such as DCT2, DCT8), discrete sine transform kernel (DST7), and skip transform (such as TS). According to the coding information of the adjacent coding blocks, determining the transformation information of the current coding block may include but is not limited to the following two methods (method 1) and method 2):
[0185] 1) The current coding block directly inherits the transformation information of the adjacent coding block.
[0186] The coding information of the adjacent coding blocks includes transformation information of the adjacent coding blocks. Determining the transformation information of the current coding block according to the coding information of the adjacent coding blocks includes: determining the transformation information of the adjacent coding blocks as the transformation information of the current coding block.
[0187] As an implementation method, when the transformation information of the adjacent coding block includes a transformation division method, the transformation division method of the adjacent coding block can be determined as the transformation division method of the current coding block, that is, the current coding block can inherit the transformation division method of the adjacent coding block. For example, if the transformation division formula of the adjacent coding block is RQT, then the optimal division method of the RQT of the adjacent coding block can be determined as the transformation division method of the current coding block, and the current coding block directly inherits the optimal division method of the RQT of the adjacent coding block. Here, the so-called optimal division method may refer to the division method with the lowest rate-distortion cost. For another example, if the transformation division method of the adjacent coding block is SBT, then the SBT of the adjacent coding block can be determined as the transformation division method of the current coding block, and the current coding block inherits the SBT of the adjacent coding block.
[0188] As another implementation, when the transform information of the adjacent coding block includes a transform partitioning mode and a transform combination, the transform partitioning mode and the transform combination of the adjacent coding block can be determined as the transform information of the current coding block, that is, the current coding block inherits the transform partitioning mode of the adjacent coding block and the transform combination corresponding to the transform partitioning mode. For example, the transform partitioning mode of the adjacent coding block is PBT, and the transform combination corresponding to PBT is as follows: Figure 3As shown, the transform combinations corresponding to the PBT include: the transform combination corresponding to sub-block 31 (DCT8, DCT8), the transform combination corresponding to sub-block 32 (DST7, DCT8), the transform combination corresponding to sub-block 33 (DCT8, DST7), and the transform combination corresponding to sub-block 34 (DST7, DST7); then the PBT of the adjacent coding block and the transform combination corresponding to the PBT can be determined as the transform information of the current coding block, and the current coding block inherits the PBT of the adjacent coding block and the transform combination corresponding to the PBT.
[0189] It is understandable that the encoding and decoding parties agree to determine the transformation information of the adjacent coding block as the transformation information of the current coding block; or, in some optional implementations, a series of control methods can be used to control whether the current coding block enables the transformation inheritance mode, thereby determining the transformation information of the adjacent coding block as the transformation information of the current coding block. In this implementation, the decoding device can detect whether the current coding block enables the transformation inheritance mode. If it is determined that the current coding block enables the transformation inheritance mode, the transformation information of the adjacent coding block is determined as the transformation information of the current coding block. Among them, the enabling control method of the transformation inheritance mode may include at least one of the following (1) and (2):
[0190] (1) Setting a transform inheritance mode flag in the video bitstream, when the transform inheritance mode flag is a first preset value (such as 1), it indicates that the current coding block enables the transform inheritance mode; when the transform inheritance mode flag is a second preset value (such as 0), it indicates that the current coding block turns off the transform inheritance mode. The setting position of the transform inheritance mode flag in the video bitstream may include at least one of the following:
[0191] a. The transform inheritance mode flag is set in the sequence header of the video to implement sequence-level signal control. When the transform inheritance mode flag in the sequence header is a first preset value, it indicates that all coding blocks in all video frames of the video enable the transform inheritance mode; when the transform inheritance mode flag in the sequence header is a second preset value, it indicates that all coding blocks in all video frames of the video disable the transform inheritance mode.
[0192] b. The transform inheritance mode flag is set in the frame header of the current frame of the video to implement image-level signal control. When the transform inheritance mode flag in the frame header of the current frame is a first preset value, it indicates that all coding blocks in the current frame enable the transform inheritance mode; when the transform inheritance mode flag in the frame header of the current frame is a second preset value, it indicates that all coding blocks in the current frame disable the transform inheritance mode.
[0193] c. The transform inheritance mode flag is set in the slice header of the slice where the current coding block is located to implement the signal control at the slice level. When the transform inheritance mode flag in the slice header is a first preset value, it indicates that all coding blocks in the slice have enabled the transform inheritance mode; when the transform inheritance mode flag in the slice header is a second preset value, it indicates that all coding blocks in the slice have disabled the transform inheritance mode; wherein a slice refers to a combination of multiple coding blocks.
[0194] d. The transform inheritance mode flag is set in the coding tree unit where the current coding block is located to implement CTU-level signal control. When the transform inheritance mode flag in the coding tree unit is a first preset value, it indicates that all coding blocks in the coding tree unit enable the transform inheritance mode; when the transform inheritance mode flag in the coding tree unit is a second preset value, it indicates that all coding blocks in the coding tree unit turn off the transform inheritance mode;
[0195] e. The transform inheritance mode flag is set in the current coding block to implement the signal control of the coding block. When the transform inheritance mode flag in the current coding block is a first preset value, it indicates that the current coding block enables the transform inheritance mode; when the transform inheritance mode flag in the current coding block is a second preset value, it indicates that the current coding block turns off the transform inheritance mode.
[0196] (2) Setting an enabling condition for the transform inheritance mode. When the current coding block meets the enabling condition, instructing the current coding block to enable the transform inheritance mode; when the current coding block does not meet the enabling condition, instructing the current coding block to turn off the transform inheritance mode. The enabling condition includes at least one of the following: size condition and prediction condition.
[0197] f. The enabling condition includes a size condition, which is used to define a preset width threshold or a preset height threshold for enabling the transform inheritance mode. The preset width threshold and the preset height threshold can be set as required, and the embodiment of the present application does not limit this. The current coding block is full of enabling conditions, including any of the following:
[0198] ① When the size condition defines a preset width threshold, the width of the current coding block is greater than the preset width threshold;
[0199] ② When the size condition defines a preset height threshold, the height of the current encoding block is greater than the preset height threshold;
[0200] ③ When the size condition defines a preset width threshold, the width of the current coding block is less than the preset width threshold;
[0201] ④ When the size condition defines a preset height threshold, the height of the current coding block is less than the preset height threshold.
[0202] g. The enabling conditions include prediction conditions. Under this implementation, the current coding block satisfies the enabling conditions, including: the adjacent coding block is a prediction reference coding block of the current coding block, that is, the coding block predicted using the prediction information of the adjacent coding block can enable the transform partition inheritance mode. At this time, the adjacent coding block is the prediction reference coding block of the current coding block.
[0203] It should be understood that the turning on and off of the transform division inheritance mode of any coding block can be controlled by one of the above-mentioned control methods ag alone, or by a combination of multiple (at least two) methods in the above-mentioned control method ag. For example, the control method includes: setting a transform inheritance mode flag in the sequence header of the video code stream, and the height of the coding block is greater than the preset height threshold, which means that all coding blocks in the video code stream whose height is greater than the preset height threshold can enable the transform inheritance mode. For another example, the control method includes: the height of the coding block is less than the preset height threshold and the adjacent coding block is a predicted reference coding block of the coding block, which means that the height in the video code stream is less than the preset height threshold and the coding block predicted using the prediction information of the adjacent coding block can enable the transform inheritance mode. The embodiment of the present application does not impose any limitation on the control method for turning on and off the transform division inheritance mode of any coding block.
[0204] It should be understood that the number of adjacent coding blocks may be greater than or equal to 1. When the number of adjacent coding blocks is greater than 1, the decoding device determines, based on the coding information of the adjacent coding blocks, that the transformation information of the current coding block may include s11-s13:
[0205] s11. Perform deduplication processing on adjacent coding blocks to obtain N deduplicated adjacent coding blocks.
[0206] In a specific implementation, the transformation information of each adjacent coding block can be determined, and an adjacent coding block with the same transformation information is retained to obtain N adjacent coding blocks after deduplication. Schematically, the number of adjacent coding blocks is three, namely adjacent coding block 1, adjacent coding block 2, and adjacent coding block 3, wherein the transformation information of adjacent coding block 1 is exactly the same as the transformation information of adjacent coding block 2, then the three adjacent coding blocks can be deduplicated to obtain two adjacent coding blocks. If adjacent coding block 1 is retained, the two adjacent coding blocks include adjacent coding block 1 and adjacent coding block 3; if adjacent coding block 2 is retained, the two adjacent coding blocks include adjacent coding block 2 and adjacent coding block 3.
[0207] The same transform information may include the following situations: ① When the transform information includes a transform partitioning mode, the same transform information means that the transform partitioning mode is exactly the same, such as the transform partitioning mode of the adjacent coding block 1 is PBT, and the transform partitioning mode of the adjacent coding block 2 is also PBT, then it can be determined that the transform information of the adjacent coding block 1 is the same as the transform information of the adjacent coding block 2. ② When the transform information includes a transform combination, the same transform information means that the transform combination is exactly the same, such as the transform combination of the adjacent coding block 1 is (DCT8, DCT8), and the transform combination of the adjacent coding block 2 is also (DCT8, DCT8), then it can be determined that the transform information of the adjacent coding block 1 is the same as the transform information of the adjacent coding block 2. ② When the transform information includes a transform partitioning mode and a transform combination, the same transform information means that the transform partitioning mode and the transform combination are exactly the same, such as the transform partitioning mode of the adjacent coding block 1 is SBT, and the transform combination is transform combination 1; the transform partitioning mode of the adjacent coding block 2 is SBT, and the transform combination is transform combination 1, then it can be determined that the transform information of the adjacent coding block 1 is the same as the transform information of the adjacent coding block 2.
[0208] s12. Determine a target adjacent coding block from N adjacent coding blocks.
[0209] The method for determining the target adjacent coding block includes any of the following: ① In the video bitstream, a selection flag can be used to indicate which adjacent coding block the current coding block inherits the transformation information of. In this implementation, if the selection flag in the video bitstream includes the flag of the adjacent coding block to be inherited, the decoding device can select the target adjacent coding block corresponding to the flag from N adjacent coding blocks according to the selected flag. The flag of the adjacent coding block includes the number of the coding block, etc.
[0210] ② If the N adjacent coding blocks contain at least one prediction reference coding block of the current coding block, and the prediction mode of the current coding block is coupled with the transform inheritance mode, the prediction reference coding block selected by the prediction mode of the current coding block is selected as the target adjacent coding block. The prediction mode of the current coding block is coupled with the transform inheritance mode, which means that the prediction mode of the current coding block is associated with the transform inheritance mode. Among them, the prediction mode includes at least one of the following: the prediction mode includes at least one of the following: inter-frame merge mode (Inter merge), intra-frame block copy merge mode (IBC merge), intra-frame template matching merge mode (Intra TMP merge), intra-frame prediction mode.
[0211] Example 1, the prediction mode is merge mode (such as Inter merge), if the merge mode of the current coding block is coupled with the transform inheritance mode, the prediction reference coding block selected by the merge mode of the current coding block can be selected from at least one prediction reference coding block as the target adjacent coding block. If the prediction mode of the current coding block is Inter merge mode, and the Inter merge mode of the current coding block selects adjacent coding block 1 from N adjacent coding blocks for prediction reference, then when the Inter merge mode of the current coding block is coupled with the transform inheritance mode, adjacent coding block 1 can be used as the target adjacent coding block.
[0212] Example 2: When the current coding block is an intra block, the intra prediction mode of the current coding block is coupled with the transform inheritance mode, and the prediction reference coding block selected by the intra prediction mode of the current coding block can be selected from at least one prediction reference coding block as the target adjacent coding block. For example, the intra prediction mode of the current coding block is derived from the adjacent coding block 2 in at least one prediction reference coding block, that is, the intra prediction mode of the current coding block selects the adjacent coding block 2 from N adjacent coding blocks for reference prediction, and then the adjacent coding block 2 can be used as the target adjacent coding block.
[0213] It should be understood that in an embodiment of the present application, the prediction mode and the transform inheritance mode of the current coding block can be coupled with each other or independent of each other. Mutually independent means that the prediction mode of the current coding block is not associated with the transform inheritance mode, and the prediction mode and the transform inheritance mode of the current coding block need to be indicated separately. In other words, when the prediction mode and the transform inheritance mode of the current coding block are independent of each other, additional bits are needed to identify the transform inheritance mode, which will result in higher bit rate consumption in the encoding and decoding process; and when the prediction mode and the transform inheritance mode of the current coding block are coupled with each other, there is no need to use additional bits to identify the transform inheritance mode, thereby reducing the bit rate consumption in the encoding and decoding process and improving the encoding and decoding efficiency.
[0214] s13. Determine the transformation information of the target adjacent coding block as the transformation information of the current coding block.
[0215] 2) The coding information of the adjacent coding block includes the residual or transform coefficient of the adjacent coding block; in an embodiment of the present application, the residual or transform coefficient of the adjacent coding block can be used to derive the residual position mode when the current coding block adopts SBT, and the residual position mode is used to indicate the sub-block area for transform coding residual. By utilizing the residual or transform coefficient of the adjacent coding block, the residual position mode when the current coding block adopts SBT can be quickly derived, thereby improving the encoding and decoding efficiency in the encoding and decoding process.
[0216] In this implementation, according to the coding information of the adjacent coding blocks, determining the transformation information of the current coding block may include the following two methods:
[0217] Method 1: One or more context index information (Context index information) is derived according to the coding information of the adjacent coding block, and each context index information corresponds to an entropy decoding method, and the entropy decoding method can be, for example, CABAC decoding, etc.; then, the decoding device determines the entropy decoding method according to the derived context index information, and performs entropy decoding processing on the residual position mode flag of the current coding block under SBT according to the determined entropy decoding method to obtain the residual position mode of the current coding block under SBT.
[0218] Among them, deriving one or more context index information according to the coding information of the adjacent coding block may include: ① obtaining the first adjacent coding block and the second adjacent coding block of the current coding block, the first adjacent coding block refers to the adjacent coding block located in the first direction of the current coding block. ② The second adjacent coding block refers to the adjacent coding block located in the second direction of the current coding block; ③ obtaining the first quantity ratio in the first adjacent coding block; the first quantity ratio refers to the ratio between the number of non-zero residual basic units contained in the first adjacent coding block and the total number of all residual basic units in the first adjacent coding block; ④ obtaining the second quantity ratio in the second adjacent coding block; the second quantity ratio refers to the ratio between the number of non-zero residual basic units contained in the second adjacent coding block and the total number of all residual basic units in the second adjacent coding block; ⑤ determining the context index information according to the size relationship between the first quantity ratio and the second quantity ratio; wherein, if the first quantity ratio is greater than the second quantity ratio, the context index information is the first index information; if the first quantity ratio is equal to the second quantity ratio, the context index information is the second index information; if the first quantity ratio is less than the second quantity ratio, the context index information is the third index information.
[0219] The first direction and the second direction can be determined as required. For example, the first direction may be located above the current coding block, and the second direction may be located to the left of the current coding block; for another example, the first direction may be located below the current coding block, and the second direction may be located to the right of the current coding block. The embodiment of the present application does not impose any limitation on the first direction and the second direction. A non-zero residual basic unit refers to a residual basic unit with a non-zero transformation, and the residual basic unit may be a 4×4 pixel block or an 8×8 pixel block. The first index information, the second index information, and the third index information can be flexibly set. Schematically, the first index information may be 0, the second index information may be 1, and the third index information may be 2.
[0220] For example, Figure 8As shown, a schematic diagram of the position relationship between a first adjacent coding block and a second adjacent coding block and a current coding block is provided in an exemplary embodiment of the present application. Figure 8 , the first adjacent coding block is an adjacent coding block located above the current coding block, the second adjacent coding block is an adjacent coding block located on the left side of the current coding block, the first adjacent coding block and the second adjacent coding block include non-zero residual basic units, and the residual basic unit is a 4×4 pixel block; the decoding device can obtain that the number of non-zero residual basic units included in the first adjacent coding block is 4, and the total number of all residual basic units in the first adjacent coding block is 16, and it can be determined that the first quantity ratio r1 in the first adjacent coding block is 0.25; the decoding device obtains that the number of non-zero residual basic units included in the second adjacent coding block is 8, the total number of all residual basic units in the second adjacent coding block is 16, and the second quantity ratio r2 in the second adjacent coding block is 0.5; at this time, r1 is less than r2, then the context index information is 2.
[0221] Mode 2: The video bitstream contains the index information of the residual position mode selected by the current coding block under SBT; SBT includes multiple candidate residual position modes, and the multiple candidate residual position modes can be as described above Figure 4a In this implementation, the transformation information of the current coding block is determined according to the coding information of the adjacent coding blocks, including the following steps s21-s23:
[0222] s21. Reorder the candidate residual position modes under the SBT according to the coding information of the adjacent coding blocks to obtain a reordered list, which contains the candidate residual position modes arranged in order and their corresponding index information.
[0223] As an implementation method, the candidate residual position modes under the SBT are reordered according to the encoding information of the adjacent coding blocks to obtain a reordered list, including: the decoding device can obtain the index information of each candidate residual position mode under the SBT according to the encoding information of the adjacent coding blocks, and then reorder the candidate residual position modes under the SBT in descending order of the index information to obtain a reordered list.
[0224] Among them, each candidate residual position mode under SBT corresponds to a sub-block transformation area at a different position. For example, the candidate residual position mode is as follows: Figure 4a The candidate residual position mode a in the above example corresponds to the sub-block transformation region 41; Figure 4aThe candidate residual position mode j in the sub-block transformation area corresponding to the candidate residual position mode j is area 410. Among them, according to the coding information of the adjacent coding block, the index information of each candidate residual position mode under SBT is obtained, including: ① obtaining the first adjacent coding block and the second adjacent coding block of the current coding block, the first adjacent coding block refers to the adjacent coding block located in the first direction of the current coding block; the second adjacent coding block refers to the adjacent coding block located in the second direction of the current coding block; ② obtaining the first quantity ratio in the first adjacent coding block; the first quantity ratio refers to the ratio between the number of non-zero residual basic units contained in the first adjacent coding block and the total number of all residual basic units in the first adjacent coding block; ③ obtaining the second quantity ratio in the second adjacent coding block; the second quantity ratio refers to the ratio between the number of non-zero residual basic units contained in the second adjacent coding block and the total number of all residual basic units in the second adjacent coding block. ④ According to the size relationship between the first quantity ratio and the second quantity ratio, the index information is assigned to each candidate residual position mode under SBT.
[0225] It should be understood that the first direction and the second direction can be determined according to the requirements. For example, the first direction can be located above the current coding block, and the second direction can be located to the left of the current coding block; for another example, the first direction can be located below the current coding block, and the second direction can be located to the right of the current coding block, which is not limited in this embodiment of the present application. The residual basic unit can be a 4×4 pixel block or an 8×8 pixel block.
[0226] According to the relationship between the first quantity ratio and the second quantity ratio, the allocation of index information to each candidate residual position mode under SBT includes the following cases:
[0227] (1) If the first quantity ratio is greater than or equal to the second quantity ratio, the index information assigned to the candidate residual position mode of the sub-block transform region in the first direction is greater than the index information assigned to the candidate residual position mode of the sub-block transform region in the second direction. Schematically, the first direction is located above the current coding block, the second direction is located on the left side of the current coding block, the first quantity ratio is r1, the second quantity ratio is r2, r1>r2, and the candidate residual position mode of the sub-block transform region located above is assigned higher index information, that is, the index information assigned to the candidate residual position mode of the sub-block transform region located above is greater than the index information assigned to the candidate residual position mode of the sub-block transform region located on the left side. For example, the candidate residual position mode of the sub-block transform region located above may include Figure 4a The candidate residual position mode a and residual position mode e in the sub-block transformation area may include Figure 4athe residual position patterns c and g; then the index information assigned to the residual position patterns a and e is greater than the index information assigned to the residual position patterns c and g.
[0228] (2) If the first quantity ratio is less than the second quantity ratio, then the index information assigned to the candidate residual position pattern where the sub-block transform region is located in the second direction is greater than the index information assigned to the candidate residual position pattern where the sub-block transform region is located in the first direction. Schematically, r1 < r2, and the candidate residual position pattern where the sub-block transform region is located on the left is assigned a higher index information, that is, the index information assigned to the candidate residual position pattern where the sub-block transform region is located on the left is greater than the index information assigned to the candidate residual position pattern where the sub-block transform region is located above. For example, the candidate residual position patterns where the sub-block transform region is located above may include Figure 4a the residual position patterns a and e; the candidate residual position patterns where the sub-block transform region is located on the left may include Figure 4a the residual position patterns c and g; then the index information assigned to the residual position patterns c and g is greater than the index information assigned to the residual position patterns a and e.
[0229] It should be understood that for a candidate residual position pattern assigned with higher index information, it is considered that the residual position pattern of the current coding block under SBT may have a certain correlation with it. Therefore, the larger the index information of the candidate residual position pattern, the shorter the coding length of the candidate residual position pattern; the shorter the coding length of the candidate residual position pattern, the higher the probability that the candidate residual position pattern is selected as the residual position pattern of the current coding block under SBT. Among them, the coding length is measured by the number of bit positions. The longer the coding length, the more bit positions are used for coding; the shorter the coding length, the fewer bit positions are used for coding. Schematically, when coding, variable-length codes are used for coding. The candidate residual position patterns include candidate residual position pattern A, candidate residual position pattern B, and candidate residual position pattern C. The index information of candidate residual position pattern A is greater than the index information of candidate residual position pattern B, and the index information of candidate residual position pattern B is greater than the index information of candidate residual position pattern C. Then when using variable-length codes for coding, the index information of candidate residual position pattern A can be encoded as 0, the index information of candidate residual position pattern B can be encoded as 10, and the index information of candidate residual position pattern C can be encoded as 11. At this time, the coding length of candidate residual position pattern A is the shortest, which also means that the probability that this candidate residual position pattern A is selected as the residual position pattern of the current coding block under SBT is the highest.
[0230] s22. Perform entropy decoding on the video bitstream to obtain the index information of the residual position mode selected by the current coding block under the SBT, and determine the residual position mode of the current coding block under the SBT from the reordering list according to the index information of the residual position mode selected by the current coding block under the SBT. Specifically, search the reordering list for a candidate residual mode corresponding to the index information of the residual position mode selected by the current coding block under the SBT, and determine the found candidate residual position mode as the residual position mode of the current coding block under the SBT.
[0231] S604: Perform decoding processing on the current coding block based on the determined transformation information of the current coding block.
[0232] In one implementation, the transformation information includes a transformation division method and / or a transformation combination. The decoding device can perform inverse transformation processing on the current coding block based on the transformation division method and / or the transformation combination of the current coding block to obtain the residual of the current coding block, and the residual of the current coding block can be used to reconstruct the current frame.
[0233] In another implementation, the transformation information includes the residual position mode selected for the current coding block under SBT. The decoding device can perform inverse transformation processing on the current coding block based on the selected residual position mode to obtain the residual of the current coding block, and the residual of the current coding block can be used to reconstruct the current frame.
[0234] In the embodiment of the present application, the current coding block in the video code stream is determined, and the adjacent coding blocks of the current coding block are determined; the transformation information of the current coding block is determined according to the coding information of the adjacent coding blocks; and the current coding block is decoded based on the determined transformation information of the current coding block. It can be seen that in the decoding process of the video, the transformation information of the current coding block can be determined based on the coding information of the adjacent coding blocks, which can reduce the coding cost consumed by encoding the transformation information of the current coding block, thereby reducing the bit rate consumption in the entire encoding and decoding process, and thus improving the decoding efficiency.
[0235] Next, the video encoding method provided in the embodiment of the present application is described. Fig. 9 , Fig. 9 A schematic flow chart of a video encoding method provided for another exemplary embodiment of the present application. The video encoding method may be executed by an encoding device in the above-mentioned video encoding and decoding system. The video encoding method described in this embodiment may include the following steps S901-S904:
[0236] S901: Determine a current coding block in a video.
[0237] A video includes one or more video frames, each of which may include one or more coding blocks. A current coding block refers to a coding block being encoded in the video.
[0238] S902: Determine an adjacent coding block of a current coding block.
[0239] The adjacent coding blocks include spatially adjacent coding blocks and / or temporally adjacent coding blocks; the spatially adjacent coding blocks refer to coding blocks adjacent to the current coding block in the current frame of the video; the current frame refers to the video frame where the current coding block is located; the current coding block refers to the coding block being encoded in the current frame; the temporally adjacent coding blocks refer to coding blocks adjacent to the reference coding block in the reference frame; the reference frame is any video frame or a specified video frame in the video except the current frame; the position of the reference coding block in the reference frame is the same as the position of the current coding block in the current frame.
[0240] The specific implementation method of step S902 is similar to that of the above step S602 and will not be repeated here.
[0241] S903: Determine transformation information of a current coding block according to coding information of adjacent coding blocks.
[0242] The coding information of the adjacent coding block includes at least one of the following: transformation information, residual, and transformation coefficient. The transformation information includes a transformation division method and / or a transformation combination. The transformation division method includes at least one of the following: PQT, PBT, SBT; the transformation combination includes a transformation kernel of a horizontal transformation and a transformation kernel of a vertical transformation, and the transformation kernel includes at least one of the following: a discrete cosine transformation kernel, a discrete sine transformation kernel, and a skip transformation. According to the coding information of the adjacent coding block, determining the transformation information of the current coding block includes but is not limited to the following methods (method 1) and method 2):
[0243] 1) The current coding block directly inherits the transformation information of the adjacent coding block.
[0244] The number of adjacent coding blocks may be greater than or equal to 1. In this case, a selection flag is included in the video bitstream, and the selection flag may specifically indicate the transformation information of the adjacent coding block that the current coding block needs to inherit. After determining the transformation information of the adjacent coding block to be inherited by the current coding block, the coding device sets the identifier of the adjacent coding block to be inherited in the selection flag.
[0245] When the encoding information of the adjacent coding block includes the transformation information of the adjacent coding block, the transformation information of the current coding block is determined according to the encoding information of the adjacent coding block, including: determining the transformation information of the adjacent coding block as the transformation information of the current coding block. As an implementation, when the transformation information of the adjacent coding block includes the transformation division mode, the transformation division mode of the adjacent coding block can be determined as the transformation division mode of the current coding block, that is, the current coding block can inherit the transformation division mode of the adjacent coding block. As another implementation, when the transformation information of the adjacent coding block includes the transformation division mode and the transformation combination, the transformation division mode and the transformation combination of the adjacent coding block can be determined as the transformation division mode and the transformation combination of the current coding block, that is, the current coding block inherits the transformation division mode of the adjacent coding block and the transformation combination corresponding to the transformation division mode. As another implementation, when the transformation information of the adjacent coding block includes the transformation combination, the adjacent coding block transformation combination can be determined as the transformation combination of the current coding block, that is, the current coding block inherits the adjacent coding block transformation combination.
[0246] It is understandable that the encoding and decoding parties agree to determine the transformation information of the adjacent coding block as the transformation information of the current coding block; or, in some optional implementations, a series of control methods can be used to control whether the current coding block enables the transformation inheritance mode, thereby determining the transformation information of the adjacent coding block as the transformation information of the current coding block. In this implementation, the encoding device can detect whether the current coding block enables the transformation inheritance mode. If it is determined that the current coding block enables the transformation inheritance mode, the transformation information of the adjacent coding block is determined as the transformation information of the current coding block. Among them, the enabling control method of the transformation inheritance mode may include at least one of the following:
[0247] (1) A transform inheritance mode flag is set in the video bitstream, and the transform inheritance mode flag is used to control whether the current coding block starts the transform inheritance mode. When the current coding block starts the transform inheritance mode, the transform inheritance mode flag can be set to a first preset value (such as 1); when the current coding block turns off the transform inheritance mode, the transform inheritance mode flag is set to a second preset value (such as 0). The setting position of the transform inheritance mode flag in the video bitstream includes at least one of the following:
[0248] a. The transform inheritance mode flag is set in the sequence header of the video. When the transform inheritance mode flag in the sequence header is a first preset value, it indicates that all coding blocks in all video frames of the video enable the transform inheritance mode; when the transform inheritance mode flag in the sequence header is a second preset value, it indicates that all coding blocks in all video frames of the video disable the transform inheritance mode;
[0249] b. The transform inheritance mode flag is set in the frame header of the current frame of the video. When the transform inheritance mode flag in the frame header is a first preset value, it indicates that all coding blocks in the current frame enable the transform inheritance mode; when the transform inheritance mode flag in the frame header of the current frame is a second preset value, it indicates that all coding blocks in the current frame disable the transform inheritance mode;
[0250] c. The transform inheritance mode flag is set in the slice header of the slice where the current coding block is located. When the transform inheritance mode flag in the slice header is a first preset value, it indicates that all coding blocks in the slice enable the transform inheritance mode; when the transform inheritance mode flag in the slice header is a second preset value, it indicates that all coding blocks in the slice disable the transform inheritance mode;
[0251] d. The transform inheritance mode flag is set in the coding tree unit where the current coding block is located. When the transform inheritance mode flag in the coding tree unit is a first preset value, it indicates that all coding blocks in the coding tree unit enable the transform inheritance mode; when the transform inheritance mode flag in the coding tree unit is a second preset value, it indicates that all coding blocks in the coding tree unit turn off the transform inheritance mode;
[0252] e. The transform inheritance mode flag is set in the current coding block. When the transform inheritance mode flag in the current coding block is a first preset value, it indicates that the current coding block enables the transform inheritance mode; when the transform inheritance mode flag in the current coding block is a second preset value, it indicates that the current coding block turns off the transform inheritance mode.
[0253] (2) Setting an enabling condition for the transform inheritance mode. When the current coding block meets the enabling condition, the current coding block is instructed to enable the transform inheritance mode. When the current coding block does not meet the enabling condition, the current coding block is instructed to turn off the transform inheritance mode. The enabling condition includes a size condition and / or a prediction condition.
[0254] f. The enabling condition includes a size condition, which is used to define a preset width threshold or a preset height threshold for enabling the transform inheritance mode. The current coding block satisfies the enabling condition, including any of the following:
[0255] ① When the size condition defines a preset width threshold, the width of the current coding block is greater than the preset width threshold;
[0256] ② When the size condition defines a preset height threshold, the height of the current encoding block is greater than the preset height threshold;
[0257] ③ When the size condition defines a preset width threshold, the width of the current coding block is less than the preset width threshold;
[0258] ④ When the size condition defines a preset height threshold, the height of the current coding block is less than the preset height threshold.
[0259] g. The enabling condition includes a prediction condition; the current coding block satisfies the enabling condition, including: the adjacent coding block is a prediction reference coding block of the current coding block.
[0260] It should be understood that the number of adjacent coding blocks may be greater than or equal to 1. When the number of adjacent coding blocks is greater than 1, the encoding device determines, based on the encoding information of the adjacent coding blocks, that the transformation information of the current coding block may include s31-s33:
[0261] s31. De-duplicate adjacent coding blocks to obtain N de-duplicated adjacent coding blocks; N is an integer greater than or equal to 1.
[0262] The specific implementation of step s31 may refer to the specific implementation of step s11 above, which will not be repeated here.
[0263] s32. Determine a target adjacent coding block from N adjacent coding blocks.
[0264] Among them, the determination method of the target adjacent coding block may include at least one of the following: ① Determine the target adjacent coding block from N adjacent coding blocks according to the rate-distortion optimization rule. Specifically, the current coding block can be encoded based on the transformation information of each adjacent coding block in the N adjacent coding blocks, and the corresponding rate-distortion cost can be determined based on the encoding result corresponding to each adjacent coding block, and the adjacent coding block corresponding to the minimum rate-distortion cost is determined as the target adjacent coding block. ② If the N adjacent coding blocks contain at least one prediction reference coding block of the current coding block, and the prediction mode of the current coding block is coupled with the transformation inheritance mode, the prediction reference coding block selected by the prediction mode of the current coding block is selected as the target adjacent coding block; wherein the prediction mode includes at least one of the following: inter-frame merge mode, intra-frame block copy merge mode, intra-frame template matching merge mode, intra-frame prediction mode. Among them, the specific implementation method of selecting the prediction reference coding block selected by the prediction mode of the current coding block as the target adjacent coding block can refer to the description of the corresponding part above, which will not be repeated here.
[0265] s33. Determine the transformation information of the target adjacent coding block as the transformation information of the current coding block.
[0266] 2) The coding information of the adjacent coding block includes the residual or transform coefficient of the adjacent coding block; in an embodiment of the present application, the residual or transform coefficient of the adjacent coding block can be used to derive the residual position mode when the current coding block adopts SBT, and the residual position mode is used to indicate the sub-block area for transform coding residual. By utilizing the residual or transform coefficient of the adjacent coding block, the residual position mode when the current coding block adopts SBT can be quickly derived, thereby improving the coding efficiency during the encoding process.
[0267] The transformation information of the current coding block includes the residual position mode of the current coding block under SBT, and the transformation information of the current coding block is determined according to the coding information of the adjacent coding blocks, including steps s41-s43:
[0268] s41. Reorder the candidate residual position modes under SBT according to the coding information of the adjacent coding blocks to obtain a reordered list.
[0269] As an implementation method, the candidate residual position modes under the SBT are reordered according to the coding information of the adjacent coding blocks to obtain a reordered list, including: obtaining the index information of the candidate residual position modes under the SBT according to the coding information of the adjacent coding blocks; and then reordering the candidate residual position modes under the SBT in descending order of the index information to obtain a reordered list. The reordered list contains the candidate residual position modes arranged in order and their corresponding index information.
[0270] Among them, each candidate residual position mode under SBT corresponds to a sub-block transformation area at a different position, and according to the coding information of the adjacent coding block, the index information of each candidate residual position mode under SBT is obtained, including: ① obtaining the first adjacent coding block and the second adjacent coding block of the current coding block, the first adjacent coding block refers to the adjacent coding block located in the first direction of the current coding block; the second adjacent coding block refers to the adjacent coding block located in the second direction of the current coding block; ② obtaining the first quantity ratio in the first adjacent coding block; the first quantity ratio refers to the ratio between the number of non-zero residual basic units contained in the first adjacent coding block and the total number of all residual basic units in the first adjacent coding block; obtaining the second quantity ratio in the second adjacent coding block; the second quantity ratio refers to the second adjacent The ratio between the number of non-zero residual basic units contained in the coding block and the total number of all residual basic units in the second adjacent coding block; ③ According to the size relationship between the first number ratio and the second number ratio, index information is assigned to each candidate residual position mode under SBT; wherein, if the first number ratio is greater than or equal to the second number ratio, the index information assigned to the candidate residual position mode in the sub-block transformation area in the first direction is greater than the index information assigned to the candidate residual position mode in the sub-block transformation area in the second direction; if the first number ratio is less than the second number ratio, the index information assigned to the candidate residual position mode in the sub-block transformation area in the second direction is greater than the index information assigned to the candidate residual position mode in the sub-block transformation area in the first direction.
[0271] It should be understood that the candidate residual position mode assigned with higher index information is considered to have a certain correlation with the residual position mode of the current coding block under SBT. Therefore, the larger the index information of the residual position mode, the shorter the encoding code length of the candidate residual position mode; the shorter the encoding code length of the residual position mode, the higher the probability that the candidate residual position mode is selected as the residual position mode of the current coding block under SBT. It should be understood that the specific implementation method of obtaining the index information of each candidate residual position mode under SBT according to the encoding information of the adjacent coding block can be found in the description of the corresponding part above, which will not be repeated here.
[0272] s42. Select the residual position mode of the current coding block under SBT from the reordering list.
[0273] Among them, selecting the residual position mode of the current coding block under SBT from the reordering table may include any of the following methods: ① In the embodiment of the present application, the earlier the candidate residual position mode is in the reordering list, the higher the probability that the candidate residual position mode is selected. Therefore, the candidate residual position mode with the largest index information (i.e., the candidate residual position mode with the shortest encoding code length or the candidate residual position mode with the highest probability of being selected) can be selected from the reordering list as the residual position mode of the current coding block under SBT. Schematically, the candidate residual position modes arranged in order in the reordering list include residual position mode a and residual position mode b; residual position mode a is the frontmost in the reordering list, so the probability of residual position mode a being selected is the highest. At this time, residual position mode a can be determined as the residual position mode of the current coding block under SBT. By selecting the residual position mode of the current coding block under SBT based on the probability that the candidate residual position mode is selected, the residual position mode of the previous coding block under SBT can be quickly determined, thereby improving coding efficiency.
[0274] ② According to the RDO rule, determine the residual position mode of the current coding block under SBT from the reordering list. The encoding device can determine the rate-distortion costs corresponding to each candidate residual position mode of the current coding block under SBT in turn, and use the candidate residual position mode corresponding to the minimum rate-distortion cost as the residual position mode of the current coding block under SBT. Schematically, the candidate residual position modes arranged in order in the reordering list include residual position mode a, residual position mode b and residual position mode c; wherein, the rate-distortion cost corresponding to residual position mode a < the rate-distortion cost of residual position mode b < the rate-distortion cost of residual position mode c, then residual position mode a is determined as the residual position mode of the current coding block under SBT.
[0275] S904: Based on the determined transformation information of the current coding block, encode the current coding block to obtain a video code stream.
[0276] Specific implementations of step S904 may include the following:
[0277] (1) The transformation information includes a transformation division method and / or a transformation combination. Based on the determined transformation information of the current coding block, the current coding block is encoded to obtain a video bitstream, including: based on the transformation information of the current coding block, the current coding block is transformed to obtain a transformation coefficient of the current coding block, and the transformation coefficient of the current coding block is quantized, entropy encoded, etc. to obtain a video bitstream.
[0278] (2) The coding information of the adjacent coding block includes the residual and transformation coefficient of the adjacent coding block. The transformation information of the current coding block includes the position residual mode flag of the current coding block under SBT; based on the determined transformation information of the current coding block, the current coding block is encoded to obtain a video bitstream, including: deriving one or more context index information according to the coding information of the adjacent coding block, each context index information corresponds to an entropy coding method, and the entropy coding method includes but is not limited to: variable length coding, Huffman coding, etc.; then the encoding device determines the entropy coding method according to the derived context index information, and performs entropy coding on the residual position mode flag of the current coding block under SBT according to the determined entropy coding method to obtain a video bitstream. Among them, the residual position mode flag is used to indicate the residual position mode of the current coding block under SBT.
[0279] Among them, one or more context index information is derived according to the coding information of the adjacent coding block, including: obtaining the first adjacent coding block and the second adjacent coding block of the current coding block, the first adjacent coding block refers to the adjacent coding block located in the first direction of the current coding block; the second adjacent coding block refers to the adjacent coding block located in the second direction of the current coding block; obtaining a first quantity ratio in the first adjacent coding block; the first quantity ratio refers to the ratio between the number of non-zero residual basic units contained in the first adjacent coding block and the total number of all residual basic units in the first adjacent coding block; obtaining a second quantity ratio in the second adjacent coding block; the second quantity ratio refers to the ratio between the number of non-zero residual basic units contained in the second adjacent coding block and the total number of all residual basic units in the second adjacent coding block; then determining the context index information according to the size relationship between the first quantity ratio and the second quantity ratio; wherein, if the first quantity ratio is greater than the second quantity ratio, the context index information is the first index information; if the first quantity ratio is equal to the second quantity ratio, the context index information is the second index information; if the first quantity ratio is less than the second quantity ratio, the context index information is the third index information. It should be understood that the derivation of one or more context index information according to the coding information of the adjacent coding blocks here can refer to the embodiments of the corresponding parts mentioned above, which will not be repeated here.
[0280] (3) The coding information of the adjacent coding block includes the residual and transformation coefficient of the adjacent coding block; the reordering list contains the candidate residual position modes arranged in order and the corresponding index information of each; based on the determined transformation information of the current coding block, the current coding block is encoded to obtain a video bitstream, including: determining the index information of the selected residual position mode in the reordering list, and then entropy encoding the index information of the selected residual position mode in the reordering list to obtain the video bitstream.
[0281] Among them, in the embodiment of the present application, the larger the index information of the candidate residual position mode, the shorter the encoding code length of the candidate residual position mode; the shorter the encoding code length of the candidate residual position mode, the higher the probability that the candidate residual position mode is selected. For example, the index information of the selected residual position mode in the reordering list is the largest, then when the selected residual position mode is entropy encoded, the selected residual position mode can be encoded with a shorter code length, such as encoding the selected residual position mode as 0 (i.e., 1 bit). In this way, the encoding efficiency can be improved.
[0282] In an embodiment of the present application, the current coding block in the video is determined, and the coding information of the adjacent coding blocks of the current coding block is determined; then, the transformation information of the current coding block is determined based on the coding information of the adjacent coding blocks; based on the determined transformation information of the current coding block, the current coding block is encoded. In the video encoding process, the transformation information of the current coding block is determined directly based on the coding information of the adjacent coding blocks, which can reduce the coding cost consumed by encoding the transformation information of the current coding block, thereby reducing the bit rate consumption in the entire encoding and decoding process, and thus improving the coding efficiency.
[0283] Next, the video decoding device provided in the embodiment of the present application is described.
[0284] See also Fig.10 , Fig.10 is a structural diagram of a video decoding device provided in an embodiment of the present application. The video decoding device may be a computer program (including program code) in a computer device. For example, the video decoding device may be an application software in a computer device. The video decoding device may be used to execute Figure 5 Some or all of the steps in the method embodiment shown. Fig.10 , the video decoding device comprises the following units:
[0285] The processing unit 1001 is used to determine the current coding block in the video bit stream;
[0286] The processing unit 1001 is further configured to determine an adjacent coding block of a current coding block;
[0287] The processing unit 1001 is further configured to determine transformation information of a current coding block according to coding information of adjacent coding blocks;
[0288] The decoding unit 1002 is used to perform decoding processing on the current coding block based on the determined transformation information of the current coding block.
[0289] In one embodiment, the adjacent coding block includes a spatial adjacent coding block and / or a temporal adjacent coding block; the spatial adjacent coding block refers to a coding block adjacent to the current coding block in the current frame of the video; the current frame refers to the video frame where the current coding block is located; the current coding block refers to a coding block being decoded in the current frame;
[0290] The temporally adjacent coding block refers to a coding block adjacent to the reference coding block in a reference frame of the video; the reference frame is any video frame or a specified video frame in the video except the current frame; the position of the reference coding block in the reference frame is the same as the position of the current coding block in the current frame.
[0291] In one embodiment, the coding information of the adjacent coding block includes transformation information of the adjacent coding block; the processing unit 1001 is specifically configured to:
[0292] Determining the transformation information of the adjacent coding block as the transformation information of the current coding block;
[0293] Among them, the transformation information includes at least one of a transformation division method and a transformation combination; the transformation division method includes at least one of the following: a residual quadtree mode, a position-based transformation mode, and a sub-block transformation mode; the transformation combination includes a transformation kernel for a horizontal transformation and a transformation kernel for a vertical transformation, and the transformation kernel includes at least one of the following: a discrete cosine transform kernel, a discrete sine transform kernel, and a skip transform.
[0294] In one embodiment, the processing unit 1001 is further configured to:
[0295] Check whether the current encoding block enables the transform inheritance mode;
[0296] If the transformation inheritance mode is enabled for the current coding block, the step of determining the transformation information of the adjacent coding block as the transformation information of the current coding block is performed.
[0297] In one embodiment, the enabling control method of the transformation inheritance mode includes at least one of the following:
[0298] A transform inheritance mode flag is set in the video bit stream, and when the transform inheritance mode flag is a first preset value, it indicates that the current coding block enables the transform inheritance mode; when the transform inheritance mode flag is a second preset value, it indicates that the current coding block disables the transform inheritance mode;
[0299] Set the enabling condition of the transform inheritance mode. When the current coding block meets the enabling condition, the current coding block is instructed to enable the transform inheritance mode; when the current coding block does not meet the enabling condition, the current coding block is instructed to turn off the transform inheritance mode;
[0300] The enabling condition includes at least one of the following: size condition and prediction condition.
[0301] In one embodiment, the setting position of the transform inheritance mode flag in the video bit stream includes at least one of the following:
[0302] The transform inheritance mode flag is set in the sequence header of the video. When the transform inheritance mode flag in the sequence header is a first preset value, it indicates that all coding blocks in all video frames of the video enable the transform inheritance mode; when the transform inheritance mode flag in the sequence header is a second preset value, it indicates that all coding blocks in all video frames of the video disable the transform inheritance mode.
[0303] The transform inheritance mode flag is set in the frame header of the current frame of the video. When the transform inheritance mode flag in the frame header of the current frame is a first preset value, it indicates that all coding blocks in the current frame enable the transform inheritance mode; when the transform inheritance mode flag in the frame header of the current frame is a second preset value, it indicates that all coding blocks in the current frame disable the transform inheritance mode.
[0304] The transform inheritance mode flag is set in the slice header of the slice where the current coding block is located. When the transform inheritance mode flag in the slice header is a first preset value, it indicates that all coding blocks in the slice enable the transform inheritance mode; when the transform inheritance mode flag in the slice header is a second preset value, it indicates that all coding blocks in the slice disable the transform inheritance mode;
[0305] The transform inheritance mode flag is set in the coding tree unit where the current coding block is located. When the transform inheritance mode flag in the coding tree unit is a first preset value, it indicates that all coding blocks in the coding tree unit enable the transform inheritance mode; when the transform inheritance mode flag in the coding tree unit is a second preset value, it indicates that all coding blocks in the coding tree unit turn off the transform inheritance mode.
[0306] The transform inheritance mode flag is set in the current coding block. When the transform inheritance mode flag in the current coding block is a first preset value, it indicates that the current coding block enables the transform inheritance mode; when the transform inheritance mode flag in the current coding block is a second preset value, it indicates that the current coding block turns off the transform inheritance mode.
[0307] In one embodiment, the enabling condition includes a size condition, and the size condition is used to define a preset width threshold or a preset height threshold for enabling the transformation inheritance mode;
[0308] The current encoding block meets the enabling conditions, including any of the following:
[0309] When the size condition defines a preset width threshold, the width of the current coding block is greater than the preset width threshold;
[0310] When the size condition defines a preset height threshold, the height of the current encoding block is greater than the preset height threshold;
[0311] When the size condition defines a preset width threshold, the width of the current coding block is less than the preset width threshold;
[0312] When the size condition defines a preset height threshold, the height of the current coding block is less than the preset height threshold.
[0313] In one embodiment, the enabling condition includes a prediction condition; the current coding block satisfies the enabling condition, including: the adjacent coding block is a prediction reference coding block of the current coding block.
[0314] In one embodiment, the number of adjacent coding blocks is greater than 1; the processing unit 1001 is specifically configured to:
[0315] Perform deduplication processing on adjacent coding blocks to obtain N adjacent coding blocks after deduplication, where N is an integer greater than 1;
[0316] Determine a target adjacent coding block from N adjacent coding blocks;
[0317] The transformation information of the target adjacent coding block is determined as the transformation information of the current coding block.
[0318] In one embodiment, a method for determining a target adjacent coding block includes:
[0319] If the selection flag in the video bitstream includes the identifier of the adjacent coding block to be inherited, then the target adjacent coding block corresponding to the identifier is selected from the N adjacent coding blocks according to the selection flag; or,
[0320] If the N adjacent coding blocks include at least one prediction reference coding block of the current coding block, and the prediction mode of the current coding block is coupled with the transform inheritance mode, then the prediction reference coding block selected by the prediction mode of the current coding block is selected as the target adjacent coding block;
[0321] The prediction mode includes at least one of the following: an inter-frame merge mode, an intra-frame block copy merge mode, an intra-frame template matching merge mode, and an intra-frame prediction mode.
[0322] In one embodiment, the coding information of the adjacent coding block includes the residual or transformation coefficient of the adjacent coding block; the video bit stream includes the position residual mode flag of the current coding block in the sub-block transformation mode; the processing unit 1001 is specifically used to:
[0323] Derives one or more context index information according to the coding information of the adjacent coding block, each context index information corresponds to an entropy decoding method;
[0324] Determining an entropy decoding method according to the derived context index information;
[0325] The residual position mode flag of the current coding block in the sub-block transformation mode is entropy decoded according to the determined entropy decoding method to obtain the residual position mode of the current coding block in the sub-block transformation mode.
[0326] In one embodiment, the processing unit 1001 is specifically configured to:
[0327] Obtain a first adjacent coding block and a second adjacent coding block of a current coding block, where the first adjacent coding block refers to an adjacent coding block located in a first direction of the current coding block; and the second adjacent coding block refers to an adjacent coding block located in a second direction of the current coding block;
[0328] Obtaining a first quantity ratio in a first adjacent coding block; the first quantity ratio refers to a ratio between the number of non-zero residual basic units in the first adjacent coding block and the total number of all residual basic units in the first adjacent coding block;
[0329] Obtaining a second quantity ratio in a second adjacent coding block; the second quantity ratio refers to a ratio between the number of non-zero residual basic units in the second adjacent coding block and the total number of all residual basic units in the second adjacent coding block;
[0330] Determining context index information according to a magnitude relationship between the first quantity ratio and the second quantity ratio;
[0331] Among them, if the first quantity ratio is greater than the second quantity ratio, the context index information is the first index information; if the first quantity ratio is equal to the second quantity ratio, the context index information is the second index information; if the first quantity ratio is less than the second quantity ratio, the context index information is the third index information.
[0332] In one embodiment, the coding information of the adjacent coding block includes the residual or transformation coefficient of the adjacent coding block; the video bitstream includes the index information of the residual position mode selected by the current coding block in the sub-block transformation mode; the sub-block transformation mode includes multiple candidate residual position modes; the processing unit 1001 is specifically used to:
[0333] Reordering the candidate residual position modes under the sub-block transform mode according to the coding information of the adjacent coding block to obtain a reordering list, wherein the reordering list includes the candidate residual position modes arranged in order and the index information corresponding to each of them;
[0334] Performing entropy decoding on the video bitstream to obtain index information of the residual position mode selected by the current coding block in the sub-block transformation mode;
[0335] According to the index information of the residual position mode selected by the current coding block in the sub-block transform mode, the residual position mode of the current coding block in the sub-block transform mode is determined from the reordering list.
[0336] In one embodiment, the processing unit 1001 is specifically configured to:
[0337] According to the coding information of the adjacent coding block, the index information of each candidate residual position mode under the sub-block transformation mode is obtained;
[0338] Reorder the candidate residual position modes under the sub-block transform mode in descending order of index information to obtain a reordered list;
[0339] Among them, the larger the index information of the candidate residual position pattern, the shorter the encoding code length of the candidate residual position pattern; the shorter the encoding code length of the candidate residual position pattern, the higher the probability that the candidate residual position pattern is selected.
[0340] In one embodiment, each candidate residual position mode in the sub-block transformation mode corresponds to a sub-block transformation area at a different position; the processing unit 1001 is specifically configured to:
[0341] Obtain a first adjacent coding block and a second adjacent coding block of a current coding block, where the first adjacent coding block refers to an adjacent coding block located in a first direction of the current coding block; and the second adjacent coding block refers to an adjacent coding block located in a second direction of the current coding block;
[0342] Obtaining a first quantity ratio in a first adjacent coding block; the first quantity ratio refers to a ratio between the number of non-zero residual basic units in the first adjacent coding block and the total number of all residual basic units in the first adjacent coding block;
[0343] Obtaining a second quantity ratio in a second adjacent coding block; the second quantity ratio refers to a ratio between the number of non-zero residual basic units in the second adjacent coding block and the total number of all residual basic units in the second adjacent coding block;
[0344] Allocating index information to each candidate residual position mode in the sub-block transform mode according to a size relationship between the first quantity ratio and the second quantity ratio;
[0345] Wherein, if the first quantity ratio is greater than or equal to the second quantity ratio, the index information assigned to the candidate residual position mode where the sub-block transformation region is located in the first direction is greater than the index information assigned to the candidate residual position mode where the sub-block transformation region is located in the second direction;
[0346] If the first quantity ratio is smaller than the second quantity ratio, the index information assigned to the candidate residual position mode whose sub-block transform region is located in the second direction is greater than the index information assigned to the candidate residual position mode whose sub-block transform region is located in the first direction.
[0347] In the embodiment of the present application, the current coding block in the video code stream is determined, and the adjacent coding blocks of the current coding block are determined; the transformation information of the current coding block is determined according to the coding information of the adjacent coding blocks; and the current coding block is decoded based on the determined transformation information of the current coding block. It can be seen that in the decoding process of the video, the transformation information of the current coding block can be determined based on the coding information of the adjacent coding blocks, which can reduce the coding cost consumed by encoding the transformation information of the current coding block, thereby reducing the bit rate consumption in the entire encoding and decoding process, and thus improving the decoding efficiency.
[0348] Next, the video encoding device provided in the embodiment of the present application is described.
[0349] See also Fig.11 , Fig.11 is a schematic diagram of the structure of a video encoding device provided in an embodiment of the present application. The video encoding device may be a computer program (including program code) in a computer device. For example, the video encoding device may be an application software in a computer device. The video encoding device may be used to execute Fig. 9 Some or all of the steps in the method embodiment shown. Fig.11 , the video encoding device comprises the following units:
[0350] Processing unit 1101, used to determine the current coding block in the video;
[0351] The processing unit 1101 is further configured to determine an adjacent coding block of a current coding block;
[0352] The processing unit 1101 is further configured to determine transformation information of a current coding block according to coding information of adjacent coding blocks;
[0353] The encoding unit 1102 is used to encode the current coding block based on the determined transformation information of the current coding block to obtain a video code stream.
[0354] In an embodiment of the present application, the current coding block in the video is determined, and the coding information of the adjacent coding blocks of the current coding block is determined; then, the transformation information of the current coding block is determined based on the coding information of the adjacent coding blocks; based on the determined transformation information of the current coding block, the current coding block is encoded. In the video encoding process, the transformation information of the current coding block is determined directly based on the coding information of the adjacent coding blocks, which can reduce the coding cost consumed by encoding the transformation information of the coding block, thereby reducing the bit rate consumption in the whole encoding and decoding process, and then improving the coding efficiency.
[0355] Next, the computer device provided in the embodiment of the present application is described.
[0356] Furthermore, the present application embodiment also provides a schematic diagram of the structure of a computer device. The schematic diagram of the structure of the computer device can be found in Fig.12 The computer device may include: a processor 1201, an input device 1202, an output device 1203 and a memory 1204. The processor 1201, the input device 1202, the output device 1203 and the memory 1204 are connected via a bus. The memory 1204 is used to store a computer program, the computer program includes program instructions, and the processor 1201 is used to execute the program instructions stored in the memory 1204.
[0357] In one embodiment, the computer device may be the above decoding device. In this embodiment, the processor 1201 executes the following operations by running the program instructions in the memory 1204:
[0358] Determine a current coding block in a video bitstream, and determine adjacent coding blocks of the current coding block;
[0359] Determine transformation information of a current coding block according to coding information of adjacent coding blocks;
[0360] Based on the determined transformation information of the current coding block, a decoding process is performed on the current coding block.
[0361] The adjacent coding blocks include spatial domain adjacent coding blocks and / or temporal domain adjacent coding blocks;
[0362] The spatially adjacent coding block refers to a coding block adjacent to the current coding block in the current frame of the video; the current frame refers to the video frame where the current coding block is located; the current coding block refers to the coding block being decoded in the current frame;
[0363] The temporally adjacent coding block refers to a coding block adjacent to the reference coding block in a reference frame of the video; the reference frame is any video frame or a specified video frame in the video except the current frame; the position of the reference coding block in the reference frame is the same as the position of the current coding block in the current frame.
[0364] The coding information of the adjacent coding block includes transformation information of the adjacent coding block; when the processor 1201 determines the transformation information of the current coding block according to the coding information of the adjacent coding block, the processor 1201 may specifically perform the following steps:
[0365] Determining the transformation information of the adjacent coding block as the transformation information of the current coding block;
[0366] Among them, the transformation information includes at least one of a transformation division method and a transformation combination; the transformation division method includes at least one of the following: a residual quadtree mode, a position-based transformation mode, and a sub-block transformation mode; the transformation combination includes a transformation kernel for a horizontal transformation and a transformation kernel for a vertical transformation, and the transformation kernel includes at least one of the following: a discrete cosine transform kernel, a discrete sine transform kernel, and a skip transform.
[0367] The processor 1201 further performs the following steps:
[0368] Check whether the current encoding block enables the transform inheritance mode;
[0369] If the transformation inheritance mode is enabled for the current coding block, the step of determining the transformation information of the adjacent coding block as the transformation information of the current coding block is performed.
[0370] The enabling control method of the transformation inheritance mode includes at least one of the following:
[0371] A transform inheritance mode flag is set in the video bit stream, and when the transform inheritance mode flag is a first preset value, it indicates that the current coding block enables the transform inheritance mode; when the transform inheritance mode flag is a second preset value, it indicates that the current coding block disables the transform inheritance mode;
[0372] Set the enabling condition of the transform inheritance mode. When the current coding block meets the enabling condition, the current coding block is instructed to enable the transform inheritance mode; when the current coding block does not meet the enabling condition, the current coding block is instructed to turn off the transform inheritance mode;
[0373] The enabling condition includes at least one of the following: size condition and prediction condition.
[0374] The setting position of the transform inheritance mode flag in the video bit stream includes at least one of the following:
[0375] The transform inheritance mode flag is set in the sequence header of the video. When the transform inheritance mode flag in the sequence header is a first preset value, it indicates that all coding blocks in all video frames of the video enable the transform inheritance mode; when the transform inheritance mode flag in the sequence header is a second preset value, it indicates that all coding blocks in all video frames of the video disable the transform inheritance mode.
[0376] The transform inheritance mode flag is set in the frame header of the current frame of the video. When the transform inheritance mode flag in the frame header of the current frame is a first preset value, it indicates that all coding blocks in the current frame enable the transform inheritance mode; when the transform inheritance mode flag in the frame header of the current frame is a second preset value, it indicates that all coding blocks in the current frame disable the transform inheritance mode.
[0377] The transform inheritance mode flag is set in the slice header of the slice where the current coding block is located. When the transform inheritance mode flag in the slice header is a first preset value, it indicates that all coding blocks in the slice enable the transform inheritance mode; when the transform inheritance mode flag in the slice header is a second preset value, it indicates that all coding blocks in the slice disable the transform inheritance mode;
[0378] The transform inheritance mode flag is set in the coding tree unit where the current coding block is located. When the transform inheritance mode flag in the coding tree unit is a first preset value, it indicates that all coding blocks in the coding tree unit enable the transform inheritance mode; when the transform inheritance mode flag in the coding tree unit is a second preset value, it indicates that all coding blocks in the coding tree unit turn off the transform inheritance mode.
[0379] The transform inheritance mode flag is set in the current coding block. When the transform inheritance mode flag in the current coding block is a first preset value, it indicates that the current coding block enables the transform inheritance mode; when the transform inheritance mode flag in the current coding block is a second preset value, it indicates that the current coding block turns off the transform inheritance mode.
[0380] The enabling condition includes a size condition, and the size condition is used to define a preset width threshold or a preset height threshold for enabling the transformation inheritance mode;
[0381] The current encoding block meets the enabling conditions, including any of the following:
[0382] When the size condition defines a preset width threshold, the width of the current coding block is greater than the preset width threshold;
[0383] When the size condition defines a preset height threshold, the height of the current encoding block is greater than the preset height threshold;
[0384] When the size condition defines a preset width threshold, the width of the current coding block is less than the preset width threshold;
[0385] When the size condition defines a preset height threshold, the height of the current coding block is less than the preset height threshold.
[0386] The enabling condition includes a prediction condition; the current coding block satisfies the enabling condition, including: the adjacent coding block is a prediction reference coding block of the current coding block.
[0387] The number of adjacent coding blocks is greater than 1; when the processor 1201 determines the transformation information of the adjacent coding blocks as the transformation information of the current coding block, the processor 1201 may specifically perform the following steps:
[0388] Perform deduplication processing on adjacent coding blocks to obtain N adjacent coding blocks after deduplication, where N is an integer greater than 1;
[0389] Determine a target adjacent coding block from N adjacent coding blocks;
[0390] The transformation information of the target adjacent coding block is determined as the transformation information of the current coding block.
[0391] The method for determining the target adjacent coding block includes:
[0392] If the selection flag in the video bitstream includes the identifier of the adjacent coding block to be inherited, then the target adjacent coding block corresponding to the identifier is selected from the N adjacent coding blocks according to the selection flag; or,
[0393] If the N adjacent coding blocks include at least one prediction reference coding block of the current coding block, and the prediction mode of the current coding block is coupled with the transform inheritance mode, then the prediction reference coding block selected by the prediction mode of the current coding block is selected as the target adjacent coding block;
[0394] The prediction mode includes at least one of the following: an inter-frame merge mode, an intra-frame block copy merge mode, an intra-frame template matching merge mode, and an intra-frame prediction mode.
[0395] The coding information of the adjacent coding block includes the residual or transformation coefficient of the adjacent coding block; the video bitstream includes the position residual mode flag of the current coding block in the sub-block transformation mode; when the processor 1201 determines the transformation information of the current coding block according to the coding information of the adjacent coding block, the following steps may be specifically performed:
[0396] Derives one or more context index information according to the coding information of the adjacent coding block, each context index information corresponds to an entropy decoding method;
[0397] Determining an entropy decoding method according to the derived context index information;
[0398] The residual position mode flag of the current coding block in the sub-block transformation mode is entropy decoded according to the determined entropy decoding method to obtain the residual position mode of the current coding block in the sub-block transformation mode.
[0399] When the processor 1201 derives one or more context index information according to the coding information of the adjacent coding block, it may specifically perform the following steps:
[0400] Obtain a first adjacent coding block and a second adjacent coding block of a current coding block, where the first adjacent coding block refers to an adjacent coding block located in a first direction of the current coding block; and the second adjacent coding block refers to an adjacent coding block located in a second direction of the current coding block;
[0401] Obtaining a first quantity ratio in a first adjacent coding block; the first quantity ratio refers to a ratio between the number of non-zero residual basic units in the first adjacent coding block and the total number of all residual basic units in the first adjacent coding block;
[0402] Obtaining a second quantity ratio in a second adjacent coding block; the second quantity ratio refers to a ratio between the number of non-zero residual basic units in the second adjacent coding block and the total number of all residual basic units in the second adjacent coding block;
[0403] Determining context index information according to a magnitude relationship between the first quantity ratio and the second quantity ratio;
[0404] Among them, if the first quantity ratio is greater than the second quantity ratio, the context index information is the first index information; if the first quantity ratio is equal to the second quantity ratio, the context index information is the second index information; if the first quantity ratio is less than the second quantity ratio, the context index information is the third index information.
[0405] The coding information of the adjacent coding block includes the residual or transformation coefficient of the adjacent coding block; the video bitstream includes the index information of the residual position mode selected by the current coding block in the sub-block transformation mode; the sub-block transformation mode includes multiple candidate residual position modes; when the processor 1201 determines the transformation information of the current coding block according to the coding information of the adjacent coding block, it can specifically perform the following steps:
[0406] Reordering the candidate residual position modes under the sub-block transform mode according to the coding information of the adjacent coding block to obtain a reordering list, wherein the reordering list includes the candidate residual position modes arranged in order and the index information corresponding to each of them;
[0407] Performing entropy decoding on the video bitstream to obtain index information of the residual position mode selected by the current coding block in the sub-block transformation mode;
[0408] According to the index information of the residual position mode selected by the current coding block in the sub-block transform mode, the residual position mode of the current coding block in the sub-block transform mode is determined from the reordering list.
[0409] The processor 1201 may specifically perform the following steps when reordering the candidate residual position modes under the sub-block transform mode according to the coding information of the adjacent coding block to obtain the reordering list:
[0410] Obtain index information of each candidate residual position mode under the sub-block transform mode;
[0411] Reorder the candidate residual position modes under the sub-block transform mode in descending order of index information to obtain a reordered list;
[0412] Among them, the larger the index information is, the shorter the encoding code length of the candidate residual position pattern is; the shorter the encoding code length is, the higher the probability that the candidate residual position pattern is selected is.
[0413] Wherein, each candidate residual position mode in the sub-block transform mode corresponds to a sub-block transform region at a different position; when the processor 1201 obtains the index information of each candidate residual position mode in the sub-block transform mode, it can specifically perform the following steps:
[0414] Obtain a first adjacent coding block and a second adjacent coding block of a current coding block, where the first adjacent coding block refers to an adjacent coding block located in a first direction of the current coding block; and the second adjacent coding block refers to an adjacent coding block located in a second direction of the current coding block;
[0415] Obtaining a first quantity ratio in a first adjacent coding block; the first quantity ratio refers to a ratio between the number of non-zero residual basic units in the first adjacent coding block and the total number of all residual basic units in the first adjacent coding block;
[0416] Obtaining a second quantity ratio in a second adjacent coding block; the second quantity ratio refers to a ratio between the number of non-zero residual basic units in the second adjacent coding block and the total number of all residual basic units in the second adjacent coding block;
[0417] Allocating index information to each candidate residual position mode in the sub-block transform mode according to a size relationship between the first quantity ratio and the second quantity ratio;
[0418] Wherein, if the first quantity ratio is greater than or equal to the second quantity ratio, the index information assigned to the candidate residual position mode where the sub-block transformation region is located in the first direction is greater than the index information assigned to the candidate residual position mode where the sub-block transformation region is located in the second direction;
[0419] If the first quantity ratio is smaller than the second quantity ratio, the index information assigned to the candidate residual position mode whose sub-block transform region is located in the second direction is greater than the index information assigned to the candidate residual position mode whose sub-block transform region is located in the first direction.
[0420] In the embodiment of the present application, the current coding block in the video code stream is determined, and the adjacent coding blocks of the current coding block are determined; the transformation information of the current coding block is determined according to the coding information of the adjacent coding blocks; and the current coding block is decoded based on the determined transformation information of the current coding block. It can be seen that in the decoding process of the video, the transformation information of the current coding block can be determined based on the coding information of the adjacent coding blocks, which can reduce the coding cost consumed by encoding the transformation information of the current coding block, thereby reducing the bit rate consumption in the entire encoding and decoding process, and thus improving the decoding efficiency.
[0421] In another embodiment, the computer device may be the above encoding device. In this embodiment, the processor 1201 executes the following operations by running the program instructions in the memory 1204:
[0422] Determine a current coding block in the video, and determine adjacent coding blocks of the current coding block;
[0423] Determine transformation information of a current coding block according to coding information of adjacent coding blocks;
[0424] Based on the determined transformation information of the current coding block, the current coding block is coded to obtain a video code stream.
[0425] In an embodiment of the present application, the current coding block in the video is determined, and the coding information of the adjacent coding blocks of the current coding block is determined; then, the transformation information of the current coding block is determined based on the coding information of the adjacent coding blocks; based on the determined transformation information of the current coding block, the current coding block is encoded. In the video encoding process, the transformation information of the current coding block is determined directly based on the coding information of the adjacent coding blocks, so that only the cost of encoding the transformation information of the coding block needs to be reduced at the encoding end, thereby reducing the bit rate consumption in the entire encoding and decoding process, thereby improving the encoding efficiency.
[0426] In addition, it should be pointed out here that: the embodiment of the present application also provides a computer-readable storage medium, and the computer-readable storage medium stores a computer program, and the computer program includes program instructions. When the processor executes the above program instructions, it can execute the above Figure 5 and Fig. 9 The method in the corresponding embodiment, therefore, will not be repeated here. For technical details not disclosed in the computer-readable storage medium embodiment involved in this application, please refer to the description of the method embodiment of this application. As an example, the program instructions can be deployed on a computer device, or executed on multiple computer devices located in one location, or, executed on multiple computer devices distributed in multiple locations and interconnected by a communication network.
[0427] According to one aspect of the present application, a computer program product is provided, the computer program product comprising a computer program, the computer program being stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device can perform the above Figure 5 and Fig. 9 The method in the corresponding embodiment will therefore not be described in detail here.
[0428] A person skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.
[0429] The above disclosure is only the preferred embodiment of the present application, which certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.
Claims
1. A video decoding method, characterized in that: include: Determine a current coding block in a video bitstream, and determine adjacent coding blocks of the current coding block; Determining transformation information of the current coding block according to the coding information of the adjacent coding block; Based on the determined transformation information of the current coding block, decoding processing is performed on the current coding block.
2. The method according to claim 1, characterized in that The adjacent coding blocks include spatial domain adjacent coding blocks and / or temporal domain adjacent coding blocks; The spatially adjacent coding block refers to a coding block adjacent to the current coding block in a current frame of the video; the current frame refers to a video frame where the current coding block is located; the current coding block refers to a coding block being decoded in the current frame; The time-domain adjacent coding block refers to a coding block adjacent to a reference coding block in a reference frame of the video; the reference frame is any video frame or a specified video frame in the video except the current frame; the position of the reference coding block in the reference frame is the same as the position of the current coding block in the current frame.
3. The method according to claim 1 or 2, characterized in that The coding information of the adjacent coding block includes transformation information of the adjacent coding block; and determining the transformation information of the current coding block according to the coding information of the adjacent coding block includes: Determining the transformation information of the adjacent coding block as the transformation information of the current coding block; Among them, the transformation information includes at least one of a transformation division method and a transformation combination; the transformation division method includes at least one of the following: a residual quadtree mode, a position-based transformation mode, and a sub-block transformation mode; the transformation combination includes a transformation kernel for a horizontal transformation and a transformation kernel for a vertical transformation, and the transformation kernel includes at least one of the following: a discrete cosine transform kernel, a discrete sine transform kernel, and a skip transform.
4. The method according to claim 3, characterized in that The method further comprises: Detecting whether the current coding block enables a transform inheritance mode; If the transformation inheritance mode is enabled for the current coding block, a step of determining the transformation information of the adjacent coding block as the transformation information of the current coding block is performed.
5. The method according to claim 4, characterized in that The activation control method of the transformation inheritance mode includes at least one of the following: Setting a transform inheritance mode flag in the video bit stream, when the transform inheritance mode flag is a first preset value, instructing the current coding block to enable the transform inheritance mode; when the transform inheritance mode flag is a second preset value, instructing the current coding block to disable the transform inheritance mode; Setting an enabling condition for a transform inheritance mode, and when the current coding block meets the enabling condition, instructing the current coding block to enable the transform inheritance mode; When the current coding block does not meet the enabling condition, instructing the current coding block to turn off the transform inheritance mode; The enabling condition includes at least one of the following: size condition and prediction condition.
6. The method according to claim 5, characterized in that The setting position of the transform inheritance mode flag in the video bit stream includes at least one of the following: The transform inheritance mode flag is set in the sequence header of the video. When the transform inheritance mode flag in the sequence header is a first preset value, it indicates that all coding blocks in all video frames of the video enable the transform inheritance mode; when the transform inheritance mode flag in the sequence header is a second preset value, it indicates that all coding blocks in all video frames of the video disable the transform inheritance mode. The transform inheritance mode flag is set in the frame header of the current frame of the video. When the transform inheritance mode flag in the frame header of the current frame is a first preset value, it indicates that all coding blocks in the current frame enable the transform inheritance mode; when the transform inheritance mode flag in the frame header of the current frame is a second preset value, it indicates that all coding blocks in the current frame disable the transform inheritance mode. The transform inheritance mode flag is set in the slice header of the slice where the current coding block is located. When the transform inheritance mode flag in the slice header is a first preset value, it indicates that all coding blocks in the slice enable the transform inheritance mode; when the transform inheritance mode flag in the slice header is a second preset value, it indicates that all coding blocks in the slice disable the transform inheritance mode. The transform inheritance mode flag is set in the coding tree unit where the current coding block is located. When the transform inheritance mode flag in the coding tree unit is a first preset value, it indicates that all coding blocks in the coding tree unit enable the transform inheritance mode; when the transform inheritance mode flag in the coding tree unit is a second preset value, it indicates that all coding blocks in the coding tree unit disable the transform inheritance mode. The transform inheritance mode flag is set in the current coding block. When the transform inheritance mode flag in the current coding block is a first preset value, it indicates that the current coding block enables the transform inheritance mode; when the transform inheritance mode flag in the current coding block is a second preset value, it indicates that the current coding block turns off the transform inheritance mode.
7. The method according to claim 5, characterized in that The enabling condition includes a size condition, and the size condition is used to define a preset width threshold or a preset height threshold for enabling the transformation inheritance mode; The current coding block satisfies the enabling condition, including any one of the following: When the size condition defines a preset width threshold, the width of the current coding block is greater than the preset width threshold; When the size condition defines a preset height threshold, the height of the current coding block is greater than the preset height threshold; When the size condition defines a preset width threshold, the width of the current coding block is less than the preset width threshold; When the size condition defines a preset height threshold, the height of the current coding block is less than the preset height threshold.
8. The method according to claim 5, characterized in that The enabling condition includes a prediction condition; the current coding block satisfies the enabling condition, including: the adjacent coding block is a prediction reference coding block of the current coding block.
9. The method according to claim 3, characterized in that The number of adjacent coding blocks is greater than 1; and determining the transformation information of the adjacent coding blocks as the transformation information of the current coding block includes: Performing deduplication processing on the adjacent coding blocks to obtain N adjacent coding blocks after deduplication, where N is an integer greater than 1; Determine a target adjacent coding block from the N adjacent coding blocks; The transformation information of the target adjacent coding block is determined as the transformation information of the current coding block.
10. The method according to claim 9, characterized in that The method for determining the target adjacent coding block includes: If the selection flag in the video bitstream includes an identifier of an adjacent coding block to be inherited, a target adjacent coding block corresponding to the identifier is selected from the N adjacent coding blocks according to the selection flag; or, If the N adjacent coding blocks include at least one prediction reference coding block of the current coding block, and the prediction mode of the current coding block is coupled with the transform inheritance mode, selecting the prediction reference coding block selected by the prediction mode of the current coding block as the target adjacent coding block; The prediction mode includes at least one of the following: an inter-frame merge mode, an intra-frame block copy merge mode, an intra-frame template matching merge mode, and an intra-frame prediction mode.
11. The method according to claim 2, characterized in that The coding information of the adjacent coding block includes the residual or transformation coefficient of the adjacent coding block; the video bit stream includes the position residual mode flag of the current coding block in the sub-block transformation mode; The determining, according to the coding information of the adjacent coding block, the transformation information of the current coding block comprises: Derived one or more context index information according to the coding information of the adjacent coding block, each context index information corresponds to an entropy decoding mode; Determining an entropy decoding method according to the derived context index information; The residual position mode flag of the current coding block in the sub-block transformation mode is entropy decoded according to the determined entropy decoding method to obtain the residual position mode of the current coding block in the sub-block transformation mode.
12. The method according to claim 11, characterized in that The deriving one or more context index information according to the coding information of the adjacent coding block includes: Acquire a first adjacent coding block and a second adjacent coding block of the current coding block, wherein the first adjacent coding block refers to an adjacent coding block located in a first direction of the current coding block; and the second adjacent coding block refers to an adjacent coding block located in a second direction of the current coding block; Obtaining a first quantity ratio in the first adjacent coding block; the first quantity ratio refers to a ratio between the number of non-zero residual basic units in the first adjacent coding block and the total number of all residual basic units in the first adjacent coding block; Obtaining a second quantity ratio in the second adjacent coding block; the second quantity ratio refers to a ratio between the number of non-zero residual basic units in the second adjacent coding block and the total number of all residual basic units in the second adjacent coding block; Determining context index information according to a magnitude relationship between the first quantity ratio and the second quantity ratio; Among them, if the first quantity ratio is greater than the second quantity ratio, the context index information is the first index information; if the first quantity ratio is equal to the second quantity ratio, the context index information is the second index information; if the first quantity ratio is less than the second quantity ratio, the context index information is the third index information.
13. The method according to claim 2, characterized in that The coding information of the adjacent coding block includes the residual or transformation coefficient of the adjacent coding block; the video bit stream includes the index information of the residual position mode selected by the current coding block in the sub-block transformation mode; The sub-block transformation mode includes a plurality of candidate residual position modes; The determining, according to the coding information of the adjacent coding block, the transformation information of the current coding block comprises: Reordering the candidate residual position modes under the sub-block transform mode according to the coding information of the adjacent coding block to obtain a reordering list, wherein the reordering list includes the candidate residual position modes arranged in order and their corresponding index information; Performing entropy decoding processing on the video bitstream to obtain index information of the residual position mode selected by the current coding block in the sub-block transformation mode; The residual position mode of the current coding block in the sub-block transform mode is determined from the reordering list according to the index information of the residual position mode selected by the current coding block in the sub-block transform mode.
14. The method according to claim 13, characterized in that The reordering of the candidate residual position modes under the sub-block transform mode according to the coding information of the adjacent coding block to obtain a reordering list includes: According to the coding information of the adjacent coding block, obtaining index information of each candidate residual position mode under the sub-block transformation mode; Reorder the candidate residual position modes under the sub-block transform mode in descending order of index information to obtain a reordered list; Among them, the larger the index information of the candidate residual position pattern, the shorter the encoding code length of the candidate residual position pattern; the shorter the encoding code length of the candidate residual position pattern, the higher the probability that the candidate residual position pattern is selected.
15. The method according to claim 14, characterized in that Each candidate residual position mode under the sub-block transformation mode corresponds to a sub-block transformation area at a different position; The obtaining, according to the coding information of the adjacent coding block, index information of each candidate residual position mode under the sub-block transform mode includes: Acquire a first adjacent coding block and a second adjacent coding block of the current coding block, wherein the first adjacent coding block refers to an adjacent coding block located in a first direction of the current coding block; and the second adjacent coding block refers to an adjacent coding block located in a second direction of the current coding block; Obtaining a first quantity ratio in the first adjacent coding block; the first quantity ratio refers to a ratio between the number of non-zero residual basic units in the first adjacent coding block and the total number of all residual basic units in the first adjacent coding block; Obtaining a second quantity ratio in the second adjacent coding block; the second quantity ratio refers to a ratio between the number of non-zero residual basic units in the second adjacent coding block and the total number of all residual basic units in the second adjacent coding block; Allocating index information to each candidate residual position mode in the sub-block transform mode according to a size relationship between the first quantity ratio and the second quantity ratio; Wherein, if the first number ratio is greater than or equal to the second number ratio, the index information assigned to the candidate residual position mode where the sub-block transform region is located in the first direction is greater than the index information assigned to the candidate residual position mode where the sub-block transform region is located in the second direction; If the first number ratio is smaller than the second number ratio, the index information assigned to the candidate residual position mode whose sub-block transform region is located in the second direction is greater than the index information assigned to the candidate residual position mode whose sub-block transform region is located in the first direction.
16. A video encoding method, characterized in that: include: Determine a current coding block in the video, and determine adjacent coding blocks of the current coding block; Determining transformation information of the current coding block according to the coding information of the adjacent coding block; Based on the determined transformation information of the current coding block, the current coding block is coded to obtain a video code stream.
17. A video decoding device, characterized in that: include: A processing unit, configured to determine a current coding block in a video bitstream; The processing unit is further configured to determine an adjacent coding block of the current coding block; The processing unit is further configured to determine transformation information of the current coding block according to the coding information of the adjacent coding block; A decoding unit is used to decode the current coding block based on the determined transformation information of the current coding block.
18. A video encoding device, characterized in that: include: a processing unit for determining a current coding block in the video; The processing unit is further configured to determine an adjacent coding block of the current coding block; The processing unit is further configured to determine transformation information of the current coding block according to the coding information of the adjacent coding block; The encoding unit is used to encode the current encoding block based on the determined transformation information of the current encoding block to obtain a video code stream.
19. A computer device, characterized in that: include: a processor suitable for executing a computer program; A computer-readable storage medium, wherein a computer program is stored in the computer-readable storage medium, and when the computer program is executed by the processor, the video decoding method according to any one of claims 1 to 15 is executed, or the video encoding method according to claim 16 is executed.
20. A computer-readable storage medium, characterized in that: The computer storage medium stores a computer program, and when the computer program is executed by a processor, the video decoding method according to any one of claims 1 to 15 is executed, or the video encoding method according to claim 16 is executed.
21. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the computer program implements the video decoding method according to any one of claims 1 to 15, or executes the video encoding method according to claim 16.
