Motion compensation considering out-of-boundary conditions in video coding
Methods, apparatuses, and non-transitory computer-readable storage mediums are provided for video coding. In one method, a decoder derives a first reference picture and a second reference picture for a current coding block; the decoder derives a first predictor sample based on a first motion vector associated with the first reference picture using a motion compensation process from the first reference picture; the decoder derives a second predictor sample based on a second motion vector associated with the second reference picture using the motion compensation process from the second reference picture; and the decoder obtains a final predictor sample in the current coding block based on at least one of the first predictor sample or the second predictor sample and an out-of-boundary (OOB) condition.
1 . A method for video coding, comprising:
deriving, by a decoder, a first reference picture and a second reference picture for a current coding block;
deriving, by the decoder, a first predictor sample based on a first motion vector associated with the first reference picture using a motion compensation process from the first reference picture;
deriving, by the decoder, a second predictor sample based on a second motion vector associated with the second reference picture using the motion compensation process from the second reference picture; and
obtaining, by the decoder, a final predictor sample in the current coding block based on at least one of the first predictor sample or the second predictor sample and an out-of-boundary (OOB) condition, wherein the OOB condition comprises whether the first predictor sample is OOB and whether the second predictor sample is OOB;
wherein obtaining the OOB condition by determining whether the first predictor sample and the second predictor sample are OOB comprises:
in response to determining at least one of integer reference samples used to generate a predictor sample is a padded sample located outside a reference picture, determining that the predictor sample is OOB;
in response to determining that either both the first predictor sample and the second predictor sample are OOB or both the first predictor sample and the second predictor sample are not OOB, assigning a first weight to the first predictor sample and assigning a second weight to the second predictor sample; and
in response to determining that a Bi-Directional Optical Flow (BDOF) is enabled for the current coding block, combining the first predictor sample and the second predictor sample to obtain the final predictor sample for the current coding block based on the first weight assigned to the first predictor sample, the second weight assigned to the second predictor sample, and a BDOF offset.
2 . The method for video coding of claim 1 , further comprising:
in response to determining that the first predictor sample is OOB and the second predictor sample is not OOB, determining the second predictor sample for the second reference picture as the final predictor sample of the current coding block.
3 . The method for video coding of claim 1 , further comprising:
in response to determining that the first predictor sample is not OOB and the second predictor sample is OOB, determining the first predictor sample for the first reference picture as the final predictor sample of the current coding block.
4 . The method for video coding of claim 1 , wherein the first weight assigned to the first predictor sample is equal to the second weight assigned to the second predictor sample, and the final predictor sample of the current coding block is determined based on an average of the first predictor sample and the second predictor sample.
5 . The method for video coding of claim 1 , further comprising:
in response to determining that the current coding block is coded as Bi-prediction with Coding unit-level Weight (BCW) mode, combining the first predictor sample and the second predictor sample to obtain the final predictor sample for the current coding block based on the BCW weighting.
6 . The method for video coding of claim 1 , further comprising:
in response to determining that the first predictor sample is OOB and the second predictor sample is not OOB, setting the BDOF offset as 0; and
in response to determining that the first predictor sample is not OOB and the second predictor sample is OOB, setting the BDOF offset as 0.
7 . The method for video coding of claim 1 , wherein determining whether the first predictor sample and the second predictor sample are OOB further comprises:
in response to determining that at least one of vertically nearest integer reference samples for a predictor sample is OOB or at least one of horizontally nearest integer reference samples for the predictor sample is OOB, determining that the predictor sample is OOB.
8 . The method for video coding of claim 1 , wherein determining whether the first predictor sample and the second predictor sample are OOB further comprises:
in response to determining that at least one of a horizontal coordinator or a vertical coordinator of a predictor sample is beyond the boundaries of the reference picture by a distance threshold.
9 . The method for video coding of claim 8 , where the distance threshold is equal to half sample.
10 . An apparatus for video coding, comprising:
one or more processors; and
a memory configured to store instructions executable by the one or more processors; wherein the one or more processors, upon execution of the instructions, are configured to perform operations comprising:
deriving, by a decoder, a first reference picture and a second reference picture for a current coding block;
deriving, by the decoder, a first predictor sample based on a first motion vector associated with the first reference picture using a motion compensation process from the first reference picture;
deriving, by the decoder, a second predictor sample based on a second motion vector associated with the second reference picture using the motion compensation process from the second reference picture; and
obtaining, by the decoder, a final predictor sample in the current coding block based on at least one of the first predictor sample or the second predictor sample and an out-of-boundary (OOB) condition, wherein the OOB condition comprises whether the first predictor sample is OOB and whether the second predictor sample is OOB;
wherein obtaining the OOB condition by determining whether the first predictor sample and the second predictor sample are OOB comprises:
in response to determining at least one of integer reference samples used to generate a predictor sample is a padded sample located outside a reference picture, determining that the predictor sample is OOB;
in response to determining that either both the first predictor sample and the second predictor sample are OOB or both the first predictor sample and the second predictor sample are not OOB, assigning a first weight to the first predictor sample and assigning a second weight to the second predictor sample; and
in response to determining that a Bi-Directional Optical Flow (BDOF) is enabled for the current coding block, combining the first predictor sample and the second predictor sample to obtain the final predictor sample for the current coding block based on the first weight assigned to the first predictor sample, the second weight assigned to the second predictor sample, and a BDOF offset.
11 . The apparatus for video coding of claim 10 , wherein the operations further comprise:
in response to determining that the first predictor sample is OOB and the second predictor sample is not OOB, determining the second predictor sample for the second reference picture as the final predictor sample of the current coding block.
12 . The apparatus for video coding of claim 10 , wherein the operations further comprise:
in response to determining that the first predictor sample is not OOB and the second predictor sample is OOB, determining the first predictor sample for the first reference picture as the final predictor sample of the current coding block.
13 . A method for storing a bitstream, comprising:
storing a bitstream to be decoded by a decoding method,
wherein the decoding method comprises:
deriving, by a decoder, a first reference picture and a second reference picture for a current coding block;
deriving, by the decoder, a first predictor sample based on a first motion vector associated with the first reference picture using a motion compensation process from the first reference picture;
deriving, by the decoder, a second predictor sample based on a second motion vector associated with the second reference picture using the motion compensation process from the second reference picture; and
obtaining, by the decoder, a final predictor sample in the current coding block based on at least one of the first predictor sample or the second predictor sample and an out-of-boundary (OOB) condition, wherein the OOB condition comprises whether the first predictor sample is OOB and whether the second predictor sample is OOB;
wherein obtaining the OOB condition by determining whether the first predictor sample and the second predictor sample are OOB comprises:
in response to determining at least one of integer reference samples used to generate a predictor sample is a padded sample located outside a reference picture, determining that the predictor sample is OOB;
in response to determining that either both the first predictor sample and the second predictor sample are OOB or both the first predictor sample and the second predictor sample are not OOB, assigning a first weight to the first predictor sample and assigning a second weight to the second predictor sample; and
in response to determining that a Bi-Directional Optical Flow (BDOF) is enabled for the current coding block, combining the first predictor sample and the second predictor sample to obtain the final predictor sample for the current coding block based on the first weight assigned to the first predictor sample, the second weight assigned to the second predictor sample, and a BDOF offset.
14 . The method of claim 13 , wherein the decoding method further comprises:
in response to determining that the first predictor sample is OOB and the second predictor sample is not OOB, determining the second predictor sample for the second reference picture as the final predictor sample of the current coding block.
15 . The method of claim 13 , wherein the decoding method further comprises:
in response to determining that the first predictor sample is not OOB and the second predictor sample is OOB, determining the first predictor sample for the first reference picture as the final predictor sample of the current coding block.
16 . The method of claim 13 , wherein the first weight assigned to the first predictor sample is equal to the second weight assigned to the second predictor sample, and the final predictor sample of the current coding block is determined based on an average of the first predictor sample and the second predictor sample.
17 . The method of claim 13 , wherein the decoding method further comprises:
in response to determining that the current coding block is coded as Bi-prediction with Coding unit-level Weight (BCW) mode, combining the first predictor sample and the second predictor sample to obtain the final predictor sample for the current coding block based on the BCW weighting.
18 . The method of claim 13 , wherein the decoding method further comprises:
in response to determining that the first predictor sample is OOB and the second predictor sample is not OOB, setting the BDOF offset as 0; and
in response to determining that the first predictor sample is not OOB and the second predictor sample is OOB, setting the BDOF offset as 0.
19 . The method of claim 13 , wherein determining whether the first predictor sample and the second predictor sample are OOB further comprises:
in response to determining that at least one of vertically nearest integer reference samples for a predictor sample is OOB or at least one of horizontally nearest integer reference samples for the predictor sample is OOB, determining that the predictor sample is OOB.
20 . The method of claim 13 , wherein determining whether the first predictor sample and the second predictor sample are OOB further comprises:
in response to determining that at least one of a horizontal coordinator or a vertical coordinator of a predictor sample is beyond the boundaries of the reference picture by a distance threshold.