Encoding / Decoding Method, Encoder, Decoder, and Storage Medium
By selecting a larger area to gather related blocks and determining context model index parameters for the current block, the method addresses the challenge of increasing compression efficiency in video coding systems, particularly in HEVC and VVC, thereby improving overall system performance.
Patent Information
- Application Number
- JP2024560482
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2022-04-11
- Publication Date
- 2025-04-16
- Estimated Expiration
- 2042-04-11
AI Technical Summary
The increasing demand for compression efficiency in video coding systems, particularly in HEVC and VVC, is challenging due to the growing proportion of bitstream syntactic elements required for controlling prediction modes, which hinders further improvements in overall compression efficiency.
The proposed solution involves an encoding and decoding method that selects a larger predetermined area to gather more related blocks for the current block, determining a context model index parameter based on reference information from these related blocks, and encoding/decoding the first syntactic element using an appropriate context model.
This approach enhances the compression efficiency of syntactic elements by fully utilizing spatial associations between image blocks, leading to improved overall system compression efficiency.
Smart Images

Figure 2025512068000001_ABST
Abstract
Description
[Technical field]
[0001] The present application relates to the field of video image processing technology, and in particular to an encoding / decoding method, an encoder, a decoder, and a storage medium. [Background technology]
[0002] Context-based Adaptive Binary Arithmetic Coding (CABAC) is a common entropy coding method. High Efficiency Video Coding (HEVC) and Versatile Video Coding (VVC) use CABAC for entropy coding, and CABAC is used to perform entropy encoding / entropy decoding processes on syntax elements.
[0003] CABAC can improve compression efficiency by using a context model. As the demand for compression efficiency increases, various new prediction modes, transform modes, etc. are added, and the number of syntax elements for controlling the selection of these modes also increases. As a result, the proportion of syntax elements for controlling various modes in the bitstream is becoming higher and higher. In order to further improve the compression efficiency of the entire system, it is becoming increasingly important to improve the compression efficiency of syntax elements. Summary of the Invention [Problem to be solved by the invention]
[0004] In order to solve the above technical problems, embodiments of the present application provide an encoding / decoding method, an encoder, a decoder, and a storage medium that can match a more appropriate context model to a first syntax element of a current block, thereby improving compression efficiency of the syntax element. [Means for solving the problem]
[0005] In a first aspect, embodiments of the present application provide an encoding method applied to an encoder, the method comprising: Selecting a plurality of coded related blocks corresponding to a current block from a predetermined region, where the predetermined region includes a region having a correlation with the current block; determining a context model index parameter of a first syntax element of the current block based on reference information of the plurality of related blocks; and encoding a first syntax element of the current block based on a context model corresponding to the context model index parameter.
[0006] In a second aspect, an embodiment of the present application provides a decoding method, applied to a decoder, comprising: Decoding the bitstream to obtain decoding target information of a first syntax element of a current block; selecting a plurality of decoded related blocks corresponding to the current block from a predetermined region, where the predetermined region includes a region having a correlation with the current block; determining a context model index parameter of a first syntax element of the current block based on reference information of the plurality of related blocks; Decoding the decoding target information based on a context model corresponding to the context model index parameter to obtain a first syntax element of the current block.
[0007] In a third aspect, embodiments of the present application provide an encoder, the encoder comprising: A first selection unit configured to select a plurality of coded related blocks corresponding to a current block from a predetermined region, where the predetermined region includes a region having a correlation with the current block; and A first determining unit configured to determine a context model index parameter of a first syntax element of the current block based on reference information of the plurality of related blocks; and a coding unit configured to code a first syntax element of the current block based on a context model corresponding to the context model index parameter.
[0008] In a fourth aspect, embodiments of the present application provide a decoder, wherein the decoder comprises: A first decoding unit configured to decode the bitstream to obtain decoding target information of a first syntax element of a current block; A second selection unit configured to select a plurality of decoded related blocks corresponding to the current block from a predetermined region, where the predetermined region includes a region having a correlation with the current block; and A second determining unit configured to determine a context model index parameter of a first syntax element of the current block based on reference information of the plurality of related blocks; and a second decoding unit configured to decode the decoding target information based on a context model corresponding to the context model index parameter to obtain a first syntax element of the current block.
[0009] In a fifth aspect, an embodiment of the present application further provides an encoder comprising a first memory and a first processor, the first memory configured to store a computer program executable by the first processor, and the first processor configured to implement the encoding method of the encoder by executing the program.
[0010] In a sixth aspect, an embodiment of the present application further provides a decoder comprising a second memory and a second processor, the second memory configured to store a computer program executable by the second processor, and the second processor configured to implement the decoding method of the decoder by executing the program.
[0011] In a seventh aspect, an embodiment of the present application provides a storage medium, the storage medium storing a computer program for causing the first processor to execute the encoding method of the encoder, or a computer program for causing the second processor to execute the decoding method of the decoder. Effect of the Invention
[0012] In an embodiment of the present application, by setting a larger predetermined area so that more related blocks can be selected for the current block, the spatial correlation between image blocks can be fully utilized, and a more appropriate context model can be matched to the first syntax element of the current block, thereby improving the compression efficiency of the syntax elements and further improving the compression efficiency of the entire system. [Brief description of the drawings]
[0013] [Figure 1] A video encoding system. [Diagram 2] A video decoding system. [Diagram 3] 2 is an exemplary flow chart of an encoding method according to an embodiment of the present application; [Figure 4] FIG. 1 is a schematic diagram of the selection position of related blocks in an embodiment of the present application. [Diagram 5] FIG. 2 is a schematic diagram of the selection position of related blocks in an embodiment of the present application; [Figure 6] FIG. 3 is a schematic diagram of the selection position of related blocks in an embodiment of the present application; [Figure 7] FIG. 4 is a schematic diagram of the selection position of related blocks in an embodiment of the present application. [Figure 8] FIG. 5 is a schematic diagram of the selection position of related blocks in an embodiment of the present application. [Figure 9] 6 is a schematic diagram of the selection position of related blocks in an embodiment of the present application; [Figure 10] 1 is a diagram showing the overall arithmetic decoding process of a binary code in an embodiment of the present application; [Figure 11] 1 is a decoding decision process for a binary code in an embodiment of the present application; [Figure 12] 1 is a renormalization process in an embodiment of the present application. [Figure 13] 1 is a bypass decoding process for a binary code in an embodiment of the present application; [Figure 14] 1 is a decryption completion process in an embodiment of the present application; [Figure 15] 2 is an exemplary flowchart of a decoding method according to an embodiment of the present application; [Figure 16] FIG. 2 is an exemplary structural diagram of a first configuration of an encoder according to an embodiment of the present application; [Figure 17] FIG. 2 is an exemplary structural diagram of a second configuration of an encoder according to an embodiment of the present application; [Figure 18] FIG. 2 is an exemplary structural diagram of a first configuration of a decoder according to an embodiment of the present application; [Figure 19] FIG. 2 is an exemplary structural diagram of a second configuration of a decoder according to an embodiment of the present application; DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0014] In order to more fully understand the features and technical contents of the embodiments of the present application, the implementation of the embodiments of the present application will be described in detail below with reference to the drawings, which are for reference and description purposes only and are not intended to limit the embodiments of the present application.
[0015] Currently, common video coding and decoding standards (e.g., VVC) adopt a block-based hybrid coding framework. Each frame in a video is divided into square largest coding units (LCUs) or coding tree units (CTUs) of the same size (e.g., 128x128, 64x64, etc.). Each largest coding unit may be divided into rectangular coding units (CUs) according to a rule. The coding units may be further divided into prediction units (PUs), transform units (TUs), etc.
[0016] On the encoding side, an image of one frame is divided into blocks, intra prediction or inter prediction is performed on a current block (CU) to generate a predicted block of the current block, the predicted block is subtracted from the original block of the current block to obtain a residual block, transformation and quantization are performed on the residual block to obtain a quantized coefficient matrix, and entropy coding is performed on the quantized coefficient matrix to output it to a bitstream.
[0017] Illustratively, FIG. 1 is a video coding system. As shown in FIG. 1, the video coding system 11 includes a transform unit 111, a quantization unit 112, a mode selection and coding logic control unit 113, an intra prediction unit 114, an inter prediction unit 115 (including motion compensation and motion estimation), an inverse quantization unit 116, an inverse transform unit 117, a loop filtering unit 118, a coding unit 119, and a decoded image buffer unit 110. For an input original video signal, a frame of image is divided into blocks, and a coding mode is determined by the mode selection and coding logic control unit 113. For a current block, intra prediction or inter prediction is used to generate a prediction block of the current block. Since there is a strong correlation between adjacent pixels in a frame in a video, the video coding and decoding technology can eliminate spatial redundancy between adjacent pixels by using the intra prediction method. Since there is a strong similarity between adjacent frames in a video, the inter prediction method in the video encoding and decoding technology can eliminate the time redundancy between adjacent frames, thereby improving the coding efficiency. The predictive block is subtracted from the original block of the current block to obtain a residual block, which is then processed by the transform unit 111 and the quantization unit 112 to obtain a quantized coefficient matrix. The quantized coefficient matrix is then entropy coded by the coding unit 119 and output into a bitstream. The quantized coefficient matrix is then further processed by the inverse quantization unit 116 and the inverse transform unit 117 to obtain a reconstructed residual block, which is subjected to blocking artifact removal by the loop filtering unit 118, and the reconstructed residual block is added to one predictive block in a frame of the decoded image buffer unit 111 to generate a reconstructed video reconstruction block. The decoded image buffer unit 110 is configured to store the reconstructed video reconstruction block used for prediction reference.As the encoding of the video images progresses, new reconstructed video reconstruction blocks are continuously generated, and all these reconstructed video reconstruction blocks are stored in the decoded image buffer unit 110 .
[0018] On the decoding side, through analysis based on analysis and existing information, the same block division information, prediction, transformation, quantization, entropy coding, loop filtering and other mode information or parameter information as on the encoding side can be determined, thereby ensuring that the decoded image obtained by the encoding side is the same as the decoded image obtained by the decoding side.
[0019] Illustratively, FIG. 2 is a video decoding system, and FIG. 2 is an exemplary structural diagram of the configuration of a video encoding system of an embodiment of the present application. As shown in FIG. 2, the video encoding system 21 includes a decoding unit 211, an inverse quantization unit 212, an inverse transform unit 213, an intra prediction unit 214, a motion compensation unit 215, a loop filtering unit 216, and a decoded image buffer unit 217. After the video encoding system 11 performs an encoding process on the input video signal, a bit stream of the video signal is output. The bit stream is input to the video decoding system 21, and first, a decoded quantization coefficient matrix is obtained through the process of the decoding unit 211, and the quantization coefficient matrix is processed by the inverse quantization unit 212 and the inverse transform unit 213 to generate a residual block in the pixel domain. The intra prediction unit 214 is configured to generate a prediction block of a current block according to the determined intra prediction direction and the data of a previous decoded block from a current frame or picture. The motion compensation unit 215 determines prediction information used for the current block by analyzing the motion vectors and other related syntax elements, and uses the prediction information to generate a prediction block for the current block. The residual block from the inverse quantization unit 212 and the inverse transform unit 213 is added to the corresponding prediction block generated by the intra prediction unit 214 or the motion compensation unit 215 to form a decoded reconstruction block, which is subjected to blocking artifact removal by the loop filtering unit 216 to improve the video quality. The decoded reconstruction block is then stored in a decoded image buffer unit 217, which is configured to store reference images for subsequent intra prediction or motion compensation, and output a video signal to obtain a restored original video signal.
[0020] Here, block partition information, prediction, transformation, various modes and parameter information of quantization, coefficients, etc. are written into the bitstream by entropy coding. Assuming that the probabilities of different elements are different, it is possible to obtain higher coding efficiency than fixed-length coding by assigning short codewords to elements with high occurrence probability and long codewords to elements with low occurrence probability. However, if the probabilities of different elements are similar or almost the same, the compression effect of entropy coding is limited. Context-based adaptive binary arithmetic coding (CABAC) is a common entropy coding method. In HEVC, VVC, etc., CABAC is used to perform entropy coding, and CABAC can improve compression efficiency by using a context model, which provides an estimated probability for the current syntax element, and the system encodes and decodes the current syntax element based on this estimated probability and updates the context model based on the value of the current syntax element.
[0021] The encoding method provided by the embodiment of the present application is mainly applied to the encoding unit 119 of the video encoding system 11 and used to encode syntax elements. The decoding method provided by the embodiment of the present application is mainly applied to the decoding unit 211 of the video decoding system 21 and used to decode syntax elements.
[0022] Based on this, the technical solution of the present application will be described in more detail below with reference to the drawings and embodiments. Before describing in detail, it should be noted that the terms "first", "second", "third" and the like referred to throughout this specification are merely for distinguishing different features, and are not intended to limit the order of priority, context, magnitude, and the like.
[0023] An embodiment of the present application provides an encoding method applied to a video encoding device, i.e., an encoder, where the functions realized by the method can be realized by a processor in the video encoding device by calling a program code, and of course, the program code can be stored in a computer storage medium, so that the video encoding device at least includes a processor and a storage medium.
[0024] FIG. 3 is an exemplary flowchart of an encoding method according to an embodiment of the present application, which is applied to an encoder. As shown in FIG. 3, the method includes the following steps:
[0025] In step 301, a plurality of coded related blocks corresponding to a current block are selected from a predetermined region, where the predetermined region includes a region having a correlation with the current block.
[0026] Here, the multiple related blocks in the embodiment of the present application refer to at least three related blocks, and the related blocks can be understood as image blocks having spatial correlation with the current block and are used to determine the context model of the syntax elements of the current block. The coded related blocks can be understood as reconstructed blocks reconstructed at the coding side.
[0027] In practical application, due to the influence of the division method of the image block, the size of the related block may or may not be consistent with the size of the current block. Figure 4 is a schematic diagram 1 of the selection position of the related block in an embodiment of the present application, as shown in Figure 4, the related blocks are the left adjacent block, the upper adjacent block, and the upper left adjacent block of the current block, and the size of the related blocks is consistent with the size of the current block. Figure 5 is a schematic diagram 2 of the selection position of the related block in an embodiment of the present application, as shown in Figure 5, the related blocks are the left adjacent block, the upper adjacent block, and the upper left adjacent block of the current block, and the size of the related blocks is not consistent with the size of the current block.
[0028] In some embodiments, the predetermined region includes adjacent regions of the current block and / or non-adjacent regions of the current block, and when the predetermined region includes adjacent regions of the current block, the related blocks include adjacent blocks of the current block, and when the predetermined region includes non-adjacent regions of the current block, the related blocks include non-adjacent blocks of the current block. It should be noted that not only adjacent blocks have a spatial correlation with the current block, but adjacent non-adjacent blocks also have a spatial correlation with the current block. This is also easy to understand, because all contents within the predetermined region are correlated. That is, in addition to using spatially adjacent blocks, adjacent non-adjacent blocks or both adjacent and non-adjacent blocks can be used to select a context model for the current block with reference to a sufficient number of associated blocks. In this way, by setting a large predetermined region so that more associated blocks are selected for the current block, the spatial association between image blocks can be fully utilized, and by matching a more appropriate context model to the first syntax element of the current block based on more associated blocks, it is possible to avoid accidental events affecting the selection of the context model. As an extreme example, if a large region surrounding the current block all uses mode 1, but only certain neighboring blocks select mode 2, if these certain neighboring blocks are selected to determine the context model of the current block, the current block will not know that many related regions have selected mode 1, which will affect the mode selection of the current block.
[0029] Specifically, multiple adjacent blocks can be selected as associated blocks of the current block, multiple non-adjacent blocks can be selected as associated blocks of the current block, or multiple adjacent and non-adjacent blocks can be selected as associated blocks of the current block.
[0030] FIG. 6 is a schematic diagram 3 of the selection position of the related block in the embodiment of the present application. In addition to the left adjacent block and the upper adjacent block, the adjacent block may also use adjacent blocks determined at other positions. As an example shown in FIG. 6, the current block is a block including reference coordinates (x0, y0), and the reference coordinates (x0, y0) are the coordinates of the upper left corner of the current block. For example, block0 is an adjacent block including reference coordinates (x0-1, y0), block1 is an adjacent block including reference coordinates (x0, y0-1), and block2 is an adjacent block including reference coordinates (x0-1, y0). ), block3 is the neighboring block containing reference coordinates (x0-1, y0+cbHeight-1), block4 is the neighboring block containing reference coordinates (x0+cbWidth-1, y0-1), block5 is the neighboring block containing reference coordinates (x0+cbWidth-1, y0-1), and block6 is the neighboring block containing reference coordinates (x0+cbWidth, y0-1), where (x0, y0) are the top-left corner coordinates of the current block, cbWidth is the width of the current block, and cbHeight is the height of the current block.
[0031] FIG. 7 is a schematic diagram 4 of the selection position of a related block in an embodiment of the present application, and more neighboring blocks in the spatial domain can be used, that is, in addition to selecting neighboring blocks from the seven neighboring blocks shown in FIG. 6, one or more neighboring blocks among block1 to block5 in FIG. 7 (i.e., the areas indicated by "...") and one or more neighboring blocks among block0 to block3 (i.e., the areas indicated by "...") can be selected to determine the context model of the syntax elements of the current block.
[0032] FIG. 8 is a schematic diagram 5 of the selection position of the relevant block in an embodiment of the present application, and furthermore, more non-adjacent blocks in the spatial domain can be used, and the relevant block can be selected from the non-adjacent regions shown in FIG. 8, or the relevant block can be selected from both the non-adjacent regions and the adjacent regions, and the selection position of the relevant block can be preset.
[0033] In a specific implementation, the predetermined region can be determined by setting a search range and a search condition, for example, a variable searchRange is set, the search range is set with the horizontal coordinate ranging from x0-searchRange to x0+searchRange, and the vertical coordinate ranging from y0-searchRange to y0+searchRange, and the search condition is set to the coded block, where (x0, y0) is the upper left corner coordinate of the current block. The coded block is searched for in the predetermined region and used as the related block of the current block. That is, the predetermined region may include a coded region or may include an uncoded region.
[0034] In practical applications, the strength of the association between the associated block and the current block may be the same or different. Exemplarily, the method further includes: setting the weight of the associated block according to the strength of the association between the associated block and the current block; and determining a context model index parameter based on the weight of the associated block and the reference information of the associated block. For example, in the case of adjacent blocks, the closer the adjacent block is to the upper left corner of the current block, the stronger the association; and the farther the adjacent block is, the weaker the association. In the case of adjacent blocks and non-adjacent blocks, the closer the adjacent block and the non-adjacent block are to the current block, the stronger the association; and the farther the association is, the weaker the association is. When using a non-adjacent block as an associated block, one method is to set different weights for the non-adjacent blocks. In this way, the weight of the associated block is set in consideration of the strength of the spatial association, thereby further improving the accuracy of the context model selection.
[0035] In some embodiments, the method further includes setting a weight of the associated block based on a distance between the associated block and the current block. In practical applications, the distance may be a horizontal distance, a vertical distance, or a linear distance.
[0036] In some embodiments, the method further comprises setting a weight for the associated block based on a reference coordinate of the associated block and a reference coordinate of the current block.
[0037] In some embodiments, the method further includes determining a first sub-region in which the associated block is located, where the first sub-region is at least one of at least two second sub-regions included in the predetermined region, and setting a weight of the associated block based on the first sub-region in which the associated block is located.
[0038] Specifically, the method further includes dividing the predetermined region into at least two second sub-regions, and setting a weight for each second sub-region.
[0039] Exemplarily, setting the weight of the associated block according to the first sub-region in which the associated block is located includes: when the first sub-region includes two or more second sub-regions, performing a fusion operation on the weight of the second sub-region to obtain the weight of the first sub-region, and setting the weight of the associated block to the weight of the first sub-region. Exemplarily, the fusion operation may be a weighting operation, an average operation, etc.
[0040] Exemplarily, setting the weight of the associated block based on the first sub-region in which the associated block is located includes: if the first sub-region includes one second sub-region, setting the weight of the first region to the weight of the second sub-region, and setting the weight of the associated block to the weight of the first sub-region, i.e., configuring the weight of the associated block to be the weight of the second sub-region.
[0041] For example, at least two concentric rings can be used to divide the predetermined region into at least two sub-regions. Specifically, the position information of each ring is preset, and based on the position information of the related block x, it is determined that the position information of the Li ring matches the position information of the related block x, and it is determined that the related block X is located in the Li ring.
[0042] Here, the location information matching may be that the location information of the Li-th ring includes the location information of the related block x, or that the distance between the Li-th ring and the related block x is smaller than a predetermined distance threshold.
[0043] FIG. 9 is a schematic diagram 5 of the selection position of related blocks in an embodiment of the present application, where 0 to 6 are adjacent blocks, and blocks with numbers greater than 6 are non-adjacent blocks. One way to identify these blocks is to configure the intervals of the concentric rings with the size of the current block as the interval length, and set the position information of each ring. As shown in FIG. 9, if the concentric rings are represented by L0 to L4, and the position information of the Lith ring includes the position information of the related block x, it is determined that the related block X is located in the Lith ring, where the position information of the related block x is the reference coordinate, and the position information of each ring includes coordinate information for representing the sides of a rectangle, and the position information of each ring includes the range of values of the first abscissa and the corresponding ordinate, the range of values of the second abscissa and the corresponding ordinate, the range of values of the first ordinate and the corresponding abscissa, and the range of values of the second ordinate and the corresponding abscissa. The four sides of each ring are surrounded by two lines that are n*cbWidth away from the current block in the left-right direction and two lines that are n*cbHeight away from the current block in the up-down direction. For example, block 9 in the figure is determined by coordinates (x0-cuWidth, y0-cuHeight), where n corresponding to the first ring L1 is 1 and n corresponding to the second ring L2 is 2. Block 14 in the figure is determined by coordinates (x0-2*cuWidth, y0-2*cuHeight).
[0044] For example, the weight of the 0th ring L0 is set to 1, that is, the weight of the adjacent blocks in the 0th ring L0 is set to 1, the weight of the first ring L1 is set to 1 / 2, the weight of the second ring L2 is set to 1 / 4, the weight of the third ring L3 is set to 1 / 8, and the weight of the fourth ring L4 is set to 1 / 16. Note that the weight setting method shown here is merely an example and is not intended to limit the present application. In actual applications, different weights can be set for the same ring, or weights can be set by combining the features of the video image.
[0045] In some embodiments, selecting a plurality of encoded associated blocks corresponding to a current block from the specified region includes determining reference coordinates of the associated blocks in the specified region based on reference coordinates of the current block, and obtaining reference information of the associated blocks based on the reference coordinates of the associated blocks.
[0046] In some embodiments, the method further comprises obtaining reference information of the associated blocks based on a predetermined selection order and reference coordinates of the associated blocks.
[0047] Here, the reference coordinates are used to identify the positions of the current block and the related blocks, and the reference coordinates may be at least one of the coordinates of the upper left corner of the block, the coordinates of the lower left corner of the block, the coordinates of the upper right corner of the block, the coordinates of the lower right corner of the block, the coordinates of the center of the block, etc. The selection order is used to set the order of selection of the multiple related blocks, and for example, the selection order may be an order of radially searching from the inside to the outside with the current block as the center, or an order of searching from left to right and top to bottom according to a certain search granularity within the search area.
[0048] By employing any of the above methods, more relevant blocks can be found, and below the encoded information of these relevant blocks is used to select a context model for the first syntax element of the current block.
[0049] In step 302, a context model index parameter of a first syntax element of the current block is determined based on reference information of the plurality of related blocks.
[0050] Exemplarily, the value of the context model index (ctxIdx) is equal to the sum of a context model index increment (ctxInc) and a context model index offset (ctxIdxOffset), where ctxIdxOffset is for classifying context models into different groups, and ctxInc is for selecting a particular context model from the group.
[0051] Here, the reference information of the related block is used to indicate a context model selected when encoding a first syntax element of the related block. Illustratively, in some embodiments, the reference information of the related block includes a context model index reference amount of the first syntax element of the related block. In some other embodiments, the reference information of the related block further includes an availability identifier of the related block. The availability identifier is used to indicate whether the context model index reference amount of the related block can be used to determine the context model index reference amount of the current block.
[0052] In some embodiments, determining a context model index parameter for a first syntax element of the current block based on the reference information of the plurality of associated blocks includes determining a context model index offset amount corresponding to the first syntax element, determining a context model index increment for the first syntax element of the current block based on the reference information of the plurality of associated blocks, determining the context model index for the first syntax element based on the context model index increment and the context model index offset amount, and setting the context model index parameter equal to the context model index.
[0053] Wherein, the current block includes multiple syntax elements, the first syntax element refers to one of the multiple syntax elements of the current block, the context model corresponding to the context model index may be understood as the context model corresponding to the first syntax element, each syntax element corresponds to two or more context models, and when encoding the first syntax element of the current block, a context model that matches the first syntax element of the current block is selected based on the same syntax element of the related block. In the embodiment of the present application, by increasing the number of context models, a context model that is more suitable for the syntax element can be selected, and the compression efficiency can be further improved.
[0054] Illustratively, for the syntax elements alf_ctb_flag[cIdx][xCtb][yCtb], alf_ctb_cc_cb_idc[xCtb][yCtb], alf_ctb_cc_cr_idc[xCtb][yCtb], split_qt_flag, split_cu_flag, cu_skip_flag[x0][y0], pred_mode_ibc_flag[x0][y0], intra_mip_flag, inter_affine_flag[x0][y0], and merge_subblock_flag[x0][y0], VVC has three context models or has three context models in one group, and for the syntax elements pred_mode_flag[x0][y0] and non_inter_flag, VVC has two context models.
[0055] Illustratively, in some embodiments, the method further includes determining a first context model list for use in selecting a context model for the first syntax element, and setting the context model index parameter to an index of the first context model list.
[0056] If multiple context model lists are pre-configured for mapping context models, each context model list contains multiple context models, ctxTable represents the context model list used in selecting a context model, and ctxIdx represents a particular context model within the index context model list.
[0057] When parsing different syntax elements, it is necessary to use the context model corresponding to each syntax element, i.e., the corresponding ctxTable and ctxIdx, and in Table 1, the syntax elements that are encoded using the context model are defined, and all the ctxTables corresponding to these syntax elements can be found in this table. Here, ctxIdxOffset is the minimum value of ctxIdx in the current initType in Table 1, and initType is related to the slice type (I slice, P slice, B slice) and also to some flags, which will not be described in detail here. It is considered that ctxIdxOffset is for classifying the context models into different groups, and ctxInc is for selecting a specific context model from the group.
[0058] Illustratively, in Table 1, the index of the first context model list corresponding to the syntax element alf_ctb_flag[][][] is Table 52, and the index of the first context model list corresponding to the syntax element alf_use_aps_flag is Table 53.
[0059] [Table 1]
[0060] In step 303, a first syntax element of the current block is encoded based on a context model corresponding to the context model index parameter.
[0061] Note that one syntax element may include one or more binary codes (bin), and flag usually has only two options, so flag generally has only one binary code. Each binary code may have one or more context models, i.e., it corresponds to one or more ctxIdx. When a binary code has multiple context models, it is necessary to select the most matching context model from the multiple context models and encode it, thereby improving encoding efficiency. In the embodiment of the present application, the premise for selecting a context model is that this binary code is encoded using a context model, and in the embodiment of the present application, unless otherwise specified, all binary codes refer to binary codes encoded by a context model.
[0062] The following provides a further example of how to determine the context model index increment.
[0063] Here, the syntax elements of the associated block refer to the encoded syntax elements of the associated block, and since the encoding side includes the processes of encoding and decoding, the encoded syntax elements may also be understood as decoded syntax elements.
[0064] In some embodiments, determining a context model index increment for a first syntax element of the current block based on reference information of the plurality of associated blocks includes: determining a first intermediate quantity based on the reference information of the plurality of associated blocks; and converting the first intermediate quantity based on a preset conversion algorithm to obtain a context model index increment for a first syntax element of the current block.
[0065] In some embodiments, the reference information of the associated block includes an availability identifier of a first syntax element of the associated block and a context model index reference amount, and determining a first intermediate amount based on the reference information of the plurality of associated blocks includes performing a logical AND operation on the availability identifier and the context model index reference amount of each associated block to obtain a logical AND operation result, and obtaining the first intermediate amount based on the logical AND operation result of each associated block.
[0066] and converting the first intermediate variable to a matching context index increment using a preset conversion algorithm, in some embodiments, the preset conversion algorithm includes one of: setting the first intermediate quantity equal to the context model index increment, dividing the first intermediate quantity by a first reference amount to obtain the context model index increment, right-shifting the first intermediate quantity by a second reference amount to obtain the context model index increment, and determining a first value range to which the first intermediate quantity belongs and setting the context model index increment to an index increment corresponding to the first value range.
[0067] For example, taking the VVC format as an example, the context model index reference amount can be expressed as a judgment condition for selecting a context model. In the embodiment of the present application, whether the Nth associated block is available and the judgment condition are represented as availableN, and the judgment condition for the Nth associated block corresponding to the first syntax element is represented as conditionN (abbreviated as condN).
[0068] Exemplarily, a first intermediate quantity (tempValue) is set. tempValue is initialized to 0, and the encoded syntax elements of the xth related block are availablex and condx, where x ranges from 0 to N, and the following operation is performed from x=0 to x=N: tempValue+=availablex&&condx. Here, in the example shown in FIG. 6, N is 6, and the value of N can be changed depending on the number of related blocks used. tempValue can be understood as an intermediate variable in the accumulation process, and when x=N, tempValue is the first intermediate quantity finally obtained.
[0069] Specifically, the coordinates (xCurr, yCurr) of the current block are set to (x0, y0), the coordinates (xNbL, yNbL) of the left adjacent block are set to (x0-1, y0), and based on (xNbL, yNbL), (x0, y0), and cIdx, it is determined whether the left adjacent block is available or not, and the result is substituted for availableL. AvailableL indicates whether the left adjacent block is available or not.
[0070] The coordinates (xNbA, yNbA) of the upper adjacent block are set to (x0, y0-1), and based on (xNbA, yNbA), (x0, y0), and cIdx, it is determined whether the upper adjacent block is available or not, and the result is substituted for availableA. AvailableA indicates whether the upper adjacent block is available or not.
[0071] Set the coordinates (xNbN, yNbN) of the Nth relevant block to (x0-Nx, y0-Ny), and derive whether the left relevant block is available based on (x0-Nx, y0-Ny), (x0, y0), and cIdx, where the coordinates (xCurr, yCurr) of the current block are input as cIdx, and the result is substituted for availableN. AvailableN indicates whether the Nth relevant block is available.
[0072] Table 2 defines the specification for determining ctxInc based on the syntax elements of the left adjacent block and the upper adjacent block, and Table 2 defines the judgment conditions of the left adjacent block and the upper adjacent block corresponding to each syntax element. Note that in the embodiment of the present application, in addition to the left adjacent block and the upper adjacent block, other related blocks are further used, that is, a sufficient number of related blocks having spatial correlation with the current block are used to select the context model, and in addition to Table 2, it is necessary to add more related block judgment conditions (condN), and if there are multiple corresponding context model groups, it is also necessary to add a context model group index (ctxSetIdx).
[0073] In one possible implementation, the first syntax element is encoded, and if it is determined that the relevant block is available, the judgment condition of the relevant block is determined in a lookup table manner. If it is determined that the relevant block is unavailable, there is no need to obtain the judgment condition of the relevant block.
[0074] [Table 2]
[0075] Next, ctxInc is matched. One possible way is ctxInc = tempValue. Or ctxInc = tempValue / M1, where M1 is an integer. For example, M1 is set to 1, 2, 3, 4, or 5 according to the context model. Or ctxInc = tempValue >> M2, where >> represents a right shift. This is because in hardware implementation, the cost of a right shift is much lower than that of division. Or it is described in the form of ctxInc = tempValue < THR0? 0 : (tempValue < THR1? 1 : 2). THR0 and THR1 are threshold values. Using these two threshold values, tempValue is divided into three value ranges, namely, tempValue < THR0, THR0 ≤ tempValue < THR1, and THR1 ≤ tempValue. In actual applications, one threshold value can be used to divide tempValue into two value ranges, or multiple threshold values can be used to divide tempValue into more value ranges.
[0076] In some embodiments, the reference information of the related block includes an availability identifier of a first syntax element of the related block and a context model index reference amount. Determining a first intermediate amount based on the reference information of the plurality of related blocks includes obtaining weights of the plurality of related blocks, performing a logical AND operation on the availability identifier and the context model index reference amount of each related block to obtain a logical AND operation result, performing a weighted operation on the logical AND operation result of each related block based on the weights of the plurality of related blocks, and obtaining the first intermediate amount based on the weighted results of each related block.
[0077] In actual applications, an addition operation is performed on the weighted result to obtain the first intermediate amount, or a logical OR operation is performed on the weighted result to obtain the first intermediate amount, or a logical AND operation is performed on the weighted result to obtain the first intermediate amount.
[0078] For example, a first intermediate quantity (tempValue) is set. tempValue is initialized to 0, and the encoded syntax elements of the xth related block are availablex and condx, where x ranges from 0 to N, and the following operation is performed from x=0 to x=N: tempValue+=(availablex&&condx)*weightx. Here, in the example shown in FIG. 9, N is 24, and the value of N can be changed according to the number of blocks to be used. Here, weightx can be determined based on the position of the related block x, for example, by determining the ring in which the related block x is located, as described above.
[0079] Exemplarily, the position information of each ring is preset, and based on the position information of the related block x, it is determined that the position information of the Li ring matches the position information of the related block x, and it is determined that the related block X is located in the Li ring. In the example shown in Fig. 9, if the position information of the Li ring includes the position information of the related block x, it is determined that the related block X is located in the Li ring, where the position information of the related block x is the reference coordinate, the position information of each ring includes coordinate information for representing the sides of a rectangle, and the position information of each ring includes a value range of a first abscissa and a corresponding ordinate, a value range of a second abscissa and a corresponding ordinate, a value range of a first ordinate and a corresponding abscissa, and a value range of a second ordinate and a corresponding abscissa.
[0080] Next, ctxInc is matched. One possible way is ctxInc = tempValue. Or ctxInc = tempValue / M1, where M1 is an integer. For example, M1 is set to 1, 2, 3, 4, or 5 according to the context model. Or ctxInc = tempValue >> M2, where >> represents a right shift. This is because in a hardware implementation, the cost of a right shift is much lower than that of division. Or it is described in the form of ctxInc = tempValue < THR0? 0 : (tempValue < THR1? 1 : 2). THR0 and THR1 are threshold values. Using these two threshold values, tempValue is divided into three value ranges, namely, tempValue < THR0, THR0 ≤ tempValue < THR1, and THR1 ≤ tempValue. In actual applications, one threshold value can be used to divide tempValue into two value ranges, or multiple threshold values can be used to divide tempValue into more value ranges.
[0081] In some embodiments, when the first syntax element corresponds to a plurality of context model groups, determining the context model index increment of the first syntax element of the current block based on the reference information of the plurality of related blocks includes determining a first intermediate quantity based on the reference information of the plurality of related blocks, determining a second intermediate quantity based on the context model group index corresponding to the first syntax element and the number of context models in each context model group, obtaining a third intermediate quantity by converting the first intermediate quantity based on a preset conversion algorithm, and obtaining the context model index increment of the first syntax element of the current block based on the second intermediate quantity and the third intermediate quantity.
[0082] That is, a syntax element may directly correspond to one or more context models, or may correspond to one or more context model groups, each of which includes multiple context models. If the first syntax element corresponds to multiple context model groups, the third intermediate amount is used to index one context model in a specific context model group, so that it is necessary to further determine the second intermediate amount based on the context model group index and the number of context models, the second intermediate amount is used as the offset amount of the context model group to index the first context model in the context model group, and the context model index increment is obtained by adding the second intermediate amount and the third intermediate amount, and is used to determine one context model in one context model group.
[0083] For example, if a context model group is set for some syntax elements, then ctxInc+=ctxSetIdx*P, where ctxSetIdx is the index of the context model group, which can take values such as 0, 1, 2, 3, etc., and P is the number of context models in the context model group, which can take values such as 2, 3, 4, 5, etc.
[0084] Illustratively, for the syntax elements alf_ctb_flag[cIdx][xCtb][yCtb], alf_ctb_cc_cb_idc[xCtb][yCtb], alf_ctb_cc_cr_idc[xCtb][yCtb], split_qt_flag, split_cu_flag, cu_skip_flag[x0][y0], pred_mode_ibc_flag[x0][y0], intra_mip_flag, inter_affine_flag[x0][y0], and merge_subblock_flag[x0][y0], VVC has three context model groups, with three context models in one group.
[0085] By adopting the above technical solution, the spatial correlation between image blocks can be fully utilized by setting a larger predetermined area so that more related blocks are selected for the current block, and a more appropriate context model can be matched for the first syntax element of the current block, thereby improving the compression efficiency of the syntax elements and further improving the compression efficiency of the entire system.
[0086] In the following, the use of CABAC in VVC is taken as an example, and the processing process of CABAC mainly includes binarization, context modeling, and binary arithmetic coding. Here, binarization refers to performing binarization processing on the input non-binary syntax element value to uniquely convert it into one binary sequence (i.e., binary string), context modeling refers to determining a context model for each bit of the binary string based on context information (e.g., coding information in the reconstructed area around the node corresponding to the syntax element), and binary arithmetic coding refers to coding the corresponding bit based on a probability value in the context model, and updating the probability value in the context model according to the value of the bit. In the embodiment of the present application, a context model for each bit in the binary string of the first syntax element is selected, and the corresponding context model is determined based on the determined context model index.
[0087] After determining the context model, an arithmetic decoding process of the binary code is invoked with the parameters of the context model as input.
[0088] The inputs of the arithmetic decoding process of a binary code are the parameters of the context model (ctxTable and ctxIdx), the bypass decoding identifier (bypassFlag), and the state variables ivlCurrRange and ivlOffset of the arithmetic decoding engine, and the output of this process is the value of this binary code (bin).
[0089] 10 is the overall arithmetic decoding process of a binary code in an embodiment of the present application. To decode the value of this bin, ctxTable, ctxIdx, bypassFlag are transmitted as input to the decoding binary code part DecodeBin(ctxTable, ctxIdx, bypassFlag), specifically, as follows:
[0090] If the value of bypassFlag is 1, call the bypass decode DecodeBypass(); If the value of bypassFlag is 0, the value of ctxTable is 0, and the value of ctxIdx is 0, call decode termination DecodeTerminate(); If the value of bypassFlag is 0 and the value of ctxTable is not 0, call the decode decision DecodeDecision(ctxTable, ctxIdx).
[0091] FIG. 11 is a decode decision process for a binary code in an embodiment of the present application, where the inputs of the decode decision DecodeDecision(ctxTable, ctxIdx) process are the variables ctxTable, ctxIdx, ivlCurrRange, and ivlOffset, and the outputs of this process are the decoded value binVal and the updated variables ivlCurrRange and ivlOffset.
[0092] 1. The value of the variable ivlLpsRange is derived as follows: Given the current value of ivlCurrRange, the variable qRangeIdx is derived as follows: qRangeIdx=ivlCurrRange>>5 Given qRangeIdx, and pStateIdx0 and pStateIdx1 corresponding to ctxTable and ctxIdx (ctxTable is the table used when selecting the context mode, ctxIdx is the context model index, and pStateIdx0 and pStateIdx1 are the two states of the current context model), valMps and ivlLpsRange are derived as follows: pState=pStateIdx1+16*pStateIdx0 valMps=pState>>14 ivlLpsRange=(qRangeIdx*((valMps?32767-pState:pState)>>9)>>1)+4 2. Set the value of the variable ivlCurrRange to ivlCurrRange-ivlLpsRange, and perform the following operations:
[0093] If ivlOffset is greater than or equal to ivlCurrRange, the value of the variable binVal becomes 1-valMps, ivlOffset is subtracted by ivlCurrRange, and the value of ivlCurrRange becomes equal to ivlLpsRange; Otherwise, the value of the variable binVal is equal to valMps.
[0094] Performs a state transition given the value of binVal. Performs a renormalization based on the current value of ivlCurrRange.
[0095] For the state transition process, the inputs of this process are the current pStateIdx0 and pStateIdx1 and the decoded value binVal, and the output of this process is the updated context variables pStateIdx0 and pStateIdx1 corresponding to ctxTable and ctxIdx.
[0096] The variables shift0 and shift1 are derived from shiftIdx, which is determined by the correspondence between shiftIdx and ctxTable and ctxIdxt.
[0097] shift0=(shiftIdx>>2)+2 shift1=(shiftIdx&3)+3+shift0 Based on the decoded value binVal, the two variables pStateIdx0 and pStateIdx1 corresponding to ctxTable and ctxIdx are updated as follows:
[0098] pStateIdx0=pStateIdx0-(pStateIdx0>>shift0)+(1023*binVal>>shift0) pStateIdx1=pStateIdx1-(pStateIdx1>>shift1)+(16383*binVal>>shift1) FIG. 12 shows the renormalization process in an embodiment of the present application, where the inputs to this process are the bits of slice data and the variables ivlCurrRange and ivlOffset, and the output of this process is the updated variables ivlCurrRange and ivlOffset.
[0099] The current value of ivlCurrRange is first compared to 256, and the subsequent steps are as follows:
[0100] If ivlCurrRange is greater than or equal to 256, no renormalization is necessary and the renormalization process ends; If not (ivlCurrRange is less than 256), proceed to the renormalization loop. In this loop, double the value of ivlCurrRange, that is, shift it left by 1 bit. Doubling the value of ivlOffset means shifting it left by 1 bit. Add the 1 bit obtained by read_bits(1) to ivlOffset.
[0101] Throughout the process, the data in the bitstream must never exceed ivlCurrRange, even if ivlOffset is greater than or equal to ivlCurrRange.
[0102] FIG. 13 shows a binary code bypass decoding DecodeBypass() process in an embodiment of the present application, the inputs of which are the slice data bits, the variables ivlCurrRange and ivlOffset, and the outputs of which are the updated variable ivlOffset and the decoded value binVal.
[0103] If the bypassFlag is 1, the bypass decoding process is called, which is as follows.
[0104] First, double the value of ivlOffset, i.e., shift it left by 1 bit. Add the 1 bit obtained by read_bits(1) to ivlOffset. Next, compare the value of ivlOffset with the value of ivlCurrRange, and the subsequent steps are as follows:
[0105] If ivlOffset is greater than or equal to ivlCurrRange, the value of binVal is set to 1 and ivlOffset is decreased by ivlCurrRange.
[0106] Otherwise (ivlOffset is less than ivlCurrRange), the value of binVal is set to 0.
[0107] Throughout the process, the data in the bitstream must never exceed ivlCurrRange, even if ivlOffset is greater than or equal to ivlCurrRange.
[0108] FIG. 14 shows the decode termination DecodeTerminate() process in an embodiment of the present application. The inputs to this process are the bits in the slice data and the variables ivlCurrRange and ivlOffsel, and the outputs of this process are the updated ivlCurrRange and ivlOffsel, and the decoded value binVal.
[0109] First, subtract 2 from the value of ivlCurrRange; If ivlOffset is greater than or equal to ivlCurrRange, the value of binVal is set to 1.
[0110] Otherwise (ivlOffset is less than ivlCurrRange), the value of binVal is set to 0 and the renormalization process is performed.
[0111] An embodiment of the present application further provides a decoding method, and FIG. 15 is an exemplary flowchart of a decoding method according to an embodiment of the present application, which is applied to a decoder, and as shown in FIG. 15, the method includes the following steps:
[0112] In step 1501, the bitstream is decoded to obtain the decoding target information of the first syntax element of the current block.
[0113] In step 1502, a plurality of decoded related blocks corresponding to the current block are selected from a predetermined region, where the predetermined region includes a region having a correlation with the current block.
[0114] Here, the multiple related blocks in the embodiment of the present application refer to at least three related blocks, and the related blocks can be understood as image blocks having spatial correlation with the current block, and are used to determine the context model of the syntax elements of the current block. The decoded related blocks can be understood as reconstructed blocks reconstructed at the decoding side.
[0115] In practical application, due to the influence of the division method of the image block, the size of the related block may or may not be consistent with the size of the current block. Figure 4 is a schematic diagram 1 of the selection position of the related block in the embodiment of the present application, as shown in Figure 4, the related blocks are the left adjacent block, the upper adjacent block, and the upper left adjacent block of the current block, and the size of the related blocks is consistent with the size of the current block. Figure 5 is a schematic diagram 2 of the selection position of the related block in the embodiment of the present application, as shown in Figure 5, the related blocks are the left adjacent block, the upper adjacent block, and the upper left adjacent block of the current block, and the size of the related blocks is not consistent with the size of the current block.
[0116] In some embodiments, the predetermined region includes adjacent regions of the current block and / or non-adjacent regions of the current block, and when the predetermined region includes adjacent regions of the current block, the related blocks include adjacent blocks of the current block, and when the predetermined region includes non-adjacent regions of the current block, the related blocks include non-adjacent blocks of the current block. It should be noted that not only adjacent blocks have a spatial correlation with the current block, but adjacent non-adjacent blocks also have a spatial correlation with the current block. This is also easy to understand, because all contents within the predetermined region are correlated. That is, in addition to using spatially adjacent blocks, adjacent non-adjacent blocks or both adjacent and non-adjacent blocks can be used to select a context model for the current block with reference to a sufficient number of associated blocks. In this way, by setting a large predetermined region so that more associated blocks are selected for the current block, the spatial association between image blocks can be fully utilized, and by matching a more appropriate context model to the first syntax element of the current block based on more associated blocks, it is possible to avoid accidental events affecting the selection of the context model.
[0117] Specifically, as shown in Figures 6 to 8, multiple adjacent blocks can be selected as associated blocks of the current block, multiple non-adjacent blocks can be selected as associated blocks of the current block, or multiple adjacent and non-adjacent blocks can be selected as associated blocks of the current block.
[0118] In practical applications, the strength of the association between the associated block and the current block may be the same or different. Exemplarily, the method further includes: setting the weight of the associated block according to the strength of the association between the associated block and the current block; and determining a context model index parameter based on the weight of the associated block and the reference information of the associated block. For example, in the case of adjacent blocks, the closer the adjacent block is to the upper left corner of the current block, the stronger the association; and the farther the adjacent block is, the weaker the association. In the case of adjacent blocks and non-adjacent blocks, the closer the adjacent block and the non-adjacent block are to the current block, the stronger the association; and the farther the association is, the weaker the association is. When using a non-adjacent block as an associated block, one method is to set different weights for the non-adjacent blocks. In this way, the weight of the associated block is set in consideration of the strength of the spatial association, thereby further improving the accuracy of the context model selection.
[0119] In some embodiments, the method further includes setting a weight of the associated block based on a distance between the associated block and the current block. In practical applications, the distance may be a horizontal distance, a vertical distance, or a linear distance.
[0120] In some embodiments, the method further comprises setting a weight for the associated block based on a reference coordinate of the associated block and a reference coordinate of the current block.
[0121] In some embodiments, the method further includes determining a first sub-region in which the associated block is located, where the first sub-region is at least one of at least two second sub-regions included in the predetermined region, and setting a weight of the associated block based on the first sub-region in which the associated block is located.
[0122] Specifically, the method further includes dividing the predetermined region into at least two second sub-regions, and setting a weight for each second sub-region.
[0123] Exemplarily, setting the weight of the associated block according to the first sub-region in which the associated block is located includes: when the first sub-region includes two or more second sub-regions, performing a fusion operation on the weight of the second sub-region to obtain the weight of the first sub-region, and setting the weight of the associated block to the weight of the first sub-region. Exemplarily, the fusion operation may be a weighting operation, an average operation, etc.
[0124] Exemplarily, setting the weight of the associated block based on the first sub-region in which the associated block is located includes: if the first sub-region includes one second sub-region, setting the weight of the first region to the weight of the second sub-region, and setting the weight of the associated block to the weight of the first sub-region, i.e., configuring the weight of the associated block to be the weight of the second sub-region.
[0125] For example, at least two concentric rings can be used to divide the predetermined region into at least two sub-regions. Specifically, the position information of each ring is preset, and based on the position information of the related block x, it is determined that the position information of the Li ring matches the position information of the related block x, and it is determined that the related block X is located in the Li ring.
[0126] Here, the location information matching may be that the location information of the Li-th ring includes the location information of the related block x, or that the distance between the Li-th ring and the related block x is smaller than a predetermined distance threshold.
[0127] FIG. 9 is a schematic diagram 5 of the selection position of related blocks in an embodiment of the present application, where 0 to 6 are adjacent blocks, and blocks with numbers greater than 6 are non-adjacent blocks. One way to identify these blocks is to configure the intervals of the concentric rings with the size of the current block as the interval length, and set the position information of each ring. As shown in FIG. 9, if the concentric rings are represented by L0 to L4, and the position information of the Lith ring includes the position information of the related block x, it is determined that the related block X is located in the Lith ring, where the position information of the related block x is the reference coordinate, and the position information of each ring includes coordinate information for representing the sides of a rectangle, and the position information of each ring includes the range of values of the first abscissa and the corresponding ordinate, the range of values of the second abscissa and the corresponding ordinate, the range of values of the first ordinate and the corresponding abscissa, and the range of values of the second ordinate and the corresponding abscissa. The four sides of each ring are surrounded by two lines that are n*cbWidth away from the current block in the left-right direction and two lines that are n*cbHeight away from the current block in the up-down direction. For example, block 9 in the figure is determined by coordinates (x0-cuWidth, y0-cuHeight), where n corresponding to the first ring L1 is 1 and n corresponding to the second ring L2 is 2. Block 14 in the figure is determined by coordinates (x0-2*cuWidth, y0-2*cuHeight).
[0128] For example, the weight of the 0th ring L0 is set to 1, that is, the weight of the adjacent blocks in the 0th ring L0 is set to 1, the weight of the first ring L1 is set to 1 / 2, the weight of the second ring L2 is set to 1 / 4, the weight of the third ring L3 is set to 1 / 8, and the weight of the fourth ring L4 is set to 1 / 16. Note that the weight setting method shown here is merely an example and is not intended to limit the present application. In actual applications, different weights can be set for the same ring, or weights can be set by combining the features of the video image.
[0129] In some embodiments, selecting a plurality of decoded associated blocks corresponding to a current block from the specified region includes determining reference coordinates of the associated blocks in the specified region based on reference coordinates of the current block, and obtaining reference information of the associated blocks based on the reference coordinates of the associated blocks.
[0130] In some embodiments, the method further comprises obtaining reference information of the associated blocks based on a predetermined selection order and reference coordinates of the associated blocks.
[0131] Here, the reference coordinates are used to identify the positions of the current block and the related blocks, and the reference coordinates may be at least one of the coordinates of the upper left corner of the block, the coordinates of the lower left corner of the block, the coordinates of the upper right corner of the block, the coordinates of the lower right corner of the block, the coordinates of the center of the block, etc. The selection order is used to set the order of selection of the multiple related blocks, and for example, the selection order may be an order of radially searching from the inside to the outside with the current block as the center, or an order of searching from left to right and top to bottom according to a certain search granularity within the search area.
[0132] In step 1503, a context model index parameter of a first syntax element of the current block is determined based on reference information of the plurality of related blocks.
[0133] Exemplarily, the value of the context model index (ctxIdx) is equal to the sum of a context model index increment (ctxInc) and a context model index offset (ctxIdxOffset), where ctxIdxOffset is for classifying context models into different groups, and ctxInc is for selecting a particular context model from the group.
[0134] Here, the reference information of the related block is used to indicate a context model selected when encoding a first syntax element of the related block. Illustratively, in some embodiments, the reference information of the related block includes a context model index reference amount of the first syntax element of the related block. In some other embodiments, the reference information of the related block further includes an availability identifier of the related block. The availability identifier is used to indicate whether the context model index reference amount of the related block can be used to determine the context model index reference amount of the current block.
[0135] In some embodiments, determining a context model index parameter for a first syntax element of the current block based on the reference information of the plurality of associated blocks includes determining a context model index offset amount corresponding to the first syntax element, determining a context model index increment for the first syntax element of the current block based on the reference information of the plurality of associated blocks, determining the context model index for the first syntax element based on the context model index increment and the context model index offset amount, and setting the context model index parameter equal to the context model index.
[0136] Wherein, the current block includes multiple syntax elements, the first syntax element refers to one of the multiple syntax elements of the current block, the context model corresponding to the context model index may be understood as the context model corresponding to the first syntax element, each syntax element corresponds to two or more context models, and when encoding the first syntax element of the current block, a context model that matches the first syntax element of the current block is selected based on the same syntax element of the related block. In the embodiment of the present application, by increasing the number of context models, a context model that is more suitable for the syntax element can be selected, and the compression efficiency can be further improved.
[0137] Illustratively, for the syntax elements alf_ctb_flag[cIdx][xCtb][yCtb], alf_ctb_cc_cb_idc[xCtb][yCtb], alf_ctb_cc_cr_idc[xCtb][yCtb], split_qt_flag, split_cu_flag, cu_skip_flag[x0][y0], pred_mode_ibc_flag[x0][y0], intra_mip_flag, inter_affine_flag[x0][y0], and merge_subblock_flag[x0][y0], VVC has three context models or has three context models in one group, and for the syntax elements pred_mode_flag[x0][y0] and non_inter_flag, VVC has two context models.
[0138] Illustratively, in some embodiments, the method further includes determining a first context model list for use in selecting a context model for the first syntax element, and setting the context model index parameter to an index of the first context model list.
[0139] If multiple context model lists are pre-configured for mapping context models, each context model list contains multiple context models, ctxTable represents the context model list used in selecting a context model, and ctxIdx represents a particular context model within the index context model list.
[0140] When parsing different syntax elements, it is necessary to use the context model corresponding to each syntax element, i.e., the corresponding ctxTable and ctxIdx, and in Table 1, the syntax elements encoded using the context model are defined, and all the ctxTables corresponding to these syntax elements can be found in this table. Here, ctxIdxOffset is the minimum value of ctxIdx in the current initType in Table 1, and initType is related to the slice type (I slice, P slice, B slice) and also to some flags, which will not be described in detail here. It is considered that ctxIdxOffset is for classifying the context models into different groups, and ctxInc is for selecting a specific context model from the group.
[0141] In step 1504, the decoding target information is decoded based on a context model corresponding to the context model index parameter to obtain a first syntax element of the current block.
[0142] Note that one syntax element may include one or more binary codes (bin), and flag usually has only two options, so flag generally has only one binary code. Each binary code may have one or more context models, i.e., it corresponds to one or more ctxIdx. When a binary code has multiple context models, it is necessary to select the most matching context model from the multiple context models and encode it, thereby improving encoding efficiency. In the embodiment of the present application, the premise for selecting a context model is that this binary code is encoded using a context model, and in the embodiment of the present application, unless otherwise specified, all binary codes refer to binary codes encoded by a context model.
[0143] The following provides a further example of how to determine the context model index increment.
[0144] Wherein the syntax element of the associated block refers to a decoded syntax element of the associated block. In some embodiments, determining a context model index increment for a first syntax element of the current block based on the reference information of the plurality of associated blocks includes: determining a first intermediate quantity based on the reference information of the plurality of associated blocks; and converting the first intermediate quantity based on a preset conversion algorithm to obtain a context model index increment for a first syntax element of the current block.
[0145] In some embodiments, the reference information of the associated block includes an availability identifier of a first syntax element of the associated block and a context model index reference amount, and determining a first intermediate amount based on the reference information of the plurality of associated blocks includes performing a logical AND operation on the availability identifier and the context model index reference amount of each associated block to obtain a logical AND operation result, and obtaining the first intermediate amount based on the logical AND operation result of each associated block.
[0146] and converting the first intermediate variable to a matching context index increment using a preset conversion algorithm, in some embodiments, the preset conversion algorithm includes one of: setting the first intermediate quantity equal to the context model index increment, dividing the first intermediate quantity by a first reference amount to obtain the context model index increment, right-shifting the first intermediate quantity by a second reference amount to obtain the context model index increment, and determining a first value range to which the first intermediate quantity belongs and setting the context model index increment to an index increment corresponding to the first value range.
[0147] For example, taking the VVC format as an example, the context model index reference amount can be expressed as a judgment condition for selecting a context model. In the embodiment of the present application, whether the Nth associated block is available and the judgment condition are represented as availableN, and the judgment condition for the Nth associated block corresponding to the first syntax element is represented as conditionN (abbreviated as condN).
[0148] Exemplarily, a first intermediate quantity (tempValue) is set. tempValue is initialized to 0, and the decoded syntax elements of the xth associated block are availablex and condx, where x ranges from 0 to N, and the following operation is performed from x=0 to x=N: tempValue+=availablex&&condx. Here, in the example shown in FIG. 6, N is 6, and the value of N can be changed depending on the number of associated blocks used. tempValue can be understood as an intermediate variable in the accumulation process, and when x=N, tempValue is the first intermediate quantity finally obtained.
[0149] Specifically, the coordinates (xCurr, yCurr) of the current block are set to (x0, y0), the coordinates (xNbL, yNbL) of the left adjacent block are set to (x0-1, y0), and based on (xNbL, yNbL), (x0, y0), and cIdx, it is determined whether the left adjacent block is available or not, and the result is substituted for availableL. AvailableL indicates whether the left adjacent block is available or not.
[0150] The coordinates (xNbA, yNbA) of the upper adjacent block are set to (x0, y0-1), and based on (xNbA, yNbA), (x0, y0), and cIdx, it is determined whether the upper adjacent block is available or not, and the result is substituted for availableA. AvailableA indicates whether the upper adjacent block is available or not.
[0151] Set the coordinates (xNbN, yNbN) of the Nth relevant block to (x0-Nx, y0-Ny), and derive whether the left relevant block is available based on (x0-Nx, y0-Ny), (x0, y0), and cIdx, where the coordinates (xCurr, yCurr) of the current block are input as cIdx, and the result is substituted for availableN. AvailableN indicates whether the Nth relevant block is available.
[0152] Next, ctxInc is matched. One possible way is ctxInc = tempValue. Or ctxInc = tempValue / M1, where M1 is an integer, for example, M1 is set to 1, 2, 3, 4, or 5 according to the context model. Or ctxInc = tempValue >> M2, where >> represents a right shift, because in hardware implementation, the cost of right shift is much lower than that of division. Or it is described in the form of ctxInc = tempValue < THR0? 0 : (tempValue < THR1? 1 : 2). THR0 and THR1 are threshold values, and using these two threshold values, tempValue is divided into three value ranges, that is, tempValue < THR0, THR0 ≤ tempValue < THR1, THR1 ≤ tempValue. In actual applications, one threshold value can be used to divide tempValue into two value ranges, or multiple threshold values can be used to divide tempValue into more value ranges. Exemplarily, the context model increment can take values such as 0, 1, 2, 3, ….
[0153] In some embodiments, the reference information of the related block includes the availability identifier of the first syntax element of the related block and the context model index reference amount. Determining the first intermediate amount based on the reference information of the plurality of related blocks includes obtaining the weights of the plurality of related blocks, performing a logical AND operation on the availability identifier of each related block and the context model index reference amount to obtain a logical AND operation result, performing a weighted operation on the logical AND operation result of each related block based on the weights of the plurality of related blocks, and obtaining the first intermediate amount based on the weighted result of each related block.
[0154] In actual applications, an addition operation is performed on the weighted result to obtain the first intermediate amount, or a logical OR operation is performed on the weighted result to obtain the first intermediate amount, or a logical AND operation is performed on the weighted result to obtain the first intermediate amount.
[0155] Exemplarily, a first intermediate quantity (tempValue) is set. tempValue is initialized to 0, and the encoded syntax elements of the x-th related block are availablex and condx, where x ranges from 0 to N, and from x = 0 to x = N, the following operation is performed: tempValue += (availablex && condx) * weightx. Here, in the example shown in FIG. 9, N is 24, and the value of N can be changed according to the number of blocks used. Here, weightx can be determined based on the position of the related block x, for example, as described above, it can be determined by judging the ring where the related block x is located.
[0156] Next, ctxInc is matched. One possible way is ctxInc = tempValue. Or ctxInc = tempValue / M1, where M1 is an integer, for example, M1 is set to 1, 2, 3, 4, or 5 according to the context model. Or ctxInc = tempValue >> M2, where >> represents a right shift, which is because in hardware implementation, the cost of right shift is much lower than division. Or it is described in the form of ctxInc = tempValue < THR0? 0 : (tempValue < THR1? 1 : 2). THR0 and THR1 are threshold values, and these two threshold values are used to divide tempValue into three value ranges, namely, tempValue < THR0, THR0 ≤ tempValue < THR1, THR1 ≤ tempValue. In actual applications, one threshold value can be used to divide tempValue into two value ranges, or multiple threshold values can be used to divide tempValue into more value ranges.
[0157] In some embodiments, when the first syntax element corresponds to a plurality of context model groups, determining a context model index increment of the first syntax element of the current block based on reference information of the plurality of associated blocks includes: determining a first intermediate quantity based on the reference information of the plurality of associated blocks; determining a second intermediate quantity based on a context model group index corresponding to the first syntax element and a number of context models in each context model group; converting the first intermediate quantity based on a preset conversion algorithm to obtain a third intermediate quantity; and obtaining a context model index increment of the first syntax element of the current block based on the second intermediate quantity and the third intermediate quantity.
[0158] That is, a syntax element may directly correspond to one or more context models, or may correspond to one or more context model groups, each of which includes multiple context models. If the first syntax element corresponds to multiple context model groups, the third intermediate amount is used to index one context model in a specific context model group, so that it is necessary to further determine the second intermediate amount based on the context model group index and the number of context models, the second intermediate amount is used as the offset amount of the context model group to index the first context model in the context model group, and the context model index increment is obtained by adding the second intermediate amount and the third intermediate amount, and is used to determine one context model in one context model group.
[0159] For example, if a context model group is set for some syntax elements, then ctxInc+=ctxSetIdx*P, where ctxSetIdx is the index of the context model group, which can take values such as 0, 1, 2, 3, etc., and P is the number of context models in the context model group, which can take values such as 2, 3, 4, 5, etc.
[0160] Illustratively, for the syntax elements alf_ctb_flag[cIdx][xCtb][yCtb], alf_ctb_cc_cb_idc[xCtb][yCtb], alf_ctb_cc_cr_idc[xCtb][yCtb], split_qt_flag, split_cu_flag, cu_skip_flag[x0][y0], pred_mode_ibc_flag[x0][y0], intra_mip_flag, inter_affine_flag[x0][y0], and merge_subblock_flag[x0][y0], VVC has three context model groups, with three context models in one group.
[0161] By adopting the above technical solution, the spatial correlation between image blocks can be fully utilized by setting a larger predetermined area so that more related blocks are selected for the current block, and a more appropriate context model can be matched for the first syntax element of the current block, thereby improving the compression efficiency of the syntax elements and further improving the compression efficiency of the entire system.
[0162] To realize the method of the embodiment of the present application, based on the same inventive concept, the embodiment of the present application further provides an encoder, as shown in FIG. 16, the encoder 160 includes: A first selection unit 1601 configured to select a plurality of coded related blocks corresponding to a current block from a predetermined region, where the predetermined region includes a region having a correlation with the current block; A first determining unit 1602 configured to determine a context model index parameter of a first syntax element of the current block based on reference information of the plurality of related blocks; and an encoding unit 1603 configured to encode a first syntax element of the current block based on a context model corresponding to the context model index parameter.
[0163] In some embodiments, the predetermined region includes adjacent regions of the current block and / or non-adjacent regions of the current block, and when the predetermined region includes adjacent regions of the current block, the related blocks include adjacent blocks of the current block, and when the predetermined region includes non-adjacent regions of the current block, the related blocks include non-adjacent blocks of the current block. It should be noted that not only adjacent blocks have a spatial correlation with the current block, but adjacent non-adjacent blocks also have a spatial correlation with the current block. This is also easy to understand, because all contents within the predetermined region are correlated. That is, in addition to using spatially adjacent blocks, adjacent non-adjacent blocks or both adjacent and non-adjacent blocks can be used to select a context model for the current block with reference to a sufficient number of associated blocks. In this way, by setting a large predetermined region so that more associated blocks are selected for the current block, the spatial association between image blocks can be fully utilized, and by matching a more appropriate context model to the first syntax element of the current block based on more associated blocks, it is possible to avoid accidental events affecting the selection of the context model.
[0164] In some embodiments, the encoder further comprises a setting unit configured to set a weight of the associated block based on a distance between the associated block and the current block.
[0165] In some embodiments, the setting unit is configured to set a weight for the associated block based on a reference coordinate of the associated block and a reference coordinate of the current block.
[0166] In some embodiments, the setting unit is configured to determine a first sub-region in which the associated block is located, the first sub-region being at least one of at least two second sub-regions included in the predetermined region, and to set a weight of the associated block based on the first sub-region in which the associated block is located.
[0167] In some embodiments, the predetermined region includes an adjacent region of the current block and a non-adjacent region of the current block. In this way, the weights of the associated blocks are set in consideration of the strength of spatial association, thereby further improving the accuracy of the context model selection.
[0168] In some embodiments, the first selection unit 1601 is configured to determine reference coordinates of the associated block in the specified area based on the reference coordinates of the current block, and obtain reference information of the associated block based on the reference coordinates of the associated block.
[0169] In some embodiments, the first selecting unit 1601 is configured to obtain the reference information of the associated block based on a predetermined selecting order and the reference coordinates of the associated block.
[0170] In some embodiments, the reference information of the associated block comprises a context model index reference quantity of a first syntax element of the associated block.
[0171] In some embodiments, the reference information for the associated block further comprises an availability identifier for the associated block.
[0172] In some embodiments, the first determining unit 1602 is configured to determine a context model index offset amount corresponding to the first syntax element, determine a context model index increment for the first syntax element of the current block based on reference information of the plurality of associated blocks, determine the context model index for the first syntax element based on the context model index increment and the context model index offset amount, and set the context model index parameter equal to the context model index.
[0173] In some embodiments, the first determining unit 1602 is configured to determine a first intermediate amount based on reference information of the plurality of associated blocks, and convert the first intermediate amount based on a preset conversion algorithm to obtain a context model index increment of a first syntax element of the current block.
[0174] In some embodiments, when the first syntax element corresponds to a plurality of context model groups, the first determining unit 1602 is configured to determine a first intermediate amount based on reference information of the plurality of associated blocks, determine a second intermediate amount based on a context model group index corresponding to the first syntax element and a number of context models in each context model group, convert the first intermediate amount based on a preset conversion algorithm to obtain a third intermediate amount, and obtain a context model index increment of the first syntax element of the current block based on the second intermediate amount and the third intermediate amount.
[0175] In some embodiments, the reference information of the associated blocks includes an availability identifier and a context model index reference amount of a first syntax element of the associated blocks, and the first determination unit 1602 is configured to perform a logical AND operation on the availability identifier and the context model index reference amount of each associated block to obtain a logical AND operation result, and obtain the first intermediate amount based on the logical AND operation result of each associated block.
[0176] In some embodiments, the reference information of the associated block includes an availability identifier and a context model index reference amount of a first syntax element of the associated block, and the first determination unit 1602 is configured to obtain weights of the multiple associated blocks, perform a logical AND operation on the availability identifier and the context model index reference amount of each associated block to obtain a logical AND operation result, perform a weighting operation on the logical AND operation result of each associated block based on the weights of the multiple associated blocks, and obtain the first intermediate amount based on the weighted result of each associated block.
[0177] In some embodiments, the pre-configured conversion algorithm includes one of: setting the first intermediate amount equal to the context model index increment; dividing the first intermediate amount by a first reference amount to obtain the context model index increment; right-shifting the first intermediate amount by a second reference amount to obtain the context model index increment; and determining a first value range to which the first intermediate amount belongs and setting the context model index increment to an index increment corresponding to the first value range.
[0178] In some embodiments, the first determining unit 1602 is configured to determine a first context model list to be used in selecting a context model for the first syntax element, and to set the context model index parameter to an index of the first context model list.
[0179] In practical application, the embodiment of the present application further provides an encoder, and FIG. 17 is an exemplary structural diagram of a second configuration of the encoder in the embodiment of the present application. As shown in FIG. 17, the encoder 170 includes: The device comprises a first memory 1701 and a first processor 1702, the first memory 1701 being configured to store a computer program executable by the first processor 1702, and the first processor 1702 being configured to execute the encoder-side encoding method by executing the program.
[0180] By adopting the above solution, the spatial correlation between image blocks can be fully utilized by setting a larger predetermined region so that more related blocks can be selected for the current block, and a more appropriate context model can be matched to the first syntax element of the current block, thereby improving the compression efficiency of the syntax elements and further improving the compression efficiency of the entire system.
[0181] An embodiment of the present application provides a decoder, and FIG. 18 is an exemplary structural diagram of a first configuration of a decoder in an embodiment of the present application. As shown in FIG. 18, the decoder 180 includes: A first decoding unit 1801 configured to decode the bitstream to obtain decoding target information of a first syntax element of a current block; A second selection unit 1802 configured to select a plurality of decoded related blocks corresponding to the current block from a predetermined region, where the predetermined region includes a region having a correlation with the current block; A second determining unit 1803 configured to determine a context model index parameter of a first syntax element of the current block according to reference information of the plurality of related blocks; and a second decoding unit 1804 configured to decode the decoding target information based on a context model corresponding to the context model index parameter to obtain a first syntax element of the current block.
[0182] In some embodiments, the predetermined region includes adjacent regions of the current block and / or non-adjacent regions of the current block, and when the predetermined region includes adjacent regions of the current block, the related blocks include adjacent blocks of the current block, and when the predetermined region includes non-adjacent regions of the current block, the related blocks include non-adjacent blocks of the current block. It should be noted that not only adjacent blocks have a spatial correlation with the current block, but adjacent non-adjacent blocks also have a spatial correlation with the current block. This is also easy to understand, because all contents within the predetermined region are correlated. That is, in addition to using spatially adjacent blocks, adjacent non-adjacent blocks or both adjacent and non-adjacent blocks can be used to select a context model for the current block with reference to a sufficient number of associated blocks. In this way, by setting a large predetermined region so that more associated blocks are selected for the current block, the spatial association between image blocks can be fully utilized, and by matching a more appropriate context model to the first syntax element of the current block based on more associated blocks, it is possible to avoid accidental events affecting the selection of the context model.
[0183] In some embodiments, the decoder further comprises a setting unit configured to set a weight of the associated block based on a distance between the associated block and the current block.
[0184] In some embodiments, the setting unit is configured to set a weight for the associated block based on a reference coordinate of the associated block and a reference coordinate of the current block.
[0185] In some embodiments, the setting unit is configured to determine a first sub-region in which the associated block is located, the first sub-region being at least one of at least two second sub-regions included in the predetermined region, and to set a weight of the associated block based on the first sub-region in which the associated block is located.
[0186] In some embodiments, the predetermined region includes an adjacent region of the current block and a non-adjacent region of the current block. In this way, the weights of the associated blocks are set in consideration of the strength of spatial association, thereby further improving the accuracy of the context model selection.
[0187] In some embodiments, the second selection unit 1802 is configured to determine, based on the reference coordinates of the current block, reference coordinates of the associated block in the specified area, and obtain reference information of the associated block based on the reference coordinates of the associated block.
[0188] In some embodiments, the second selecting unit 1802 is configured to obtain the reference information of the associated block based on a predetermined selecting order and the reference coordinates of the associated block.
[0189] In some embodiments, the reference information of the associated block comprises a context model index reference quantity of a first syntax element of the associated block.
[0190] In some embodiments, the reference information for the associated block further comprises an availability identifier for the associated block.
[0191] In some embodiments, the second determining unit 1803 is configured to determine a context model index offset amount corresponding to the first syntax element, determine a context model index increment for the first syntax element of the current block based on reference information of the plurality of associated blocks, determine the context model index for the first syntax element based on the context model index increment and the context model index offset amount, and set the context model index parameter equal to the context model index.
[0192] In some embodiments, the second determining unit 1803 is configured to determine a first intermediate amount based on reference information of the plurality of associated blocks, and convert the first intermediate amount based on a preset conversion algorithm to obtain a context model index increment of a first syntax element of the current block.
[0193] In some embodiments, when the first syntax element corresponds to a plurality of context model groups, the second determining unit 1803 is configured to determine a first intermediate amount based on reference information of the plurality of associated blocks, determine a second intermediate amount based on a context model group index corresponding to the first syntax element and a number of context models in each context model group, convert the first intermediate amount based on a preset conversion algorithm to obtain a third intermediate amount, and obtain a context model index increment of the first syntax element of the current block based on the second intermediate amount and the third intermediate amount.
[0194] In some embodiments, the reference information of the associated blocks includes an availability identifier and a context model index reference amount of a first syntax element of the associated blocks, and the second determination unit 1803 is configured to perform a logical AND operation on the availability identifier and the context model index reference amount of each associated block to obtain a logical AND operation result, and obtain the first intermediate amount based on the logical AND operation result of each associated block.
[0195] In some embodiments, the reference information of the associated block includes an availability identifier and a context model index reference amount of a first syntax element of the associated block, and the second determination unit 1803 is configured to obtain weights of the multiple associated blocks, perform a logical AND operation on the availability identifier and the context model index reference amount of each associated block to obtain a logical AND operation result, perform a weighting operation on the logical AND operation result of each associated block based on the weights of the multiple associated blocks, and obtain the first intermediate amount based on the weighting result of each associated block.
[0196] In some embodiments, the pre-configured conversion algorithm includes one of: setting the first intermediate amount equal to the context model index increment; dividing the first intermediate amount by a first reference amount to obtain the context model index increment; right-shifting the first intermediate amount by a second reference amount to obtain the context model index increment; and determining a first value range to which the first intermediate amount belongs and setting the context model index increment to an index increment corresponding to the first value range.
[0197] In some embodiments, the second determining unit 1803 is configured to determine a first context model list to be used in selecting a context model for the first syntax element, and to set the context model index parameter to an index of the first context model list.
[0198] In practical application, the embodiment of the present application further provides a decoder. FIG. 19 is an exemplary structural diagram of a second configuration of the decoder in the embodiment of the present application. As shown in FIG. 19, the decoder 190 includes: The device comprises a second memory 1901 and a second processor 1902, the second memory 1901 being configured to store a computer program executable by the second processor 1902, and the second processor 1902 being configured to execute a decoder-side decoding method by executing the program.
[0199] By adopting the above technical solution, the spatial correlation between image blocks can be fully utilized by setting a larger predetermined area so that more related blocks are selected for the current block, and a more appropriate context model can be matched for the first syntax element of the current block, thereby improving the compression efficiency of the syntax elements and further improving the compression efficiency of the entire system.
[0200] In addition, each functional module in this embodiment may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated units may be realized in the form of hardware or software functional modules.
[0201] Correspondingly, an embodiment of the present application provides a storage medium having a computer program stored thereon, the computer program causing a first processor to execute an encoding method of an encoder, or the computer program causing a second processor to execute a decoding method of a decoder.
[0202] It should be noted that the above description of the storage medium and device embodiments is similar to the description of the method embodiments, and has the same beneficial effects as the method embodiments. For technical details not disclosed in the storage medium and device embodiments of the present application, they can be understood by referring to the description of the method embodiments of the present application.
[0203] The above content is only a specific embodiment of the present application, and the protection scope of the present application is not limited thereto. Any modifications or replacements that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims. [Industrial Applicability]
[0204] The present application provides an encoding / decoding method, an encoder, a decoder, and a storage medium, in which the encoding includes: selecting a plurality of encoded related blocks corresponding to a current block from a predetermined region, where the predetermined region includes a region having a correlation with the current block; determining a context model index parameter of a first syntax element of the current block based on reference information of the plurality of related blocks; and encoding the first syntax element of the current block based on a context model corresponding to the context model index parameter. In this way, by setting a large predetermined region so that more related blocks are selected for the current block, the spatial correlation between image blocks can be fully utilized, and a more appropriate context model can be matched to the first syntax element of the current block, thereby improving the compression efficiency of the syntax elements and further improving the compression efficiency of the entire system.
Claims
1. 1. An encoding method applied to an encoder, comprising: Selecting a plurality of coded related blocks corresponding to a current block from a predetermined region, the predetermined region including a region having a correlation with the current block; determining a context model index parameter of a first syntax element of the current block based on reference information of the plurality of related blocks; and encoding a first syntax element of the current block based on a context model corresponding to the context model index parameter.
2. the predetermined region includes a neighboring region of the current block and / or a non-neighboring region of the current block; If the predetermined region includes a neighboring region of the current block, the related block includes a neighboring block of the current block; If the predetermined region includes a non-adjacent region of the current block, the related block includes a non-adjacent block of the current block. The encoding method according to claim 1 .
3. The encoding method comprises: and setting a weight for the associated block based on a distance between the associated block and the current block. The encoding method according to claim 1 .
4. The encoding method comprises: and setting a weight for the associated block based on a reference coordinate of the associated block and a reference coordinate of the current block. The encoding method according to claim 1 .
5. The encoding method comprises: determining a first sub-region in which the relevant block is located, the first sub-region being at least one of at least two second sub-regions included in the predetermined region; and setting a weight for the associated block based on a first sub-region in which the associated block is located. The encoding method according to claim 1 .
6. Selecting a plurality of coded related blocks corresponding to a current block from the predetermined region includes: determining a reference coordinate of the related block in the predetermined region based on the reference coordinate of the current block; and obtaining reference information of the associated block based on a reference coordinate of the associated block. The encoding method according to claim 1 .
7. The encoding method comprises: and obtaining reference information of the associated blocks according to a predetermined selection order and reference coordinates of the associated blocks. The encoding method according to claim 6.
8. the reference information of the associated block includes a context model index reference quantity of a first syntax element of the associated block; The encoding method according to claim 1 .
9. the reference information for the associated block further includes an availability identifier for the associated block; The encoding method according to claim 8.
10. determining a context model index parameter of a first syntax element of the current block based on reference information of the plurality of associated blocks, determining a context model index offset corresponding to the first syntax element; determining a context model index increment for a first syntax element of the current block based on reference information of the plurality of related blocks; determining the context model index for the first syntax element based on the context model index increment and the context model index offset; setting the context model index parameter equal to the context model index. The encoding method according to claim 1 .
11. determining a context model index increment for a first syntax element of the current block based on reference information of the plurality of associated blocks, determining a first intermediate amount based on reference information of the plurality of related blocks; and transforming the first intermediate quantity based on a preset transformation algorithm to obtain a context model index increment for a first syntax element of the current block. The video encoding method of claim 10.
12. determining a context model index increment for the first syntax element of the current block based on reference information of the plurality of associated blocks when the first syntax element corresponds to a plurality of context model groups, determining a first intermediate amount based on reference information of the plurality of related blocks; determining a second intermediate amount based on a context model group index corresponding to the first syntax element and a number of context models in each context model group; transforming the first intermediate quantity based on a preset transformation algorithm to obtain a third intermediate quantity; and obtaining a context model index increment for a first syntax element of the current block based on the second intermediate amount and the third intermediate amount. The encoding method according to claim 10.
13. The reference information of the associated block includes an availability identifier of a first syntax element of the associated block and a context model index reference quantity; Determining a first intermediate amount based on reference information of the plurality of related blocks includes: performing a logical AND operation on the availability identifier and the context model index reference amount of each associated block to obtain a logical AND operation result; and obtaining the first intermediate amount based on a logical AND operation result of each associated block.
13. The encoding method according to claim 11 or 12.
14. The reference information of the associated block includes an availability identifier of a first syntax element of the associated block and a context model index reference quantity; Determining a first intermediate amount based on reference information of the plurality of related blocks includes: obtaining weights of the plurality of associated blocks; performing a logical AND operation on the availability identifier and the context model index reference amount of each associated block to obtain a logical AND operation result; performing a weighting operation on a result of the AND operation of each of the associated blocks based on weights of the plurality of associated blocks; and obtaining the first intermediate amount based on the weighted result of each associated block.
13. The encoding method according to claim 11 or 12.
15. The preset conversion algorithm is: setting the first intermediate amount equal to the context model index increment; dividing the first intermediate amount by a first reference amount to obtain the context model index increment; right-shifting the first intermediate amount by a second reference amount to obtain the context model index increment; and determining a first value range within which the first intermediate amount falls, and setting the context model index increment to an index increment corresponding to the first value range.
13. The encoding method according to claim 11 or 12.
16. The encoding method comprises: determining a first context model list for use in selecting a context model for the first syntax element; and setting the context model index parameter to an index of the first context model list. The encoding method according to claim 10.
17. A decoding method applied to a decoder, comprising the steps of: Decoding the bitstream to obtain decoding target information of a first syntax element of a current block; selecting a plurality of decoded related blocks corresponding to the current block from a predetermined region, the predetermined region including a region having a correlation with the current block; determining a context model index parameter of a first syntax element of the current block based on reference information of the plurality of related blocks; decoding the decoding target information based on a context model corresponding to the context model index parameter to obtain a first syntax element of the current block.
18. the predetermined region includes a neighboring region of the current block and / or a non-neighboring region of the current block; If the predetermined region includes a neighboring region of the current block, the related block includes a neighboring block of the current block; If the predetermined region includes a non-adjacent region of the current block, the related block includes a non-adjacent block of the current block.
18. The method of decoding according to claim 17.
19. The decoding method includes: and setting a weight for the associated block based on a distance between the associated block and the current block.
18. The method of decoding according to claim 17.
20. The decoding method includes: and setting a weight for the associated block based on a reference coordinate of the associated block and a reference coordinate of the current block.
18. The method of decoding according to claim 17.
21. The decoding method includes: determining a first sub-region in which the relevant block is located, the first sub-region being at least one of at least two second sub-regions included in the predetermined region; and setting a weight for the associated block based on a first sub-region in which the associated block is located.
18. The method of decoding according to claim 17.
22. Selecting a plurality of decoded associated blocks corresponding to the current block from the predetermined region includes: determining a reference coordinate of the related block in the predetermined region based on the reference coordinate of the current block; and obtaining reference information of the associated block based on a reference coordinate of the associated block.
18. The method of decoding according to claim 17.
23. The decoding method includes: and obtaining reference information of the associated blocks according to a predetermined selection order and reference coordinates of the associated blocks.
23. The method of decoding according to claim 22.
24. the reference information of the associated block includes a context model index reference quantity of a first syntax element of the associated block; 18. The method of decoding according to claim 17.
25. the reference information for the associated block further includes an availability identifier for the associated block; 25. The method of decoding according to claim 24.
26. determining a context model index parameter of a first syntax element of the current block based on reference information of the plurality of associated blocks, determining a context model index offset corresponding to the first syntax element; determining a context model index increment for a first syntax element of the current block based on reference information of the plurality of related blocks; determining the context model index for the first syntax element based on the context model index increment and the context model index offset; setting the context model index parameter equal to the context model index.
18. The method of decoding according to claim 17.
27. determining a context model index increment for a first syntax element of the current block based on reference information of the plurality of associated blocks, determining a first intermediate amount based on reference information of the plurality of related blocks; and transforming the first intermediate quantity based on a preset transformation algorithm to obtain a context model index increment for a first syntax element of the current block.
27. The method of decoding according to claim 26.
28. determining a context model index increment for the first syntax element of the current block based on reference information of the plurality of associated blocks when the first syntax element corresponds to a plurality of context model groups, determining a first intermediate amount based on reference information of the plurality of related blocks; determining a second intermediate amount based on a context model group index corresponding to the first syntax element and a number of context models in each context model group; transforming the first intermediate quantity based on a preset transformation algorithm to obtain a third intermediate quantity; and obtaining a context model index increment for a first syntax element of the current block based on the second intermediate amount and the third intermediate amount.
27. The method of decoding according to claim 26.
29. The reference information of the associated block includes an availability identifier of a first syntax element of the associated block and a context model index reference quantity; Determining a first intermediate amount based on reference information of the plurality of related blocks includes: performing a logical AND operation on the availability identifier and the context model index reference amount of each associated block to obtain a logical AND operation result; and obtaining the first intermediate amount based on a logical AND operation result of each associated block.
29. A decoding method according to claim 27 or 28.
30. The reference information of the associated block includes an availability identifier of a first syntax element of the associated block and a context model index reference quantity; Determining a first intermediate amount based on reference information of the plurality of related blocks includes: obtaining weights of the plurality of associated blocks; performing a logical AND operation on the availability identifier and the context model index reference amount of each associated block to obtain a logical AND operation result; performing a weighting operation on a result of the AND operation of each of the associated blocks based on weights of the plurality of associated blocks; and obtaining the first intermediate amount based on the weighted result of each associated block.
29. A decoding method according to claim 27 or 28.
31. The preset conversion algorithm is: setting the first intermediate amount equal to the context model index increment; dividing the first intermediate amount by a first reference amount to obtain the context model index increment; right-shifting the first intermediate amount by a second reference amount to obtain the context model index increment; and determining a first value range within which the first intermediate amount falls, and setting the context model index increment to an index increment corresponding to the first value range.
29. A decoding method according to claim 27 or 28.
32. The decoding method includes: determining a first context model list for use in selecting a context model for the first syntax element; and setting the context model index parameter to an index of the first context model list.
27. The method of decoding according to claim 26.
33. 1. An encoder comprising: A first selection unit configured to select a plurality of coded related blocks corresponding to a current block from a predetermined region, the predetermined region including a region having a correlation with the current block; and a first determining unit configured to determine a context model index parameter of a first syntax element of the current block based on reference information of the plurality of related blocks; an encoding unit configured to encode a first syntax element of the current block based on a context model corresponding to the context model index parameter.
34. A decoder comprising: a first decoding unit configured to decode the bitstream to obtain decoding target information of a first syntax element of a current block; A second selection unit configured to select a plurality of decoded related blocks corresponding to the current block from a predetermined region, the predetermined region including a region having a correlation with the current block; and a second determining unit configured to determine a context model index parameter of a first syntax element of the current block based on reference information of the plurality of related blocks; a second decoding unit configured to decode the decoding target information based on a context model corresponding to the context model index parameter to obtain a first syntax element of the current block.
35. 1. An encoder comprising: A first memory and a first processor, An encoder, comprising: the first memory configured to store a computer program executable by a first processor; and the first processor configured to execute the program to realize the encoding method according to any one of claims 1 to 16.
36. A decoder comprising: a second memory and a second processor; A decoder, the second memory being configured to store a computer program executable by a second processor, the second processor being configured to execute the program to realize the decoding method of any one of claims 17 to 32.
37. A computer-readable storage medium having stored thereon a computer program for causing a first processor to execute the encoding method according to any one of claims 1 to 16 or a computer program for causing a second processor to execute the decoding method according to any one of claims 17 to 32.
Citation Information
Patent Citations
View compositing mode for 3D video coding
JP2015516763A
Video decoding method and video decoder
JP2021536710A
Entropy coding for video encoding and decoding
US20220116662A1
Entropy coding for video encoding and decoding
WO2020185500A1
Syntax signaling and parsing based on colour component
WO2021083188A1