Device and method for intra predictions based on a template-based intra mode derivation mode
A method of decoding video data is provided. The method includes: receiving the video data; determining, from an image frame of the video data, a block unit; determining a first intra prediction of the block unit based on a decoder-side intra mode derivation (DIMD) mode; determining a second intra prediction of the block unit based on an intra prediction mode other than the DIMD mode; generating a third intra prediction based on the first intra prediction and the second intra prediction; and reconstructing the block unit based on the third intra prediction. In addition, an electronic device using the method is also provided.
1 . A non-transitory machine-readable medium of an electronic device storing one or more computer-executable instructions for decoding video data, the one or more computer-executable instructions, when executed by at least one processor of the electronic device, causing the electronic device to:
receive the video data;
determine, from an image frame of the video data, a block unit;
determine a first intra prediction of the block unit based on a template-based intra mode derivation (TIMD) mode, wherein determining the first intra prediction of the block unit based on the TIMD mode comprises:
determining a template region associated with the block unit;
calculating a plurality of template costs for a plurality of candidate modes of a candidate list, respectively, based on the template region;
selecting a first candidate mode and a second candidate mode of the plurality of candidate modes based on the plurality of template costs; and
determining the first intra prediction based on the first candidate mode and the second candidate mode;
determine a second intra prediction of the block unit based on an intra prediction mode other than the selected first and second candidate modes in the TIMD mode, wherein the intra prediction mode other than the selected first and second candidate modes in the TIMD mode is a planar mode;
generate a third intra prediction based on the first intra prediction and the second intra prediction; and
reconstruct the block unit based on the third intra prediction.
2 . The non-transitory machine-readable medium of claim 1 , wherein:
the template region comprises a first reconstructed block left-neighboring the block unit, and a second reconstructed block upper-neighboring the block unit,
the first candidate mode of the plurality of candidate modes corresponds to a first minimum template cost of the plurality of template costs,
the second candidate mode of the plurality of candidate modes corresponds to a second minimum template cost of the plurality of template costs,
the first minimum template cost comprises a least template cost in the plurality of template costs, and
the second minimum template cost comprises a template cost that is greater than the first minimum template cost, but less than all other template costs in the plurality of template costs.
3 . The non-transitory machine-readable medium of claim 2 , wherein determining the first intra prediction based on the first candidate mode and the second candidate mode comprises:
determining whether the second minimum template cost is less than twice the first minimum template cost;
in a case that the second minimum template cost is not less than twice the first minimum template cost, determining the first intra prediction based on the first candidate mode; and
in a case that the second minimum template cost is less than twice the first minimum template cost, determining the first intra prediction based on the first candidate mode, the second candidate mode, the first minimum template cost, and the second minimum template cost.
4 . The non-transitory machine-readable medium of claim 1 , wherein calculating the plurality of template costs for the plurality of candidate modes of the candidate list, respectively, based on the template region comprises:
generating a plurality of predictions of the template region based on a plurality of reference samples of the template region, the plurality of predictions corresponding to the plurality of candidate modes of the candidate list; and
calculating a plurality of template costs for the plurality of predictions based on a template reconstruction of the template region, the plurality of template costs for the plurality of predictions corresponding to the plurality of template costs for the plurality of candidate modes of the candidate list.
5 . The non-transitory machine-readable medium of claim 1 , wherein generating the third intra prediction based on the first intra prediction and the second intra prediction comprises:
determining a first weight corresponding to the first intra prediction, and a second weight corresponding to the second intra prediction; and
generating the third intra prediction by calculating a weighted average of the first intra prediction and the second intra prediction based on the first weight and the second weight.
6 . An electronic device for decoding video data, the electronic device comprising:
at least one processor; and
at least one non-transitory computer-readable medium coupled to the at least one processor and storing one or more computer-executable instructions that, when executed by the at least one processor, cause the electronic device to:
receive the video data;
determine, from an image frame of the video data, a block unit;
determine a first intra prediction of the block unit based on a template-based intra mode derivation (TIMD) mode, wherein determining the first intra prediction of the block unit based on the TIMD mode comprises:
determining a template region associated with the block unit;
calculating a plurality of template costs for a plurality of candidate modes of a candidate list, respectively, based on the template region;
selecting a first candidate mode and a second candidate mode of the plurality of candidate modes based on the plurality of template costs; and
determining the first intra prediction based on the first candidate mode and the second candidate mode;
determine a second intra prediction of the block unit based on an intra prediction mode other than the selected first and second candidate modes in the TIMD mode, wherein the intra prediction mode other than the selected first and second candidate modes in the TIMD mode is a planar mode;
generate a third intra prediction based on the first intra prediction and the second intra prediction; and
reconstruct the block unit based on the third intra prediction.
7 . The electronic device of claim 6 , wherein:
the template region comprises a first reconstructed block left-neighboring the block unit, and a second reconstructed block upper-neighboring the block unit,
the first candidate mode of the plurality of candidate modes corresponds to a first minimum template cost of the plurality of template costs,
the second candidate mode of the plurality of candidate modes corresponds to a second minimum template cost of the plurality of template costs,
the first minimum template cost comprises a least template cost in the plurality of template costs, and
the second minimum template cost comprises a template cost that is greater than the first minimum template cost, but less than all other template costs in the plurality of template costs.
8 . The electronic device of claim 7 , wherein determining the first intra prediction based on the first candidate mode and the second candidate mode comprises:
determining whether the second minimum template cost is less than twice the first minimum template cost;
in a case that the second minimum template cost is not less than twice the first minimum template cost, determining the first intra prediction based on the first candidate mode; and
in a case that the second minimum template cost is less than twice the first minimum template cost, determining the first intra prediction based on the first candidate mode, the second candidate mode, the first minimum template cost, and the second minimum template cost.
9 . The electronic device of claim 6 , wherein calculating the plurality of template costs for the plurality of candidate modes of the candidate list, respectively, based on the template region comprises:
generating a plurality of predictions of the template region based on a plurality of reference samples of the template region, the plurality of predictions corresponding to the plurality of candidate modes of the candidate list; and
calculating a plurality of template costs for the plurality of predictions based on a template reconstruction of the template region, the plurality of template costs for the plurality of predictions corresponding to the plurality of template costs for the plurality of candidate modes of the candidate list.
10 . The electronic device of claim 6 , wherein generating the third intra prediction based on the first intra prediction and the second intra prediction comprises:
determining a first weight corresponding to the first intra prediction, and a second weight corresponding to the second intra prediction; and
generating the third intra prediction by calculating a weighted average of the first intra prediction and the second intra prediction based on the first weight and the second weight.
11 . An electronic device for encoding video data, the electronic device comprising:
at least one processor; and
at least one non-transitory computer-readable medium coupled to the at least one processor and storing one or more computer-executable instructions that, when executed by the at least one processor, cause the electronic device to:
receive the video data;
determine, from an image frame of the video data, a block unit;
determine a first intra prediction of the block unit based on a template-based intra mode derivation (TIMD) mode, wherein determining the first intra prediction of the block unit based on the TIMD mode comprises:
determining a template region associated with the block unit;
calculating a plurality of template costs for a plurality of candidate modes of a candidate list, respectively, based on the template region;
selecting a first candidate mode and a second candidate mode of the plurality of candidate modes based on the plurality of template costs; and
determining the first intra prediction based on the first candidate mode and the second candidate mode;
determine a second intra prediction of the block unit based on an intra prediction mode other than the selected first and second candidate modes in the TIMD mode, wherein the intra prediction mode other than the selected first and second candidate modes in the TIMD mode is a planar mode;
generate a third intra prediction based on the first intra prediction and the second intra prediction; and
predict the block unit based on the third intra prediction.
12 . The electronic device of claim 11 , wherein:
the template region comprises a first reconstructed block left-neighboring the block unit, and a second reconstructed block upper-neighboring the block unit,
the first candidate mode of the plurality of candidate modes corresponds to a first minimum template cost of the plurality of template costs,
the second candidate mode of the plurality of candidate modes corresponds to a second minimum template cost of the plurality of template costs,
the first minimum template cost comprises a least template cost in the plurality of template costs, and
the second minimum template cost comprises a template cost that is greater than the first minimum template cost, but less than all other template costs in the plurality of template costs.
13 . The electronic device of claim 12 , wherein determining the first intra prediction based on the first candidate mode and the second candidate mode comprises:
determining whether the second minimum template cost is less than twice the first minimum template cost;
in a case that the second minimum template cost is not less than twice the first minimum template cost, determining the first intra prediction based on the first candidate mode; and
in a case that the second minimum template cost is less than twice the first minimum template cost, determining the first intra prediction based on the first candidate mode, the second candidate mode, the first minimum template cost, and the second minimum template cost.
14 . The electronic device of claim 11 , wherein calculating the plurality of template costs for the plurality of candidate modes of the candidate list, respectively, based on the template region comprises:
generating a plurality of predictions of the template region based on a plurality of reference samples of the template region, the plurality of predictions corresponding to the plurality of candidate modes of the candidate list; and
calculating a plurality of template costs for the plurality of predictions based on a template reconstruction of the template region, the plurality of template costs for the plurality of predictions corresponding to the plurality of template costs for the plurality of candidate modes of the candidate list.
15 . The electronic device of claim 11 , wherein generating the third intra prediction based on the first intra prediction and the second intra prediction comprises:
determining a first weight corresponding to the first intra prediction, and a second weight corresponding to the second intra prediction; and
generating the third intra prediction by calculating a weighted average of the first intra prediction and the second intra prediction based on the first weight and the second weight.