# US 2025/0386016 A1 · Signaling by using template matching cost

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

- Number: US 2025/0386016 A1
- Document ID: US20250386016A1
- Status: Published application
- Kind: A1
- Application number: 19/249,821
- Filed: 2025-06-25
- Published: 2025-12-18
- Earliest claimed: 2023-07-14
- Assignees: Tencent America LLC
- Applicants: Tencent America LLC
- Inventors: Lien-fei CHEN; Xin ZHAO; Madhu PERINGASSERY KRISHNAN; Biao WANG; Roman CHERNYAK; Shan LIU
- Web page: https://patentgrep.com/patent/US20250386016A1

## CPC

- H04N 19/117: Filters, e.g. for pre-processing or post-processing (sub-band filter banks H04N19/635)
- H04N 19/70: characterised by syntax aspects related to video coding, e.g. related to compression standards
- H04N 19/159: Prediction type, e.g. intra-frame, inter-frame or bidirectional frame prediction
- H04N 19/176: the region being a block, e.g. a macroblock
- H04N 19/198: {including smoothing of a sequence of encoding parameters, e.g. by averaging, by choice of the maximum, minimum or median value}
- H04N 19/593: involving spatial prediction techniques
- H04N: PICTORIAL COMMUNICATION, e.g. TELEVISION

## Abstract

An apparatus including processing circuitry is provided. The processing circuitry is configured to, when a first syntax element indicates that a non-linear function-based prediction method is applied to reconstruct a current block, determine a prediction model from a plurality of candidate prediction models based on a plurality of TM costs between a template of the current block and a template of a reference block according to the plurality of candidate prediction models associated with the non-linear function-based prediction method. The processing circuitry is configured to determine a prediction block of the current block as the reference block processed by a non-linear function of the prediction model.

## Claims

### Claim 1

A method of video decoding, the method comprising:
receiving a bitstream including a first syntax element that indicates whether a function-based prediction method is applied to reconstruct a current block based on a template matching prediction, the function-based prediction method applying a prediction model that is associated with a template type of a template of the current block and includes a function that is applied to a reference block of the current block, the function including parameters derived based on the template of the current block and a template of the reference block;
when the first syntax element indicates that the function-based prediction method is applied to reconstruct the current block, determining the prediction model from a plurality of candidate prediction models based on a plurality of template matching (TM) costs between the template of the current block and the template of the reference block according to the plurality of candidate prediction models associated with the function-based prediction method; and
determining a prediction block of the current block as the reference block processed by the function of the prediction model.

### Claim 2 (depends on 1)

The method of claim 1, wherein the determining the prediction model further comprises:
applying a function of each of the plurality of candidate prediction models to the template of the current block and the template of the reference block to obtain a processed template of the current block and the processed template of the reference block;
determining each of the plurality of TM costs based on the processed template of the current block and the processed template of the reference block according to a respective one of the plurality of candidate prediction models; and
determining the prediction model from the plurality of candidate prediction models that corresponds to a minimum TM cost of the plurality of TM costs.

### Claim 3 (depends on 1)

The method of claim 1, wherein the determining the prediction block of the current block further comprises:
applying the function of the prediction model to process samples of the reference block; and
determining the prediction block of the current block as the samples of the reference block processed by the function of the prediction model.

### Claim 4 (depends on 1)

The method of claim 1, wherein:
the function is one of a linear function and a non-linear function, and
the linear function is defined as
∑
i
=
0
n
⁢
(
α
i
×
p
⁡
(
x
i
,
y
i
)
)
,
p(xi,yi) being a sample of the reference block, αi and β being factors.

### Claim 5 (depends on 1)

The method of claim 1, wherein the template type includes one of:
a first template type that includes a first template region positioned at a left side of the current block,
a second template type that includes a second template region positioned at a top side of the current block,
a third template type including the first template region positioned at the left side of the current block and the second template region positioned at the top side of the current block, and
a fourth temple type including the first template region positioned at the left side of the current block, the second template region positioned at the top side of the current block, and a top-left template region positioned at a top-left corner of the current block and arranged between the first template region and the second template region.

### Claim 6 (depends on 1)

The method of claim 1, wherein the first syntax element indicates that the prediction model is applied to at least one of a Cb component and a Cr component of the current block.

### Claim 7 (depends on 1)

The method of claim 1, wherein the determining the prediction model comprises:
generating processed samples of the template of the current block and processed samples of the template of the reference block based on a first candidate prediction model of the plurality of candidate prediction models;
determining a first TM cost of the plurality of TM costs based on the processed samples of the template of the current block and the processed samples of the template of the reference block;
filtering the samples of the template of the current block and the samples of the template of the reference block;
generating processed filtered samples of the template of the current block and processed filtered samples of the template of the current block based on the first candidate prediction model; and
determining a second TM cost of the plurality of TM costs based on the processed filtered samples of the template of the current block and the processed filtered samples of the template of the reference block.

### Claim 8 (depends on 7)

The method of claim 7, wherein the filtering further comprises:
subtracting a mean of samples of the template of the current block from each of the samples of the template of the current block to generate adjusted samples of the template of the current block;
subtracting a mean of samples of the template of the reference block from each of the samples of the template of the reference block to generated adjust samples of the template of the current block; and
determining a third TM cost of the plurality of TM costs based on the adjusted samples of the template of the current block and the adjusted samples of the template of the reference block.

### Claim 9 (depends on 1)

The method of claim 1, wherein the determining the prediction model comprises:
determining a first TM cost of the plurality of TM costs based on samples of the template of the current block and samples of the template of the reference block;
generating processed samples of the template of the current block and processed samples of the template of the reference block based on a first candidate prediction model of the plurality of candidate prediction models; and
determining a second TM cost of the plurality of TM costs based on the processed samples of the template of the current block and the processed samples of the template of the reference block.

### Claim 10 (depends on 1)

The method of claim 1, wherein the determining the prediction block of the current block further comprises:
determining one of the plurality of TM costs that is indicated by a second syntax element in the bitstream;
determining the prediction model from the plurality of candidate prediction models that corresponds to the determined one of the plurality of TM costs;
applying the function of the prediction model to process samples of the reference block; and
determining the prediction block of the current block based on the samples of the reference block that are processed by the function of the prediction model.

### Claim 11 (depends on 2)

The method of claim 2, further comprising:
normalizing each TM cost of the plurality of TM costs by dividing the respective TM cost with a template size corresponding to the respective TM cost;
reordering the plurality of normalized TM costs in an ascending order based on the normalized TM costs; and
generating a candidate list based on the plurality of reordered normalized TM costs.

### Claim 12 (depends on 11)

The method of claim 11, further comprising:
receiving a third syntax element in the bitstream that indicates which one of the plurality of reordered normalized TM costs is selected, the third syntax element being associated with at least one of a Cb component or a Cr component of the current block; and
determining the prediction model from the plurality of candidate prediction models that corresponds to the TM cost indicated by the third syntax element.

### Claim 13

A method of video encoding, the method comprising:
determining whether a function-based prediction method is applied to predict a current block based on a template matching prediction, the function-based prediction method applying a prediction model that is associated with a template type of a template of the current block and includes a function that is applied to a reference block of the current block, the function including parameters derived based on the template of the current block and a template of the reference block;
when the function-based prediction method is determined to be applied to predict the current block, determining the prediction model from a plurality of candidate prediction models based on a plurality of template matching (TM) costs between the template of the current block and the template of the reference block according to the plurality of candidate prediction models associated with the function-based prediction method; and
determining a prediction block of the current block as the reference block processed by the function of the prediction model.

### Claim 14 (depends on 13)

The method of claim 13, wherein the determining the prediction model further comprises:
applying a function of each of the plurality of candidate prediction models to the template of the current block and the template of the reference block to obtain a processed template of the current block and the processed template of the reference block;
determining each of the plurality of TM costs based on the processed template of the current block and the processed template of the reference block according to a respective one of the plurality of candidate prediction models; and
determining the prediction model from the plurality of candidate prediction models that corresponds to a minimum TM cost of the plurality of TM costs.

### Claim 15 (depends on 13)

The method of claim 13, wherein the determining the prediction block of the current block further comprises:
applying the function of the prediction model to process samples of the reference block; and
determining the prediction block of the current block as the samples of the reference block processed by the function of the prediction model.

### Claim 16 (depends on 13)

The method of claim 13, wherein:
the function is one of a linear function and a non-linear function, and
the linear function is defined as
∑
i
=
0
n
⁢
(
α
i
×
p
⁡
(
x
i
,
y
i
)
)
,
p(xi,yi) being a sample of the reference block, αi and β being factors.

### Claim 17 (depends on 13)

The method of claim 13, wherein the template type includes one of:
a first template type that includes a first template region positioned at a left side of the current block,
a second template type that includes a second template region positioned at a top side of the current block,
a third template type including the first template region positioned at the left side of the current block and the second template region positioned at the top side of the current block, and
a fourth temple type including the first template region positioned at the left side of the current block, the second template region positioned at the top side of the current block, and a top-left template region positioned at a top-left corner of the current block and arranged between the first template region and the second template region.

### Claim 18 (depends on 13)

The method of claim 13, further comprising:
encoding a first syntax element into a bitstream to indicate that the prediction model is applied to at least one of a Cb component and a Cr component of the current block.

### Claim 19 (depends on 13)

The method of claim 13, wherein the determining the prediction model comprises:
generating processed samples of the template of the current block and processed samples of the template of the reference block based on a first candidate prediction model of the plurality of candidate prediction models;
determining a first TM cost of the plurality of TM costs based on the processed samples of the template of the current block and the processed samples of the template of the reference block;
filtering the samples of the template of the current block and the samples of the template of the reference block;
generating processed filtered samples of the template of the current block and processed filtered samples of the template of the current block based on the first candidate prediction model; and
determining a second TM cost of the plurality of TM costs based on the processed filtered samples of the template of the current block and the processed filtered samples of the template of the reference block.

### Claim 20

A non-transitory computer readable medium storing a video media bitstream encoded by an encoding method, the encoding method comprising:
determining whether a function-based prediction method is applied to predict a current block based on a template matching prediction, the function-based prediction method applying a prediction model that is associated with a template type of a template of the current block and includes a function that is applied to a reference block of the current block, the function including parameters derived based on the template of the current block and a template of the reference block;
when the function-based prediction method is determined to be applied to predict the current block, determining the prediction model from a plurality of candidate prediction models based on a plurality of template matching (TM) costs between the template of the current block and the template of the reference block according to the plurality of candidate prediction models associated with the function-based prediction method;
determining a prediction block of the current block as the reference block processed by the function of the prediction model; and
encoding the current block into the video media bitstream based on the determined prediction block of the current block.
