Enhancement for block adaptive weighted prediction
This disclosure relates generally to video coding/decoding and particularly for enhancing block adaptive weighted prediction. One method includes receiving a coded video bitstream comprising a current block of a current frame and a first syntax element indicating a prediction mode for the current block, a plurality of scaling factor look-up tables being stored and comprising different ranges of scaling factors, wherein step sizes of the scaling factors or precisions of the scaling factors for each look-up table in the plurality of scaling factor look-up tables are same; determining the prediction mode based on a value of the first syntax element, wherein the prediction mode is used for predicting the current block based on a reference block of a reference frame; determining a scaling factor from one of the plurality of scaling factor look-up tables; and reconstructing the current block based on the reference block and the determined scaling factor.
1 . A method for decoding a current block of a current frame in a coded video bitstream with block adaptive weighted prediction (BAWP), the method comprising:
obtaining, by a decoding device comprising a memory storing instructions and a processor in communication with the memory, the coded video bitstream;
extracting, by the decoding device from the coded video bitstream, a first syntax element indicating a prediction mode for predicting the current block based on a reference block of a reference frame;
in response to a scaling factor being determined explicitly, extracting, by the decoding device from the coded video bitstream, a second syntax element to determine the scaling factor from a scaling factor look-up table, wherein the scaling factor look-up table comprises six scaling factors {10, 13, 15, 17, 19, 22} divided by 16 corresponding to {−6, −3, −1, 1, 3, 6} with a scaling factor offset;
deriving, by the decoding device, an offset based on the determined scaling factor, a template of the current block, and a template of the reference block according to a first linear equation; and
reconstructing, by the decoding device, the current block based on the reference block, the determined scaling factor, and the derived offset according to a second linear equation.
2 . The method according to claim 1 , further comprising:
determining, by the device, the reference block of the reference frame based on a motion vector.
3 . The method according to claim 1 , wherein the reconstructing the current block based on the reference block and the determined scaling factor according to the second linear equation comprises:
computing pixel values of the current block as a*p+b, wherein a is the determined scaling factor, b is the derived offset, and p is a reference pixel value at a reference point determined by a motion vector.
4 . The method according to claim 1 , wherein the deriving the offset based on the determined scaling factor, the template of the current block, and the template of the reference block according to the first linear equation comprises:
computing the offset with the first linear equation based on the determined scaling factor, the template of the current block, and the template of the reference block.
5 . An apparatus for encoding a current block of a current frame with block adaptive weighted prediction (BAWP), the apparatus comprising:
a memory storing instructions; and
a processor in communication with the memory, wherein, when the processor executes the instructions, the processor is configured to cause the apparatus to:
obtain video data comprising the current block of the current frame;
determine a first syntax element indicating a prediction mode for predicting the current block based on a reference block of a reference frame;
determine a second syntax element indicating a scaling factor from a scaling factor look-up table, wherein the scaling factor look-up table comprises six scaling factors {10, 13, 15, 17, 19, 22} divided by 16 corresponding to {−6, −3, −1, 1, 3, 6} with a scaling factor offset;
derive an offset based on the scaling factor, a template of the current block, and a template of the reference block according to a first linear equation; and
encode the current block based on the reference block, the scaling factor, and the derived offset according to a second linear equation.
6 . The apparatus according to claim 5 , wherein, when the processor is configured to cause the apparatus to derive the offset based on the scaling factor, the template of the current block, and the template of the reference block according to the first linear equation, the processor is configured to cause the apparatus to:
compute the offset with the first linear equation based on the determined scaling factor, the template of the current block, and the template of the reference block.
7 . A non-transitory computer readable storage medium storing a video bitstream that is generated by a video encoding method, the video encoding method comprising: instructions for encoding a current block of a current frame with block adaptive weighted prediction (BAWP), wherein, when the instructions are executed by one or more processors, the instructions are configured to cause the one or more processors to perform:
obtaining video data comprising the current block of the current frame;
determining a first syntax element indicating a prediction mode for predicting the current block based on a reference block of a reference frame and signaling the first syntax element in a video bitstream;
determining a second syntax element indicating a scaling factor from a scaling factor look-up table and signaling the second syntax element in the video bitstream, wherein the scaling factor look-up table comprises six scaling factors {10, 13, 15, 17, 19, 22} divided by 16 corresponding to {−6, −3, −1, 1, 3, 6} with a scaling factor offset;
deriving an offset based on the scaling factor, a template of the current block, and a template of the reference block according to a first linear equation; and
encoding the current block into the video bitstream based on the reference block, the scaling factor, and the derived offset according to a second linear equation.
8 . The non-transitory computer readable storage medium according to claim 7 , wherein the deriving the offset based on the scaling factor, the template of the current block, and the template of the reference block according to the first linear equation comprises:
computing the offset with the first linear equation based on the determined scaling factor, the template of the current block, and the template of the reference block.