Encoding and decoding method and apparatus, and devices
AssigneeHangzhou Hikvision Digital Technology Co., Ltd.
InventorFangdong Chen
Life of this patent
Estimating the term…
Abstract
The present disclosure provides an encoding and decoding method, apparatus, and devices. The encoding and decoding method includes the following steps: determining to use a decoder-side motion vector refinement mode for a current block if the conditions are all satisfied; and if it is determined to use the decoder-side motion vector refinement mode for the current block, performing motion compensation on the current block.
Claims20
A decoding method, comprising:
- in response to determining to use decoder-side motion vector refinement mode for a current block, performing, based on the decoder-side motion vector refinement mode, motion compensation on the current block to obtain prediction values of the current block;
- wherein, performing, based on the decoder-side motion vector refinement mode, the motion compensation on the current block to obtain the prediction values of the current block, comprising:
- for each sub-block of one or more sub-blocks comprised in the current block:
- determining, according to a first original motion vector of the sub-block, a first reference block corresponding to the sub-block;
- determining, according to a second original motion vector of the sub-block, a second reference block corresponding to the sub-block;
- adjusting, according to first pixel values of the first reference block and second pixel values of the second reference block, the first original motion vector and the second original motion vector, to obtain a first target motion vector corresponding to the first original motion vector and a second target motion vector corresponding to the second original motion vector;
- and
- determining, according to the first target motion vector and the second target motion vector, prediction values of the sub-block;
- obtaining, according to prediction values of all sub-blocks in the current block, prediction values of the current block;
- wherein, adjusting, according to first pixel values of the first reference block and second pixel values of the second reference block, the first original motion vector and the second original motion vector, to obtain the first target motion vector corresponding to the first original motion vector and the second target motion vector corresponding to the second original motion vector comprising:
- selecting all of (2*SR+1)*(2*SR+1) motion vectors surrounding and comprising an initial motion vector as candidate motion vectors;
- according to the first pixel values of the first reference block and the second pixel values of the second reference block, determining cost values of the candidate motion vectors and determining a motion vector with a minimum cost value from the candidate motion vectors as an optimal motion vector;
- adjusting, according to the optimal motion vector, the first original motion vector and the second original motion vector, to obtain the first target motion vector corresponding to the first original motion vector and the second target motion vector corresponding to the second original motion vector;
- wherein, the initial motion vector is the first original motion vector or the second original motion vector;
- wherein, SR represents a search range, a value of SR is equal to 2, and the search order of 25 motion vectors is as follows:
- {Mv(0, 0), Mv(−2, −2), Mv(−1, −2), Mv(0, −2), Mv(1, −2), Mv(2, −2), Mv(−2, −1), Mv(−1, −1), Mv(0, −1), Mv(1, −1), Mv(2, −1), Mv(−2, 0), Mv(−1, 0), Mv(0, 0), Mv(1, 0), Mv(2, 0), Mv(−2, 1), Mv(−1, 1), Mv(0, 1), Mv(1, 1), Mv(2, 1), Mv(−2, 2), Mv(−1, 2), Mv(0, 2), Mv(1, 2), Mv(2, 2)};
- Mv(0,0) represents the initial motion vector, other candidates motion vector excluded Mv(0,0) are offset motion vectors of the initial motion vector.
An encoding method, comprising:
- in response to determining to use decoder-side motion vector refinement mode for a current block, encoding the current block based on the decoder-side motion vector refinement mode;
- wherein, encoding the current block based on the decoder-side motion vector refinement mode, comprising:
- for each sub-block of one or more sub-blocks comprised in the current block:
- determining, according to a first original motion vector of the sub-block, a first reference block corresponding to the sub-block;
- determining, according to a second original motion vector of the sub-block, a second reference block corresponding to the sub-block;
- adjusting, according to first pixel values of the first reference block and second pixel values of the second reference block, the first original motion vector and the second original motion vector, to obtain a first target motion vector corresponding to the first original motion vector and a second target motion vector corresponding to the second original motion vector;
- and
- determining, according to the first target motion vector and the second target motion vector, prediction values of the sub-block;
- obtaining, according to prediction values of all sub-blocks in the current block, prediction values of the current block;
- wherein, adjusting, according to first pixel values of the first reference block and second pixel values of the second reference block, the first original motion vector and the second original motion vector, to obtain the first target motion vector corresponding to the first original motion vector and the second target motion vector corresponding to the second original motion vector comprising:
- selecting all of (2*SR+1)*(2*SR+1) motion vectors surrounding and comprising an initial motion vector as candidate motion vectors;
- according to the first pixel values of the first reference block and the second pixel values of the second reference block, determining cost values of the candidate motion vectors and determining a motion vector with a minimum cost value from the candidate motion vectors as an optimal motion vector;
- adjusting, according to the optimal motion vector, the first original motion vector and the second original motion vector, to obtain the first target motion vector corresponding to the first original motion vector and the second target motion vector corresponding to the second original motion vector;
- wherein, the initial motion vector is the first original motion vector or the second original motion vector;
- wherein, SR represents a search range, a value of SR is equal to 2, and the search order of 25 motion vectors is as follows:
- {Mv(0, 0), Mv(−2, −2), Mv(−1, −2), Mv(0, −2), Mv(1, −2), Mv(2, −2), Mv(−2, −1), Mv(−1, −1), Mv(0, −1), Mv(1, −1), Mv(2, −1), Mv(−2, 0), Mv(−1, 0), Mv(0, 0), Mv(1, 0), Mv(2, 0), Mv(−2, 1), Mv(−1, 1), Mv(0, 1), Mv(1, 1), Mv(2, 1), Mv(−2, 2), Mv(−1, 2), Mv(0, 2), Mv(1, 2), Mv(2, 2)};
- Mv(0,0) represents the initial motion vector, other candidates motion vector excluded Mv(0,0) are offset motion vectors of the initial motion vector.
A decoding device, comprising a processor and a machine-readable storage medium, wherein the machine-readable storage medium stores machine-executable instructions executable by the processor;
- and
- the processor is configured to execute the machine-executable instructions to implement the operations comprising:
- in response to determining to use decoder-side motion vector refinement mode for a current block, performing, based on the decoder-side motion vector refinement mode, motion compensation on the current block to obtain prediction values of the current block;
- wherein, performing, based on the decoder-side motion vector refinement mode, the motion compensation on the current block to obtain the prediction values of the current block, comprising:
- for each sub-block of one or more sub-blocks comprised in the current block:
- determining, according to a first original motion vector of the sub-block, a first reference block corresponding to the sub-block;
- determining, according to a second original motion vector of the sub-block, a second reference block corresponding to the sub-block;
- adjusting, according to first pixel values of the first reference block and second pixel values of the second reference block, the first original motion vector and the second original motion vector, to obtain a first target motion vector corresponding to the first original motion vector and a second target motion vector corresponding to the second original motion vector;
- and
- determining, according to the first target motion vector and the second target motion vector, prediction values of the sub-block;
- obtaining, according to prediction values of all sub-blocks in the current block, prediction values of the current block;
- wherein, adjusting, according to first pixel values of the first reference block and second pixel values of the second reference block, the first original motion vector and the second original motion vector, to obtain the first target motion vector corresponding to the first original motion vector and the second target motion vector corresponding to the second original motion vector comprising:
- selecting all of (2*SR+1)*(2*SR+1) motion vectors surrounding and comprising an initial motion vector as candidate motion vectors;
- according to the first pixel values of the first reference block and the second pixel values of the second reference block, determining cost values of the candidate motion vectors and determining a motion vector with a minimum cost value from the candidate motion vectors as an optimal motion vector;
- adjusting, according to the optimal motion vector, the first original motion vector and the second original motion vector, to obtain the first target motion vector corresponding to the first original motion vector and the second target motion vector corresponding to the second original motion vector;
- wherein, the initial motion vector is the first original motion vector or the second original motion vector;
- wherein, SR represents a search range, a value of SR is equal to 2, and the search order of 25 motion vectors is as follows:
- {Mv(0, 0), Mv(−2, −2), Mv(−1, −2), Mv(0, −2), Mv(1, −2), Mv(2, −2), Mv(−2, −1), Mv(−1, −1), Mv(0, −1), Mv(1, −1), Mv(2, −1), Mv(−2, 0), Mv(−1, 0), Mv(0, 0), Mv(1, 0), Mv(2, 0), Mv(−2, 1), Mv(−1, 1), Mv(0, 1), Mv(1, 1), Mv(2, 1), Mv(−2, 2), Mv(−1, 2), Mv(0, 2), Mv(1, 2), Mv(2, 2)};
- Mv(0,0) represents the initial motion vector, other candidates motion vector excluded Mv(0,0) are offset motion vectors of the initial motion vector.
An encoding device, comprising a processor and a machine-readable storage medium, wherein the machine-readable storage medium stores machine-executable instructions executable by the processor;
- and
- the processor is configured to execute the machine-executable instructions to implement the operations comprising:
- in response to determining to use decoder-side motion vector refinement mode for a current block, encoding the current block based on the decoder-side motion vector refinement mode;
- wherein, encoding the current block based on the decoder-side motion vector refinement mode, comprising:
- for each sub-block of one or more sub-blocks comprised in the current block:
- determining, according to a first original motion vector of the sub-block, a first reference block corresponding to the sub-block;
- determining, according to a second original motion vector of the sub-block, a second reference block corresponding to the sub-block;
- adjusting, according to first pixel values of the first reference block and second pixel values of the second reference block, the first original motion vector and the second original motion vector, to obtain a first target motion vector corresponding to the first original motion vector and a second target motion vector corresponding to the second original motion vector;
- and
- determining, according to the first target motion vector and the second target motion vector, prediction values of the sub-block;
- obtaining, according to prediction values of all sub-blocks in the current block, prediction values of the current block;
- wherein, adjusting, according to first pixel values of the first reference block and second pixel values of the second reference block, the first original motion vector and the second original motion vector, to obtain the first target motion vector corresponding to the first original motion vector and the second target motion vector corresponding to the second original motion vector comprising:
- selecting all of (2*SR+1)*(2*SR+1) motion vectors surrounding and comprising an initial motion vector as candidate motion vectors;
- according to the first pixel values of the first reference block and the second pixel values of the second reference block, determining cost values of the candidate motion vectors and determining a motion vector with a minimum cost value from the candidate motion vectors as an optimal motion vector;
- adjusting, according to the optimal motion vector, the first original motion vector and the second original motion vector, to obtain the first target motion vector corresponding to the first original motion vector and the second target motion vector corresponding to the second original motion vector;
- wherein, the initial motion vector is the first original motion vector or the second original motion vector;
- wherein, SR represents a search range, a value of SR is equal to 2, and the search order of 25 motion vectors is as follows:
- {Mv(0, 0), Mv(−2, −2), Mv(−1, −2), Mv(0, −2), Mv(1, −2), Mv(2, −2), Mv(−2, −1), Mv(−1, −1), Mv(0, −1), Mv(1, −1), Mv(2, −1), Mv(−2, 0), Mv(−1, 0), Mv(0, 0), Mv(1, 0), Mv(2, 0), Mv(−2, 1), Mv(−1, 1), Mv(0, 1), Mv(1, 1), Mv(2, 1), Mv(−2, 2), Mv(−1, 2), Mv(0, 2), Mv(1, 2), Mv(2, 2)};
- Mv(0,0) represents the initial motion vector, other candidates motion vector excluded Mv(0,0) are offset motion vectors of the initial motion vector.
Dependencies are inferred from the claim text.