# US 2022/0295094 A1 · Encoding and decoding method, device and apparatus

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2022/0295094 A1
- Document ID: US20220295094A1
- Status: Published application
- Kind: A1
- Application number: 17/753,341
- Filed: 2020-09-16
- Published: 2022-09-15
- Earliest claimed: 2019-09-23
- Assignees: Hangzhou Hikvision Digital Technology Co., Ltd.
- Applicants: Hangzhou Hikvision Digital Technology Co., Ltd.
- Inventors: Fangdong CHEN
- Web page: https://patentgrep.com/patent/US20220295094A1

## CPC

- H04N 19/159: Prediction type, e.g. intra-frame, inter-frame or bidirectional frame prediction
- H04N 19/577: Motion compensation with bidirectional frame interpolation, i.e. using B-pictures
- H04N 19/105: Selection of the reference unit for prediction within a chosen coding or prediction mode, e.g. adaptive choice of position and number of pixels used for prediction
- H04N 19/119: Adaptive subdivision aspects, e.g. subdivision of a picture into rectangular or non-rectangular coding blocks
- H04N 19/176: the region being a block, e.g. a macroblock
- H04N 19/182: the unit being a pixel
- H04N 19/44: Decoders specially adapted therefor, e.g. video decoders which are asymmetric with respect to the encoder
- H04N 19/513: Processing of motion vectors
- H04N 19/70: characterised by syntax aspects related to video coding, e.g. related to compression standards
- H04N: PICTORIAL COMMUNICATION, e.g. TELEVISION

## Abstract

The present application provides an encoding and decoding method, apparatus, and device, the method for encoding and decoding includes: determining prediction values of pixel points of current image block; determining gradient values of pixel points of the current image block based on the prediction values of pixel points of the current image block; determining offset vectors of pixel points of the current image block; determining prediction compensation values of pixel points of the current image block based on the gradient values and the offset vectors of pixel points of the current image block; and determining final prediction values of pixel points of the current image block based on the prediction values and the prediction compensation values of pixel points of the current image block. The method can expand the range of application of the prediction compensation adjustment.

## Claims

### Claim at position 1

1-21. (canceled)

### Claim 22

A decoding method, comprising:
determining whether a current image block satisfies an enabling condition for a Bi-directional Optical Flow mode;
if the current image block satisfies the enabling condition for the Bi-directional Optical Flow mode, allowing to use the Bi-directional Optical Flow mode for the current image block;
if the current image block does not satisfies the enabling condition for the Bi-directional Optical Flow mode, refusing to use the Bi-directional Optical Flow mode;
wherein, when the Bi-directional Optical Flow mode is used for the current image block, a condition satisfied by the current image block comprises: a size of a reference picture of the current image block is the same as a size of a picture to which the current image block belongs, and the reference picture is not a long-term reference picture;
if the Bi-directional Optical Flow mode is allowed to be used, the method further comprises:
for a plurality of sub-blocks divided from the current image block, determining, for each sub-block, a prediction value of each pixel point in the sub-block and a prediction compensation value of each pixel point in the sub-block, and determining a final prediction value of the sub-block based on the prediction value of each pixel point in the sub-block and the prediction compensation value of each pixel point in the sub-block, wherein, the prediction compensation value of each pixel point in the sub-block is determined based on a gradient value and an offset vector of each pixel point in the sub-block, the gradient value of each pixel point in the sub-block is determined based on the prediction value of each pixel point in the sub-block, and the prediction value of each pixel point in the sub-block is determined based on motion information of the current image block;
wherein, determining the gradient value of each pixel point in the sub-block comprises: filling 1 row/column of integer pixel points on the top, bottom, left and right edges of a 4*4 sub-block respectively to obtain a corresponding 6*6 block, and calculating a gradient value of each pixel point in the 4*4 sub-block based on a pixel value of each pixel point in the 6*6 block.

### Claim 23 (depends on 22)

The method according to claim 22, wherein, the method further comprises:
if the Bi-directional Optical Flow mode is allowed to be used, determining a final prediction value of the current image block by the following steps:
determining a prediction value of each pixel point of the current image block;
determining a gradient value of each pixel point of the current image block based on the prediction value of each pixel point of the current image block;
determining an offset vector of each pixel point of the current image block;
determining a prediction compensation value of each pixel point of the current image block based on the gradient value and the offset vector of each pixel point of the current image block; and
determining a final prediction value of each pixel point of the current image block based on the prediction value and the prediction compensation value of each pixel point of the current image block.

### Claim 24 (depends on 22)

The method according to claim 22,
wherein, when the size of the reference picture of the current image block is different from the size of the picture to which the current image block belongs, it is not allowed to use the Bi-directional Optical Flow mode for the current image block;
wherein, when the reference picture of the current image block is a long-term reference picture, it is not allowed to use the Bi-directional Optical Flow mode for the current image block;
wherein, when the size of the reference picture of the current image block is different from the size of the picture to which the current image block belongs, and the reference picture of the current image block is a long-term reference picture, it is not allowed to use the Bi-directional Optical Flow mode for the current image block;
or
wherein, the current image block is a decoding block obtained by dividing using one of quadtree division, horizontal binary tree division, vertical binary tree division, horizontal trigeminal tree division, or vertical ternary tree division;
wherein, the Bi-directional Optical Flow mode refers to a mode for adjusting a motion compensation value by an optical flow method based on motion compensation values of two reference pictures of the current image block.

### Claim 25

An encoding method, comprising:
determining whether a current image block satisfies an enabling condition for a Bi-directional Optical Flow mode;
if the current image block satisfies the enabling condition for the Bi-directional Optical Flow mode, allowing to use the Bi-directional Optical Flow mode;
if the current image block does not satisfies the enabling condition for the Bi-directional Optical Flow mode, refusing to use the Bi-directional Optical Flow mode;
wherein, when the Bi-directional Optical Flow mode is used for the current image block, a condition satisfied by the current image block comprises: a size of a reference picture of the current image block is the same as a size of a picture to which the current image block belongs, and the reference picture is not a long-term reference picture;
if the Bi-directional Optical Flow mode is allowed to be used, the method further comprises:
for a plurality of sub-blocks divided from the current image block, determining, for each sub-block, a prediction value of each pixel point in the sub-block and a prediction compensation value of each pixel point in the sub-block, and determining a final prediction value of the sub-block based on the prediction value of each pixel point in the sub-block and the prediction compensation value of each pixel point in the sub-block, wherein, the prediction compensation value of each pixel point in the sub-block is determined based on a gradient value and an offset vector of each pixel point in the sub-block, the gradient value of each pixel point in the sub-block is determined based on the prediction value of each pixel point in the sub-block, and the prediction value of each pixel point in the sub-block is determined based on motion information of the current image block;
wherein, determining the gradient value of each pixel point in the sub-block comprises: filling 1 row/column of integer pixel points on the top, bottom, left and right edges of a 4*4 sub-block respectively to obtain a corresponding 6*6 block, and calculating a gradient value of each pixel point in the 4*4 sub-block based on a pixel value of each pixel point in the 6*6 block.

### Claim 26 (depends on 22)

An apparatus configured to perform the method according to claim 22.

### Claim 27 (depends on 22)

A decoding device comprising a processor and a machine-readable storage medium storing machine-executable instructions executable by the processor, wherein, the processor is configured to execute the machine-executable instructions to implement the method according to claim 22.

### Claim 28 (depends on 25)

An encoding device comprising a processor and a machine-readable storage medium storing machine-executable instructions executable by the processor, wherein, the processor is configured to execute the machine-executable instructions to implement the method according to claim 25.

### Claim 29

A decoding method, comprising:
determining whether a current image block satisfies an enabling condition for a Decoder-side Motion Vector Refinement (DMVR) mode;
if the current image block satisfies the enabling condition for the DMVR mode, allowing to use the DMVR mode;
if the current image block does not satisfies the enabling condition for the DMVR mode, refusing to use the DMVR mode;
wherein, when the DMVR mode is used for the current image block, a condition satisfied by the current image block comprises: a size of a reference picture of the current image block is the same as a size of a picture to which the current image block belongs, and the reference picture is not a long-term reference picture;
wherein, when the DMVR mode is used for the current image block, the current image block satisfies at least following conditions at the same time:
a current mode of the current image block is a general merge mode;
picture header control information indicates that it is allowed to use the DMVR mode for the current image block;
the current image block uses a bidirectional prediction mode, a display order of one of two reference pictures is previous to a picture to which the current image block belongs, and a display order of the other of the two reference pictures is subsequent to the picture to which the current image block belongs, and distances between the two reference pictures and the picture to which the current image block belongs are equal;
weighted weights of the two reference pictures of the current image block are the same;
a size of the current image block satisfies a limiting condition; wherein, the size of the current image block satisfies a limiting condition, comprising: a width of the current image block is greater than or equal to a first threshold, a height of the current image block is greater than or equal to a second threshold, and an area of the current image block is greater than or equal to a third threshold;
sizes of the two reference pictures of the current image block are respectively the same as the size of the picture to which the current image block belongs.

### Claim 30 (depends on 29)

The method according to claim 29,
wherein, the picture header control information indicates that it is allowed to use the DMVR mode for the current image block, comprising:
a switch for picture header control DMVR mode is of a first numerical value; wherein the switch for picture header control DMVR mode is of a first numerical value means that picture header control allows to use the DMVR mode for the current image block;
wherein, the size of the current image block satisfies a limiting condition, comprising: a width of the current image block is greater than or equal to 8, a height of the current image block is greater than or equal to 8, and an area of the current image block is greater than or equal to 128.

### Claim 31 (depends on 29)

The method according to claim 29, wherein, when the current image block does not allow enabling the DMVR mode, the current image block does not satisfy at least one of the following conditions:
a current mode of the current image block is a general merge mode;
picture header control information allows to use the DMVR mode for the current image block;
the current image block uses a bidirectional prediction mode, a display order of one of two reference pictures is previous to a picture to which the current image block belongs, and a display order of the other of the two reference pictures is subsequent to the picture to which the current image block belongs, and distances between the two reference pictures and the picture to which the current image block belongs are equal;
weighted weights of the two reference pictures of the current image block are the same;
a size of the current image block satisfies a limiting condition;
sizes of the two reference pictures of the current image block are respectively the same as the size of the picture to which the current image block belongs.

### Claim 32 (depends on 29)

The method according to claim 29,
wherein, when the size of the reference picture of the current image block is different from the size of the picture to which the current image block belongs, it is not allowed to use a Decoder-side DMVR mode for the current image block;
wherein, when the reference picture of the current image block is a long-term reference picture, it is not allowed to use the Decoder-side DMVR mode for the current image block;
wherein, when the size of the reference picture of the current image block is different from the size of the picture to which the current image block belongs, and the reference picture of the current image block is a long-term reference picture, it is not allowed to use the Decoder-side DMVR mode for the current image block;
wherein, when the current image block is not the general merge mode, it is not allowed to use the Decoder-side DMVR mode for the current image block;
or
wherein, the current image block is a decoding block obtained by dividing using one of quadtree division, horizontal binary tree division, vertical binary tree division, horizontal trigeminal tree division, or vertical ternary tree division;
wherein, the Decoder-side Motion Vector mode refers to a mode in which a difference between motion vectors is obtained by searching based on motion compensation values of two reference pictures of the current image block.

### Claim 33

An encoding method, comprising:
determining whether a current image block satisfies an enabling condition for a Decoder-side Motion Vector Refinement (DMVR) mode;
if the current image block satisfies the enabling condition for the DMVR mode, allowing to use the DMVR mode;
if the current image block does not satisfies the enabling condition for the DMVR mode, refusing to use the DMVR mode;
wherein, when the DMVR mode is used for the current image block, a condition satisfied by the current image block comprises: a size of a reference picture of the current image block is the same as a size of a picture to which the current image block belongs, and the reference picture is not a long-term reference picture;
wherein, when the DMVR mode is used for the current image block, the current image block satisfies at least following conditions at the same time:
a current mode of the current image block is a general merge mode;
picture header control information indicates that it is allowed to use the DMVR mode for the current image block;
the current image block uses a bidirectional prediction mode, a display order of one of two reference pictures is previous to a picture to which the current image block belongs, and a display order of the other of the two reference pictures is subsequent to the picture to which the current image block belongs, and distances between the two reference pictures and the picture to which the current image block belongs are equal;
weighted weights of the two reference pictures of the current image block are the same;
a size of the current image block satisfies a limiting condition; wherein, the size of the current image block satisfies a limiting condition, comprising: a width of the current image block is greater than or equal to a first threshold, a height of the current image block is greater than or equal to a second threshold, and an area of the current image block is greater than or equal to a third threshold;
sizes of the two reference pictures of the current image block are respectively the same as the size of the picture to which the current image block belongs.

### Claim 34 (depends on 29)

An apparatus configured to perform the method according to claim 29.

### Claim 35 (depends on 29)

A decoding device comprising a processor and a machine-readable storage medium storing machine-executable instructions executable by the processor, wherein, the processor is configured to execute the machine-executable instructions to implement the method according to claim 29.

### Claim 36 (depends on 33)

An encoding device comprising a processor and a machine-readable storage medium storing machine-executable instructions executable by the processor, wherein, the processor is configured to execute the machine-executable instructions to implement the method according to claim 33.

### Claim 37 (depends on 22)

An electronic device, comprising:
a processor;
a memory for storing instructions executable by the processor;
wherein, the processor is configured to execute the method according to claim 22.

### Claim 38 (depends on 29)

An electronic device, comprising:
a processor;
a memory for storing instructions executable by the processor;
wherein, the processor is configured to execute the method according to claim 29.

### Claim 39 (depends on 22)

A non-transitory storage medium having instructions stored thereon, wherein, when executed by a processor, implement the method according to claim 22.

### Claim 40 (depends on 29)

A non-transitory storage medium having instructions stored thereon, wherein, when executed by a processor, implement the method according to claim 29.
