WO2023197104A1 - 一种编解码方法、编码器、解码器及存储介质 - Google Patents

一种编解码方法、编码器、解码器及存储介质 Download PDF

Info

Publication number
WO2023197104A1
WO2023197104A1 PCT/CN2022/086089 CN2022086089W WO2023197104A1 WO 2023197104 A1 WO2023197104 A1 WO 2023197104A1 CN 2022086089 W CN2022086089 W CN 2022086089W WO 2023197104 A1 WO2023197104 A1 WO 2023197104A1
Authority
WO
WIPO (PCT)
Prior art keywords
context model
block
current block
relevant
syntax element
Prior art date
Application number
PCT/CN2022/086089
Other languages
English (en)
French (fr)
Inventor
王凡
Original Assignee
Oppo广东移动通信有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Oppo广东移动通信有限公司 filed Critical Oppo广东移动通信有限公司
Priority to PCT/CN2022/086089 priority Critical patent/WO2023197104A1/zh
Publication of WO2023197104A1 publication Critical patent/WO2023197104A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/70Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by syntax aspects related to video coding, e.g. related to compression standards
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/90Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using coding techniques not provided for in groups H04N19/10-H04N19/85, e.g. fractals
    • H04N19/91Entropy coding, e.g. variable length coding [VLC] or arithmetic coding

Definitions

  • the present application relates to the technical field of video image processing, and in particular to a coding and decoding method, an encoder, a decoder and a storage medium.
  • CABAC Context-based Adaptive Binary Arithmetic Coding
  • entropy coding entropy coding
  • HEVC High Efficiency Video Coding
  • VVC Versatile Video Coding
  • CABAC uses context models to improve compression efficiency. As the demand for compression efficiency continues to increase, various new prediction modes, transformation modes, etc. are added, followed by more syntax elements to control the selection of these modes, etc. , so that the proportion of syntax elements used to control various modes in the code stream is getting higher and higher. Therefore, in order to further improve the compression efficiency of the entire system, it is becoming more and more important to improve the compression efficiency of syntax elements.
  • embodiments of the present application provide a coding and decoding method, an encoder, a decoder and a storage medium, which can match a more suitable context model for the first syntax element of the current block and improve the compression efficiency of syntax elements. .
  • embodiments of the present application provide an encoding method, applied to an encoder, including:
  • the first syntax element of the current block is encoded based on the context model corresponding to the context model index parameter.
  • embodiments of the present application provide a decoding method, applied to a decoder, including:
  • the information to be decoded is decoded based on the context model corresponding to the context model index parameter to obtain the first syntax element of the current block.
  • an encoder including:
  • the first selection unit is used to select a plurality of coded relevant blocks corresponding to the current block from a predetermined area; wherein the predetermined area includes an area that is relevant to the current block;
  • a first determining unit configured to determine the context model index parameter of the first syntax element of the current block based on the reference information of the plurality of related blocks
  • An encoding unit configured to encode the first syntax element of the current block based on the context model corresponding to the context model index parameter.
  • embodiments of the present application provide a decoder, wherein the decoder includes:
  • the first decoding unit is used to decode the code stream and obtain the information to be decoded of the first syntax element of the current block;
  • a second selection unit configured to select a plurality of decoded related blocks corresponding to the current block from a predetermined area; wherein the predetermined area includes an area that is relevant to the current block;
  • a second determination unit configured to determine the context model index parameter of the first syntax element of the current block based on the reference information of the plurality of related blocks
  • the second decoding unit is configured to decode the information to be decoded based on the context model corresponding to the context model index parameter to obtain the first syntax element of the current block.
  • embodiments of the present application further provide an encoder, including: a first memory and a first processor; the first memory stores a computer program that can run on the first processor, and the first The encoding method of the encoder is implemented when the processor executes the program.
  • embodiments of the present application further provide a decoder, including: a second memory and a second processor; the second memory stores a computer program that can run on the second processor, and the second The decoding method of the decoder is implemented when the processor executes the program.
  • embodiments of the present application provide a storage medium, including: a computer program stored thereon, which implements the encoding method of the encoder when executed by the first processor; or, the computer program is executed by the first processor.
  • the second processor is executed, the decoding method of the decoder is implemented.
  • the embodiment of the present application selects more relevant blocks for the current block by setting a larger predetermined area, making full use of the spatial correlation of image blocks, and can match a more suitable context model for the first syntax element of the current block, improving The compression efficiency of syntax elements is improved, thereby improving the compression efficiency of the entire system.
  • Figure 1 shows a video coding system
  • Figure 2 shows a video decoding system
  • Figure 3 is a schematic flow chart of the encoding method provided by the embodiment of the present application.
  • Figure 4 is a schematic diagram 1 of the selected positions of relevant blocks in the embodiment of the present application.
  • Figure 5 is a schematic diagram 2 of the selected positions of relevant blocks in the embodiment of the present application.
  • Figure 6 is a schematic diagram 3 of the selected positions of relevant blocks in the embodiment of the present application.
  • Figure 7 is a schematic diagram 4 of the selected positions of relevant blocks in the embodiment of the present application.
  • Figure 8 is a schematic diagram 5 of the selected positions of relevant blocks in the embodiment of the present application.
  • Figure 9 is a schematic diagram 6 of the selected positions of relevant blocks in the embodiment of the present application.
  • Figure 10 shows the entire arithmetic decoding process of a binary symbol in the embodiment of the present application
  • Figure 11 is the decoding decision-making process of a binary symbol in the embodiment of the present application.
  • Figure 12 shows the renormalization process in the embodiment of the present application
  • Figure 13 shows the bypass decoding process of a binary symbol in the embodiment of the present application
  • Figure 14 shows the termination decoding process in the embodiment of the present application
  • Figure 15 is a schematic flow chart of the decoding method provided by the embodiment of the present application.
  • Figure 16 is a schematic structural diagram of the first component of the encoder provided by the embodiment of the present application.
  • Figure 17 is a schematic diagram of the second structural structure of the encoder provided by the embodiment of the present application.
  • Figure 18 is a schematic structural diagram of the first component of the decoder provided by the embodiment of the present application.
  • Figure 19 is a schematic structural diagram of the second structure of the decoder provided by the embodiment of the present application.
  • Each frame in the video is divided into square largest coding units (LCU) or coding tree units (CTU) of the same size (such as 128x128, 64x64, etc.).
  • LCU square largest coding units
  • CTU coding tree units
  • Each maximum coding unit can be divided into rectangular coding units (coding units, CU) according to rules.
  • the coding unit may also be divided into prediction unit (PU), transformation unit (TU), etc.
  • a frame of image is divided into blocks, and intra prediction or inter prediction is used for the current block (CU) to generate the prediction block of the current block.
  • the prediction block is subtracted from the original block of the current block to obtain the residual block.
  • the residual block is transformed and quantized to obtain a quantized coefficient matrix, and the quantized coefficient matrix is entropy-encoded and output to the code stream.
  • Figure 1 is a video coding system.
  • the video coding system 11 includes: a transformation unit 111, a quantization unit 112, a mode selection and coding control logic unit 113, an intra prediction unit 114, a frame Inter prediction unit 115 (including: motion compensation and motion estimation), inverse quantization unit 116, inverse transform unit 117, loop filter unit 118, encoding unit 119 and decoded image buffer unit 110; for the input original video signal, one frame
  • the image is divided into blocks, the encoding mode is determined by the mode selection and encoding control logic unit 113, and intra prediction or inter prediction is used for the current block to generate a prediction block of the current block.
  • the interframe prediction method is used in video coding and decoding technology to eliminate the temporal redundancy between adjacent frames, thereby improving coding efficiency.
  • the prediction block is subtracted from the original block of the current block to obtain a residual block.
  • the residual block is passed through the transformation unit 111 and the quantization unit 112 to obtain a quantization coefficient matrix; the quantization coefficient matrix is entropy-encoded and output to the code stream through the encoding unit 119; in addition, the quantization
  • the coefficient matrix passes through the inverse quantization unit 116 and the inverse transform unit 117 to obtain a reconstructed residual block.
  • the reconstructed residual block passes through the loop filtering unit 118 to remove block artifacts, and then the reconstructed residual block is added to the decoded image.
  • a prediction block in the frame of the cache unit 111 is used to generate a reconstructed video reconstruction block.
  • the decoded image buffer unit 110 is used to store the reconstructed video reconstruction block for prediction reference. As the video image encoding proceeds, new reconstructed video reconstruction blocks will be continuously generated, and these reconstructed video reconstruction blocks will be stored in the decoded image cache unit 110 .
  • the decoding end determines the same block division information as the encoding end through parsing and analyzing based on existing information, prediction, transformation, quantization, entropy coding, loop filtering and other mode information or parameter information, thereby ensuring the decoded image and decoding obtained by the encoding end
  • the decoded image obtained at both ends is the same.
  • Figure 2 is a video decoding system.
  • Figure 2 is a schematic structural diagram of a video encoding system according to an embodiment of the present application.
  • the video encoding system 21 includes: a decoding unit 211 and an inverse transformation unit 212.
  • the code of the video signal is output stream; the code stream is input into the video decoding system 21, and first passes through the decoding unit 211 to obtain the decoded quantization coefficient matrix; the quantization coefficient matrix is processed through the inverse transformation unit 212 and the inverse quantization unit 213, so that in the pixel domain
  • the residual block is generated in Motion vectors and other associated syntax elements are used to determine prediction information for the current block, and the prediction information is used to generate a prediction block for the current block; by comparing the residual block from the inverse transform unit 212 and the inverse quantization unit 213 with the intra frame
  • the corresponding prediction blocks generated by the prediction unit 214 or the motion compensation unit 215 are summed to form a decoded reconstruction block; the decoded reconstruction block passes through the loop filtering unit 216 to remove blocking artifacts, which can improve the video
  • CABAC Context-based adaptive binary arithmetic coding
  • An encoding method provided by the embodiment of the present application mainly acts on the encoding unit 119 of the video encoding system 11 to encode syntax elements.
  • the provided decoding method mainly acts on the decoding unit 211 of the video decoding system 21 for decoding syntax elements.
  • the embodiment of the present application provides a coding method, which is applied to a video coding device, that is, an encoder.
  • the functions implemented by this method can be implemented by the processor in the video encoding device calling the program code.
  • the program code can be stored in a computer storage medium. It can be seen that the video encoding device at least includes a processor and a storage medium.
  • Figure 3 is a schematic flow chart of the encoding method provided by the embodiment of the present application. The method is applied to the encoder. As shown in Figure 3, the method includes:
  • Step 301 Select multiple coded relevant blocks corresponding to the current block from a predetermined area; wherein the predetermined area includes an area that is relevant to the current block;
  • multiple related blocks refer to at least three related blocks.
  • the related blocks can be understood as image blocks that are spatially relevant to the current block and are used to determine the context model of the syntax element of the current block.
  • the coded correlation block can also be understood as a reconstruction block reconstructed by the coding end.
  • FIG 4 is a schematic diagram of the selection position of the relevant block in the embodiment of the present application. As shown in Figure 4, the relevant block is the left adjacent block of the current block, the upper adjacent block and the upper left adjacent block. The size of the relevant block and the current block consistent.
  • Figure 5 is a second schematic diagram of the selection position of the relevant block in the embodiment of the present application. As shown in Figure 5, the relevant block is the left adjacent block of the current block, the upper adjacent block and the upper left adjacent block. The size of the relevant block and the current block Inconsistent.
  • the predetermined area includes an adjacent area of the current block and/or a non-adjacent area of the current block; when the predetermined area includes an adjacent area of the current block, the correlation Blocks include adjacent blocks of the current block; when the predetermined area includes non-adjacent areas of the current block, the relevant blocks include non-adjacent blocks of the current block. It should be noted that not only adjacent blocks are spatially correlated with the current block, but non-adjacent blocks that are close to each other are also spatially correlated with the current block. It is also easy to understand, the content within the predetermined area is relevant.
  • multiple adjacent blocks may be selected as relevant blocks of the current block
  • multiple non-adjacent blocks may be selected as relevant blocks of the current block
  • multiple adjacent blocks and non-adjacent blocks may be selected as relevant blocks of the current block.
  • Figure 6 is a schematic diagram 3 of the selected positions of relevant blocks in the embodiment of the present application.
  • the adjacent blocks can also use adjacent blocks determined in other positions.
  • An example is shown in Figure 6
  • the current block is a block containing reference coordinates (x0, y0). Taking the reference coordinates (x0, y0) as the upper left corner coordinate of the current block as an example, block0 is an adjacent block containing reference coordinates (x0-1, y0).
  • block1 is an adjacent block containing reference coordinates (x0, y0-1)
  • block2 is an adjacent block containing reference coordinates (x0-1, y0-1)
  • block3 is an adjacent block containing reference coordinates (x0-1, y0+cbHeight -1) adjacent block
  • block4 is an adjacent block containing reference coordinates (x0+cbWidth-1, y0-1)
  • block5 is an adjacent block containing reference coordinates (x0+cbWidth-1, y0-1)
  • block6 is an adjacent block containing reference coordinates (x0+cbWidth, y0-1), where (x0, y0) is the coordinate of the upper left corner of the current block, cbWidth is the width of the current block, and cbHeight is the height of the current block.
  • Figure 7 is a schematic diagram 4 of the selection positions of relevant blocks in the embodiment of the present application. Furthermore, more adjacent blocks in the spatial domain can be used, that is, the adjacent blocks are selected among the seven adjacent blocks shown in Figure 6. You can also select one or more adjacent blocks between block1 and block5 in Figure 7 (i.e., the area indicated by " --), and one or more adjacent blocks between block0 and block3 (i.e., the area indicated by " -- area), used to determine the context model of the current block syntax element.
  • Figure 8 is a schematic diagram 5 of the selection position of the relevant blocks in the embodiment of the present application. Furthermore, more non-adjacent blocks in the spatial domain can be used, and the relevant blocks are selected from the non-adjacent areas shown in Figure 8, or from the non-adjacent areas shown in Figure 8. Related blocks are selected in adjacent areas and adjacent areas at the same time, and the relevant block selection positions can be preset.
  • the search range is that the abscissa is from x0-searchRange to x0+searchRange, and the ordinate is from y0-searchRange to y0+searchRange.
  • Search The condition is the encoded block, (x0, y0) is the coordinate of the upper left corner of the current block.
  • An encoded block is searched within a predetermined area as a related block of the current block. That is to say, the predetermined area may include a coded area or a bit-encoded area.
  • the correlation strength of the relevant block and the current block is the same or different.
  • the method further includes: configuring the weight of the relevant block according to the correlation between the relevant block and the current block; and determining the context model index parameters based on the weight of the relevant block and the reference information of the relevant block. For example, for adjacent blocks, the closer to the upper left corner of the current block, the stronger the correlation, and vice versa. For adjacent blocks and non-adjacent blocks, the closer the distance to the current block, the stronger the correlation, and vice versa. If the relevant block uses non-adjacent blocks, one method is to set different weights for the non-adjacent blocks. In this way, considering the strength of spatial correlation, the accuracy of context model selection can be further improved by setting the weight of relevant blocks.
  • the method further includes: configuring a weight of the relevant block based on a distance between the relevant block and the current block.
  • the distance can be horizontal distance, vertical distance, or linear distance.
  • the method further includes: configuring the weight of the relevant block based on the reference coordinates of the relevant block and the reference coordinates of the current block.
  • the method further includes: determining a first sub-region where the relevant block is located; wherein the first sub-region is at least one of at least two second sub-regions included in the predetermined region. ; Configure the weight of the relevant block based on the first sub-region where the relevant block is located.
  • the method further includes: dividing the predetermined area into at least two second sub-areas; and configuring the weight of each second sub-area.
  • configuring the weight of the relevant block based on the first sub-region where the relevant block is located includes: when the first sub-region contains more than two second sub-regions, fusing the weights of the second sub-regions Operation is performed to obtain the weight of the first sub-region; the weight of the relevant block is configured as the weight of the first sub-region.
  • the fusion operation can be a weighting operation, an averaging operation, etc.
  • configuring the weight of the relevant block based on the first sub-region where the relevant block is located includes: when the first sub-region contains a second sub-region, configuring the weight of the first region to the second sub-region.
  • the weight of the region configure the weight of the relevant block as the weight of the first sub-region. That is, the weight of the relevant block is configured as the weight of the second sub-region.
  • At least two concentric rings may be used to divide the predetermined area into at least two sub-areas.
  • the position information of each ring is preset, and based on the position information of the relevant block x, it is determined that the position information of the Li-th ring matches the position information of the relevant block x, and it is determined that the relevant block X is located in the Li-th ring.
  • the position information matches, which may be that the position information of the Li-th ring contains the position information of the relevant block x, or the distance between the Li-th ring and the relevant block x is less than a preset distance threshold.
  • Figure 9 is a schematic diagram 5 of the selection positions of relevant blocks in the embodiment of the present application.
  • 0 to 6 are adjacent blocks, and blocks with sequence numbers greater than 6 are non-adjacent blocks.
  • One way to locate these blocks is to configure the intervals of the concentric rings with the current block size as the interval length to set the position information of each ring.
  • the position information includes: the first abscissa and its corresponding ordinate value range, the second abscissa and its corresponding ordinate value range, the first ordinate and its corresponding abscissa value range, the second abscissa Coordinates and their corresponding abscissa value ranges.
  • the four sides of each ring are surrounded by two lines on the left and right, n*cbWidth from the current block, and two lines on the top and bottom, n*cbHeight from the current block.
  • block 9 in the figure is determined by coordinates (x0-cuWidth, y0-cuHeight).
  • the n corresponding to the first ring L1 is 1, and the n corresponding to the second ring L2 is 2.
  • Block 14 in the figure is determined by coordinates (x0-2*cuWidth, y0-2*cuHeight).
  • the weight of the 0th ring L0 is set to 1, that is, the weight of the adjacent block located in the 0th ring L0 is set to 1, the weight of the first ring L1 is set to 1/2, and the weight of the second ring L2 is set to 1/4, the weight of the third ring L3 is set to 1/8, the weight of the fourth ring L4 is set to 1/16, etc.
  • this is only an example of a weight setting method and is not intended to limit this application. In actual applications, different weights can also be set for the same ring, or the weights can be set based on video image characteristics.
  • selecting a plurality of coded related blocks corresponding to the current block from a predetermined area includes: based on the reference coordinates of the current block, determining the reference coordinates of the related blocks in the predetermined area. ; Based on the reference coordinates of the related block, obtain the reference information of the related block.
  • the method further includes: obtaining reference information of the relevant block based on a preset selection order and reference coordinates of the relevant block.
  • the reference coordinates are used to locate the current block and related blocks.
  • the reference coordinates can be at least one of the following: the upper left corner coordinates of the block, the lower left corner coordinates of the block, the upper right corner coordinates of the block, the lower right corner coordinates of the block, and the center coordinates of the block. wait.
  • the selection order is used to set the order in which multiple related blocks are selected. For example, the selection order can be radiating from the inside out with the current block as the center, or from left to right and top to bottom in the search area according to a certain search granularity. search.
  • More related blocks can be found using any of the above methods.
  • the encoded information of these related blocks is used to select a context model for the first syntax element of the current block.
  • Step 302 Determine the context model index parameter of the first syntax element of the current block based on the reference information of the multiple related blocks;
  • the value of the context model index (ctxIdx) is equal to the sum of the context model index increment (ctxInc) and the context model index offset (ctxIdxOffset). It can be thought that ctxIdxOffset first classifies the context models into different groups, while ctxInc selects a certain context model within the group.
  • the reference information of the related block is used to indicate the context model selected when encoding the first syntax element of the related block.
  • the reference information of the related block includes: a context model index reference amount of the first syntax element of the related block.
  • the reference information of the related block further includes: an available identifier of the related block. The available flag is used to indicate whether the context model index reference of the relevant block can be used to determine the context model index reference of the current block.
  • determining the context model index parameter of the first syntax element of the current block based on the reference information of the multiple related blocks includes: determining the context model index parameter corresponding to the first syntax element. shift amount; based on the reference information of the multiple related blocks, determine the context model index increment of the first syntax element of the current block; based on the context model index increment and the context model index offset, determine the context model index of the first syntax element; setting the context model index parameter equal to the context model index.
  • 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 can be understood as the context model corresponding to the first syntax element.
  • Each Each syntax element corresponds to two or more context models.
  • a matching context model is selected for the first syntax element of the current block based on the same syntax element of the related block.
  • the compression efficiency can be further improved by increasing the number of context models and selecting a more matching context model for the syntax elements.
  • VVC has 3 context models or a group has 3 context models, for the syntax elements pred_mode_flag[x0][y0] and non_inter_flag, VVC has 2 context models.
  • the method further includes: determining a first context model list used when selecting the context model of the first syntax element; setting the context model index parameter to the first context Index into the model list.
  • each context model list contains multiple context models.
  • Use ctxTable to represent the context model list used when selecting a context model, and use ctxIdx to index a certain one in the context model list.
  • Context model When multiple context model lists are preset to map context models, each context model list contains multiple context models.
  • Use ctxTable to represent the context model list used when selecting a context model, and use ctxIdx to index a certain one in the context model list.
  • ctxTable defines the syntax elements (syntax elements) encoded using the context model.
  • the corresponding syntax elements can be found in this table.
  • ctxTable is the minimum value of ctxIdx in the current initType in Table 1.
  • InitType is related to the slice type (I slice, P slice, B slice) and some flags, which will not be described here. It can be thought that ctxIdxOffset first classifies the context models into different groups, while ctxInc selects a certain context model within the group.
  • the index of the corresponding first context model list is Table 52 (Table52)
  • the index of the corresponding first context model list is Table 52 53 (Table 53).
  • Step 303 Encode the first syntax element of the current block based on the context model corresponding to the context model index parameter.
  • a syntax element may have one or more binary symbols (bin).
  • flag has only one binary symbol, because flag usually only has 2 options.
  • Each binary symbol may have one or more context models, which corresponds to one or more ctxIdx.
  • context models which corresponds to one or more ctxIdx.
  • the syntax elements of the relevant block refer to the encoded syntax elements of the relevant block. Since the encoding side includes encoding and decoding processes, the encoded syntax elements can also be understood as decoded syntax elements.
  • determining the context model index increment of the first syntax element of the current block based on the reference information of the multiple related blocks includes: determining based on the reference information of the multiple related blocks. A first intermediate quantity; convert the first intermediate quantity based on a preset conversion algorithm to obtain the context model index increment of the first syntax element of the current block.
  • the reference information of the related block includes: an available identifier of the first syntax element of the related block and a context model index reference amount, and based on the reference information of the multiple related blocks, the first The intermediate quantity includes: performing an AND operation on the available identifier of each relevant block and the context model index reference quantity to obtain an AND operation result; and obtaining the first intermediate quantity based on the AND operation result of each relevant block.
  • a preset conversion algorithm is used to convert the first intermediate variable into a matching context index increment.
  • the preset conversion algorithm includes one of the following: setting the first intermediate quantity equal to the context model index increment; dividing the first intermediate quantity by a first reference quantity to obtain the the context model index increment; shift the first intermediate quantity to the right by a second reference quantity to obtain the context model index increment; determine the first value range in which the first intermediate quantity is located, and move the first intermediate quantity to the right to obtain the context model index increment.
  • the index increment corresponding to the value range is used as the context model index increment.
  • the context model index reference quantity can be represented by the judgment condition for selecting the context model.
  • availableN is used to represent whether the Nth relevant block is available and the judgment condition
  • conditionN (abbreviated to condN) represents the judgment condition of the Nth related block corresponding to the first syntax element.
  • the first intermediate quantity (tempValue) is set.
  • the initialization of tempValue is set to 0.
  • the encoded syntax elements of the x-th relevant block are availablex and condx. 6. When using different numbers of related blocks, they can be replaced with corresponding values.
  • the current block coordinates (xCurr, yCurr) are set to (x0, y0), and the coordinates (xNbL, yNbL) of the adjacent block on the left are set to (x0-1, y0).
  • cIdx deduces whether the adjacent block on the left is available, and assigns the result to availableL.
  • AvailableL indicates whether the adjacent block on the left is available.
  • the coordinates (xNbA, yNbA) of the upper adjacent block are set to (x0, y0-1). According to (xNbA, yNbA), (x0, y0), cIdx deduces whether the upper adjacent block is available, and assigns the result to availableA. AvailableA indicates whether the upper adjacent block is available.
  • Table 2 defines the syntax elements of the left adjacent block and the upper adjacent block to determine the specification of ctxInc.
  • Table 2 defines the judgment conditions for each syntax element corresponding to the left adjacent block and the upper adjacent block. It should be noted that in the embodiment of the present application, in addition to using the left adjacent block and the upper adjacent block, other related blocks are also added, that is, a sufficient number of related blocks that have spatial correlation with the current block are used for context model selection. , it is necessary to add more judgment conditions (condN) of related blocks on the basis of Table 2. If it corresponds to multiple context model groups, it is also necessary to add the context model group index (ctxSetIdx).
  • the first syntax element is encoded, and after it is determined that the relevant block is available, the judgment condition of the relevant block is determined by looking up a table. After it is determined that the relevant block is unavailable, there is no need to obtain the judgment conditions of the relevant block.
  • ctxInc tempValue.
  • ctxInc tempValue>>M2, where >> represents right shift, because the cost of right shift in hardware implementation is much smaller than division.
  • THR0 and THR1 are thresholds.
  • the two thresholds are used to divide tempValue into three value ranges, namely tempValue ⁇ THR0, THR0 ⁇ tempValue ⁇ THR1, and THR1 ⁇ tempValue.
  • a threshold can be used to divide tempValue into two value ranges, or multiple thresholds can be used to subdivide tempValue into more value ranges.
  • the reference information of the related block includes: an available identifier and a context model index reference amount of the first syntax element of the related block,
  • Determining the first intermediate quantity based on the reference information of the multiple relevant blocks includes: obtaining the weights of the multiple relevant blocks; and performing an operation on the available identifier of each relevant block and the context model index reference quantity.
  • An AND operation is performed to obtain an AND operation result; a weighted operation is performed on the AND operation result of each correlation block based on the weights of the multiple correlation blocks; and the first intermediate quantity is obtained based on the weighted result of each correlation block.
  • the weighted results are summed to obtain the first intermediate quantity, the weighted results are ORed to obtain the first intermediate quantity, the weighted results are ANDed to obtain the first intermediate quantity, etc.
  • the first intermediate quantity (tempValue) is set.
  • N is 24, it can be changed to the corresponding value when using different numbers of blocks.
  • the weightx can be determined based on the position of the relevant block x. For example, as mentioned above, it can be determined by judging which ring the relevant block x is in.
  • the position information of each ring is preset, and based on the position information of the relevant block x, it is determined that the position information of the Lith ring matches the position information of the relevant block x, and it is determined that the relevant block X is located in the Lith ring.
  • the position information of the Li-th ring includes the position information of the relevant block x, it is determined that the relevant block Used to describe the coordinate information of the rectangular side.
  • the position information of each ring includes: the first abscissa and its corresponding ordinate value range, the second abscissa and its corresponding ordinate value range, the first ordinate and its corresponding value range.
  • ctxInc tempValue.
  • ctxInc tempValue>>M2, where >> represents right shift, because the cost of right shift in hardware implementation is much smaller than division.
  • THR0 and THR1 are thresholds.
  • the two thresholds are used to divide tempValue into three value ranges, namely tempValue ⁇ THR0, THR0 ⁇ tempValue ⁇ THR1, and THR1 ⁇ tempValue.
  • a threshold can be used to divide tempValue into two value ranges, or multiple thresholds can be used to subdivide tempValue into more value ranges.
  • the context model index increment of the first syntax element of the current block is determined based on the reference information of the multiple related blocks.
  • the method 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. ; Convert the first intermediate quantity based on a preset conversion algorithm to obtain a third intermediate quantity; Obtain the context model of the first syntax element of the current block based on the second intermediate quantity and the third intermediate quantity Index increment.
  • a grammar element can directly correspond to one or more context models, or it can correspond to one or more context model groups, and each context model group includes multiple context models.
  • the third intermediate quantity is used to index a context model in a certain context model group. Therefore, the second intermediate quantity also needs to be determined based on the context model group index and the number of context models.
  • the second intermediate quantity serves as the offset of the context model group and is used to index the first context model in the context model group.
  • the second intermediate quantity and the third intermediate quantity are added to the context model index increment to determine a context model.
  • ctxInc+ ctxSetIdx*P
  • ctxSetIdx is the index of the context model group
  • ctxSetIdx can be 0, 1, 2, 3, etc.
  • P is the context model number in the context model group. Number, P can be 2, 3, 4, 5, etc.
  • VVC has 3 context model groups, and one group has 3 context models.
  • CABAC CABAC in VVC as an example to introduce.
  • the processing process of CABAC mainly includes binarization, context modeling and binary arithmetic coding.
  • binarization refers to binary processing of the input non-binary syntax element value and uniquely converts it into a binary sequence (i.e., binary string);
  • context modeling refers to processing each bit in the binary string according to the context.
  • Information (for example, the coding information in the reconstructed area around the corresponding node of the syntax element) determines the context model of the bit;
  • binary arithmetic coding refers to encoding the corresponding bit according to the probability value in the context model, and based on the bit's Value updates the probability value in the context model.
  • the embodiment of the present application is used to select the context model of each bit in the binary string of the first syntax element, and determine the corresponding context model according to the determined context model index.
  • the parameters of the context model are used as input to invoke the arithmetic decoding process of binary symbols.
  • the input of the arithmetic decoding process of binary symbols is the parameters of the context model (ctxTable and ctxIdx) the bypass decoding flag (bypassFlag) and the state variables ivlCurrRange and ivlOffset of the arithmetic decoding engine.
  • the output of this process is the value of this binary symbol (bin).
  • Figure 10 shows the entire arithmetic decoding process of a binary symbol in the embodiment of the present application.
  • ctxTable, ctxIdx, bypassFlag are transferred as input to the decoded binary symbol part DecodeBin(ctxTable, ctxIdx, bypassFlag), as follows:
  • bypassFlag If the value of bypassFlag is 1, call bypass decoding DecodeBypass();
  • bypassFlag is 0. If the value of bypassFlag is 0, the value of ctxTable is 0, and the value of ctxIdx is 0, call DecodeTerminate() to terminate decoding;
  • Figure 11 shows the decoding decision process of a binary symbol in the embodiment of the present application.
  • the input of the decoding decision DecodeDecision (ctxTable, ctxIdx) process is the variables ctxTable, ctxIdx, ivlCurrRange, and ivlOffset.
  • the output of this process is the decoded value binVal, updated The following variables ivlCurrRange and ivlOffset.
  • variable ivlLpsRange is derived as follows:
  • variable qRangeIdx Given the current value of ivlCurrRange, the variable qRangeIdx is derived as follows:
  • valMps and ivlLpsRange are exported as follows:
  • ivlLpsRange (qRangeIdx*((valMps?32767-pState:pState)>>9)>>1)+4
  • variable binVal 1–valMps
  • ivlOffset is minus or equal to ivlCurrRange
  • the value of ivlCurrRange is ivlLpsRange
  • variable binVal is valMps
  • State transition (state transition) process the input of this process is the current pStateIdx0 and pStateIdx1, and the solved value binVal.
  • the output of this process is the updated ctxTable and the context variables pStateIdx0 and pStateIdx1 corresponding to ctxIdx.
  • shift0 and shift1 are derived from shiftIdx, and shiftIdx is determined by the corresponding relationship between shiftIdx, ctxTable, and ctxIdx.
  • pStateIdx0 pStateIdx0-(pStateIdx0>>shift0)+(1023*binVal>>shift0)
  • pStateIdx1 pStateIdx1-(pStateIdx1>>shift1)+(16383*binVal>>shift1)
  • Figure 12 shows the renormalization process in the embodiment of the present application.
  • the input of this process is the bits in the slice data and the variables ivlCurrRange and ivlOffset.
  • the output of this process is the updated variables ivlCurrRange and ivlOffset.
  • the data in the code stream during the entire process should not cause ivlOffset to be greater than or equal to ivlCurrRange.
  • Figure 13 shows the DecodeBypass() process of bypass decoding a binary symbol in the embodiment of the present application.
  • the input of this process is the bits of the slice data, the variables ivlCurrRange and ivlOffset, and the output of this process is the updated variable ivlOffset and the extracted value binVal. .
  • bypassFlag When bypassFlag is 1, the bypass decoding process is called.
  • the bypass decoding process is as follows:
  • ivlOffset is greater than or equal to ivlCurrRange, the value of binVal is set to 1, and ivlOffset is minus ivlCurrRange.
  • the data in the code stream during the entire process should not cause ivlOffset to be greater than or equal to ivlCurrRange.
  • Figure 14 shows the DecodeTerminate() process of terminating decoding in the embodiment of the present application.
  • the input of this process is the bits in the slice data and the variables ivlCurrRange and ivlOffsel.
  • the output of this process is the updated ivlCurrRange and ivlOffsel, and the solved value binVal.
  • ivlOffset is greater than or equal to ivlCurrRange, the value of binVal is set to 1.
  • Figure 15 is a schematic flow chart of the decoding method provided by the embodiment of the present application. It is applied to the decoder. As shown in Figure 15, the method includes:
  • Step 1501 Decode the code stream and obtain the information to be decoded of the first syntax element of the current block;
  • Step 1502 Select a plurality of decoded related blocks corresponding to the current block from a predetermined area; wherein the predetermined area includes an area that is relevant to the current block;
  • multiple related blocks refer to at least three related blocks.
  • the related blocks can be understood as image blocks that are spatially relevant to the current block and are used to determine the context model of the syntax element of the current block.
  • the decoded relevant block can also be understood as a reconstructed block reconstructed by the decoding end.
  • FIG 4 is a schematic diagram of the selection position of the relevant block in the embodiment of the present application. As shown in Figure 4, the relevant block is the left adjacent block of the current block, the upper adjacent block and the upper left adjacent block. The size of the relevant block and the current block consistent.
  • Figure 5 is a second schematic diagram of the selection position of the relevant block in the embodiment of the present application. As shown in Figure 5, the relevant block is the left adjacent block of the current block, the upper adjacent block and the upper left adjacent block. The size of the relevant block and the current block Inconsistent.
  • the predetermined area includes an adjacent area of the current block and/or a non-adjacent area of the current block; when the predetermined area includes an adjacent area of the current block, the correlation Blocks include adjacent blocks of the current block; when the predetermined area includes non-adjacent areas of the current block, the relevant blocks include non-adjacent blocks of the current block. It should be noted that not only adjacent blocks are spatially correlated with the current block, but non-adjacent blocks that are close to each other are also spatially correlated with the current block. It is also easy to understand, the content within the predetermined area is relevant.
  • multiple adjacent blocks may be selected as relevant blocks of the current block
  • multiple non-adjacent blocks may be selected as relevant blocks of the current block
  • multiple adjacent blocks and non-adjacent blocks may be selected as relevant blocks of the current block. piece. As shown in Figure 6- Figure 8.
  • the correlation strength of the relevant block and the current block is the same or different.
  • the method further includes: configuring the weight of the relevant block according to the correlation between the relevant block and the current block; and determining the context model index parameters based on the weight of the relevant block and the reference information of the relevant block. For example, for adjacent blocks, the closer to the upper left corner of the current block, the stronger the correlation, and vice versa. For adjacent blocks and non-adjacent blocks, the closer the distance to the current block, the stronger the correlation, and vice versa. If the relevant block uses non-adjacent blocks, one method is to set different weights for the non-adjacent blocks. In this way, considering the strength of spatial correlation, the accuracy of context model selection can be further improved by setting the weight of relevant blocks.
  • the method further includes: configuring a weight of the relevant block based on a distance between the relevant block and the current block.
  • the distance can be horizontal distance, vertical distance, or linear distance.
  • the method further includes: configuring the weight of the relevant block based on the reference coordinates of the relevant block and the reference coordinates of the current block.
  • the method further includes: determining a first sub-region where the relevant block is located; wherein the first sub-region is at least one of at least two second sub-regions included in the predetermined region. ; Configure the weight of the relevant block based on the first sub-region where the relevant block is located.
  • the method further includes: dividing the predetermined area into at least two second sub-areas; and configuring the weight of each second sub-area.
  • configuring the weight of the relevant block based on the first sub-region where the relevant block is located includes: when the first sub-region contains more than two second sub-regions, fusing the weights of the second sub-regions Operation is performed to obtain the weight of the first sub-region; the weight of the relevant block is configured as the weight of the first sub-region.
  • the fusion operation can be a weighting operation, an averaging operation, etc.
  • configuring the weight of the relevant block based on the first sub-region where the relevant block is located includes: when the first sub-region contains a second sub-region, configuring the weight of the first region to the second sub-region.
  • the weight of the region configure the weight of the relevant block as the weight of the first sub-region. That is, the weight of the relevant block is configured as the weight of the second sub-region.
  • At least two concentric rings may be used to divide the predetermined area into at least two sub-areas.
  • the position information of each ring is preset, and based on the position information of the relevant block x, it is determined that the position information of the Li-th ring matches the position information of the relevant block x, and it is determined that the relevant block X is located in the Li-th ring.
  • the position information matches, which may be that the position information of the Li-th ring contains the position information of the relevant block x, or the distance between the Li-th ring and the relevant block x is less than a preset distance threshold.
  • Figure 9 is a schematic diagram 5 of the selection positions of relevant blocks in the embodiment of the present application.
  • 0 to 6 are adjacent blocks, and blocks with sequence numbers greater than 6 are non-adjacent blocks.
  • One way to locate these blocks is to configure the intervals of the concentric rings with the current block size as the interval length to set the position information of each ring.
  • the position information includes: the first abscissa and its corresponding ordinate value range, the second abscissa and its corresponding ordinate value range, the first ordinate and its corresponding abscissa value range, the second abscissa Coordinates and their corresponding abscissa value ranges.
  • the four sides of each ring are surrounded by two lines on the left and right that are n*cbWidth from the current block, and two lines that are n*cbHeight on the top and bottom of the current block.
  • block 9 in the figure is determined by coordinates (x0-cuWidth, y0-cuHeight).
  • the n corresponding to the first ring L1 is 1, and the n corresponding to the second ring L2 is 2.
  • Block 14 in the figure is determined by coordinates (x0-2*cuWidth, y0-2*cuHeight).
  • the weight of the 0th ring L0 is set to 1, that is, the weight of the adjacent block located in the 0th ring L0 is set to 1, the weight of the first ring L1 is set to 1/2, and the weight of the second ring L2 is set to 1/4, the weight of the third ring L3 is set to 1/8, the weight of the fourth ring L4 is set to 1/16, etc.
  • this is only an example of a weight setting method and is not intended to limit this application. In actual applications, different weights can also be set for the same ring, or the weights can be set based on video image characteristics.
  • selecting a plurality of decoded related blocks corresponding to the current block from a predetermined area includes: based on the reference coordinates of the current block, determining the reference coordinates of the related blocks in the predetermined area. ; Based on the reference coordinates of the related block, obtain the reference information of the related block.
  • the method further includes: obtaining reference information of the relevant block based on a preset selection order and reference coordinates of the relevant block.
  • the reference coordinates are used to locate the current block and related blocks.
  • the reference coordinates can be at least one of the following: the upper left corner coordinates of the block, the lower left corner coordinates of the block, the upper right corner coordinates of the block, the lower right corner coordinates of the block, and the center coordinates of the block. wait.
  • the selection order is used to set the order in which multiple related blocks are selected. For example, the selection order can be radiating from the inside out with the current block as the center, or from left to right and top to bottom in the search area according to a certain search granularity. search.
  • Step 1503 Determine the context model index parameter of the first syntax element of the current block based on the reference information of the multiple related blocks;
  • the value of the context model index (ctxIdx) is equal to the sum of the context model index increment (ctxInc) and the context model index offset (ctxIdxOffset). It can be thought that ctxIdxOffset first classifies the context models into different groups, while ctxInc selects a certain context model within the group.
  • the reference information of the related block is used to indicate the context model selected when encoding the first syntax element of the related block.
  • the reference information of the related block includes: a context model index reference amount of the first syntax element of the related block.
  • the reference information of the related block further includes: an available identifier of the related block. The available flag is used to indicate whether the context model index reference of the relevant block can be used to determine the context model index reference of the current block.
  • determining the context model index parameter of the first syntax element of the current block based on the reference information of the multiple related blocks includes: determining the context model index parameter corresponding to the first syntax element. shift amount; based on the reference information of the multiple related blocks, determine the context model index increment of the first syntax element of the current block; based on the context model index increment and the context model index offset, determine the context model index of the first syntax element; setting the context model index parameter equal to the context model index.
  • 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 can be understood as the context model corresponding to the first syntax element.
  • Each Each syntax element corresponds to two or more context models.
  • a matching context model is selected for the first syntax element of the current block based on the same syntax element of the related block.
  • the compression efficiency can be further improved by increasing the number of context models and selecting a more matching context model for the syntax elements.
  • VVC has 3 context models or a group has 3 context models, for the syntax elements pred_mode_flag[x0][y0] and non_inter_flag, VVC has 2 context models.
  • the method further includes: determining a first context model list used when selecting the context model of the first syntax element; setting the context model index parameter to the first context Index into the model list.
  • each context model list contains multiple context models.
  • Use ctxTable to represent the context model list used when selecting a context model, and use ctxIdx to index a certain one in the context model list.
  • Context model When multiple context model lists are preset to map context models, each context model list contains multiple context models.
  • Use ctxTable to represent the context model list used when selecting a context model, and use ctxIdx to index a certain one in the context model list.
  • ctxTable defines the syntax elements (syntax elements) encoded using the context model.
  • the corresponding syntax elements can be found in this table.
  • ctxTable is the minimum value of ctxIdx in the current initType in Table 1.
  • InitType is related to the slice type (I slice, P slice, B slice) and some flags, which will not be described here. It can be thought that ctxIdxOffset first classifies the context models into different groups, while ctxInc selects a certain context model within the group.
  • Step 1504 Decode the information to be decoded based on the context model corresponding to the context model index parameter to obtain the first syntax element of the current block.
  • a syntax element may have one or more binary symbols (bin).
  • flag has only one binary symbol, because flag usually only has 2 options.
  • Each binary symbol may have one or more context models, which corresponds to one or more ctxIdx.
  • context models which corresponds to one or more ctxIdx.
  • determining the context model index increment of the first syntax element of the current block based on the reference information of the multiple related blocks includes: determining based on the reference information of the multiple related blocks. A first intermediate quantity; convert the first intermediate quantity based on a preset conversion algorithm to obtain the context model index increment of the first syntax element of the current block.
  • the reference information of the related block includes: an available identifier of the first syntax element of the related block and a context model index reference amount, and based on the reference information of the multiple related blocks, the first The intermediate quantity includes: performing an AND operation on the available identifier of each relevant block and the context model index reference quantity to obtain an AND operation result; and obtaining the first intermediate quantity based on the AND operation result of each relevant block.
  • a preset conversion algorithm is used to convert the first intermediate variable into a matching context index increment.
  • the preset conversion algorithm includes one of the following: setting the first intermediate quantity equal to the context model index increment; dividing the first intermediate quantity by a first reference quantity to obtain the the context model index increment; shift the first intermediate quantity to the right by a second reference quantity to obtain the context model index increment; determine the first value range in which the first intermediate quantity is located, and move the first intermediate quantity to the right to obtain the context model index increment.
  • the index increment corresponding to the value range is used as the context model index increment.
  • the context model index reference quantity can be represented by the judgment condition for selecting the context model.
  • availableN is used to represent whether the Nth relevant block is available and the judgment condition
  • conditionN (abbreviated to condN) represents the judgment condition of the Nth related block corresponding to the first syntax element.
  • the first intermediate quantity (tempValue) is set.
  • the initialization of tempValue is set to 0.
  • the decoded syntax elements of the xth relevant block are availablex and condx. 6. When using different numbers of related blocks, they can be replaced with corresponding values.
  • the current block coordinates (xCurr, yCurr) are set to (x0, y0), and the coordinates (xNbL, yNbL) of the adjacent block on the left are set to (x0-1, y0).
  • cIdx deduces whether the adjacent block on the left is available, and assigns the result to availableL.
  • AvailableL indicates whether the adjacent block on the left is available.
  • the coordinates (xNbA, yNbA) of the upper adjacent block are set to (x0, y0-1). According to (xNbA, yNbA), (x0, y0), cIdx deduces whether the upper adjacent block is available, and assigns the result to availableA. AvailableA indicates whether the upper adjacent block is available.
  • ctxInc tempValue.
  • ctxInc tempValue>>M2, where >> represents right shift, because the cost of right shift in hardware implementation is much smaller than division.
  • THR0 and THR1 are thresholds.
  • the two thresholds are used to divide tempValue into three value ranges, namely tempValue ⁇ THR0, THR0 ⁇ tempValue ⁇ THR1, and THR1 ⁇ tempValue.
  • a threshold can be used to divide tempValue into two value ranges, or multiple thresholds can be used to subdivide tempValue into more value ranges.
  • the context model increment can be 0, 1, 2, 3,...etc.
  • the reference information of the related block includes: an available identifier and a context model index reference amount of the first syntax element of the related block,
  • Determining the first intermediate quantity based on the reference information of the multiple relevant blocks includes: obtaining the weights of the multiple relevant blocks; and performing an operation on the available identifier of each relevant block and the context model index reference quantity.
  • An AND operation is performed to obtain an AND operation result; a weighted operation is performed on the AND operation result of each correlation block based on the weights of the multiple correlation blocks; and the first intermediate quantity is obtained based on the weighted result of each correlation block.
  • the weighted results are summed to obtain the first intermediate quantity, the weighted results are ORed to obtain the first intermediate quantity, the weighted results are ANDed to obtain the first intermediate quantity, etc.
  • the first intermediate quantity (tempValue) is set.
  • N is 24, it can be changed to the corresponding value when using different numbers of blocks.
  • the weightx can be determined based on the position of the relevant block x. For example, as mentioned above, it can be determined by judging which ring the relevant block x is in.
  • ctxInc tempValue.
  • ctxInc tempValue>>M2, where >> represents right shift, because the cost of right shift in hardware implementation is much smaller than division.
  • THR0 and THR1 are thresholds.
  • the two thresholds are used to divide tempValue into three value ranges, namely tempValue ⁇ THR0, THR0 ⁇ tempValue ⁇ THR1, and THR1 ⁇ tempValue.
  • a threshold can be used to divide tempValue into two value ranges, or multiple thresholds can be used to subdivide tempValue into more value ranges.
  • the context model index increment of the first syntax element of the current block is determined based on the reference information of the multiple related blocks.
  • the method 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. ; Convert the first intermediate quantity based on a preset conversion algorithm to obtain a third intermediate quantity; Obtain the context model of the first syntax element of the current block based on the second intermediate quantity and the third intermediate quantity Index increment.
  • a grammar element can directly correspond to one or more context models, or it can correspond to one or more context model groups, and each context model group includes multiple context models.
  • the third intermediate quantity is used to index a context model in a certain context model group. Therefore, the second intermediate quantity also needs to be determined based on the context model group index and the number of context models.
  • the second intermediate quantity serves as the offset of the context model group and is used to index the first context model in the context model group.
  • the second intermediate quantity and the third intermediate quantity are added to the context model index increment to determine a context model.
  • ctxInc+ ctxSetIdx*P
  • ctxSetIdx is the index of the context model group
  • ctxSetIdx can be 0, 1, 2, 3, etc.
  • P is the context model number in the context model group. Number, P can be 2, 3, 4, 5, etc.
  • VVC has 3 context model groups, and one group has 3 context models.
  • the embodiment of the present application also provides an encoder.
  • the encoder 160 includes:
  • the first selection unit 1601 is used to select a plurality of coded relevant blocks corresponding to the current block from a predetermined area; wherein the predetermined area includes an area that is relevant to the current block;
  • the first determining unit 1602 is configured to determine the context model index parameter of the first syntax element of the current block based on the reference information of the multiple related blocks;
  • Encoding unit 1603 configured to encode the first syntax element of the current block based on the context model corresponding to the context model index parameter.
  • the predetermined area includes an adjacent area of the current block and/or a non-adjacent area of the current block; when the predetermined area includes an adjacent area of the current block, the correlation Blocks include adjacent blocks of the current block; when the predetermined area includes non-adjacent areas of the current block, the relevant blocks include non-adjacent blocks of the current block. It should be noted that not only adjacent blocks are spatially correlated with the current block, but non-adjacent blocks that are close to each other are also spatially correlated with the current block. It is also easy to understand, the content within the predetermined area is relevant.
  • the encoder further includes: a setting unit configured to configure a weight of the relevant block based on a distance between the relevant block and the current block.
  • a setting unit is configured to configure the weight of the relevant block based on the reference coordinates of the relevant block and the reference coordinates of the current block.
  • a unit is configured to determine the first sub-region where the relevant block is located; wherein the first sub-region is at least one of at least two second sub-regions included in the predetermined region; The weight of the relevant block is configured based on the first sub-region where the relevant block is located.
  • the predetermined area may include an adjacent area of the current block and a non-adjacent area of the current block. In this way, considering the strength of spatial correlation, the accuracy of context model selection can be further improved by setting the weight of relevant blocks.
  • the first selection unit 1601 is configured to determine the reference coordinates of the relevant block in the predetermined area based on the reference coordinates of the current block; based on the reference coordinates of the relevant block, obtain Reference information of the relevant block.
  • the first selection unit 1601 is configured to obtain reference information of the relevant block based on a preset selection order and the reference coordinates of the relevant block.
  • the reference information of the related block includes: a context model index reference amount of the first syntax element of the related block.
  • the reference information of the related block further includes: an available identifier of the related block.
  • the first determining unit 1602 is used to determine the context model index offset corresponding to the first syntax element; based on the reference information of the multiple related blocks, determine the th of the current block.
  • a context model index increment of a syntax element; determining the context model index of the first syntax element based on the context model index increment and the context model index offset; setting the context model index parameters is equal to the context model index.
  • the first determining unit 1602 is configured to determine a first intermediate quantity based on the reference information of the multiple related blocks; convert the first intermediate quantity based on a preset conversion algorithm to obtain the Describes the increment of the context model index of the first syntax element of the current block.
  • the first determining unit 1602 when the first syntax element corresponds to multiple context model groups, is configured to determine a first intermediate quantity based on the reference information of the multiple related blocks; based on the The context model group index corresponding to the first syntax element and the number of context models in each context model group determine the second intermediate quantity; convert the first intermediate quantity based on the preset conversion algorithm to obtain the third intermediate quantity; Based on the second intermediate quantity and the third intermediate quantity, a context model index increment of the first syntax element of the current block is obtained.
  • the reference information of the related block includes: an available identifier of the first syntax element of the related block and a context model index reference quantity, and the first determining unit 1602 is used to determine the reference information of each related block.
  • An AND operation is performed on the available identifier and the context model index reference quantity to obtain an AND operation result; based on the AND operation result of each relevant block, the first intermediate quantity is obtained.
  • the reference information of the related block includes: an available identifier of the first syntax element of the related block and a context model index reference amount, and the first determining unit 1602 is used to obtain the multiple related blocks.
  • the preset conversion algorithm includes one of the following: setting the first intermediate quantity equal to the context model index increment; dividing the first intermediate quantity by a first reference quantity to obtain the the context model index increment; shift the first intermediate quantity to the right by a second reference quantity to obtain the context model index increment; determine the first value range in which the first intermediate quantity is located, and move the first intermediate quantity to the right to obtain the context model index increment.
  • the index increment corresponding to the value range is used as the context model index increment.
  • the first determining unit 1602 is configured to determine the first context model list used when selecting the context model of the first syntax element; set the context model index parameter to the first Index into the context model list.
  • Figure 17 is a schematic structural diagram of the second structure of the encoder in the embodiment of the present application.
  • the encoder 170 includes:
  • Figure 18 is a schematic structural diagram of the first component of the decoder in the embodiment of the present application. As shown in Figure 18, the decoder 180 includes:
  • the first decoding unit 1801 is used to decode the code stream and obtain the information to be decoded of the first syntax element of the current block;
  • the second selection unit 1802 is used to select a plurality of decoded related blocks corresponding to the current block from a predetermined area; wherein the predetermined area includes an area that is relevant to the current block;
  • the second determination unit 1803 is configured to determine the context model index parameter of the first syntax element of the current block based on the reference information of the multiple related blocks;
  • the second decoding unit 1804 is configured to decode the information to be decoded based on the context model corresponding to the context model index parameter to obtain the first syntax element of the current block.
  • the predetermined area includes an adjacent area of the current block and/or a non-adjacent area of the current block; when the predetermined area includes an adjacent area of the current block, the correlation Blocks include adjacent blocks of the current block; when the predetermined area includes non-adjacent areas of the current block, the relevant blocks include non-adjacent blocks of the current block. It should be noted that not only adjacent blocks are spatially correlated with the current block, but non-adjacent blocks that are close to each other are also spatially correlated with the current block. It is also easy to understand, the content within the predetermined area is relevant.
  • the decoder further includes: a setting unit configured to configure a weight of the relevant block based on a distance between the relevant block and the current block.
  • a setting unit is configured to configure the weight of the relevant block based on the reference coordinates of the relevant block and the reference coordinates of the current block.
  • a unit is configured to determine the first sub-region where the relevant block is located; wherein the first sub-region is at least one of at least two second sub-regions included in the predetermined region; The weight of the relevant block is configured based on the first sub-region where the relevant block is located.
  • the predetermined area may include an adjacent area of the current block and a non-adjacent area of the current block. In this way, considering the strength of spatial correlation, the accuracy of context model selection can be further improved by setting the weight of relevant blocks.
  • the second selection unit 1802 is configured to determine the reference coordinates of the relevant block in the predetermined area based on the reference coordinates of the current block; based on the reference coordinates of the relevant block, obtain the Reference information for related blocks.
  • the second selection unit 1802 is configured to obtain the reference information of the relevant block based on the preset selection order and the reference coordinates of the relevant block.
  • the reference information of the related block includes: a context model index reference amount of the first syntax element of the related block.
  • the reference information of the related block further includes: an available identifier of the related block.
  • the second determination unit 1803 is used to determine the context model index offset corresponding to the first syntax element; and determine the first syntax of the current block based on the reference information of the multiple related blocks. a context model index increment of the element; determining the context model index of 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 second determination unit 1803 is configured to determine a first intermediate quantity based on the reference information of the multiple related blocks; convert the first intermediate quantity based on a preset conversion algorithm to obtain the current Increment of the context model index of the first syntax element of the block.
  • the second determination unit 1803 is configured to determine the first intermediate quantity based on the reference information of the multiple related blocks; based on the first The context model group index corresponding to the syntax element and the number of context models in each context model group determine the second intermediate quantity; the first intermediate quantity is converted based on the preset conversion algorithm to obtain the third intermediate quantity; based on the The second intermediate quantity and the third intermediate quantity are used to obtain the context model index increment of the first syntax element of the current block.
  • the reference information of the related block includes: an available identifier of the first syntax element of the related block and a context model index reference amount.
  • the second determining unit 1803 is used to determine the reference information of each related block.
  • An AND operation can be performed with the identifier and the context model index reference quantity to obtain an AND operation result; based on the AND operation result of each relevant block, the first intermediate quantity is obtained.
  • the reference information of the related block includes: an available identifier of the first syntax element of the related block and a context model index reference amount.
  • the second determination unit 1803 is used to obtain the reference information of the multiple related blocks. Weight; performing an AND operation on the available identifier of each relevant block and the context model index reference quantity to obtain an AND operation result; performing a weighted operation on the AND operation result of each relevant block based on the weights of the multiple relevant blocks ; Based on the weighted result of each relevant block, the first intermediate quantity is obtained.
  • the preset conversion algorithm includes one of the following: setting the first intermediate quantity equal to the context model index increment; dividing the first intermediate quantity by a first reference quantity to obtain the the context model index increment; shift the first intermediate quantity to the right by a second reference quantity to obtain the context model index increment; determine the first value range in which the first intermediate quantity is located, and move the first intermediate quantity to the right to obtain the context model index increment.
  • the index increment corresponding to the value range is used as the context model index increment.
  • the second determining unit 1803 is configured to determine the first context model list used when selecting the context model of the first syntax element; set the context model index parameter to the first context model The index of the list.
  • Figure 19 is a schematic structural diagram of the second structure of the decoder in the embodiment of the present application.
  • the decoder 190 includes:
  • each functional module in this embodiment can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit.
  • the above integrated units can be implemented in the form of hardware or software function modules.
  • embodiments of the present application provide a storage medium on which a computer program is stored.
  • the computer program is executed by the first processor, the encoding method of the encoder is implemented; or, the computer program is executed by the second processor.
  • the decoding method of the decoder When, implement the decoding method of the decoder.
  • the present application provides a coding and decoding method, an encoder, a decoder and a storage medium, including: selecting a plurality of coded related blocks corresponding to the current block from a predetermined area; wherein the predetermined area includes the current block A region with correlation; determining a context model index parameter of the first syntax element of the current block based on the reference information of the multiple related blocks; encoding the context model of the current block based on the context model index parameter corresponding to the context model index parameter.
  • the first grammatical element including: selecting a plurality of coded related blocks corresponding to the current block from a predetermined area; wherein the predetermined area includes the current block A region with correlation; determining a context model index parameter of the first syntax element of the current block based on the reference information of the multiple related blocks; encoding the context model of the current block based on the context model index parameter corresponding to the context model index parameter.
  • the spatial correlation of the image blocks is fully utilized, and a more suitable context model can be matched for the first syntax element of the current block, thereby improving the syntax elements.
  • the compression efficiency is improved, thereby improving the compression efficiency of the entire system.

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

本申请公开了一种编解码方法、编码器、解码器及存储介质,包括:从预定区域内选取当前块对应的已编码的多个相关块;其中,所述预定区域包括与所述当前块具备相关性的区域;基于所述多个相关块的参考信息,确定所述当前块的第一语法元素的上下文模型索引参数;基于所述上下文模型索引参数对应的上下文模型编码所述当前块的第一语法元素。这样,通过设置较大的预定区域为当前块选择更多相关块,充分利用了图像块在空间上的相关性,能够为当前块的第一语法元素匹配到更适合的上下文模型,提高语法元素的压缩效率,进而提高整个系统的压缩效率。。

Description

一种编解码方法、编码器、解码器及存储介质 技术领域
本申请涉及视频图像处理技术领域,尤其涉及一种编解码方法、编码器、解码器及存储介质。
背景技术
基于上下文自适应的二进制算术编码(Context-based Adaptive Binary Arithmetic Coding,CABAC)是一种常用的熵编码(entropy coding)方法,高效率视频编码(High Efficiency Video Coding,HEVC)和多功能视频编码(Versatile Video Coding,VVC)等都使用CABAC进行熵编码,CABAC用于对语法元素进行熵编码/熵解码处理。
CABAC使用上下文模型可以提升压缩效率,随着压缩效率的需求不断提高,各种新的预测模式,变换模式等被加入,随之而来的是更多的语法元素用来控制这些模式的选择等,以至于码流中,用于控制各种模式的语法元素所占的比例越来越高,所以为了更进一步提升整个系统的压缩效率,提高语法元素的压缩效率变得越来越重要。
发明内容
为解决上述技术问题,本申请实施例提供了一种编解码方法、编码器、解码器及存储介质,能够为当前块的第一语法元素匹配到更适合的上下文模型,提高语法元素的压缩效率。
第一方面,本申请实施例提供了一种编码方法,应用于编码器,包括:
从预定区域内选取当前块对应的已编码的多个相关块;其中,所述预定区域包括与所述当前块具备相关性的区域;
基于所述多个相关块的参考信息,确定所述当前块的第一语法元素的上下文模型索引参数;
基于所述上下文模型索引参数对应的上下文模型编码所述当前块的第一语法元素。
第二方面,本申请实施例提供了一种解码方法,应用于解码器,包括:
解码码流,获取当前块的第一语法元素的待解码信息;
从预定区域内选取所述当前块对应的已解码的多个相关块;其中,所述预定区域包括与所述当前块具备相关性的区域;
基于所述多个相关块的参考信息,确定所述当前块的第一语法元素的上下文模型索引参数;
基于所述上下文模型索引参数对应的上下文模型解码所述待解码信息,得到所述当前块的第一语法元素。
第三方面,本申请实施例提供了一种编码器,包括:
第一选取单元,用于从预定区域内选取当前块对应的已编码的多个相关块;其中,所述预定区域包括与所述当前块具备相关性的区域;
第一确定单元,用于基于所述多个相关块的参考信息,确定所述当前块的第一语法元素的上下文模型索引参数;
编码单元,用于基于所述上下文模型索引参数对应的上下文模型编码所述当前块的第一语法元素。
第四方面,本申请实施例提供了一种解码器,其中,所述解码器包括:
第一解码单元,用于解码码流,获取当前块的第一语法元素的待解码信息;
第二选取单元,用于从预定区域内选取所述当前块对应的已解码的多个相关块;其中,所述预定区域包括与所述当前块具备相关性的区域;
第二确定单元,用于基于所述多个相关块的参考信息,确定所述当前块的第一语法元素的上下文模型索引参数;
第二解码单元,用于基于所述上下文模型索引参数对应的上下文模型解码所述待解码信息,得到所述当前块的第一语法元素。
第五方面,本申请实施例还提供了一种编码器,包括:第一存储器和第一处理器;所述第一存储器存储有可在第一处理器上运行的计算机程序,所述第一处理器执行所述程序时实现编码器的所述编码方法。
第六方面,本申请实施例还提供了一种解码器,包括:第二存储器和第二处理器;所述第二存储器存储有可在第二处理器上运行的计算机程序,所述第二处理器执行所述程序时实现解码器的所述解码方法。
第七方面,本申请实施例提供了一种存储介质,包括:其上存储有计算机程序,该计算机程序被第一处理器执行时,实现编码器的所述编码方法;或者,该计算机程序被第二处理器执行时,实现解码器的所述解码方法。
本申请实施例通过设置较大的预定区域为当前块选择更多相关块,充分利用了图像块在空间上的相关性,能够为当前块的第一语法元素匹配到更适合的上下文模型,提高语法元素的压缩效率,进而提高整个系统的压缩效率。
附图说明
图1为一种视频编码系统;
图2为一种视频解码系统;
图3为本申请实施例提供的编码方法的流程示意图;
图4为本申请实施例中相关块的选择位置示意图一;
图5为本申请实施例中相关块的选择位置示意图二;
图6为本申请实施例中相关块的选择位置示意图三;
图7为本申请实施例中相关块的选择位置示意图四;
图8为本申请实施例中相关块的选择位置示意图五;
图9为本申请实施例中相关块的选择位置示意图六;
图10为本申请实施例中一个二元符号的整个算数解码过程;
图11为本申请实施例中一个二元符号的解码决策过程;
图12为本申请实施例中重归一化过程;
图13为本申请实施例中一个二元符号的旁路解码过程;
图14为本申请实施例中终止解码过程;
图15为本申请实施例提供的解码方法的流程示意图;
图16为本申请实施例提供的编码器的第一组成结构示意图;
图17为本申请实施例提供的编码器的第二组成结构示意图;
图18为本申请实施例提供的解码器的第一组成结构示意图;
图19为本申请实施例提供的解码器的第二组成结构示意图。
具体实施方式
为了能够更加详尽地了解本申请实施例的特点与技术内容,下面结合附图对本申请实施例的实现进行详细阐述,所附附图仅供参考说明之用,并非用来限定本申请实施例。
目前通用的视频编解码标准(如VVC)都采用基于块的混合编解码。视频中的每一帧被分割成相同大小(如128x128,64x64等)的正方形的最大编码单元(largest coding unit,LCU)或者叫编码树单元(coding tree unit,CTU)。每个最大编码单元可根据规则划分成矩形的编码单元(coding unit,CU)。编码单元可能还会划分预测单元(prediction unit,PU),变换单元(transform unit,TU)等。
在编码端,将一帧图像划分成块,对当前块(current block,CU)使用帧内预测或帧间预测产生当前块的预测块,当前块的原始块减去预测块得到残差块,对残差块进行变换、量化得到量化系数矩阵,对量化系数矩阵进行熵编码输出到码流中。
示例性的,图1为一种视频编码系统,如图1所示,该视频编码系统11包括:变换单元111、量化单元112、模式选择和编码控制逻辑单元113、帧内预测单元114、帧间预测单元115(包括:运动补偿和运动估计)、反量化单元116、反变换单元117、环路滤波单元118、编码单元119和解码图像缓存单元110;针对输入的原始视频信号,将一帧图像划分成块,通过模式选择和编码控制逻辑单元113确定编码模式,对当前块使用帧内预测或帧间预测产生当前块的预测块,由于视频的一个帧中的相邻像素之间存在很强的相关性,在视频编解码技术中使用帧内预测的方法消除相邻像素之间的空间冗余。由于视频中的相邻帧之间存在着很强的相似性,在视频编解码技术中使用帧间预测方法消除相邻帧之间的时间冗余,从而提高编码效率。当前块的原始块减去预测块得到残差块,对残差块经过变换单元111、量化单元112得到量化系数矩阵;量化系数矩阵经过编码单元119进行熵编码输出到码流中;此外,量化系数矩阵经过反量化单元116和反变换单元117得到重构建残差块,该重构建残差块通过环路滤波单元118去除方块效 应伪影,然后,将该重构残差块添加到解码图像缓存单元111的帧中的一个预测块,用以产生经重构建的视频重建块。解码图像缓存单元110用于存放重构建的视频重建块,用于预测参考。随着视频图像编码的进行,会不断生成新的重构建的视频重建块,这些重构建的视频重建块都会被存放在解码图像缓存单元110中。
解码端通过解析及根据已有信息进行分析确定与编码端相同的块划分信息,预测、变换、量化、熵编码、环路滤波等模式信息或者参数信息,从而保证编码端获得的解码图像和解码端获得的解码图像相同。
示例性的,图2为一种视频解码系统,图2为本申请实施例视频编码系统的组成结构示意图,如图2所示,该视频编码系统21包括:解码单元211、反变换单元212,与反量化单元213、帧内预测单元214、运动补偿单元215、环路滤波单元216和解码图像缓存单元217单元;输入的视频信号经过视频编码系统11进行编码处理之后,输出该视频信号的码流;该码流输入视频解码系统21中,首先经过解码单元211,用于得到解码后的量化系数矩阵;针对该量化系数矩阵通过反变换单元212与反量化单元213进行处理,以便在像素域中产生残差块;帧内预测单元214可用于基于所确定的帧内预测方向和来自当前帧或图片的先前经解码块的数据而产生当前视块的预测块;运动补偿单元215是通过剖析运动向量和其他关联语法元素来确定用于当前块的预测信息,并使用该预测信息以产生当前块的预测块;通过对来自反变换单元212与反量化单元213的残差块与由帧内预测单元214或运动补偿单元215产生的对应预测块进行求和,而形成解码的重构块;该解码的重构块通过环路滤波单元216以便去除方块效应伪影,可以改善视频质量;然后将经解码的重构块存储于解码图像缓存单元217中,解码图像缓存单元217存储用于后续帧内预测或运动补偿的参考图像,同时也用于视频信号的输出,得到所恢复的原始视频信号。
其中,块划分信息,预测、变换、量化的各种模式及参数信息,系数等通过熵编码写入码流中。假设不同元素的概率是不同的,为出现概率较大的元素分配较短的码字,为出现概率较小的元素分配较长的码字,能获得比定长编码更高的编码效率。但是如果不同元素的概率相近或基本相同,熵编码的压缩空间就有限。基于上下文的自适应二进制算术编码(context-based adaptive binary arithmetic coding,CABAC)是常用熵编码方法。HEVC和VVC等都使用CABAC进行熵编码,CABAC使用上下文模型可以提升压缩效率,上下文模型为当前语法元素提供了一个估计的概率,系统根据这个估计的概率来编解码当前语法元素,并根据当前语法元素的值更新上下文模型。
本申请实施例提供的一种编码方法主要作用于视频编码系统11的编码单元119,用于编码语法元素。提供的一种解码方法主要作用于视频解码系统21的解码单元211,用于解码语法元素。
基于此,下面结合附图和实施例对本申请的技术方案进一步详细阐述。在进行详细阐述之前,需要说明的是,说明书通篇中提到的“第一”、“第二”、“第三”等,仅仅是为了区分不同的特征,不具有限定优先级、先后顺序、大小关系等功能。
本申请实施例提供了一种编码方法,该方法应用于视频编码设备,即编码器。该方法所实现的功能可以通过视频编码设备中的处理器调用程序代码来实现,当然程序代码可以保存在计算机存储介质中,可见,该视频编码设备至少包括处理器和存储介质。
图3为本申请实施例提供的编码方法的流程示意图,该方法应用于编码器,如图3所示,该方法包括:
步骤301:从预定区域内选取当前块对应的已编码的多个相关块;其中,所述预定区域包括与所述当前块具备相关性的区域;
其中,本申请实施例中多个相关块是指至少三个相关块,相关块可以理解为与当前块在空间上具备相关性的图像块,用于确定当前块语法元素的上下文模型。已编码的相关块还可以理解为编码端经重构建的重建块。
实际应用中,受到图像块划分方式的影响,相关块的尺寸可以与当前块的尺寸一致也可以不一致。图4为本申请实施例中相关块的选择位置示意图一,如图4所示,相关块为当前块左侧相邻块,上侧相邻块和左上相邻块,相关块和当前块尺寸一致。图5为本申请实施例中相关块的选择位置示意图二,如图5所示,相关块为当前块左侧相邻块,上侧相邻块和左上相邻块,相关块和当前块尺寸不一致。
在一些实施例中,所述预定区域包括所述当前块的相邻区域和/或所述当前块的不相邻区域;所述预定区域包括所述当前块的相邻区域时,所述相关块包括所述当前块的相邻块;所述预定区域包括所述当前块的不相邻区域时,所述相关块包括所述当前块的不相邻块。需要说明的是,不止相邻块与当前块有空间上的相关性,距离近的不相邻块与当前块也有空间上的相关性。这也很容易理解,在预定区域内的内容都是有相关性的。也就是说,除了使用空域相邻块之外,还可以使用距离近的不相邻块,或者相邻块和不相邻块都使用,以参考足够多的相关块为当前块选择上下文模型。如此,通过设置较大的预定区域为当前块选择更多相关块,充分利用了图像块在空间上的相关性,根据更多相关块为当前块的第一语法元素匹配到更适合的上下文模型,避免偶然事件影响上下文模型的选择。举一个极端的例子,当前块 周围一大片区域都使用了模式一,而偏偏在某几个相邻块选择了模式二,若刚好选择某几个相邻块用于确定当前块的上下文模型,那当前块就不知道很多相关区域选了模式一,从而影响了当前块的模式选择。
具体地,可以选择多个相邻块作为当前块的相关块,多个不相邻块作为当前块的相关块,或者,多个相邻块和不相邻块作为当前块的相关块。
图6为本申请实施例中相关块的选择位置示意图三,相邻块除了左侧相邻块和上侧相邻块之外,还可以使用其他位置确定的相邻块,一个例子如图6所示,当前块是包含参考坐标(x0,y0)的块,以参考坐标(x0,y0)为当前块左上角坐标为例,block0是包含参考坐标(x0-1,y0)的相邻块,block1是包含参考坐标(x0,y0-1)的相邻块,block2是包含参考坐标(x0-1,y0-1)的相邻块,block3是包含参考坐标(x0-1,y0+cbHeight-1)的相邻块,block4是包含参考坐标(x0+cbWidth-1,y0-1)的相邻块,block5是包含参考坐标(x0+cbWidth-1,y0-1)的相邻块,block6是包含参考坐标(x0+cbWidth,y0-1)的相邻块,其中,(x0,y0)为当前块左上角坐标,cbWidth为当前块的宽,cbHeight为当前块的高。
图7为本申请实施例中相关块的选择位置示意图四,更进一步地,可以使用更多的空域相邻块,即相邻块除在图6所示的7个相邻块之中选择,还可以选择图7中block1和block5之间一个或多个相邻块(即“…”所指示的区域),以及block0和block3之间一个或多个相邻块(即“…”所指示的区域),用来确定当前块语法元素的上下文模型。
图8为本申请实施例中相关块的选择位置示意图五,更进一步地可以使用更多的空域不相邻块,从图8所示的从不相邻区域内选择相关块,或者,从不相邻区域和相邻区域同时选择相关块,相关块选择位置可以预先设定。
具体实现上,可以设置一个搜索范围和搜索条件来确定预定区域,比如说设置一个变量searchRange,搜索范围为横坐标在x0-searchRange到x0+searchRange,纵坐标在y0-searchRange到y0+searchRange,搜索条件为已编码的块,(x0,y0)为当前块左上角坐标。在预定区域内搜索已编码的块作为当前块的相关块。也就是说,预定区域可以包括已编码区域,也可以包括位编码区域。
实际应用中,相关块和当前块的相关性强度相同或不同。示例性的,该方法还包括:根据相关块与当前块的相关性强弱,配置相关块的权重;基于相关块的权重和相关块的参考信息确定上下文模型索引参数。举一个例子,对于相邻块而言越靠近当前块的左上角相关性越强,反之越弱。对于相邻块和不相邻块而言与当前块距离越近相关性越强,反之越弱,如果相关块使用了不相邻块,一种方法是给不相邻块设置不同的权重。这样,考虑空间相关性的强弱,通过设置相关块的权重可以进一步提高上下文模型选择的准确性。
在一些实施例中,所述方法还包括:基于所述相关块与所述当前块的距离,配置所述相关块的权重。实际应用中,距离可以为横向距离,纵向距离,或者直线距离。
在一些实施例中,所述方法还包括:基于所述相关块的参考坐标和所述当前块的参考坐标,配置所述相关块的权重。
在一些实施例中,所述方法还包括:确定所述相关块所在的第一子区域;其中,所述第一子区域为所述预定区域包含的至少两个第二子区域中的至少一个;基于所述相关块所在的第一子区域,配置所述相关块的权重。
具体地,该方法还包括:将所述预定区域划分为至少两个第二子区域;配置每个第二子区域的权重。
示例性的,基于所述相关块所在的第一子区域,配置所述相关块的权重,包括:当第一子区域包含两个以上第二子区域时,将第二子区域的权重进行融合运算,得到第一子区域的权重;将所述相关块的权重配置为所述第一子区域的权重。示例性的,融合运算可以为加权运算,取平均运算等。
示例性的,基于所述相关块所在的第一子区域,配置所述相关块的权重,包括:当第一子区域包含一个第二子区域时,将第一区域的权重配置为第二子区域的权重;将所述相关块的权重配置为所述第一子区域的权重。即将所述相关块的权重配置为第二子区域的权重。
示例性的,可以用至少两个同心环将预定区域划分至少两个子区域。具体地,预先设定每环的位置信息,根据相关块x的位置信息,确定第Li环的位置信息与相关块x的位置信息匹配,确定相关块X位于第Li环。
这里,位置信息匹配,可以是第Li环的位置信息包含相关块x的位置信息,或者第Li环的与相关块x距离小于预设距离阈值。
图9为本申请实施例中相关块的选择位置示意图五,0~6是相邻块,序号大于6的块是不相邻块。一种定位这些块的方法是,以当前块尺寸为间隔长度配置同心环的间隔,以设定每环的位置信息,以图9所示为例,用L0-L4表示同心环,第Li环的位置信息包括相关块x的位置信息时,确定相关块X位于第Li环,其中,相关块x的位置信息为参考坐标,每环的位置信息包括用于描述矩形边的坐标信息,每环的位置信息包括:第一横坐标及其对应的纵坐标取值范围,第二横坐标及其对应的纵坐标取值范围,第一纵坐标及其对应的横坐标取值范围,第二横坐标及其对应的横坐标取值范围。每个环的四条边由左右 距离当前块n*cbWidth的两条线,上下距离当前块n*cbHeight的两条线合围而成。于是举个例子,图中块9由坐标(x0-cuWidth,y0-cuHeight)确定,第一环L1对应的n就是1,第二环L2对应的n就是2。图中块14由坐标(x0-2*cuWidth,y0-2*cuHeight)确定。
示例性的,第0环L0的权重设为1,即位于第0环L0的相邻块的权重设为1,第一环L1的权重设为1/2,第二环L2的权重设为1/4,第三环L3的权重设为1/8,第四环L4的权重设为1/16等。需要说明的是,这里只是示例性的给出了一种权重设置方法,并不是用于限定本申请,实际应用中还可以为同一环设置不同权重,或者结合视频图像特征设置权重。
在一些实施例中,所述从预定区域内选取当前块对应的已编码的多个相关块,包括:基于所述当前块的参考坐标,在所述预定区域内确定所述相关块的参考坐标;基于所述相关块的参考坐标,获取所述相关块的参考信息。
在一些实施例中,所述方法还包括:基于预设选取顺序和所述相关块的参考坐标,获取所述相关块的参考信息。
这里,参考坐标用于定位当前块和相关块,参考坐标可以为以下至少之一:块的左上角坐标、块的左下角坐标、块的右上角坐标、块的右下角坐标、块的中心坐标等。选取顺序用于设定多个相关块的选取的先后顺序,例如,选取顺序可以为以当前块为中心从内向外辐射搜索,或者在搜索区域内按照一定搜索粒度从左向右从上向下搜索。
采用上述任意一种方法能够找到更多相关块,下面用这些相关块已编码的信息为当前块的第一语法元素选择上下文模型。
步骤302:基于所述多个相关块的参考信息,确定所述当前块的第一语法元素的上下文模型索引参数;
示例性的,上下文模型索引(ctxIdx)的值等于上下文模型索引增量(ctxInc)和上下文模型索引偏移量(ctxIdxOffset)的和。可以认为ctxIdxOffset是先把上下文模型归为不同的组,而ctxInc是在组内选择某一个上下文模型。
这里,相关块的参考信息用于指示编码相关块的第一语法元素时所选择的上下文模型。示例性的,在一些实施例中,所述相关块的参考信息包括:所述相关块的第一语法元素的上下文模型索引参考量。在另一些实施例中,所述相关块的参考信息还包括:所述相关块的可用标识。可用标识用于指示相关块的上下文模型索引参考量是否能够用于确定当前块的上下文模型索引参考量。
在一些实施例中,所述基于所述多个相关块的参考信息,确定所述当前块的第一语法元素的上下文模型索引参数,包括:确定所述第一语法元素对应的上下文模型索引偏移量;基于所述多个相关块的参考信息,确定所述当前块的第一语法元素的上下文模型索引增量;基于所述上下文模型索引增量和所述上下文模型索引偏移量,确定所述第一语法元素的所述上下文模型索引;将所述上下文模型索引参数设置为等于所述上下文模型索引。
需要说明的是,当前块包括多个语法元素,第一语法元素是指当前块的多个语法元素中的一个,上下文模型索引对应的上下文模型可以理解为第一语法元素对应的上下文模型,每个语法元素对应两个或更多上下文模型,对当前块的第一语法元素进行编码时,基于相关块相同语法元素为当前块第一语法元素选择匹配的上下文模型。本申请实施例中,还可以通过增加上下文模型数量,为语法元素选择更匹配的上下文模型,进一步提高压缩效率。
示例性的,对语法元素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]和merge_subblock_flag[x0][y0],VVC有3个上下文模型或一个组有3个上下文模型,对语法元素pred_mode_flag[x0][y0]和non_inter_flag,VVC有2个上下文模型。
示例性的,在一些实施例中,该方法还包括:确定选择所述第一语法元素的上下文模型时所使用的第一上下文模型列表;将所述上下文模型索引参数设置为所述第一上下文模型列表的索引。
当预设多个上下文模型列表来映射上下文模型时,每个上下文模型列表包含多个上下文模型,用ctxTable来表示选择上下文模型时所使用的上下文模型列表,用ctxIdx来索引上下文模型列表中某一个上下文模型。
在解析不同的语法元素时,需要使用该语法元素对应的上下文模型,也就是对应的ctxTable和ctxIdx,表1定义了使用上下文模型编码的语法元素(syntax element)都能在这个表里找到对应的ctxTable。其中ctxIdxOffset为表1中当前initType中ctxIdx的最小值,initType跟slice类型(I slice,P slice,B slice)有关,还和某些flag有关,这里不再赘述。可以认为ctxIdxOffset是先把上下文模型归为不同的组,而ctxInc是在组内选择某一个上下文模型。
示例性的,表1中对于语法元素alf_ctb_flag[][][],对应的第一上下文模型列表的索引为表52(Table52),对于语法元素alf_use_aps_flag,对应的第一上下文模型列表的索引为表53(Table53)。
表1
Figure PCTCN2022086089-appb-000001
步骤303:基于所述上下文模型索引参数对应的上下文模型编码所述当前块的第一语法元素。
需要说明的是,一个语法元素可能有一个或多个二元符号(bin),一般flag只有一个二元符号,因为flag通常只有2个选项。而每个二元符号可能有一个或多个上下文模型,也就是对应一个或多个ctxIdx,当二元符号有多个上下文模型,需要从多个上下文模型选择一个最匹配的上下文模型进行编码,从而提高编码效率。本申请实施例中选择上下文模型的前提这个二元符号是用上下文模型编码的,本申请实施例中如果不做特殊说明,二元符号都是指的上下文模型编码的二元符号。
下面对上下文模型索引增量的确定方法进行进一步的举例说明。
其中,相关块的语法元素是指相关块已编码的语法元素,由于编码端包含编码和解码过程,因此已编码的语法元素也可以理解称为已解码的语法元素。
在一些实施例中,所述基于所述多个相关块的参考信息,确定所述当前块的第一语法元素的上下文模型索引增量,包括:基于所述多个相关块的参考信息,确定第一中间量;基于预设转换算法对所述第一中间量进行转换,得到所述当前块的第一语法元素的上下文模型索引增量。
在一些实施例中,所述相关块的参考信息包括:所述相关块的第一语法元素的可用标识和上下文模型索引参考量,所述基于所述多个相关块的参考信息,确定第一中间量,包括:对每个相关块的所述可用标识和所述上下文模型索引参考量进行与运算,得到与运算结果;基于每个相关块的与运算结果,得到所述第一中间量。
进一步的,利用预设转换算法将第一中间变量转换为匹配的上下文索引增量。在一些实施例中,所述预设转换算法包括以下之一:将所述第一中间量设置为等于所述上下文模型索引增量;将所述第一中间量除以第一参考量得到所述上下文模型索引增量;将所述第一中间量右移第二参考量得到所述上下文模型索引增量;确定所述第一中间量所在的第一取值范围,将所述第一取值范围对应的索引增量作为所述上下文模型索引增量。
示例性的,以VVC的格式为例,上下文模型索引参考量可以用选择上下文模型的判断条件来表示,本申请实施例中用availableN表示第N个相关块是否可用以及判断条件,用conditionN(简称condN)表示第一语法元素对应的第N个相关块的判断条件。
示例性的,设置第一中间量(tempValue)。tempValue初始化设为0,第x个相关块已编码的语法元素为availablex和condx,x取0至N,从0至N执行如下操作:tempValue+=availablex&&condx,其中,以图6所示为例N取6,在使用不同个数的相关块时可以换成对应的值。tempValue可以理解为累加过程中的中间变量,当x=N,tempValue为最终得到的第一中间量。
具体地,当前块坐标(xCurr,yCurr)设为(x0,y0),左侧相邻块的坐标(xNbL,yNbL)设为(x0-1,y0),根据(xNbL,yNbL),(x0,y0),cIdx推导左侧相邻块是否可用,并将结果赋值给availableL。AvailableL表示左侧相邻块是否可用。
上侧相邻块的坐标(xNbA,yNbA)设为(x0,y0-1),根据(xNbA,yNbA),(x0,y0),cIdx推导上侧相邻块是否可用,并将结果赋值给availableA。AvailableA表示上侧相邻块是否可用。
将第N个相关块的坐标(xNbN,yNbN)设为(x0-Nx,y0-Ny),根据(x0-Nx,y0-Ny),(x0,y0),当前块坐标(xCurr,yCurr)作为cIdx输入,cIdx推导出左侧相关块是否可用,并将结果赋值给availableN。AvailableN表示第N个相关块是否可用。
表2定义左侧相邻块和上侧相邻块的语法元素确定ctxInc的规范,表2中定义了每种语法元素对应左侧相邻块和上侧相邻块的判断条件。需要说明的是,本申请实施例中除了利用左侧相邻块和上侧相邻块,还增加了其他相关块,即利用与当前块具备空间相关性的足够数量的相关块进行上下文模型选择,需要在表2的基础上中添加更多相关块的判断条件(condN),若对应多个上下文模型组,还需添加上下 文模型组索引(ctxSetIdx)。
在一种可能的实现方式中,编码第一语法元素,在确定相关块可用后,通过查表的方式确定相关块的判断条件。在确定相关块不可用后,无需获取相关块的判断条件。
表2
Figure PCTCN2022086089-appb-000002
然后匹配ctxInc。一种可能的方法是ctxInc=tempValue。或者ctxInc=tempValue/M1,其中M1是一个整数,例如,M1根据上下文模型配置为1、2、3、4或5。或者ctxInc=tempValue>>M2,其中>>表示右移,因为在硬件实现时右移的代价比除法小得多。或者写成ctxInc=tempValue<THR0?0:(tempValue<THR1?1:2)的形式。THR0和THR1是阈值,利用2个阈值将tempValue划分为三个取值范围,即tempValue<THR0,THR0≤tempValue<THR1,THR1≤tempValue。实际应用中,可以利用一个阈值将tempValue划分为两个取值范围,或者利用多个阈值将tempValue细分为更多个取值范围。
在一些实施例中,所述相关块的参考信息包括:所述相关块的第一语法元素的可用标识和上下文模型索引参考量,
所述基于所述多个相关块的参考信息,确定第一中间量,包括:获取所述多个相关块的权重;对每个相关块的所述可用标识和所述上下文模型索引参考量进行与运算,得到与运算结果;基于所述多个相关块的权重对每个相关块的与运算结果进行加权运算;基于每个相关块的加权结果,得到所述第一中间量。
实际应用中,对加权结果进行求和运算得到所述第一中间量,对加权结果进行或运算得到所述第一中间量,对加权结果进行与运算得到所述第一中间量等。
示例性的,设置第一中间量(tempValue)。tempValue初始化设为0,第x个相关块已编码的语法元素为availablex和condx,x取0至N,从0至N执行如下操作:tempValue+=(availablex&&condx)*weightx。其中,以图9所示为例N取24,在使用不同个数的块时可以换成对应的值。其中weightx可以根据相关块x的位置来确定,比如上面提到通过判断相关块x在第几环来确定。
示例性的,预先设定每环的位置信息,根据相关块x的位置信息,确定第Li环的位置信息与相关块x的位置信息匹配,确定相关块X位于第Li环。以图9所示为例,第Li环的位置信息包括相关块x的位置信息时,确定相关块X位于第Li环,其中,相关块x的位置信息为参考坐标,每环的位置信息包括用于描述矩形边的坐标信息,每环的位置信息包括:第一横坐标及其对应的纵坐标取值范围,第二横坐标及其对应的纵坐标取值范围,第一纵坐标及其对应的横坐标取值范围,第二横坐标及其对应的横坐标取值范围。
然后匹配ctxInc。一种可能的方法是ctxInc=tempValue。或者ctxInc=tempValue/M1,其中M1是一个整数,例如,M1根据上下文模型配置为1、2、3、4或5。或者ctxInc=tempValue>>M2,其中>>表示右移,因为在硬件实现时右移的代价比除法小得多。或者写成ctxInc=tempValue<THR0?0:(tempValue<THR1?1:2)的形式。THR0和THR1是阈值,利用2个阈值将tempValue划分为三个取值范围,即tempValue<THR0,THR0≤tempValue<THR1,THR1≤tempValue。实际应用中,可以利用一个阈值将tempValue划分为两个取值范围,或者利用多个阈值将tempValue细分为更多个取值范围。
在一些实施例中,所述第一语法元素对应多个上下文模型组时,所述基于所述多个相关块的参考信息,确定所述当前块的第一语法元素的上下文模型索引增量,包括:基于所述多个相关块的参考信息,确定第一中间量;基于所述第一语法元素对应的上下文模型组索引和每个上下文模型组中的上下文模型个数,确定第二中间量;基于预设转换算法对所述第一中间量进行转换,得到第三中间量;基于所述第二中间量和所述第三中间量,得到所述当前块的第一语法元素的上下文模型索引增量。
也就是说,语法元素可以直接对应一个或多个上下文模型,也可以对应一个或多个上下文模型组,每个上下文模型组包括多个上下文模型。当第一语法元素对应多个上下文模型组时,第三中间量用于索引某一个上下文模型组中的一个上下文模型,因此还需要根据上下文模型组索引和上下文模型个数确定第二中间量,第二中间量作为上下文模型组的偏移量,用于索引上下文模型组中的第一个上下文模型,第二中间量和第三中间量相加上下文模型索引增量,用于确定一个上下文模型组中的一个上下文模型。
示例性的,为某些语法元素设置上下文模型组时,ctxInc+=ctxSetIdx*P,ctxSetIdx为上下文模型组的索引,ctxSetIdx可以取0,1,2,3等,P为上下文模型组中上下文模型个数,P可以取2,3,4,5等。
示例性的,对语法元素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]和merge_subblock_flag[x0][y0],VVC有3个上下文模型组,一个组有3个上下文模型。
采用上述技术方案,通过设置较大的预定区域为当前块选择更多相关块,充分利用了图像块在空间上的相关性,能够为当前块的第一语法元素匹配到更适合的上下文模型,提高语法元素的压缩效率,进而提高整个系统的压缩效率。
下面以VVC中使用CABAC为例进行介绍,CABAC的处理过程主要包括二进制化(binarization)、上下文建模(context modeling)和二进制算术编码(binary arithmetic coding)。其中,二进制化是指对输入的非二进制语法元素值进行二进制处理,将其唯一的转换为一个二进制序列(即二进制串);上下文建模是指对二进制串中的每一个位元,根据上下文信息(例如,语法元素对应节点周围已重建区域内的编码信息)决定该位元的上下文模型;二进制算术编码是指根据上下文模型中的概率值对对应的位元进行编码,并根据位元的值更新上下文模型中的概率值。本申请实施例用于实现第一语法元素的二进制串中每一个位元的上下文模型的选择,根据确定的上下文模型索引确定对应的上下文模型。
确定上下文模型之后,上下文模型的参数作为输入调用二元符号的算数解码过程。
二元符号的算数解码过程输入是上下文模型的参数(ctxTable和ctxIdx)旁路解码标识(bypassFlag)以及算数解码引擎的状态变量ivlCurrRange和ivlOffset这个过程的输出是这个二元符号(bin)的值。
图10为本申请实施例中一个二元符号的整个算数解码过程。为了解码这个bin的值,ctxTable,ctxIdx,bypassFlag作为输入被传输到解码二元符号部分DecodeBin(ctxTable,ctxIdx,bypassFlag),具体如下:
如果bypassFlag的值为1,调用旁路解码DecodeBypass();
bypassFlag的值为0,如果bypassFlag的值为0,ctxTable的值为0,且ctxIdx的值为0,调用终止解码DecodeTerminate();
bypassFlag的值为0且ctxTable的值不为0,调用解码决策DecodeDecision(ctxTable,ctxIdx)。
图11为本申请实施例中一个二元符号的解码决策过程,解码决策DecodeDecision(ctxTable,ctxIdx)过程的输入是变量ctxTable,ctxIdx,ivlCurrRange,和ivlOffset,这个过程的输出是解码的值binVal,更新后的变量ivlCurrRange和ivlOffset。
1.变量ivlLpsRange的值按如下方法导出:
给定ivlCurrRange的当前值,变量qRangeIdx按如下方法导出:
qRangeIdx=ivlCurrRange>>5
给定qRangeIdx,ctxTable和ctxIdx对应的pStateIdx0和pStateIdx1,其中,ctxTable是选择上下文模式时使用的表格,ctxIdx是上下文模型索引,pStateIdx0和pStateIdx1是当前上下文模型的两个状态。valMps和ivlLpsRange按如下方法导出:
pState=pStateIdx1+16*pStateIdx0
valMps=pState>>14
ivlLpsRange=(qRangeIdx*((valMps?32767-pState:pState)>>9)>>1)+4
2.变量ivlCurrRange的值设为ivlCurrRange–ivlLpsRange,并执行如下操作:
如果ivlOffset大于或等于ivlCurrRange,变量binVal的值为1–valMps,ivlOffset减等于ivlCurrRange,ivlCurrRange的值为ivlLpsRange
否则,变量binVal的值为valMps
给定binVal的值,执行状态转移(statetransition)。基于ivlCurrRange的当前值,执行重归一化(renormalization)。
状态转移(state transition)过程,这个过程的输入是当前的pStateIdx0和pStateIdx1,以及解出的值 binVal,这个过程的输出是更新的ctxTable和ctxIdx对应的上下文变量pStateIdx0和pStateIdx1。
变量shift0和shift1由shiftIdx导出,shiftIdx由shiftIdx与ctxTable和ctxIdx的对应关系确定。
shift0=(shiftIdx>>2)+2
shift1=(shiftIdx&3)+3+shift0
基于解出的值binVal,与ctxTable和ctxIdx对应的两个变量pStateIdx0和pStateIdx1的更新如下
pStateIdx0=pStateIdx0-(pStateIdx0>>shift0)+(1023*binVal>>shift0)
pStateIdx1=pStateIdx1-(pStateIdx1>>shift1)+(16383*binVal>>shift1)
图12为本申请实施例中重归一化(renormalization)过程,这个过程的输入是片数据中的bits和变量ivlCurrRange和ivlOffset,这个过程的输出是更新的变量ivlCurrRange和ivlOffset。
ivlCurrRange的当前值首选与256比较,后续步骤如下所述:
如果ivlCurrRange大于或等于256,不需要重归一化,重归一化过程结束;
否则(ivlCurrRange小于256),进入重归一化循环。在这个循环中,ivlCurrRange的值乘2,也就是左移一位。ivlOffset的值乘2,也就是左移一位。用read_bits(1)得到的一位移入到ivlOffset中。
整个过程中码流中的数据不应该导致ivlOffset大于或等于ivlCurrRange。
图13为本申请实施例中一个二元符号的旁路解码DecodeBypass()过程,这个过程的输入是片数据的bits,变量ivlCurrRange和ivlOffset,这个过程的输出是更新的变量ivlOffset和解出的值binVal。
当bypassFlag为1时旁路解码过程被调用,旁路解码过程如下:
首先ivlOffset的值乘2,也就是左移一位。用read_bits(1)得到的一位移入到ivlOffset中。然后ivlOffset的值会和ivlCurrRange的值比较,后续步骤如下:
如果ivlOffset大于或等于ivlCurrRange,binVal的值设为1,ivlOffset减等于ivlCurrRange。
否则(ivlOffset小于ivlCurrRange)binVal的值设为0。
整个过程中码流中的数据不应该导致ivlOffset大于或等于ivlCurrRange。
图14为本申请实施例中终止解码DecodeTerminate()过程,这个过程的输入是片数据中的bits和变量ivlCurrRange和ivlOffsel。这个过程的输出是更新的ivlCurrRange和ivlOffsel,以及解出的值binVal。
首先ivlCurrRange的值减2;
如果ivlOffset大于或等于ivlCurrRange,binVal的值设为1。
否则(ivlOffset小于ivlCurrRange)binVal的值设为0,执行重归一化过程。
本申请实施例还提供了一种解码方法,图15为本申请实施例提供的解码方法的流程示意图,应用于解码器,如图15所示,该方法包括:
步骤1501:解码码流,获取当前块的第一语法元素的待解码信息;
步骤1502:从预定区域内选取所述当前块对应的已解码的多个相关块;其中,所述预定区域包括与所述当前块具备相关性的区域;
其中,本申请实施例中多个相关块是指至少三个相关块,相关块可以理解为与当前块在空间上具备相关性的图像块,用于确定当前块语法元素的上下文模型。已解码的相关块还可以理解为解码端经重构建的重建块。
实际应用中,受到图像块划分方式的影响,相关块的尺寸可以与当前块的尺寸一致也可以不一致。图4为本申请实施例中相关块的选择位置示意图一,如图4所示,相关块为当前块左侧相邻块,上侧相邻块和左上相邻块,相关块和当前块尺寸一致。图5为本申请实施例中相关块的选择位置示意图二,如图5所示,相关块为当前块左侧相邻块,上侧相邻块和左上相邻块,相关块和当前块尺寸不一致。
在一些实施例中,所述预定区域包括所述当前块的相邻区域和/或所述当前块的不相邻区域;所述预定区域包括所述当前块的相邻区域时,所述相关块包括所述当前块的相邻块;所述预定区域包括所述当前块的不相邻区域时,所述相关块包括所述当前块的不相邻块。需要说明的是,不止相邻块与当前块有空间上的相关性,距离近的不相邻块与当前块也有空间上的相关性。这也很容易理解,在预定区域内的内容都是有相关性的。也就是说,除了使用空域相邻块之外,还可以使用距离近的不相邻块,或者相邻块和不相邻块都使用,以参考足够多的相关块为当前块选择上下文模型。如此,通过设置较大的预定区域为当前块选择更多相关块,充分利用了图像块在空间上的相关性,根据更多相关块为当前块的第一语法元素匹配到更适合的上下文模型,避免偶然事件影响上下文模型的选择。
具体地,具体地,可以选择多个相邻块作为当前块的相关块,多个不相邻块作为当前块的相关块,或者,多个相邻块和不相邻块作为当前块的相关块。如图6-图8所示。
实际应用中,相关块和当前块的相关性强度相同或不同。示例性的,该方法还包括:根据相关块与当前块的相关性强弱,配置相关块的权重;基于相关块的权重和相关块的参考信息确定上下文模型索引参数。举一个例子,对于相邻块而言越靠近当前块的左上角相关性越强,反之越弱。对于相邻块和不相邻块而言与当前块距离越近相关性越强,反之越弱,如果相关块使用了不相邻块,一种方法是给不相邻块设置不同的权重。这样,考虑空间相关性的强弱,通过设置相关块的权重可以进一步提高上下文模型 选择的准确性。
在一些实施例中,所述方法还包括:基于所述相关块与所述当前块的距离,配置所述相关块的权重。实际应用中,距离可以为横向距离,纵向距离,或者直线距离。
在一些实施例中,所述方法还包括:基于所述相关块的参考坐标和所述当前块的参考坐标,配置所述相关块的权重。
在一些实施例中,所述方法还包括:确定所述相关块所在的第一子区域;其中,所述第一子区域为所述预定区域包含的至少两个第二子区域中的至少一个;基于所述相关块所在的第一子区域,配置所述相关块的权重。
具体地,该方法还包括:将所述预定区域划分为至少两个第二子区域;配置每个第二子区域的权重。
示例性的,基于所述相关块所在的第一子区域,配置所述相关块的权重,包括:当第一子区域包含两个以上第二子区域时,将第二子区域的权重进行融合运算,得到第一子区域的权重;将所述相关块的权重配置为所述第一子区域的权重。示例性的,融合运算可以为加权运算,取平均运算等。
示例性的,基于所述相关块所在的第一子区域,配置所述相关块的权重,包括:当第一子区域包含一个第二子区域时,将第一区域的权重配置为第二子区域的权重;将所述相关块的权重配置为所述第一子区域的权重。即将所述相关块的权重配置为第二子区域的权重。
示例性的,可以用至少两个同心环将预定区域划分至少两个子区域。具体地,预先设定每环的位置信息,根据相关块x的位置信息,确定第Li环的位置信息与相关块x的位置信息匹配,确定相关块X位于第Li环。
这里,位置信息匹配,可以是第Li环的位置信息包含相关块x的位置信息,或者第Li环的与相关块x距离小于预设距离阈值。
图9为本申请实施例中相关块的选择位置示意图五,0~6是相邻块,序号大于6的块是不相邻块。一种定位这些块的方法是,以当前块尺寸为间隔长度配置同心环的间隔,以设定每环的位置信息,以图9所示为例,用L0-L4表示同心环,第Li环的位置信息包括相关块x的位置信息时,确定相关块X位于第Li环,其中,相关块x的位置信息为参考坐标,每环的位置信息包括用于描述矩形边的坐标信息,每环的位置信息包括:第一横坐标及其对应的纵坐标取值范围,第二横坐标及其对应的纵坐标取值范围,第一纵坐标及其对应的横坐标取值范围,第二横坐标及其对应的横坐标取值范围。每个环的四条边由左右距离当前块n*cbWidth的两条线,上下距离当前块n*cbHeight的两条线合围而成。于是举个例子,图中块9由坐标(x0-cuWidth,y0-cuHeight)确定,第一环L1对应的n就是1,第二环L2对应的n就是2。图中块14由坐标(x0-2*cuWidth,y0-2*cuHeight)确定。
示例性的,第0环L0的权重设为1,即位于第0环L0的相邻块的权重设为1,第一环L1的权重设为1/2,第二环L2的权重设为1/4,第三环L3的权重设为1/8,第四环L4的权重设为1/16等。需要说明的是,这里只是示例性的给出了一种权重设置方法,并不是用于限定本申请,实际应用中还可以为同一环设置不同权重,或者结合视频图像特征设置权重。
在一些实施例中,所述从预定区域内选取当前块对应的已解码的多个相关块,包括:基于所述当前块的参考坐标,在所述预定区域内确定所述相关块的参考坐标;基于所述相关块的参考坐标,获取所述相关块的参考信息。
在一些实施例中,所述方法还包括:基于预设选取顺序和所述相关块的参考坐标,获取所述相关块的参考信息。
这里,参考坐标用于定位当前块和相关块,参考坐标可以为以下至少之一:块的左上角坐标、块的左下角坐标、块的右上角坐标、块的右下角坐标、块的中心坐标等。选取顺序用于设定多个相关块的选取的先后顺序,例如,选取顺序可以为以当前块为中心从内向外辐射搜索,或者在搜索区域内按照一定搜索粒度从左向右从上向下搜索。
步骤1503:基于所述多个相关块的参考信息,确定所述当前块的第一语法元素的上下文模型索引参数;
示例性的,上下文模型索引(ctxIdx)的值等于上下文模型索引增量(ctxInc)和上下文模型索引偏移量(ctxIdxOffset)的和。可以认为ctxIdxOffset是先把上下文模型归为不同的组,而ctxInc是在组内选择某一个上下文模型。
这里,相关块的参考信息用于指示编码相关块的第一语法元素时所选择的上下文模型。示例性的,在一些实施例中,所述相关块的参考信息包括:所述相关块的第一语法元素的上下文模型索引参考量。在另一些实施例中,所述相关块的参考信息还包括:所述相关块的可用标识。可用标识用于指示相关块的上下文模型索引参考量是否能够用于确定当前块的上下文模型索引参考量。
在一些实施例中,所述基于所述多个相关块的参考信息,确定所述当前块的第一语法元素的上下文模型索引参数,包括:确定所述第一语法元素对应的上下文模型索引偏移量;基于所述多个相关块的参 考信息,确定所述当前块的第一语法元素的上下文模型索引增量;基于所述上下文模型索引增量和所述上下文模型索引偏移量,确定所述第一语法元素的所述上下文模型索引;将所述上下文模型索引参数设置为等于所述上下文模型索引。
需要说明的是,当前块包括多个语法元素,第一语法元素是指当前块的多个语法元素中的一个,上下文模型索引对应的上下文模型可以理解为第一语法元素对应的上下文模型,每个语法元素对应两个或更多上下文模型,对当前块的第一语法元素进行编码时,基于相关块相同语法元素为当前块第一语法元素选择匹配的上下文模型。本申请实施例中,还可以通过增加上下文模型数量,为语法元素选择更匹配的上下文模型,进一步提高压缩效率。
示例性的,对语法元素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]和merge_subblock_flag[x0][y0],VVC有3个上下文模型或一个组有3个上下文模型,对语法元素pred_mode_flag[x0][y0]和non_inter_flag,VVC有2个上下文模型。
示例性的,在一些实施例中,该方法还包括:确定选择所述第一语法元素的上下文模型时所使用的第一上下文模型列表;将所述上下文模型索引参数设置为所述第一上下文模型列表的索引。
当预设多个上下文模型列表来映射上下文模型时,每个上下文模型列表包含多个上下文模型,用ctxTable来表示选择上下文模型时所使用的上下文模型列表,用ctxIdx来索引上下文模型列表中某一个上下文模型。
在解析不同的语法元素时,需要使用该语法元素对应的上下文模型,也就是对应的ctxTable和ctxIdx,表1定义了使用上下文模型编码的语法元素(syntax element)都能在这个表里找到对应的ctxTable。其中ctxIdxOffset为表1中当前initType中ctxIdx的最小值,initType跟slice类型(I slice,P slice,B slice)有关,还和某些flag有关,这里不再赘述。可以认为ctxIdxOffset是先把上下文模型归为不同的组,而ctxInc是在组内选择某一个上下文模型。
步骤1504:基于所述上下文模型索引参数对应的上下文模型解码所述待解码信息,得到所述当前块的第一语法元素。
需要说明的是,一个语法元素可能有一个或多个二元符号(bin),一般flag只有一个二元符号,因为flag通常只有2个选项。而每个二元符号可能有一个或多个上下文模型,也就是对应一个或多个ctxIdx,当二元符号有多个上下文模型,需要从多个上下文模型选择一个最匹配的上下文模型进行编码,从而提高编码效率。本申请实施例中选择上下文模型的前提这个二元符号是用上下文模型编码的,本申请实施例中如果不做特殊说明,二元符号都是指的上下文模型编码的二元符号。
下面对上下文模型索引增量的确定方法进行进一步的举例说明。
其中,相关块的语法元素是指相关块已解码的语法元素。在一些实施例中,所述基于所述多个相关块的参考信息,确定所述当前块的第一语法元素的上下文模型索引增量,包括:基于所述多个相关块的参考信息,确定第一中间量;基于预设转换算法对所述第一中间量进行转换,得到所述当前块的第一语法元素的上下文模型索引增量。
在一些实施例中,所述相关块的参考信息包括:所述相关块的第一语法元素的可用标识和上下文模型索引参考量,所述基于所述多个相关块的参考信息,确定第一中间量,包括:对每个相关块的所述可用标识和所述上下文模型索引参考量进行与运算,得到与运算结果;基于每个相关块的与运算结果,得到所述第一中间量。
进一步的,利用预设转换算法将第一中间变量转换为匹配的上下文索引增量。在一些实施例中,所述预设转换算法包括以下之一:将所述第一中间量设置为等于所述上下文模型索引增量;将所述第一中间量除以第一参考量得到所述上下文模型索引增量;将所述第一中间量右移第二参考量得到所述上下文模型索引增量;确定所述第一中间量所在的第一取值范围,将所述第一取值范围对应的索引增量作为所述上下文模型索引增量。
示例性的,以VVC的格式为例,上下文模型索引参考量可以用选择上下文模型的判断条件来表示,本申请实施例中用availableN表示第N个相关块是否可用以及判断条件,用conditionN(简称condN)表示第一语法元素对应的第N个相关块的判断条件。
示例性的,设置第一中间量(tempValue)。tempValue初始化设为0,第x个相关块已解码的语法元素为availablex和condx,x取0至N,从0至N执行如下操作:tempValue+=availablex&&condx,其中,以图6所示为例N取6,在使用不同个数的相关块时可以换成对应的值。tempValue可以理解为累加过程中的中间变量,当x=N,tempValue为最终得到的第一中间量。
具体地,当前块坐标(xCurr,yCurr)设为(x0,y0),左侧相邻块的坐标(xNbL,yNbL)设为(x0-1,y0),根据(xNbL,yNbL),(x0,y0),cIdx推导左侧相邻块是否可用,并将结果赋值给availableL。AvailableL表示左侧相邻块是否可用。
上侧相邻块的坐标(xNbA,yNbA)设为(x0,y0-1),根据(xNbA,yNbA),(x0,y0),cIdx推导上侧相邻块是否可用,并将结果赋值给availableA。AvailableA表示上侧相邻块是否可用。
将第N个相关块的坐标(xNbN,yNbN)设为(x0-Nx,y0-Ny),根据(x0-Nx,y0-Ny),(x0,y0),当前块坐标(xCurr,yCurr)作为cIdx输入,cIdx推导出左侧相关块是否可用,并将结果赋值给availableN。AvailableN表示第N个相关块是否可用。
然后匹配ctxInc。一种可能的方法是ctxInc=tempValue。或者ctxInc=tempValue/M1,其中M1是一个整数,例如,M1根据上下文模型配置为1、2、3、4或5。或者ctxInc=tempValue>>M2,其中>>表示右移,因为在硬件实现时右移的代价比除法小得多。或者写成ctxInc=tempValue<THR0?0:(tempValue<THR1?1:2)的形式。THR0和THR1是阈值,利用2个阈值将tempValue划分为三个取值范围,即tempValue<THR0,THR0≤tempValue<THR1,THR1≤tempValue。实际应用中,可以利用一个阈值将tempValue划分为两个取值范围,或者利用多个阈值将tempValue细分为更多个取值范围。示例性的,上下文模型增量可以取0,1,2,3,…等。
在一些实施例中,所述相关块的参考信息包括:所述相关块的第一语法元素的可用标识和上下文模型索引参考量,
所述基于所述多个相关块的参考信息,确定第一中间量,包括:获取所述多个相关块的权重;对每个相关块的所述可用标识和所述上下文模型索引参考量进行与运算,得到与运算结果;基于所述多个相关块的权重对每个相关块的与运算结果进行加权运算;基于每个相关块的加权结果,得到所述第一中间量。
实际应用中,对加权结果进行求和运算得到所述第一中间量,对加权结果进行或运算得到所述第一中间量,对加权结果进行与运算得到所述第一中间量等。
示例性的,设置第一中间量(tempValue)。tempValue初始化设为0,第x个相关块已编码的语法元素为availablex和condx,x取0至N,从0至N执行如下操作:tempValue+=(availablex&&condx)*weightx。其中,以图9所示为例N取24,在使用不同个数的块时可以换成对应的值。其中weightx可以根据相关块x的位置来确定,比如上面提到通过判断相关块x在第几环来确定。
然后匹配ctxInc。一种可能的方法是ctxInc=tempValue。或者ctxInc=tempValue/M1,其中M1是一个整数,例如,M1根据上下文模型配置为1、2、3、4或5。或者ctxInc=tempValue>>M2,其中>>表示右移,因为在硬件实现时右移的代价比除法小得多。或者写成ctxInc=tempValue<THR0?0:(tempValue<THR1?1:2)的形式。THR0和THR1是阈值,利用2个阈值将tempValue划分为三个取值范围,即tempValue<THR0,THR0≤tempValue<THR1,THR1≤tempValue。实际应用中,可以利用一个阈值将tempValue划分为两个取值范围,或者利用多个阈值将tempValue细分为更多个取值范围。
在一些实施例中,所述第一语法元素对应多个上下文模型组时,所述基于所述多个相关块的参考信息,确定所述当前块的第一语法元素的上下文模型索引增量,包括:基于所述多个相关块的参考信息,确定第一中间量;基于所述第一语法元素对应的上下文模型组索引和每个上下文模型组中的上下文模型个数,确定第二中间量;基于预设转换算法对所述第一中间量进行转换,得到第三中间量;基于所述第二中间量和所述第三中间量,得到所述当前块的第一语法元素的上下文模型索引增量。
也就是说,语法元素可以直接对应一个或多个上下文模型,也可以对应一个或多个上下文模型组,每个上下文模型组包括多个上下文模型。当第一语法元素对应多个上下文模型组时,第三中间量用于索引某一个上下文模型组中的一个上下文模型,因此还需要根据上下文模型组索引和上下文模型个数确定第二中间量,第二中间量作为上下文模型组的偏移量,用于索引上下文模型组中的第一个上下文模型,第二中间量和第三中间量相加上下文模型索引增量,用于确定一个上下文模型组中的一个上下文模型。
示例性的,为某些语法元素设置上下文模型组时,ctxInc+=ctxSetIdx*P,ctxSetIdx为上下文模型组的索引,ctxSetIdx可以取0,1,2,3等,P为上下文模型组中上下文模型个数,P可以取2,3,4,5等。
示例性的,对语法元素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]和merge_subblock_flag[x0][y0],VVC有3个上下文模型组,一个组有3个上下文模型。
采用上述技术方案,通过设置较大的预定区域为当前块选择更多相关块,充分利用了图像块在空间上的相关性,能够为当前块的第一语法元素匹配到更适合的上下文模型,提高语法元素的压缩效率,进而提高整个系统的压缩效率。
为实现本申请实施例的方法,基于同一发明构思本申请实施例还提供了一种编码器,如图16所示,该编码器160包括:
第一选取单元1601,用于从预定区域内选取当前块对应的已编码的多个相关块;其中,所述预定区 域包括与所述当前块具备相关性的区域;
第一确定单元1602,用于基于所述多个相关块的参考信息,确定所述当前块的第一语法元素的上下文模型索引参数;
编码单元1603,用于基于所述上下文模型索引参数对应的上下文模型编码所述当前块的第一语法元素。
在一些实施例中,所述预定区域包括所述当前块的相邻区域和/或所述当前块的不相邻区域;所述预定区域包括所述当前块的相邻区域时,所述相关块包括所述当前块的相邻块;所述预定区域包括所述当前块的不相邻区域时,所述相关块包括所述当前块的不相邻块。需要说明的是,不止相邻块与当前块有空间上的相关性,距离近的不相邻块与当前块也有空间上的相关性。这也很容易理解,在预定区域内的内容都是有相关性的。也就是说,除了使用空域相邻块之外,还可以使用距离近的不相邻块,或者相邻块和不相邻块都使用,以参考足够多的相关块为当前块选择上下文模型。如此,通过设置较大的预定区域为当前块选择更多相关块,充分利用了图像块在空间上的相关性,根据更多相关块为当前块的第一语法元素匹配到更适合的上下文模型,避免偶然事件影响上下文模型的选择。
在一些实施例中,所述编码器还包括:设置单元,用于基于所述相关块与所述当前块的距离,配置所述相关块的权重。
在一些实施例中,设置单元,用于基于所述相关块的参考坐标和所述当前块的参考坐标,配置所述相关块的权重。
在一些实施例中,设置单元,用于确定所述相关块所在的第一子区域;其中,所述第一子区域为所述预定区域包含的至少两个第二子区域中的至少一个;基于所述相关块所在的第一子区域,配置所述相关块的权重。
在一些实施例中,所述预定区域可以包括所述当前块的相邻区域和所述当前块的不相邻区域。这样,考虑空间相关性的强弱,通过设置相关块的权重可以进一步提高上下文模型选择的准确性。
在一些实施例中,所述第一选取单元1601,用于基于所述当前块的参考坐标,在所述预定区域内确定所述相关块的参考坐标;基于所述相关块的参考坐标,获取所述相关块的参考信息。
在一些实施例中,所述第一选取单元1601,用于基于预设选取顺序和所述相关块的参考坐标,获取所述相关块的参考信息。
在一些实施例中,所述相关块的参考信息包括:所述相关块的第一语法元素的上下文模型索引参考量。
在一些实施例中,所述相关块的参考信息还包括:所述相关块的可用标识。
在一些实施例中,所述第一确定单元1602,用于确定所述第一语法元素对应的上下文模型索引偏移量;基于所述多个相关块的参考信息,确定所述当前块的第一语法元素的上下文模型索引增量;基于所述上下文模型索引增量和所述上下文模型索引偏移量,确定所述第一语法元素的所述上下文模型索引;将所述上下文模型索引参数设置为等于所述上下文模型索引。
在一些实施例中,所述第一确定单元1602,用于基于所述多个相关块的参考信息,确定第一中间量;基于预设转换算法对所述第一中间量进行转换,得到所述当前块的第一语法元素的上下文模型索引增量。
在一些实施例中,所述第一语法元素对应多个上下文模型组时,所述第一确定单元1602,用于基于所述多个相关块的参考信息,确定第一中间量;基于所述第一语法元素对应的上下文模型组索引和每个上下文模型组中的上下文模型个数,确定第二中间量;基于预设转换算法对所述第一中间量进行转换,得到第三中间量;基于所述第二中间量和所述第三中间量,得到所述当前块的第一语法元素的上下文模型索引增量。
在一些实施例中,所述相关块的参考信息包括:所述相关块的第一语法元素的可用标识和上下文模型索引参考量,所述第一确定单元1602,用于对每个相关块的所述可用标识和所述上下文模型索引参考量进行与运算,得到与运算结果;基于每个相关块的与运算结果,得到所述第一中间量。
在一些实施例中,所述相关块的参考信息包括:所述相关块的第一语法元素的可用标识和上下文模型索引参考量,所述第一确定单元1602,用于获取所述多个相关块的权重;对每个相关块的所述可用标识和所述上下文模型索引参考量进行与运算,得到与运算结果;基于所述多个相关块的权重对每个相关块的与运算结果进行加权运算;基于每个相关块的加权结果,得到所述第一中间量。
在一些实施例中,所述预设转换算法包括以下之一:将所述第一中间量设置为等于所述上下文模型索引增量;将所述第一中间量除以第一参考量得到所述上下文模型索引增量;将所述第一中间量右移第二参考量得到所述上下文模型索引增量;确定所述第一中间量所在的第一取值范围,将所述第一取值范围对应的索引增量作为所述上下文模型索引增量。
在一些实施例中,所述第一确定单元1602,用于确定选择所述第一语法元素的上下文模型时所使用的第一上下文模型列表;将所述上下文模型索引参数设置为所述第一上下文模型列表的索引。
在实际应用中,本申请实施例还提供了一种编码器,图17为本申请实施例中编码器的第二组成结构示意图如图17所示,编码器170包括:
第一存储器1701和第一处理器1702;第一存储器1701存储有可在第一处理器1702上运行的计算机程序,第一处理器1702执行程序时编码器侧的编码方法。
采用上述方案,通过设置较大的预定区域为当前块选择更多相关块,充分利用了图像块在空间上的相关性,能够为当前块的第一语法元素匹配到更适合的上下文模型,提高语法元素的压缩效率,进而提高整个系统的压缩效率。
本申请实施例提供一种解码器,图18为本申请实施例中解码器的第一组成结构示意图,如图18所示,该解码器180包括:
第一解码单元1801,用于解码码流,获取当前块的第一语法元素的待解码信息;
第二选取单元1802,用于从预定区域内选取所述当前块对应的已解码的多个相关块;其中,所述预定区域包括与所述当前块具备相关性的区域;
第二确定单元1803,用于基于所述多个相关块的参考信息,确定所述当前块的第一语法元素的上下文模型索引参数;
第二解码单元1804,用于基于所述上下文模型索引参数对应的上下文模型解码所述待解码信息,得到所述当前块的第一语法元素。
在一些实施例中,所述预定区域包括所述当前块的相邻区域和/或所述当前块的不相邻区域;所述预定区域包括所述当前块的相邻区域时,所述相关块包括所述当前块的相邻块;所述预定区域包括所述当前块的不相邻区域时,所述相关块包括所述当前块的不相邻块。需要说明的是,不止相邻块与当前块有空间上的相关性,距离近的不相邻块与当前块也有空间上的相关性。这也很容易理解,在预定区域内的内容都是有相关性的。也就是说,除了使用空域相邻块之外,还可以使用距离近的不相邻块,或者相邻块和不相邻块都使用,以参考足够多的相关块为当前块选择上下文模型。如此,通过设置较大的预定区域为当前块选择更多相关块,充分利用了图像块在空间上的相关性,根据更多相关块为当前块的第一语法元素匹配到更适合的上下文模型,避免偶然事件影响上下文模型的选择。
在一些实施例中,所述解码器还包括:设置单元,用于基于所述相关块与所述当前块的距离,配置所述相关块的权重。
在一些实施例中,设置单元,用于基于所述相关块的参考坐标和所述当前块的参考坐标,配置所述相关块的权重。
在一些实施例中,设置单元,用于确定所述相关块所在的第一子区域;其中,所述第一子区域为所述预定区域包含的至少两个第二子区域中的至少一个;基于所述相关块所在的第一子区域,配置所述相关块的权重。
在一些实施例中,所述预定区域可以包括所述当前块的相邻区域和所述当前块的不相邻区域。这样,考虑空间相关性的强弱,通过设置相关块的权重可以进一步提高上下文模型选择的准确性。
在一些实施例中,第二选取单元1802,用于基于所述当前块的参考坐标,在所述预定区域内确定所述相关块的参考坐标;基于所述相关块的参考坐标,获取所述相关块的参考信息。
在一些实施例中,第二选取单元1802,用于基于预设选取顺序和所述相关块的参考坐标,获取所述相关块的参考信息。
在一些实施例中,所述相关块的参考信息包括:所述相关块的第一语法元素的上下文模型索引参考量。
在一些实施例中,所述相关块的参考信息还包括:所述相关块的可用标识。
在一些实施例中,第二确定单元1803,用于确定所述第一语法元素对应的上下文模型索引偏移量;基于所述多个相关块的参考信息,确定所述当前块的第一语法元素的上下文模型索引增量;基于所述上下文模型索引增量和所述上下文模型索引偏移量,确定所述第一语法元素的所述上下文模型索引;将所述上下文模型索引参数设置为等于所述上下文模型索引。
在一些实施例中,第二确定单元1803,用于基于所述多个相关块的参考信息,确定第一中间量;基于预设转换算法对所述第一中间量进行转换,得到所述当前块的第一语法元素的上下文模型索引增量。
在一些实施例中,所述第一语法元素对应多个上下文模型组时,第二确定单元1803,用于基于所述多个相关块的参考信息,确定第一中间量;基于所述第一语法元素对应的上下文模型组索引和每个上下文模型组中的上下文模型个数,确定第二中间量;基于预设转换算法对所述第一中间量进行转换,得到第三中间量;基于所述第二中间量和所述第三中间量,得到所述当前块的第一语法元素的上下文模型索引增量。
在一些实施例中,所述相关块的参考信息包括:所述相关块的第一语法元素的可用标识和上下文模型索引参考量,第二确定单元1803,用于对每个相关块的所述可用标识和所述上下文模型索引参考量进 行与运算,得到与运算结果;基于每个相关块的与运算结果,得到所述第一中间量。
在一些实施例中,所述相关块的参考信息包括:所述相关块的第一语法元素的可用标识和上下文模型索引参考量,第二确定单元1803,用于获取所述多个相关块的权重;对每个相关块的所述可用标识和所述上下文模型索引参考量进行与运算,得到与运算结果;基于所述多个相关块的权重对每个相关块的与运算结果进行加权运算;基于每个相关块的加权结果,得到所述第一中间量。
在一些实施例中,所述预设转换算法包括以下之一:将所述第一中间量设置为等于所述上下文模型索引增量;将所述第一中间量除以第一参考量得到所述上下文模型索引增量;将所述第一中间量右移第二参考量得到所述上下文模型索引增量;确定所述第一中间量所在的第一取值范围,将所述第一取值范围对应的索引增量作为所述上下文模型索引增量。
在一些实施例中,第二确定单元1803,用于确定选择所述第一语法元素的上下文模型时所使用的第一上下文模型列表;将所述上下文模型索引参数设置为所述第一上下文模型列表的索引。
在实际应用中,本申请实施例还提供了一种解码器,图19为本申请实施例中解码器的第二组成结构示意图,如图19所示,解码器190包括:
第二存储器1901和第二处理器1902;第二存储器1901存储有可在第二处理器1902上运行的计算机程序,第二处理器1902执行程序时解码器侧的解码方法。
采用上述技术方案,通过设置较大的预定区域为当前块选择更多相关块,充分利用了图像块在空间上的相关性,能够为当前块的第一语法元素匹配到更适合的上下文模型,提高语法元素的压缩效率,进而提高整个系统的压缩效率。
另外,在本实施例中的各功能模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。
相应的,本申请实施例提供了一种存储介质,其上存储有计算机程序,该计算机程序被第一处理器执行时,实现编码器的编码方法;或者,该计算机程序被第二处理器执行时,实现解码器的解码方法。
这里需要指出的是:以上存储介质和装置实施例的描述,与上述方法实施例的描述是类似的,具有同方法实施例相似的有益效果。对于本申请存储介质和装置实施例中未披露的技术细节,请参照本申请方法实施例的描述而理解。
以上,仅为本申请的实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以权利要求的保护范围为准。
工业实用性
本申请提供了一种编解码方法、编码器、解码器及存储介质,包括:从预定区域内选取当前块对应的已编码的多个相关块;其中,所述预定区域包括与所述当前块具备相关性的区域;基于所述多个相关块的参考信息,确定所述当前块的第一语法元素的上下文模型索引参数;基于所述上下文模型索引参数对应的上下文模型编码所述当前块的第一语法元素。这样,通过设置较大的预定区域为当前块选择更多相关块,充分利用了图像块在空间上的相关性,能够为当前块的第一语法元素匹配到更适合的上下文模型,提高语法元素的压缩效率,进而提高整个系统的压缩效率。

Claims (37)

  1. 一种编码方法,应用于编码器,其中,包括:
    从预定区域内选取当前块对应的已编码的多个相关块;其中,所述预定区域包括与所述当前块具备相关性的区域;
    基于所述多个相关块的参考信息,确定所述当前块的第一语法元素的上下文模型索引参数;
    基于所述上下文模型索引参数对应的上下文模型编码所述当前块的第一语法元素。
  2. 根据权利要求1所述的方法,其中,
    所述预定区域包括所述当前块的相邻区域和/或所述当前块的不相邻区域;
    所述预定区域包括所述当前块的相邻区域时,所述相关块包括所述当前块的相邻块;
    所述预定区域包括所述当前块的不相邻区域时,所述相关块包括所述当前块的不相邻块。
  3. 根据权利要求1所述的方法,其中,所述方法还包括:
    基于所述相关块与所述当前块的距离,配置所述相关块的权重。
  4. 根据权利要求1所述的方法,其中,所述方法还包括:
    基于所述相关块的参考坐标和所述当前块的参考坐标,配置所述相关块的权重。
  5. 根据权利要求1所述的方法,其中,所述方法还包括:
    确定所述相关块所在的第一子区域;其中,所述第一子区域为所述预定区域包含的至少两个第二子区域中的至少一个;
    基于所述相关块所在的第一子区域,配置所述相关块的权重。
  6. 根据权利要求1所述的方法,其中,所述从预定区域内选取当前块对应的已编码的多个相关块,包括:
    基于所述当前块的参考坐标,在所述预定区域内确定所述相关块的参考坐标;
    基于所述相关块的参考坐标,获取所述相关块的参考信息。
  7. 根据权利要求6所述的方法,其中,所述方法还包括:
    基于预设选取顺序和所述相关块的参考坐标,获取所述相关块的参考信息。
  8. 根据权利要求1所述的方法,其中,所述相关块的参考信息包括:所述相关块的第一语法元素的上下文模型索引参考量。
  9. 根据权利要求8所述的方法,其中,所述相关块的参考信息还包括:所述相关块的可用标识。
  10. 根据权利要求1所述的方法,其中,
    所述基于所述多个相关块的参考信息,确定所述当前块的第一语法元素的上下文模型索引参数,包括:
    确定所述第一语法元素对应的上下文模型索引偏移量;
    基于所述多个相关块的参考信息,确定所述当前块的第一语法元素的上下文模型索引增量;
    基于所述上下文模型索引增量和所述上下文模型索引偏移量,确定所述第一语法元素的所述上下文模型索引;
    将所述上下文模型索引参数设置为等于所述上下文模型索引。
  11. 根据权利要求10所述的方法,其中,
    所述基于所述多个相关块的参考信息,确定所述当前块的第一语法元素的上下文模型索引增量,包括:
    基于所述多个相关块的参考信息,确定第一中间量;
    基于预设转换算法对所述第一中间量进行转换,得到所述当前块的第一语法元素的上下文模型索引增量。
  12. 根据权利要求10所述的方法,其中,
    所述第一语法元素对应多个上下文模型组时,所述基于所述多个相关块的参考信息,确定所述当前块的第一语法元素的上下文模型索引增量,包括:
    基于所述多个相关块的参考信息,确定第一中间量;
    基于所述第一语法元素对应的上下文模型组索引和每个上下文模型组中的上下文模型个数,确定第二中间量;
    基于预设转换算法对所述第一中间量进行转换,得到第三中间量;
    基于所述第二中间量和所述第三中间量,得到所述当前块的第一语法元素的上下文模型索引增量。
  13. 根据权利要求11或12所述的方法,其中,所述相关块的参考信息包括:所述相关块的第一语法元素的可用标识和上下文模型索引参考量,
    所述基于所述多个相关块的参考信息,确定第一中间量,包括:
    对每个相关块的所述可用标识和所述上下文模型索引参考量进行与运算,得到与运算结果;
    基于每个相关块的与运算结果,得到所述第一中间量。
  14. 根据权利要求11或12所述的方法,其中,所述相关块的参考信息包括:所述相关块的第一语法元素的可用标识和上下文模型索引参考量,
    所述基于所述多个相关块的参考信息,确定第一中间量,包括:
    获取所述多个相关块的权重;
    对每个相关块的所述可用标识和所述上下文模型索引参考量进行与运算,得到与运算结果;
    基于所述多个相关块的权重对每个相关块的与运算结果进行加权运算;
    基于每个相关块的加权结果,得到所述第一中间量。
  15. 根据权利要求11或12所述的方法,其中,所述预设转换算法包括以下之一:
    将所述第一中间量设置为等于所述上下文模型索引增量;
    将所述第一中间量除以第一参考量得到所述上下文模型索引增量;
    将所述第一中间量右移第二参考量得到所述上下文模型索引增量;
    确定所述第一中间量所在的第一取值范围,将所述第一取值范围对应的索引增量作为所述上下文模型索引增量。
  16. 根据权利要求10所述的方法,其中,所述方法还包括:
    确定选择所述第一语法元素的上下文模型时所使用的第一上下文模型列表;
    将所述上下文模型索引参数设置为所述第一上下文模型列表的索引。
  17. 一种解码方法,应用于解码器,其中,包括
    解码码流,获取当前块的第一语法元素的待解码信息;
    从预定区域内选取所述当前块对应的已解码的多个相关块;其中,所述预定区域包括与所述当前块具备相关性的区域;
    基于所述多个相关块的参考信息,确定所述当前块的第一语法元素的上下文模型索引参数;
    基于所述上下文模型索引参数对应的上下文模型解码所述待解码信息,得到所述当前块的第一语法元素。
  18. 根据权利要求17所述的方法,其中,
    所述预定区域包括所述当前块的相邻区域和/或所述当前块的不相邻区域;
    所述预定区域包括所述当前块的相邻区域时,所述相关块包括所述当前块的相邻块;
    所述预定区域包括所述当前块的不相邻区域时,所述相关块包括所述当前块的不相邻块。
  19. 根据权利要求17所述的方法,其中,所述方法还包括:
    基于所述相关块与所述当前块的距离,配置所述相关块的权重。
  20. 根据权利要求17所述的方法,其中,所述方法还包括:
    基于所述相关块的参考坐标和所述当前块的参考坐标,配置所述相关块的权重。
  21. 根据权利要求17所述的方法,其中,所述方法还包括:
    确定所述相关块所在的第一子区域;其中,所述第一子区域为所述预定区域包含的至少两个第二子区域中的至少一个;
    基于所述相关块所在的第一子区域,配置所述相关块的权重。
  22. 根据权利要求17所述的方法,其中,所述从预定区域内选取所述当前块对应的已解码的多个相关块,包括:
    基于所述当前块的参考坐标,在所述预定区域内确定所述相关块的参考坐标;
    基于所述相关块的参考坐标,获取所述相关块的参考信息。
  23. 根据权利要求22所述的方法,其中,所述方法还包括:
    基于预设选取顺序和所述相关块的参考坐标,获取所述相关块的参考信息。
  24. 根据权利要求17所述的方法,其中,所述相关块的参考信息包括:所述相关块的第一语法元素的上下文模型索引参考量。
  25. 根据权利要求24所述的方法,其中,所述相关块的参考信息还包括:所述相关块的可用标识。
  26. 根据权利要求17所述的方法,其中,
    所述基于所述多个相关块的参考信息,确定所述当前块的第一语法元素的上下文模型索引参数,包括:
    确定所述第一语法元素对应的上下文模型索引偏移量;
    基于所述多个相关块的参考信息,确定所述当前块的第一语法元素的上下文模型索引增量;
    基于所述上下文模型索引增量和所述上下文模型索引偏移量,确定所述第一语法元素的所述上下文 模型索引;
    将所述上下文模型索引参数设置为等于所述上下文模型索引。
  27. 根据权利要求26所述的方法,其中,所述基于所述多个相关块的参考信息,确定所述当前块的第一语法元素的上下文模型索引增量,包括:
    基于所述多个相关块的参考信息,确定第一中间量;
    基于预设转换算法对所述第一中间量进行转换,得到所述当前块的第一语法元素的上下文模型索引增量。
  28. 根据权利要求26所述的方法,其中,
    所述第一语法元素对应多个上下文模型组时,所述基于所述多个相关块的参考信息,确定所述当前块的第一语法元素的上下文模型索引增量,包括:
    基于所述多个相关块的参考信息,确定第一中间量;
    基于所述第一语法元素对应的上下文模型组索引和每个上下文模型组中的上下文模型个数,确定第二中间量;
    基于预设转换算法对所述第一中间量进行转换,得到第三中间量;
    基于所述第二中间量和所述第三中间量,得到所述当前块的第一语法元素的上下文模型索引增量。
  29. 根据权利要求27或28所述的方法,其中,所述相关块的参考信息包括:所述相关块的第一语法元素的可用标识和上下文模型索引参考量,
    所述基于所述多个相关块的参考信息,确定第一中间量,包括:
    对每个相关块的所述可用标识和所述上下文模型索引参考量进行与运算,得到与运算结果;
    基于每个相关块的与运算结果,得到所述第一中间量。
  30. 根据权利要求27或28所述的方法,其中,所述相关块的参考信息包括:所述相关块的第一语法元素的可用标识和上下文模型索引参考量,
    所述基于所述多个相关块的参考信息,确定第一中间量,包括:
    获取所述多个相关块的权重;
    对每个相关块的所述可用标识和所述上下文模型索引参考量进行与运算,得到与运算结果;
    基于所述多个相关块的权重对每个相关块的与运算结果进行加权运算;
    基于每个相关块的加权结果,得到所述第一中间量。
  31. 根据权利要求27或28所述的方法,其中,所述预设转换算法包括以下之一:
    将所述第一中间量设置为等于所述上下文模型索引增量;
    将所述第一中间量除以第一参考量得到所述上下文模型索引增量;
    将所述第一中间量右移第二参考量得到所述上下文模型索引增量;
    确定所述第一中间量所在的第一取值范围,将所述第一取值范围对应的索引增量作为所述上下文模型索引增量。
  32. 根据权利要求26所述的方法,其中,所述方法还包括:
    确定选择所述第一语法元素的上下文模型时所使用的第一上下文模型列表;
    将所述上下文模型索引参数设置为所述第一上下文模型列表的索引。
  33. 一种编码器,其中,所述编码器包括:
    第一选取单元,用于从预定区域内选取当前块对应的已编码的多个相关块;其中,所述预定区域包括与所述当前块具备相关性的区域;
    第一确定单元,用于基于所述多个相关块的参考信息,确定所述当前块的第一语法元素的上下文模型索引参数;
    编码单元,用于基于所述上下文模型索引参数对应的上下文模型编码所述当前块的第一语法元素。
  34. 一种解码器,其中,所述解码器包括:
    第一解码单元,用于解码码流,获取当前块的第一语法元素的待解码信息;
    第二选取单元,用于从预定区域内选取所述当前块对应的已解码的多个相关块;其中,所述预定区域包括与所述当前块具备相关性的区域;
    第二确定单元,用于基于所述多个相关块的参考信息,确定所述当前块的第一语法元素的上下文模型索引参数;
    第二解码单元,用于基于所述上下文模型索引参数对应的上下文模型解码所述待解码信息,得到所述当前块的第一语法元素。
  35. 一种编码器,其中,所述编码器包括:
    第一存储器和第一处理器;
    所述第一存储器存储有可在第一处理器上运行的计算机程序,所述第一处理器执行所述程序时实现 权利要求1至16任一项所述编码方法。
  36. 一种解码器,其中,所述解码器包括:
    第二存储器和第二处理器;
    所述第二存储器存储有可在第二处理器上运行的计算机程序,所述第二处理器执行所述程序时实现权利要求17至32任一项所述解码方法。
  37. 一种计算机可读存储介质,其中,所述计算机可读存储介质存储有计算机程序,所述计算机程序被第一处理器执行时,实现权利要求1至16任一项所述编码方法;或者,所述计算机程序被第二处理器执行时,实现权利要求17至32任一项所述解码方法。
PCT/CN2022/086089 2022-04-11 2022-04-11 一种编解码方法、编码器、解码器及存储介质 WO2023197104A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2022/086089 WO2023197104A1 (zh) 2022-04-11 2022-04-11 一种编解码方法、编码器、解码器及存储介质

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2022/086089 WO2023197104A1 (zh) 2022-04-11 2022-04-11 一种编解码方法、编码器、解码器及存储介质

Publications (1)

Publication Number Publication Date
WO2023197104A1 true WO2023197104A1 (zh) 2023-10-19

Family

ID=88328621

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/086089 WO2023197104A1 (zh) 2022-04-11 2022-04-11 一种编解码方法、编码器、解码器及存储介质

Country Status (1)

Country Link
WO (1) WO2023197104A1 (zh)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105025296A (zh) * 2014-04-30 2015-11-04 北京大学 一种高级算术编码器及其实现方法
US20200029091A1 (en) * 2016-09-29 2020-01-23 Qualcomm Incorporated Motion vector coding for video coding
CN112040247A (zh) * 2018-09-10 2020-12-04 华为技术有限公司 视频解码方法及视频解码器
CN113647112A (zh) * 2019-03-11 2021-11-12 交互数字Vc控股公司 用于视频编码和解码的熵编解码

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105025296A (zh) * 2014-04-30 2015-11-04 北京大学 一种高级算术编码器及其实现方法
US20200029091A1 (en) * 2016-09-29 2020-01-23 Qualcomm Incorporated Motion vector coding for video coding
CN112040247A (zh) * 2018-09-10 2020-12-04 华为技术有限公司 视频解码方法及视频解码器
CN113647112A (zh) * 2019-03-11 2021-11-12 交互数字Vc控股公司 用于视频编码和解码的熵编解码

Similar Documents

Publication Publication Date Title
US10742984B2 (en) Method and apparatus for multi-table based context adaptive binary arithmetic coding
TWI753356B (zh) 用於編碼或解碼轉換塊的方法與裝置
JP7325553B2 (ja) 符号化・復号化の方法、装置、および記憶媒体
TWI748201B (zh) 適於相依純量量化之變換係數熵寫碼技術
US10819981B2 (en) Method and apparatus for entropy coding of source samples with large alphabet
RU2562764C2 (ru) Кодирование коэффициентов преобразования для кодирования видео
JP7245341B2 (ja) 統合変換タイプ通知および変換タイプ依存変換係数レベルコーディング
CN113068032B (zh) 图像编解码方法、编码器、解码器以及存储介质
KR102020101B1 (ko) 비디오 코덱에서 신택스 요소 인코딩을 위한 방법 및 장치
JP7250927B2 (ja) フレーム内予測符号化方法、装置、電子デバイスおよびコンピュータプログラム
TW201349867A (zh) 用於係數掃描之係數群及係數寫碼
TW201309031A (zh) 視訊編碼方法與裝置以及視訊解碼方法與裝置
JP2015507885A5 (zh)
WO2022116317A1 (zh) 帧内预测方法、编码器、解码器以及存储介质
US11695962B2 (en) Encoding and decoding methods and corresponding devices
CN111316642B (zh) 信令图像编码和解码划分信息的方法和装置
JP7439841B2 (ja) ループ内フィルタリングの方法及びループ内フィルタリングの装置
TW202131681A (zh) 脈絡適應性二進制算術寫碼用參數化體系決定技術
WO2020182104A1 (zh) 进行编码和解码的方法、解码装置和编码装置
CN113497936A (zh) 编码方法、解码方法、编码器、解码器以及存储介质
WO2023197104A1 (zh) 一种编解码方法、编码器、解码器及存储介质
CN116016915B (zh) 变换与系数信令的方法和装置
JP2012134757A (ja) コンテクスト適応エントロピー符号化方法,コンテクスト適応エントロピー復号方法,コンテクスト適応エントロピー符号化装置,コンテクスト適応エントロピー復号装置およびそれらのプログラム
CN117063467A (zh) 块划分方法、编码器、解码器以及计算机存储介质
WO2022188114A1 (zh) 帧内预测方法、编码器、解码器以及存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22936764

Country of ref document: EP

Kind code of ref document: A1