Method and apparatus for video coding using secondary most probable mode list based on template matching
A method and apparatus for video coding utilize a template matching-based secondary MPM list. The video coding method and the apparatus generate a secondary most probable mode (MPM) list according to a gradient-based template matching result and utilize the secondary MPM list for intra prediction of the current block for improving video coding efficiency and enhancing video quality.
1 . A method of decoding a current block, performed by a video decoding device, the method comprising:
setting a template of the current block;
determining a corresponding block in a reconstructed region of a current picture based on a matching cost between a template of the corresponding block and the template of the current block;
calculating gradient magnitudes and gradient directions for pixels of the corresponding block;
generating a HoG (Histogram of Gradients) based on the gradient magnitudes and the gradient directions;
deriving intra-prediction modes of the current block based on the HoG; and
generating a prediction block of the current block based on the intra-prediction modes of the current block.
2 . The method of claim 1 , wherein determining the corresponding block includes:
calculating a gradient magnitude of the template of the current block by applying a differential filter to the template;
calculating a gradient magnitude in K×Q blocks for a predefined search region, K and Q being integers greater than or equal to 1; and
determining the corresponding block by calculating the matching cost based on the gradient magnitude of the template of the current block and the gradient magnitude in K×Q blocks.
3 . The method of claim 2 ,
wherein the matching cost is calculated when the gradient magnitude in K×Q blocks is equal to or greater than a preset threshold.
4 . The method of claim 1 , wherein deriving the intra-prediction modes of the current block includes:
accumulating the gradient magnitudes into intra-prediction mode indices according to the gradient directions; and
ordering the intra-prediction mode indices in descending order according to a cumulative gradient magnitude for each intra-prediction mode index.
5 . The method of claim 4 , wherein accumulating the gradient magnitudes includes:
calculating a gradient magnitude value for each of the pixels of the corresponding block, calculating a directionality by using the gradient magnitude value, and then calculating the intra-prediction mode index by using the directionality and a predefined directionality table.
6 . A method of encoding a current block, performed by a video encoding device, the method comprising:
setting a template of the current block;
determining a corresponding block in a reconstructed region of a current based on a matching cost between a template of the corresponding block and the template of the current block;
calculating gradient magnitudes and gradient directions for pixels of the corresponding block;
generating a HoG (Histogram of Gradients) based on the gradient magnitudes and the gradient directions;
deriving intra-prediction modes of the current block based on the HoG; and
generating a prediction block of the current block based on the intra-prediction modes of the current block.
7 . A non-transitory computer-readable recording medium storing a bitstream generated by a video encoding method, the video encoding method comprising:
setting a template of the current block;
determining a corresponding block in a reconstructed region of a current picture based on a matching cost between a template of the corresponding block and the template of the current block;
calculating gradient magnitudes and gradient directions for pixels of the corresponding block;
generating a HoG (Histogram of Gradients) based on the gradient magnitudes and the gradient directions;
deriving intra-prediction modes of the current block based on the HoG; and
generating a prediction block of the current block based on the intra-prediction modes of the current block.
8 . The method of claim 1 , wherein the matching cost includes at least one of Sum of Absolute Difference (SAD) or Sum of Squared Difference (SSD).
9 . The method of claim 6 , wherein the matching cost includes at least one of Sum of Absolute Difference (SAD) or Sum of Squared Difference (SSD).
10 . The non-transitory computer-readable recording medium of claim 7 , wherein the matching cost includes at least one of Sum of Absolute Difference (SAD) or Sum of Squared Difference (SSD).