# US 2026/0075183 A1 · Method and device for video coding using template-based prediction

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

- Number: US 2026/0075183 A1
- Document ID: US20260075183A1
- Status: Published application
- Kind: A1
- Application number: 19/101,178
- Filed: 2023-07-05
- Published: 2026-03-12
- Earliest claimed: 2022-08-09
- Assignees: Hyundai Motor Company; Kia Corporation; Kwangwoon University Industry-Academic Collaboration Foundation
- Applicants: Hyundai Motor Company; Kia Corporation; Kwangwoon University Industry-Academic Collaboration Foundation
- Inventors: Dong Gyu Sim; Min Hun Lee; Han Sol Choi; Jin Heo; Seung Wook Park
- Web page: https://patentgrep.com/patent/US20260075183A1

## CPC

- 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/11: among a plurality of spatial predictive coding modes
- H04N 19/176: the region being a block, e.g. a macroblock
- H04N 19/186: the unit being a colour or a chrominance component
- H04N 19/196: being specially adapted for the computation of encoding parameters, e.g. by averaging previously computed encoding parameters (processing of motion vectors H04N19/513)
- H04N 19/503: involving temporal prediction (adaptive coding with adaptive selection between spatial and temporal predictive coding H04N19/107; adaptive coding with adaptive selection among a plurality of temporal predictive coding modes H04N19/109)
- H04N 19/593: involving spatial prediction techniques
- H04N 19/70: characterised by syntax aspects related to video coding, e.g. related to compression standards
- H04N: PICTORIAL COMMUNICATION, e.g. TELEVISION

## Abstract

A method and an apparatus are disclosed for video coding using template-based prediction. In the disclosed embodiments, a video decoding device decodes a distance index (adjacent_idx) that indicates a distance between the current block and a template region. The video decoding device determines the template region based on the distance between the current block and the template region, and a shape of the template region. The video decoding searches for an optimal template in a search region by using the template region and based on template matching and generates a prediction block of the current block from a reference block corresponding to the optimal template.

## Claims

### Claim 1

A method of reconstructing a current block by a video decoding device, the method comprising:
decoding from a bitstream a distance index (adjacent_idx) that indicates a distance between the current block and a template region;
determining the template region based on the distance between the current block and the template region, and a shape of the template region;
searching for an optimal template in a search region by using the template region and based on template matching, wherein the search region is defined within a reconstructed region of the current block; and
generating a prediction block of the current block from a reference block corresponding to the optimal template.

### Claim 2 (depends on 1)

The method of claim 1, wherein the shape of the template region comprises:
an L-shape that is present on a top-and-left of the current block and is defined based on a width of the current block, a height of the current block, a bottom width of a template region present on a left of the current block, a right height of a template region present on a top of the current block, and the distance between the current block and the template region,
wherein the bottom width of the template region present on the left of the current block and the right height of the template region present on the top of the current block are implicitly determined or fixed values based on a size of the current block.

### Claim 3 (depends on 1)

The method of claim 1, wherein the shape of the template region comprises:
a rectangular shape that is present on a left of the current block and is defined based on a width and a height of a template region present on the left of the current block,
wherein a difference between the height of the template region and a height of the current block is implicitly determined or a fixed value based on a size of the current block, and the width of the template region is implicitly determined or a fixed value based on the size of the current block.

### Claim 4 (depends on 1)

The method of claim 1, wherein the shape of the template region comprises:
a rectangular shape that is present on a top of the current block and is defined based on a width and a height of a template region present on the top of the current block,
wherein a difference between the width of the template region and a width of the current block is implicitly determined or a fixed value based on a size of the current block, and the height of the template region is implicitly determined or a fixed value based on the size of the current block.

### Claim 5 (depends on 1)

The method of claim 1, wherein determining the template region comprises:
decoding from the bitstream an index indicative of the shape of the template region; and
determining the shape of the template region based on the index.

### Claim 6 (depends on 1)

The method of claim 1, wherein determining the template region comprises:
implicitly determining the shape of the template region based on an aspect ratio of the current block.

### Claim 7 (depends on 1)

The method of claim 1, wherein determining the template region comprises:
implicitly determining, regarding a chroma block of the current block, a position and a shape of a template region of the chroma block according to a prediction mode of a co-located luma block with the chroma block.

### Claim 8 (depends on 1)

The method of claim 1, wherein searching for the optimal template comprises:
searching through a natural number N of templates in order of increasing loss value of the templates due to the template matching.

### Claim 9 (depends on 8)

The method of claim 8, wherein generating the prediction block comprises:
weight summing reference blocks corresponding to the N templates to generate the prediction block of the current block.

### Claim 10 (depends on 1)

The method of claim 1, further comprising:
calculating a gradient of the template region; and
resetting the template region by using the gradient.

### Claim 11 (depends on 10)

The method of claim 10, wherein calculating the gradient comprises:
dividing the template region into subblocks;
calculating a magnitude and directionality of the gradient for each of the subblocks; and
generating a directionality histogram of the gradient.

### Claim 12 (depends on 11)

The method of claim 11, wherein each of the subblocks has a size implicitly determined by a size of the current block, or has a preset size.

### Claim 13 (depends on 11)

The method of claim 11, wherein resetting the template region comprises:
determining as the template region a region of subblocks having a most frequent directionality based on the directionality histogram.

### Claim 14 (depends on 11)

The method of claim 11, wherein resetting the template region comprises:
generating a magnitude histogram for the gradient;
selecting, based on the magnitude histogram, subblocks having gradient magnitudes equal to or greater than a preset threshold; and
determining, based on the directionality histogram, a region of selected subblocks having a most frequent directionality as the template region.

### Claim 15

A method of encoding a current block by a video encoding device, the method comprising:
determining a distance index (adjacent_idx) that indicates a distance between the current block and a template region;
determining the template region based on the distance between the current block and the template region, and a shape of the template region;
searching for an optimal template in a search region by using the template region and based on template matching, wherein the search region is defined within a reconstructed region of the current block; and
generating a prediction block of the current block from a reference block corresponding to the optimal template.

### Claim 16 (depends on 15)

The method of claim 15, further comprising encoding the distance index.

### Claim 17

A computer-readable recording medium storing a bitstream generated by a video encoding method, the video encoding method comprises:
determining a distance index (adjacent_idx) that indicates a distance between a current block and a template region;
determining the template region based on the distance between the current block and the template region, and a shape of the template region;
searching for an optimal template in a search region, by using the template region and based on template matching, wherein the search region is defined within a reconstructed region of the current block; and
generating a prediction block of the current block from a reference block corresponding to the optimal template.
