Coding method, decoding method, encoder and decoder
View Patent ↗Disclosed in the present application are a coding method, a decoding method, an encoder and a decoder. The coding method includes: selecting a plurality of coded related blocks corresponding to a current block from a predetermined area, the predetermined area comprising an area having a correlation with the current block; on the basis of information of the plurality of related blocks, determining a context index parameter of a first syntax element of the current block; and on the basis of a context corresponding to the context index parameter, coding the first syntax element of the current block.
1 . A coding method, applied to an encoder, comprising:
selecting, from a predetermined region, a plurality of coded related blocks corresponding to a current block, wherein the predetermined region comprises a region having a correlation with the current block;
determining, based on information of the plurality of related blocks, a context index parameter for a first syntax element of the current block; and
coding, based on a context corresponding to the context index parameter, the first syntax element of the current block,
wherein the predetermined region comprises a non-adjacent region of the current block and the related blocks comprise non-adjacent blocks of the current block.
2 . The method of claim 1 , wherein
the predetermined region further comprises an adjacent region of the current block and the related blocks further comprise adjacent blocks of the current block.
3 . The method of claim 1 , further comprising:
configuring, based on distances between the related blocks and the current block, weights for the related blocks, or
configuring, based on coordinates of the related blocks and coordinates of the current block, weights for the related blocks.
4 . The method of claim 1 , wherein information of a related block comprises: a context index reference value of a first syntax element of the related block and an availability flag of the related block.
5 . The method of claim 1 , wherein determining, based on the information of the plurality of related blocks, the context index parameter for the first syntax element of the current block comprises:
determining a context index offset corresponding to the first syntax element;
determining, based on the information of the plurality of related blocks, a context index increment for the first syntax element of the current block;
determining, based on the context index increment and the context index offset, the context index of the first syntax element; and
setting the context index parameter to be equal to the context index.
6 . The method of claim 5 , wherein determining, based on the information of the plurality of related blocks, the context index increment for the first syntax element of the current block comprises:
determining, based on the information of the plurality of related blocks, a first temporary value; and
performing, based on a preset conversion algorithm, conversion on the first temporary value to acquire the context index increment for the first syntax element of the current block.
7 . The method of claim 6 , wherein the information of the related blocks comprises: an availability flag and a context index reference value of a first syntax element of each related block, and
determining, based on the information of the plurality of related blocks, the first temporary value comprises:
acquiring weights of the plurality of related blocks;
performing an AND operation on the availability flag and the context index reference value of each related block to acquire an AND operation result;
performing, based on the weights of the plurality of related blocks, a weighting operation on the AND operation result of each related block; and
acquiring, based on a weighting result of each related block, the first temporary value.
8 . A decoding method, applied to a decoder, comprising:
decoding a bitstream to acquire information to be decoded of a first syntax element of a current block;
selecting, from a predetermined region, a plurality of decoded related blocks corresponding to the current block, wherein the predetermined region comprises a region having a correlation with the current block;
determining, based on information of the plurality of related blocks, a context index parameter for the first syntax element of the current block; and
decoding, based on a context corresponding to the context index parameter, the information to be decoded to acquire the first syntax element of the current block,
wherein the predetermined region comprises a non-adjacent region of the current block and the related blocks comprise non-adjacent blocks of the current block.
9 . The method of claim 8 , wherein
the predetermined region further comprises an adjacent region of the current block and the related blocks further comprise adjacent blocks of the current block.
10 . The method of claim 8 , further comprising:
configuring, based on distances between the related blocks and the current block, weights for the related blocks, or
configuring, based on coordinates of the related blocks and coordinates of the current block, weights for the related blocks.
11 . The method of claim 8 , wherein information of a related block comprises: a context index reference value of a first syntax element of the related block and an availability flag of the related block.
12 . The method of claim 8 , wherein determining, based on the information of the plurality of related blocks, the context index parameter for the first syntax element of the current block comprises:
determining a context index offset corresponding to the first syntax element;
determining, based on the information of the plurality of related blocks, a context index increment for the first syntax element of the current block;
determining, based on the context index increment and the context index offset, the context index of the first syntax element; and
setting the context index parameter to be equal to the context index.
13 . The method of claim 12 , wherein determining, based on the information of the plurality of related blocks, the context index increment for the first syntax element of the current block comprises:
determining, based on the information of the plurality of related blocks, a first temporary value; and
performing, based on a preset conversion algorithm, conversion on the first temporary value, to acquire the context index increment for the first syntax element of the current block.
14 . The method of claim 13 , wherein the information of the related blocks comprises: an availability flag and a context index reference value of a first syntax element of each related block, and
determining, based on the information of the plurality of related blocks, the first temporary value comprises:
acquiring weights of the plurality of related blocks;
performing an AND operation on the availability flag and the context index reference value of each related block to acquire an AND operation result;
performing, based on the weights of the plurality of related blocks, a weighting operation on the AND operation result of each related block; and
acquiring, based on a weighting result of each related block, the first temporary value.
15 . A decoder, comprising:
a memory for storing a computer program; and
a processor,
wherein the processor is configured to execute the computer program to perform the following operations:
decoding a bitstream to acquire information to be decoded of a first syntax element of a current block;
selecting, from a predetermined region, a plurality of decoded related blocks corresponding to the current block, wherein the predetermined region comprises a region having a correlation with the current block;
determining, based on information of the plurality of related blocks, a context index parameter for the first syntax element of the current block; and
decoding, based on a context corresponding to the context index parameter, the information to be decoded to acquire the first syntax element of the current block,
wherein the predetermined region comprises a non-adjacent region of the current block and the related blocks comprise non-adjacent blocks of the current block.
16 . The decoder of claim 15 , wherein the processor is further configured to execute the computer program to:
configure, based on distances between the related blocks and the current block, weights for the related blocks, or
configure, based on coordinates of the related blocks and coordinates of the current block, weights for the related blocks.
17 . The decoder of claim 15 , wherein information of a related block comprises: a context index reference value of a first syntax element of the related block and an availability flag of the related block.
18 . The decoder of claim 15 , wherein the processor is further configured to execute the computer program to:
determine a context index offset corresponding to the first syntax element;
determine, based on the information of the plurality of related blocks, a first temporary value;
perform, based on a preset conversion algorithm, conversion on the first temporary value, to acquire a context index increment for the first syntax element of the current block;
determine, based on the context index increment and the context index offset, the context index of the first syntax element; and
set the context index parameter to be equal to the context index.
19 . An encoder, comprising:
a memory for storing a computer program; and
a processor,
wherein the processor is configured to execute the computer program to implement the following operations:
selecting, from a predetermined region, a plurality of coded related blocks corresponding to a current block, wherein the predetermined region comprises a region having a correlation with the current block;
determining, based on information of the plurality of related blocks, a context index parameter for a first syntax element of the current block; and
coding, based on a context corresponding to the context index parameter, the first syntax element of the current block,
wherein the predetermined region comprises a non-adjacent region of the current block and the related blocks comprise non-adjacent blocks of the current block.
20 . A non-transitory computer-readable storage medium, having a computer program and a bitstream stored thereon, wherein the computer program, when executed by a processor, enables the processor to perform the steps of the encoding method of claim 1 to generate the bitstream.