Method and device for encoding video data and computer-readable storage media

BR112025021382A2Pending Publication Date: 2026-09-01
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
BR112025021382
Authority / Receiving Office
BR · BR
Patent Type
Applications
Publication Date
2026-09-01

Smart Images

  • Figure 00000000_0000_ABST
    Figure 00000000_0000_ABST
Patent Text Reader
Need to check novelty before this filing date? Find Prior Art

Description

1 / 112 “Template availability for template matching tools”

[0001] This application claims priority over U.S. Patent Application No. 18 / 632,979, filed April 11, 2024, and U.S. Provisional Patent Application No. 63 / 496,378, filed April 14, 2023, the contents of which are incorporated herein by reference in their entirety. U.S. Patent Application No. 18 / 632,979, filed April 11, 2024, claims the benefit of U.S. Provisional Patent Application No. 63 / 496,378, filed April 14, 2023. TECHNICAL FIELD

[0002] This disclosure relates to video encoding and video decoding. BACKGROUND

[0003] Digital video capabilities can be incorporated into a wide range of devices, including digital televisions, digital direct broadcast systems, wireless broadcast systems, personal digital assistants (PDAs), laptop or desktop computers, tablet computers, e-readers, digital cameras, digital recording devices, digital media players, video game devices, video game consoles, cellular or satellite radiotelephones, so-called smartphones, video conferencing devices, video streaming devices, and the like. Digital video devices implement video coding techniques, such as those described in the standards defined by MPEG-2, MPEG-4, ITU-T H.263, ITU-T H.264 / MPEG-4, Part 10, Advanced Video Coding (AVC). Petition 870250090174, dated 03 / 10 / 2025, pp. 121 / 261 2 / 112 Advanced video coding), ITU-T H.265 / high-efficiency video coding (HEVC), ITU-T H.266 / versatile video coding (VVC), and extensions of these standards, as well as proprietary video codecs / formats such as AOMedia Video 1 (AV1), which was developed by the Alliance for Open Media. Video devices can transmit, receive, encode, decode, and / or store digital video information more efficiently through the implementation of these video coding techniques.

[0004] Video coding techniques include spatial (intra-image) and / or temporal (inter-image) prediction to reduce or remove the inherent redundancy in video sequences. For block-based video coding, a video slice (e.g., a video image or a portion of a video image) can be partitioned into video blocks, which may also be called coding tree units (CTUs), coding units (CUs), and / or coding nodes. Video blocks in an intracoded (I) slice of an image are coded using spatial prediction with respect to reference samples in neighboring blocks in the same image. Video blocks in an intercoded (P or B) slice of an image may use spatial prediction with respect to reference samples in neighboring blocks in the same image or temporal prediction with respect to reference samples in other reference images.Images can be called frames, and reference images can be called reference frames. Petition 870250090174, dated 03 / 10 / 2025, pp. 122 / 261 3 / 112 SUMMARY

[0005] In general, this disclosure describes techniques for template matching in video encoding. Current template matching search algorithms have excessive limitations with respect to search areas near an image boundary and a reconstructed area boundary (e.g., the boundary of an area that has been reconstructed). The techniques described in the present invention can improve the quality of encoded video by addressing these deficiencies of current template matching search algorithms. For example, the techniques described in the present invention can provide additional potential reference blocks to be considered for situations where a potential reference block and / or an actual block may be near an image boundary or reconstructed area boundary.

[0006] In one example, a method includes: determining a current template of a current block of video data; determining a potential reference block in an image of the video data for the current block; determining that the potential reference block and a reference template of the potential reference block are entirely within the image, the reference template having the same shape as the current template; based on the potential reference block and the reference template both being entirely within the image, performing template matching between the reference template and the current template; and encoding the current block based on the template matching.

[0007] In another example, a device Petition 870250090174, dated 03 / 10 / 2025, pp. 123 / 261 4 / 112 includes one or more memories configured to store video data and one or more processors implemented in a circuit set and communicatively coupled to one or more memories, the one or more processors being configured to: determine a current template of a current block of video data; determine a potential reference block in an image of the video data for the current block; determine that the potential reference block and a reference template of the potential reference block are entirely within the image, the reference template having the same shape as the current template; based on the potential reference block and the reference template both being entirely within the image, perform template matching between the reference template and the current template; and encode the current block based on the template matching.

[0008] In another example, computer-readable storage media are encoded with instructions that, when executed, cause one or more processors to: determine a current template of a current block of video data; determine a potential reference block in an image of the video data for the current block; determine that the potential reference block and a reference template of the potential reference block are entirely within the image, the reference template having the same shape as the current template; based on the potential reference block and the reference template both being entirely within the image, perform template matching between the reference template and the current template; and encode the current block based on the matching of Petition 870250090174, dated 03 / 10 / 2025, pp. 124 / 261 5 / 112 template.

[0009] Details of one or more examples are presented in the attached drawings and in the description below. Other attributes, objectives and advantages will become apparent from the description, drawings and claims. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] Figure 1 is a block diagram illustrating an example video encoding and decoding system that can perform the techniques of the present disclosure.

[0011] Figure 2 is a conceptual diagram illustrating sample template matching search areas.

[0012] Figure 3 is a conceptual diagram illustrating an example of template matching performed in a research area around an initial motion vector (MV).

[0013] Figure 4 is a tabular diagram illustrating adaptive motion vector resolution (AMVR) search patterns and AMVR fusion mode.

[0014] Figure 5 is a conceptual diagram illustrating an example of a template and reference samples of the template in reference images.

[0015] Figure 6 is a conceptual diagram illustrating a template and reference samples for a block with sub-block movement using movement information from the sub-blocks of the current block.

[0016] Figure 7 is a tubular diagram illustrating a template for the 1st and 2nd geometric partitions, where A represents the use of samples above, L Petition 870250090174, dated 03 / 10 / 2025, pp. 125 / 261 6 / 112 represents the use of samples on the left, and L+A represents the use of both samples on the left and above.

[0017] Figure 8 is a conceptual diagram illustrating examples of intrablock copy (IBC) reference regions that depend on the current CU position.

[0018] Figure 9 is a conceptual diagram illustrating parts of an example template.

[0019] Figures 10A to 10C are conceptual diagrams illustrating examples of image boundary treatment that depend on the template type.

[0020] Figure 11 is a conceptual diagram illustrating an alternative example of image boundary treatment for an example of an L-shape.

[0021] Figure 12 is a conceptual diagram illustrating the example filling of unavailable samples when copying values ​​from available samples.

[0022] Figure 13 is a flowchart illustrating example template matching techniques according to one or more aspects of this disclosure.

[0023] Figure 14 is a block diagram illustrating an example video encoder that can perform the techniques of the present disclosure.

[0024] Figure 15 is a block diagram illustrating an example video decoder that can perform the techniques of the present disclosure.

[0025] Figure 16 is a flowchart illustrating an example method for coding an actual block in accordance with the techniques of this disclosure.

[0026] Figure 17 is a flowchart illustrating Petition 870250090174, dated 03 / 10 / 2025, pp. 126 / 261 7 / 112 an example method for decoding a current block according to the techniques of the present disclosure. DETAILED DESCRIPTION

[0027] For some video content, current template matching search algorithms may have excessive limitations with respect to search areas near an image boundary and the reconstructed area boundary. By restricting potential matching templates to these limited search areas near an image boundary or a reconstructed area boundary, template matching search algorithms, in some cases, exclude better matches. This can unduly limit encoding efficiency and / or the quality of the decoded image. The techniques described in the present invention can improve encoding efficiency and / or the quality of the encoded video by addressing these shortcomings of current template matching search algorithms.

[0028] Figure 1 is a block diagram illustrating an example 100 video encoding and decoding system that can perform the techniques of this disclosure. The techniques of this disclosure generally refer to the process of encoding (encoding and / or decoding) video data. In general, video data includes any data for processing a video. Thus, video data can include raw, unencoded video, encoded video, decoded (e.g., reconstructed) video, and video metadata such as signaling data. Petition 870250090174, dated 03 / 10 / 2025, pp. 127 / 261 8 / 112

[0029] As shown in Figure 1, the system 100 includes a source device 102 that provides encoded video data to be decoded and displayed by a destination device 116 in this example. In particular, the source device 102 provides the video data to the destination device 116 via a computer-readable medium 110. The source device 102 and the destination device 116 may be or include any of a wide range of devices, such as desktop computers, notebook computers (i.e., laptops), mobile devices, tablet computers, set-top boxes, telephone handsets such as smartphones, televisions, cameras, display devices, digital media players, video game consoles, video streaming devices, broadcast receiving devices, or similar devices.In some cases, the source device 102 and the destination device 116 may be equipped for wireless communication and, in this way, may be referred to as wireless communication devices.

[0030] In the example in Figure 1, source device 102 includes video source 104, memory 106, video encoder 200, and output interface 108. Destination device 116 includes input interface 122, video decoder 300, memory 120, and display device 118. According to this disclosure, the video encoder 200 of source device 102 and the video decoder 300 of destination device 116 can be configured to apply template matching techniques. Thus, source device 102 represents an example of an encoding device of Petition 870250090174, dated 03 / 10 / 2025, pp. 128 / 261 9 / 112 video, while destination device 116 represents an example of a video decoding device. In other examples, a source device and a destination device may include other components or arrangements. For example, source device 102 may receive video data from an external video source, such as an external camera. Similarly, destination device 116 may interface with an external display device, rather than including an integrated display device.

[0031] As shown in Figure 1, system 100 is merely an example. In general, any digital video encoding and / or decoding device can perform template matching techniques. Source device 102 and destination device 116 are merely examples of such encoding devices in which source device 102 generates encoded video data for transmission to destination device 116. This disclosure refers to an encoding device as a device that performs the encoding (encoding and / or decoding) process of data. Thus, video encoder 200 and video decoder 300 represent examples of encoding devices, in particular, a video encoder and a video decoder, respectively.In some examples, source device 102 and destination device 116 may operate in a substantially symmetrical manner, such that each of the source device 102 and destination device 116 includes video encoding and decoding components. In this way, system 100 can support unidirectional or bidirectional video transmission between the devices. Petition 870250090174, dated 03 / 10 / 2025, pp. 129 / 261 10 / 112 source 102 and destination device 116, for example, for video streaming, video playback, video broadcasting or video telephony.

[0032] In general, the video source 104 represents a video data source (i.e., raw, unencoded video data) and provides a sequential series of images (also called frames) of video data to the video encoder 200, which encodes data into images. The video source 104 from the source device 102 may include a video capture device, such as a video camera, a video file containing previously captured raw video, and / or a video feed interface for receiving video from a video content provider. As an additional alternative, the video source 104 may generate computer graphics-based data, such as the source video, or a combination of live video, archived video, and computer-generated video. In each case, the video encoder 200 encodes the captured, pre-captured, or computer-generated video data.The video encoder 200 can rearrange the images from the received order (sometimes called the display order) into an encoding order for encoding. The video encoder 200 can generate a bitstream that includes encoded video data. The source device 102 can then output the encoded video data via the output interface 108 to the computer-readable medium 110 for reception and / or retrieval, for example, via the input interface 122 of the destination device 116.

[0033] Memory 106 of source device 102 and memory 120 of destination device 116 represent Petition 870250090174, dated 03 / 10 / 2025, pp. 130 / 261 11 / 112 general-purpose memories. In some examples, memories 106 and 120 may store raw video data, for example, raw video from video source 104 and raw and decoded video data from video decoder 300. Additionally or alternatively, memories 106 and 120 may store executable software instructions, for example, by video encoder 200 and video decoder 300, respectively. Although memory 106 and memory 120 are shown separately from video encoder 200 and video decoder 300 in this example, it should be understood that video encoder 200 and video decoder 300 may also include internal memories for functionally similar or equivalent purposes. In addition, memories 106 and 120 can store encoded video data, for example, output from video encoder 200 and input to video decoder 300.In some examples, memory portions 106, 120 can be allocated as one or more video buffers, for example, to store raw, decoded and / or encoded video data.

[0034] The computer-readable medium 110 may represent any type of medium or device with the capability to carry encoded video data from the source device 102 to the destination device 116. In one example, the computer-readable medium 110 represents a communication medium to enable the source device 102 to transmit encoded video data directly to the destination device 116 in real time, for example, via a radio frequency network or computer-based network. The output interface 108 may modulate a transmission signal. Petition 870250090174, dated 03 / 10 / 2025, pp. 131 / 261 12 / 112 which includes the encoded video data, and the input interface 122 can demodulate the received transmission signal according to a communication standard, such as a wireless communication protocol. The communication medium may include any wireless or wired communication medium, such as a radio frequency (RF) spectrum or one or more physical transmission lines. The communication medium may be part of a packet-based network, such as a local area network, a wide area network, or a global network such as the Internet. The communication medium may include routers, switches, base stations, or any other equipment that may be useful in facilitating communication between the source device 102 and the destination device 116.

[0035] In some examples, source device 102 may output encoded data from output interface 108 to storage device 112. Similarly, destination device 116 may access encoded data from storage device 112 via input interface 122. Storage device 112 may include any of a variety of distributed or locally accessed data storage media, such as a hard disk, Blu-ray discs, DVDs, CD-ROMs, flash memory, volatile or non-volatile memory, or any other digital storage media suitable for storing encoded video data.

[0036] In some examples, source device 102 may output encoded video data to file server 114 or another intermediate storage device that may store the encoded video data generated by source device 102. The Petition 870250090174, dated 03 / 10 / 2025, pp. 132 / 261 13 / 112 target device 116 can access video data stored from the file server 114 via streaming or download.

[0037] The file server 114 can be any type of server device with the ability to store encoded video data and transmit such encoded video data to the destination device 116.File server 114 can represent a web server (for example, for a website), a server configured to provide a file transfer protocol service (such as File Transfer Protocol (FTP) or File Delivery over Unidirectional Transport (FLUTE)), a Content Delivery Network (CDN) device, a Hypertext Transfer Protocol (HTTP) server, a Multimedia Broadcast Multicast Service (MBMS) or enhanced MBMS (eMBMS) server, and / or a Network Attached Storage (NAS) device.File server 114 may, additionally or alternatively, implement one or more HTTP streaming protocols, such as Dynamic Adaptive Streaming over HTTP (DASH), HTTP Live Streaming (HLS), Real-Time Streaming Protocol (RTSP), or similar protocols.

[0038] Target device 116 can access encoded video data from the server of Petition 870250090174, dated 03 / 10 / 2025, pp. 133 / 261 14 / 112 files 114 through any standard data connection, including an internet connection. This may include a wireless channel (e.g., a Wi-Fi connection), a wired connection (e.g., digital subscriber line (DSL), cable modem, etc.) or a combination of both that is suitable for accessing encoded video data stored on the file server 114. The input interface 122 may be configured to operate according to any one or more of the various protocols discussed above to retrieve or receive media data from the file server 114 or other protocols to retrieve media data.

[0039] Output interface 108 and input interface 122 may represent wireless transmitters / receivers, modems, wired network communication components (e.g., Ethernet cards), wireless communication components operating in accordance with any of a variety of Institute of Electrical and Electronics Engineers (IEEE) 802.11 standards, or other physical components. In examples where output interface 108 and input interface 122 include wireless components, output interface 108 and input interface 122 may be configured to transfer data, such as encoded video data, in accordance with a cellular communication standard such as 4G, 4G-LTE (long-term evolution), LTE-advanced, 5G, or similar.In some examples where output interface 108 includes a wireless transmitter, output interface 108 and input interface 122 can be configured to transfer data, such as video data. Petition 870250090174, dated 03 / 10 / 2025, pp. 134 / 261 15 / 112 encoded, according to other wireless standards, such as an IEEE 802.11 specification, an IEEE 802.15 specification (e.g., ZigBee™), a Bluetooth™ standard, or similar. In some examples, the source device 102 and / or the destination device 116 may include the respective system-on-a-chip (SoC) devices. For example, the source device 102 may include an SoC device to perform the functionality assigned to the video encoder 200 and / or the output interface 108, and the destination device 116 may include an SoC device to perform the functionality assigned to the video decoder 300 and / or the input interface 122.

[0040] The techniques of this disclosure can be applied to video encoding to support any of a variety of multimedia applications, such as over-the-air television broadcasts, cable television broadcasts, satellite television broadcasts, Internet streaming video transmissions, such as dynamic adaptive streaming over HTTP (DASH), digital video that is encoded on a data storage medium, decoding of digital video stored on a data storage medium, or other applications.

[0041] The input interface 122 of the destination device 116 receives a video bitstream encoded from the computer-readable medium 110 (e.g., a communication medium, storage device 112, file server 114, or similar). The encoded video bitstream may include signaling information defined by the video encoder 200, which is also used by the video decoder 300, such as syntax elements that Petition 870250090174, dated 03 / 10 / 2025, pp. 135 / 261 16 / 112 have values ​​that describe characteristics and / or process video blocks or other encoded units (e.g., slices, images, image groups, sequences, or the like). Display device 118 displays decoded images from the decoded video data to a user. Display device 118 may represent any of several display devices, such as a liquid crystal display (LCD), a plasma display, an organic light-emitting diode (OLED) display, or another type of display device.

[0042] Although not shown in Figure 1, in some examples, the video encoder 200 and the video decoder 300 can each be integrated with an audio encoder and / or audio decoder and may include suitable MUX-DEMUX units, or other hardware and / or software, to handle multiplexed streams that include audio and video in a common data stream.

[0043] Each of the 200 video encoder and 300 video decoder can be implemented as any of several suitable sets of encoder and / or decoder circuits, such as one or more microprocessors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), discrete logic, software, hardware, firmware, or any combination thereof. When the techniques are partially implemented in software, a device can store Petition 870250090174, dated 03 / 10 / 2025, pp. 136 / 261 17 / 112 instructions for the software in a suitable non-transient, computer-readable medium and execute the instructions in hardware using one or more processors to perform the techniques of this disclosure. Each of the video encoder 200 and video decoder 300 can be included in one or more encoders or decoders, any of which can be integrated as part of a combined encoder / decoder (CODEC) in a respective device. A device that includes video encoder 200 and / or video decoder 300 can implement video encoder 200 and / or video decoder 300 in a processing circuitry, such as an integrated circuit and / or a microprocessor. This device can be a wireless communication device, such as a cell phone or any other type of device described in the present invention.

[0044] The Video Encoder 200 and Video Decoder 300 can operate according to a video encoding standard, such as ITU-T H.265, also called High Efficiency Video Coding (HEVC), or extensions thereof, such as scalable video coding extensions and / or multi-view extensions. Alternatively, the Video Encoder 200 and Video Decoder 300 can operate according to other proprietary or industry standards, such as ITU-T H.266, also called Versatile Video Coding (VVC). In other examples, the Video Encoder 200 and Video Decoder 300 can operate according to a proprietary video codec / format, such as AOMedia Video 1 (AV1), AV1 extensions and / or versions. Petition 870250090174, dated 03 / 10 / 2025, pp. 137 / 261 18 / 112 successors of AV1 (e.g., AV2). In other examples, the Video Encoder 200 and Video Decoder 300 may operate according to other proprietary formats or industry standards. The techniques of this disclosure, however, are not limited to any particular encoding standard or format. In general, the Video Encoder 200 and Video Decoder 300 can be configured to perform the techniques of this disclosure in conjunction with any video encoding techniques that use template matching.

[0045] In general, the Video Encoder 200 and Video Decoder 300 can perform image block-based encoding. The term block generally refers to a structure that includes data to be processed (e.g., encoded, decoded, or otherwise used in the encoding and / or decoding process). For example, a block might include a two-dimensional array of luminance and / or chrominance data samples. In general, the Video Encoder 200 and Video Decoder 300 can encode video data represented in a YUV format (e.g., Y, Cb, Cr). In other words, instead of encoding red, green, and blue (RGB) data for samples of an image, the 200 video encoder and the 300 video decoder can encode luminance and chrominance components, where the chrominance components can include both red and blue hue chrominance components.In some examples, the 200 video encoder converts received RGB formatted data to a YUV representation before encoding, and the 300 video decoder converts it to... Petition 870250090174, dated 03 / 10 / 2025, pp. 138 / 261 19 / 112 YUV representation in RGB format. Alternatively, pre- and post-processing units (not shown) can perform these conversions.

[0046] This disclosure may generally refer to the encoding (e.g., encoding and decoding) of images to include the process of encoding or decoding image data. Similarly, this disclosure may refer to the encoding of blocks of an image to include the process of encoding or decoding data for the blocks, for example, prediction and / or residual encoding. An encoded video bitstream generally includes a series of values ​​for syntax elements representing encoding decisions (e.g., encoding modes) and image block partitioning. Thus, references to the encoding of an image or a block should generally be understood as encoding values ​​for syntax elements that form the image or block.

[0047] HEVC defines several blocks, including coding units (CUs), prediction units (PUs), and transform units (TUs). According to HEVC, a video encoder (such as video encoder 200) partitions a coding tree unit (CTU) into CUs according to a quadtree structure. That is, the video encoder partitions CTUs and CUs into four equal, non-overlapping squares, and each node in the quadtree has zero or four child nodes. Nodes without child nodes can be called leaf nodes, and the CUs of these leaf nodes may include one or more PUs and / or one or more TUs. The video encoder may additionally partition Petition 870250090174, dated 03 / 10 / 2025, pp. 139 / 261 20 / 112 PUs and TUs. For example, in HEVC, a residual quadtree (RQT) represents the partitioning of TUs. In HEVC, PUs represent interprediction data, while TUs represent residual data. Intraprediction CUSs include intraprediction information, such as an indication of intramode.

[0048] As another example, the Video Encoder 200 and Video Decoder 300 can be configured to operate according to VVC. According to VVC, a video encoder (such as the Video Encoder 200) partitions an image into a plurality of CTUs. The Video Encoder 200 can partition a CTU according to a tree structure, such as a quadtree-binary tree (QTBT) structure or a multi-type tree (MTT) structure. The QTBT structure removes the concepts of multiple partition types, such as the separation between CUs, PUs, and TUs of HEVC. A QTBT structure includes two levels: a first level partitioned according to the quadtree partition and a second level partitioned according to the binary tree partition. A root node of the QTBT structure corresponds to a CTU. The leaf nodes of the binary trees correspond to the CUs.

[0049] In an MTT partitioning structure, blocks can be partitioned using a quadtree (QT) partition, a binary tree (BT) partition, and one or more types of triple tree (TT) partitions (also called ternary tree (TT) partitions). A triple or ternary tree partition is a partition where a block is divided into three sub-blocks. In Petition 870250090174, dated 03 / 10 / 2025, pp. 140 / 261 21 / 112 some examples, a triple or ternary tree partition divides a block into three sub-blocks without splitting the original block through the center. The partitioning types in MTT (e.g., QT, BT, and TT) can be symmetric or asymmetric.

[0050] When operating according to the AV1 codec, the Video Encoder 200 and Video Decoder 300 can be configured to encode video data in blocks. In AV1, the largest encoding block that can be processed is called a superblock. In AV1, a superblock can be 128x128 luma samples or 64x64 luma samples. However, in successor video encoding formats (e.g., AV2), a superblock can be defined by different (e.g., larger) luma sample sizes. In some instances, a superblock is the top level of a block quadtree. The Video Encoder 200 can further partition a superblock into smaller encoding blocks. The Video Encoder 200 can partition a superblock and other encoding blocks into smaller blocks using quadratic or non-quadratic partitioning. Non-quadratic blocks can include N / 2xN, NxN / 2, N / 4xN, and NxN / 4 blocks.The Video Encoder 200 and Video Decoder 300 can perform separate prediction and transformation processes on each of the encoding blocks.

[0051] AV1 also defines a video data tile. A tile is a rectangular array of superblocks that can be independently encoded from other tiles. That is, video encoder 200 and video decoder 300 can encode and decode, respectively, Petition 870250090174, dated 03 / 10 / 2025, pp. 141 / 261 22 / 112 encoding blocks on a tile without using video data from other tiles. However, the 200 video encoder and 300 video decoder can perform filtering between tile boundaries. Tiles can be of uniform or non-uniform size. Tile-based encoding can enable parallel and / or multi-threaded processing for encoder and decoder implementations.

[0052] In some examples, the 200 video encoder and the 300 video decoder may use a single QTBT or MTT structure to represent each of the luminance and chrominance components, while in other examples, the 200 video encoder and the 300 video decoder may use two or more QTBT or MTT structures, such as one QTBT / MTT structure for the luminance component and another QTBT / MTT structure for both chrominance components (or two QTBT / MTT structures for the respective chrominance components).

[0053] The 200 video encoder and the 300 video decoder can be configured to use quadtree partition, QTBT partition, MTT partition, superblock partition, or other partition structures.

[0054] In some examples, a CTU includes a coding tree block (CTB) of luma samples, two corresponding CTBs of chroma samples from an image that has three sample arrangements, or a CTB of samples from a monochrome image or an image that is encoded using three separate color planes and syntax structures used to encode the samples. A CTB can be an NxN block of samples for some value of N, so that dividing a component into CTBs is a Petition 870250090174, dated 03 / 10 / 2025, pp. 142 / 261 23 / 112 Partitioning. A component is an array or a single sample of one of the three arrays (luma and two chroma) that make up an image in 4:2:0, 4:2:2, or 4:4:4 color format, or the array or a single sample of the array that makes up an image in monochrome format. In some examples, a coding block is an MxN block of samples for some values ​​of M and N, so a division of a CTB into coding blocks is a partitioning.

[0055] Blocks (e.g., CTUs or CUs) can be grouped in various ways in an image. As an example, a brick can refer to a rectangular region of CTU rows in a particular tile in an image. A tile can be a rectangular region of CTUs in a particular column of tiles and a particular row of tiles in an image. A column of tiles refers to a rectangular region of CTUs that has a height equal to the height of the image and a width specified by syntax elements (e.g., as in an image parameter set). A row of tiles refers to a rectangular region of CTUs that has a height specified by syntax elements (e.g., as in an image parameter set) and a width equal to the width of the image.

[0056] In some examples, a tile can be partitioned into multiple bricks, each of which may include one or more rows of CTUs in the tile. A tile that is not partitioned into multiple bricks may also be called a brick. However, a brick that is a true subset of a tile may not be called a tile. The bricks in an image may also be arranged in a slice. A slice may be an integer number of bricks. Petition 870250090174, dated 03 / 10 / 2025, pp. 143 / 261 24 / 112 of an image that can be contained exclusively within a single network abstraction layer (NAL) unit. In some examples, a slice includes a number of complete tiles or just a consecutive sequence of complete bricks of a tile.

[0057] This disclosure may use NxN and N by N interchangeably to refer to the sample dimensions of a block (such as a CU or other video block) in terms of vertical and horizontal dimensions, for example, 16x16 samples or 16 by 16 samples. Generally, a 16x16 CU will have 16 samples in a vertical direction (y = 16) and 16 samples in a horizontal direction (x = 16). Similarly, an NxN CU generally has N samples in a vertical direction and N samples in a horizontal direction, where N represents a non-negative integer value. The samples in a CU may be arranged in rows and columns. Furthermore, CUs do not necessarily have to have the same number of samples in the horizontal direction as in the vertical direction. For example, CUs may include NxM samples, where M is not necessarily equal to N.

[0058] The Video Encoder 200 encodes video data into CUs that represent residual and / or prediction information and other information. Prediction information indicates how the CU should be predicted to form a prediction block for the CU. Residual information generally represents sample-by-sample differences between samples of the CU before encoding and the prediction block.

[0059] To predict a CU, the video encoder 200 can generally form a prediction block. Petition 870250090174, dated 03 / 10 / 2025, pp. 144 / 261 25 / 112 for the CU through interprediction or intraprediction. Interprediction generally refers to predicting the CU from previously encoded image data, while intraprediction generally refers to predicting the CU from previously encoded data of the same image. To perform interprediction, the Video Encoder 200 can generate the prediction block using one or more motion vectors. The Video Encoder 200 can generally perform a motion search to identify a reference block that closely matches the CU, for example, in terms of differences between the CU and the reference block.The Video Encoder 200 can calculate a difference metric using a sum of absolute differences (SAD), a sum of squared differences (SSD), a mean absolute difference (MAD), mean squared differences (MSD), or other such difference calculations to determine whether a reference block closely matches the current CU. In some examples, the Video Encoder 200 can predict the current CU using one-way prediction or two-way prediction.

[0060] Some VVC examples also provide an affine motion compensation mode, which can be considered an interprediction mode. In affine motion compensation mode, the 200 video encoder can determine two or more motion vectors that represent non-translational motion, such as zooming in or out, rotation, perspective motion, or other types of irregular motion. Petition 870250090174, dated 03 / 10 / 2025, pages 145 / 261 26 / 112

[0061] To perform intraprediction, the Video Encoder 200 can select an intraprediction mode to generate the prediction block. Some VVC examples provide sixty-seven intraprediction modes, including several directional modes, as well as planar mode and DC mode. In general, the Video Encoder 200 selects an intraprediction mode that describes neighboring samples for a current block (e.g., a CU block), from which samples of the current block are predicted. Such samples can generally be above, above and to the left, or to the left of the current block in the same image as the current block, assuming that the Video Encoder 200 encodes CTUs and CUs in raster scan order (left to right, top to bottom).

[0062] The Video Encoder 200 encodes data representing the prediction mode for a current block. For example, for interprediction modes, the Video Encoder 200 can encode data representing which of the various available interprediction modes are used, as well as motion information for the corresponding mode. For one-way or two-way interprediction, for example, the Video Encoder 200 can encode motion vectors using Advanced Motion Vector Prediction (AMVP) or fusion mode. The Video Encoder 200 can use similar modes to encode motion vectors for affine motion compensation mode.

[0063] AV1 includes two general techniques for encoding and decoding a block of video data encoding. The two general techniques are intraprediction (by Petition 870250090174, dated 03 / 10 / 2025, pp. 146 / 261 27 / 112 example, intra-frame prediction or spatial prediction) and inter-prediction (e.g., inter-frame prediction or temporal prediction). In the context of AV1, when predicting blocks of a current video data frame using an intraprediction mode, the Video Encoder 200 and Video Decoder 300 do not use video data from other video data frames. For most intraprediction modes, the Video Encoder 200 encodes blocks of a current frame based on the difference between sample values ​​in the current block and predicted values ​​generated from reference samples in the same frame. The Video Encoder 200 determines the predicted values ​​generated from the reference samples based on the intraprediction mode.

[0064] After prediction, such as intraprediction or interprediction of a block, the Video Encoder 200 can calculate residual data for the block. The residual data, such as a residual block, represents the sample by sample differences between the block and a prediction block for the block, formed using the corresponding prediction mode. The Video Encoder 200 can apply one or more transforms to the residual block to produce transformed data in a transform domain, rather than the sample domain. For example, the Video Encoder 200 can apply a discrete cosine transform (DCT), an integer transform, a wavelet transform, or a conceptually similar transform to the residual video data. Additionally, the Video Encoder 200 can apply a secondary transform after the first transform, such as a mode-dependent non-separable secondary transform. Petition 870250090174, dated 03 / 10 / 2025, pp. 147 / 261 28 / 112 (MDNSST - mode-dependent non-separable secondary transform), a signal-dependent transform, a Karhunen-Loeve transform (KLT - Karhunen-Loeve transform), or similar. The 200 video encoder produces transform coefficients after the application of one or more transforms.

[0065] As mentioned above, after any transforms to produce transform coefficients, the Video 200 encoder can perform quantization of the transform coefficients. Quantization generally refers to a process in which transform coefficients are quantized to possibly reduce the amount of data used to represent the transform coefficients, providing additional compression. By performing the quantization process, the Video 200 encoder can reduce the bit depth associated with some or all of the transform coefficients. For example, the Video 200 encoder can round an n-bit value to an m-bit value during quantization, where n is greater than m. In some instances, to perform quantization, the Video 200 encoder can perform a right shift in the bit direction of the value to be quantized.

[0066] After quantization, the 200 video encoder can sweep the transform coefficients, producing a one-dimensional vector from the two-dimensional array that includes the quantized transform coefficients. The sweep can be designed to place higher-energy (and therefore lower-frequency) transform coefficients in front of the vector and lower-energy transform coefficients in front. Petition 870250090174, dated 03 / 10 / 2025, pp. 148 / 261 29 / 112 (and therefore higher frequency) on the back of the vector. In some examples, the 200 video encoder may use a predefined scan order to scan the quantized transform coefficients to produce a serialized vector and then entropically encode the quantized transform coefficients of the vector. In other examples, the 200 video encoder may perform an adaptive scan. After scanning the quantized transform coefficients to form the one-dimensional vector, the 200 video encoder may entropically encode the one-dimensional vector, for example, according to context-adaptive binary arithmetic coding (CABAC). The 200 video encoder may also entropically encode the values ​​for syntax elements that describe metadata associated with the encoded video data for use by the 300 video decoder in decoding the video data.

[0067] To perform CABAC, the video encoder 200 can assign a context in a context model to a symbol to be transmitted. The context can refer, for example, to the possibility of neighboring values ​​of the symbol being zero or non-zero values. Probability determination can be based on a context assigned to the symbol.

[0068] The 200 video encoder can additionally generate syntax data, such as block-based syntax data, image-based syntax data, and sequence-based syntax data, for the 300 video decoder, for example, in an image header, a block header, a slice header, or other syntax data, such as a sequence parameter set (SPS). Petition 870250090174, dated 03 / 10 / 2025, pp. 149 / 261 30 / 112 - sequence parameter set), a picture parameter set (PPS) or a video parameter set (VPS). The Video Decoder 300 can similarly decode this syntax data to determine how to decode corresponding video data.

[0069] In this way, video encoder 200 can generate a bitstream that includes encoded video data, for example, syntax elements that describe the partitioning of an image into blocks (e.g., CUs) and residual and / or prediction information for the blocks. Finally, video decoder 300 can receive the bitstream and decode the encoded video data.

[0070] In general, the 300 video decoder performs a reciprocal process with respect to that performed by the 200 video encoder to decode the encoded video data from the bitstream. For example, the 300 video decoder can decode values ​​for bitstream syntax elements using CABAC in a substantially similar, though reciprocal, manner to the 200 video encoder's CABAC encoding process. Syntax elements can define partition information for partitioning an image into CTUs, and partitioning each CTU according to a corresponding partition structure, such as a QTBT structure, to define CTU CUs. Syntax elements can additionally define residual and prediction information for blocks (e.g., CUs) of video data.

[0071] Residual information can be represented, for example, by transform coefficients Petition 870250090174, dated 03 / 10 / 2025, pp. 150 / 261 31 / 112 quantized. The Video Decoder 300 can inversely quantize and inversely transform the quantized transform coefficients of a block to reproduce a residual block for the block. The Video Decoder 300 uses a signaled prediction mode (intra- or interprediction) and related prediction information (e.g., motion information for interprediction) to form a prediction block for the block. The Video Decoder 300 can then combine the prediction block and the residual block (on a sample-by-sample basis) to reproduce the original block. The Video Decoder 300 can perform additional processing, such as performing a deblocking process to reduce visual artifacts along block boundaries.

[0072] This disclosure may generally refer to the signaling of certain information, such as syntax elements. The term signaling may generally refer to the communication of values ​​for syntax elements and / or other data used to decode encoded video data. That is, the video encoder 200 may signal values ​​for syntax elements in the bitstream. In general, signaling refers to the generation of a value in the bitstream. As mentioned above, the source device 102 may transport the bitstream to the destination device 116 substantially in real time or in non-real time, as may occur during the storage of syntax elements in the storage device 112 for later retrieval by the destination device 116.

[0073] According to the techniques of this disclosure, one method includes: determining a current model Petition 870250090174, dated 03 / 10 / 2025, pp. 151 / 261 32 / 112 of a current block of video data; determine a potential reference block in an image of the video data for the current block; determine that the potential reference block and a reference template of the potential reference block are entirely within the image, the reference template having the same shape as the current template; based on the potential reference block and the reference template both being entirely within the image, perform template matching between the reference template and the current template; and encode the current block based on the template matching.

[0074] In another example, a device includes one or more memories configured to store video data and one or more processors implemented in a circuit set and communicatively coupled to one or more memories, the one or more processors being configured to: determine a current template of a current block of video data; determine a potential reference block in an image of the video data for the current block; determine that the potential reference block and a reference template of the potential reference block are entirely within the image, the reference template having the same shape as the current template; based on the potential reference block and the reference template both being entirely within the image, perform template matching between the reference template and the current template; and encode the current block based on the template matching.

[0075] In another example, computer-readable storage media are encoded with Petition 870250090174, dated 03 / 10 / 2025, pp. 152 / 261 33 / 112 instructions that, when executed, cause one or more processors to: determine a current template of a current block of video data; determine a potential reference block in an image of the video data for the current block; determine that the potential reference block and a reference template of the potential reference block are entirely within the image, the reference template having the same shape as the current template; based on the potential reference block and the reference template both being entirely within the image, perform template matching between the reference template and the current template; and encode the current block based on the template matching.

[0076] This disclosure relates to different techniques (e.g., template type, merging, etc.) for use in template matching (TM) related tools. The disclosed techniques can be applied to any of the existing video codecs, such as High Efficiency Video Coding (HEVC), Versatile Video Coding (VVC), Essential Video Coding (EVC), Joint Exploration Model (JEM), or can be applied to an efficient coding tool in future video coding standards (e.g., Enhanced Compression Model (ECM)).

[0077] This section discusses HEVC, JEM, and VVC techniques related to the techniques disclosed. Video coding standards include ITU-T H.261, ISO / IEC MPEG-1 Visual, ITU-T H.262 or ISO / IEC MPEG-2 Visual, ITU-T Petition 870250090174, dated 03 / 10 / 2025, pp. 153 / 261 34 / 112 H.263, ISO / IEC MPEG-4 Visual and ITU-T H.264 (also known as ISO / IEC MPEG-4 AVC), including their scalable video coding (SVC) and multiview video coding (MVC) extensions.

[0078] In addition, a new video coding standard, namely High Efficiency Video Coding (HEVC) or ITU-T H.265, including its range extension, multi-view extension (MV-HEVC) and scalable extension (SHVC), was developed by the Joint Collaboration Team on Video Coding (JCT-VC) as well as by the Joint Collaboration Team on 3D Video Coding Extension Development (JCT-3V) of the ITU-T Video Coding Experts Group (VCEG) and the ISO / IEC Motion Picture Experts Group (MPEG).

[0079] The preliminary specification of the latest HEVC standard, and from this point onward referred to as HEVC WD, is available at phenix.intevry.fr / jct / doc_end_user / documents / 14_Vienna / wg11 / JCTVCN1003-v1.

[0080] The ITU-T VCEG (Q6 / 16) and ISO / IEC MPEG (JTC 1 / SC 29 / WG 11) study the potential need for standardization of future video coding technology with a compression capability that significantly exceeds that of the current HEVC standard (including its current extensions and short-term extensions for coding). Petition 870250090174, dated 03 / 10 / 2025, pages 154 / 261 35 / 112 of screen content and high dynamic range encoding). The groups work together on this exploration activity in a collaborative effort known as the Joint Video Exploration Team (JVET) to evaluate compression technology designs proposed by their experts in this area. The latest version of the reference software, namely VVC Test Model 10 (VTM 10), can be downloaded from: vcgit.hhi.fraunhofer.de / jvet / VVCSoftware_VTM. The preliminary specification for versatile video coding (VVC) can be called JVET-T2001. A description of the versatile video coding algorithm and test model 10 (VTM 10.0) can be called JVET-T2002. Alliance for Open Media (AOM) video coding formats, such as AV1 and AV2, can also be used.

[0081] Intratemplate matching prediction (intra TMP) is a special intraprediction mode that copies a prediction block (e.g., the best prediction block) from the reconstructed portion of the current frame whose L-shaped template, to the left or above, matches the current template. For a predefined search range, the video encoder (e.g., video encoder 200) searches for the template most similar to the current template in a reconstructed portion of the current frame and uses the matching block as a prediction block. The video encoder then signals the use of this mode, and the same prediction operation is performed in the video decoder (e.g., video decoder 300).

[0082] Figure 2 is a conceptual diagram illustrating template matching research areas. Petition 870250090174, dated 03 / 10 / 2025, pp. 155 / 261 Example 36 / 112. The prediction signal is generated by combining the L-shaped causal neighbor to the left or above the current block 260 with another block (e.g., reference block 262) in a predefined search area that includes a search area R1, R2, R3, or R4.

[0083] In some examples, the search areas may differ from those shown in the example in Figure 2. For example, R1 may include CTUs above, R2 may include CTUs to the left and below the current block, R3 may include CTUs to the left above the current block and a portion to the left of the current CTU, and R4 may include a portion to the right of the current CTU.

[0084] An L-shaped template includes left, above, and above-left template parts, as shown in Figure 9 and discussed below. Video encoder 200 or video decoder 300 can use a sum of absolute differences (SAD) as a cost function to determine a matching template. For example, video encoder 200 or video decoder 300 can determine that the template with the lowest SAD obtained from the current block template is the matching template.

[0085] Within each region, for example, video decoder 300 can search for the template that has the lowest SAD relative to the current template and use the corresponding block from the template as a prediction block (e.g., a reference block). For example, video decoder 300 can select a reference block from a plurality of potential reference blocks as being the potential reference block having the template with the lowest cost of Petition 870250090174, dated 03 / 10 / 2025, pp. 156 / 261 37 / 112 template match.

[0086] The dimensions of the regions (SearchRange_w, SearchRange_h) can be defined proportionally to the block dimension (BlkW, BlkH) to have a fixed number of SAD comparisons per pixel. That is: SearchRange_w = a * BlkW Equation (1) SearchRange_h = a * BlkH Equation (2) Where 'a' is a constant that controls the tradeoff between gain and complexity. In practice, 'a' is often equal to 5. In one example, the minimum value for the dimension of the regions (SearchRange_w, SearchRange_h) can be defined as: SearchRange_w = min(minSize, a * BlkW) Equation (3) SearchRange_h = min(minSize, a * BlkH) Equation (4) Where minSize is a minimum size for the search area dimension. In practice, minSize is often equal to 64.

[0087] The intratemplate matching tool can be enabled for CUs with a width and height of 64 or less. This maximum CU size for intratemplate matching can be configured.

[0088] The intra TMP mode can be signaled at a CU level via a dedicated flag when the DIMD decoder-side intra mode derivation is not used for a current CU. For example, video encoder 200 can signal the intra TMP mode to video decoder 300 via a dedicated flag.

[0089] The research region (R1 to R4 in Figure 2) can be subsampled by an integer factor. This reduces the Petition 870250090174, dated 03 / 10 / 2025, pp. 157 / 261 38 / 112 template matching search by a factor of, for example, 4. After finding the best template match, a multi-stage refinement process can be performed in which another template matching search is performed around the best match with a reduced search range restricted to the zone, from the defined areas R1, R2, R3, R4 where the best match was found in the first stage. The refined search range can be defined as min(w,h) / 2, where w,h are the width and height of the current CU. For example, video encoder 200 or video decoder 300 can perform the multi-stage refinement process.

[0090] Figure 3 is a conceptual diagram illustrating an example of template matching performed in a search area around an initial motion vector (MV). Intertemplate matching (Inter™) is a decoder-side MV derivation technique to refine the motion information of the current CU 390 by determining the closest match between a current template 392 (e.g., neighboring blocks above and / or to the left of the current CU) in a current image 396 and a block with a reference template 394 of the same size as the current template 392 in a reference image 398. As illustrated in Figure 3, a better MV can be searched around the initial motion of the current CU 390 within a search range of [-8, +8] pel. The template matching technique in Chen et al., Description of SDR, HDR and 360° video coding technology proposal by Qualcomm and Technicolor Petition 870250090174, dated 03 / 10 / 2025, pp. 158 / 261 39 / 112 - Low and high complexity versions, Joint Video Exploration Team (JVET) of ITU-T SG 16 WP 3 and ISO / IEC JTC 1 / SC 29 / WG 11, 10th meeting: San Diego, USA, April 10-20, 2018, document JVET-J0021, can be used with the following modifications: the search step size can be determined based on the adaptive motion vector resolution (AMVR) mode, and InterTM can be cascaded with a bilateral matching process in fusion modes.

[0091] Figure 4 is a tabular diagram illustrating AMVR search patterns and AMVR fusion mode. The Video Encoder 200 or Video Decoder 300 can perform AMVR using search patterns as presented in Figure 4. A ^' in a cell of Figure 4 is indicative of the particular search pattern being supported for that mode. In AMVP mode, a motion vector predictor (MVP) candidate can be determined based on the template matching error to select the MVP candidate that achieves the minimum difference between the current block template (also called in the present invention a current template) and the reference block template (also called in the present invention a reference template), and then InterTM is performed only for that particular MVP candidate for MV refinement purposes.Inter™ refines this MVP candidate, starting from the total motion vector difference (MVD) accuracy of pel (or 4 pel for 4 pel AMVR mode) within a search range of [-8, +8] pel using iterative diamond-type search. The AMVP candidate can be further refined. Petition 870250090174, dated 03 / 10 / 2025, pp. 159 / 261 40 / 112 using cross-search with full MVD precision (or 4 pel for 4 pel AMVR mode), followed sequentially by half pel and quarter pel searches, depending on the AMVR mode, as specified in Table 1, depicted in Figure 4. This search process ensures that the MVP candidate retains the same MV precision as that indicated by the AMVR mode after the TM process. In the search process, if the difference between the previous minimum cost and the current minimum cost in the iteration is less than a threshold equal to the block area, the search process is terminated.

[0092] In fusion mode, similar search techniques can be applied to the fusion candidate indicated by the fusion index. As shown in Table 1, InterTM can be performed throughout the path up to MVD accuracy of 1 / 8 pel or can ignore those beyond MVD accuracy of half pel, depending on whether the alternative interpolation filter (which is used when AMVR is in half pel mode) is used according to the fusion motion information. Furthermore, when TM mode is enabled, template matching can function as a standalone process or an extra MV refinement process between block- and sub-block-based bilateral matching (BM) methods, depending on whether BM can be enabled or not according to its enable condition check.

[0093] Candidates for merging can be adaptively reordered using template matching (TM). Reordering techniques can be applied to regular merging mode, TM merging mode, and merging mode. Petition 870250090174, dated 03 / 10 / 2025, pp. 160 / 261 41 / 112 affine (excluding the subblock-based temporal motion vector prediction (SbTMVP) candidate). For TM fusion mode, fusion candidates can be reordered before the refinement process. The 200 video encoder or the 300 video decoder can perform these reordering techniques.

[0094] The 200 video encoder or 300 video decoder can construct an initial list of fusion candidates according to a given check order, such as temporal motion vector predictors (TMVPs), non-adjacent fusion candidates, paired HMVPs, virtual or similar. Then, the candidates in the initial list can be divided into several subgroups. For template matching (TM) fusion mode and / or decoder-side motion vector refinement (DMVR) adaptive mode, each fusion candidate in the initial list can first be refined using multi-pass TM / DMVR. The fusion candidates in each subgroup can be reordered to generate a list of reordered fusion candidates, and the reordering can be done according to cost values ​​based on template matching.The index of a merge candidate selected from the list of reordered merge candidates can be signaled by video encoder 200 to video decoder 300. For simplification, merge candidates in the last, but not the first, subgroup cannot be reordered. The zero candidates resulting from the adaptive reordering of the reordering process. Petition 870250090174, dated 03 / 10 / 2025, pp. 161 / 261 42 / 112 merge candidates (ARMC - adaptive reordering of merge candidates) can be excluded during the construction of the merge motion vector candidate list. The subgroup size can be set to 5 for regular merge mode and TM merge mode. The subgroup size can be set to 3 for affine merge mode.

[0095] The template matching cost of a merge candidate during the reordering process can be measured by SAD between samples of a template from the current block and their corresponding reference samples. The template includes a set of reconstructed samples neighboring the current block. The template reference samples are located by the merge candidate's movement information. When a merge candidate uses bidirectional prediction, the merge candidate's template reference samples are also generated by biprediction, as shown in Figure 5.

[0096] Figure 5 is a conceptual diagram illustrating an example of a template and reference samples of the template in reference images. As shown in the example in Figure 5, a video encoder (e.g., video encoder 200 or video decoder 300) is performing an encoding process (e.g., encoding or decoding) a current block 500 of a current image 502. The current block 500 is associated with a list of merge candidates that includes one or more biprediction merge candidates. Each of the biprediction merge candidates includes a motion vector from List 0 and a motion vector from List 1. The motion vector from List 0 indicates a location within a reference image in Petition 870250090174, dated 03 / 10 / 2025, pp. 162 / 261 43 / 112 a first list of reference images (e.g., list 0). The motion vector of List 1 indicates a location within a reference image in a second list of reference images (e.g., list 1). In the example in Figure 5, the motion vector of List 0 of a selected merge candidate indicates a location in a reference image 504. The motion vector of List 1 of a selected merge candidate indicates a location in a reference image 506. The video encoder 200 or video decoder 300 can then use a template 508 from the current block 500 to search areas near the locations indicated in reference image 504 and reference image 506 for templates 510 (i.e., reference samples of a template in reference list 0 and reference list 1).Thus, video encoder 200 or video decoder 300 may be able to identify a reference block 512 and a reference block 514 that are potentially more similar to the current block 500 than the reference blocks at the locations indicated by the motion vector from List 0 and the motion vector from List 1.

[0097] When multi-pass DMVR is used to derive refined motion for the initial list of merge candidates, only the first pass (e.g., PU level) of the multi-pass DMVR can be applied in the reordering. When template matching is used to derive refined motion, the template size can be set to 1. In some examples, only the template above or to the left can be used during TM motion refinement when the block Petition 870250090174, dated 03 / 10 / 2025, pp. 163 / 261 44 / 112 is flat with a block width twice the height or narrow with a height twice the width. The TM can be extended to achieve MVD accuracy of 1 / 16 pel. The first four fusion candidates can be reordered with refined motion in TM fusion mode.

[0098] Figure 6 is a conceptual diagram illustrating a template and example reference samples for a block with sub-block motion using motion information from the sub-blocks of the current block. For sub-block-based merge candidates with a sub-block size equal to Wsub χ Hsub, the template above includes several 602 subtemplates (which together can constitute the reference template above) with a size of Wsub χ 1, and the template on the left includes several 604 subtemplates (which together can constitute the reference template on the left) with a size of 1 χ Hsub. As shown in Figure 6, the motion information from the sub-blocks in the first row and first column (sub-blocks A to G) of the current block 606 is used to derive the reference samples from each subtemplate.

[0099] In the reordering process, the video encoder 200 or the video decoder 300 may consider a candidate redundant if the cost difference between a candidate and its predecessor is less than (i.e., less than) a lambda value (λ), for example, |D1-D2| < λ, where D1 and D2 are the costs obtained during the first ARMC ordering and λ is the Lagrangian parameter used in the rate-distortion (RD) criterion in the video encoder 200.

[00100] For example, video encoder 200 or video decoder 300 can execute an algorithm Petition 870250090174, dated 03 / 10 / 2025, pp. 164 / 261 45 / 112 for the reordering process which can work as follows: Determine the minimum cost difference between a candidate and its predecessor among all candidates in the list. If the minimum cost difference is greater than or equal to λ, the list is considered sufficiently diverse and the reordering is stopped. If this minimum cost difference is less than λ, the candidate is considered redundant and the candidate is moved to an additional position in the list. This additional position is the first where the candidate is sufficiently diverse compared to its predecessor. The algorithm can be stopped after a finite number of iterations (if the minimum cost difference is not less than λ).

[00101] This algorithm can be applied to Regular, TM, BM, and Affine merge modes. A similar algorithm can be applied to merge mode with motion vector difference (MMVD) and signal MVD prediction methods, which also use ARMC for reordering.

[00102] The value of λ can be set equal to the λ of the rate-distortion criterion used to select the best fusion candidate in the 200 video encoder for low-delay configuration, and equal to the λ value corresponding to another quantization parameter (QP quantization parameter) for random access configuration. A set of λ values ​​corresponding to each signaled QP offset can be provided in the SPS or in the slice header for QP offsets that are not present in the SPS. Petition 870250090174, dated 03 / 10 / 2025, pp. 165 / 261 46 / 112

[00103] The ARMC design is also applicable to AMVP mode, where AMVP candidates are reordered according to TM cost. For the template-matched advanced motion vector prediction mode (TM-AMVP), an initial list of AMVP candidates can be built, followed by refinement from the TM to build a refined list of AMVP candidates. Furthermore, an MVP candidate with a TM cost greater than a threshold, which is equal to five times the cost of the first MVP candidate, can be ignored.

[00104] It should be noted that when wrap-around motion compensation is enabled, the MV candidate must be cut with a wrap-around offset adjustment value that is taken into account.

[00105] Figure 7 is a tubular diagram illustrating a template for the 1st and 2nd geometric partitions, where A represents the use of samples above, L represents the use of samples to the left, and L+A represents the use of both samples to the left and above.

[00106] The Video Encoder 200 or Video Decoder 300 can apply template matching to geometric partitioning mode (GPM geometric partitioning mode). When GPM mode is enabled for a CU, the Video Encoder 200 can signal a CU-level flag to indicate whether TM is applied to both geometric partitions. Motion information for each geometric partition can be refined using TM. When TM is chosen, a template can be constructed using left, above, or adjacent neighboring samples. Petition 870250090174, dated 03 / 10 / 2025, pp. 166 / 261 47 / 112 left and above according to the partition angle, as shown in Table 2 of Figure 7. The motion can then be refined by minimizing the difference between the current template and the template in the reference image using the same search pattern as the merge mode with the half-pel interpolation filter disabled.

[00107] A list of GPM candidates can be constructed as follows: Interleaved MV candidates from List-0 and MV candidates from List-1 are derived directly from the regular list of merge candidates, where MV candidates from List-0 have higher priority than MV candidates from List-1. A pruning method with an adaptive threshold based on the current CU size is applied to remove redundant MV candidates. Interleaved MV candidates from List-1 and MV candidates from List-0 are additionally derived directly from the regular list of merge candidates, where MV candidates from List-1 have higher priority than MV candidates from List-0. The same pruning method with the adaptive threshold is also applied to remove redundant MV candidates. Zero MV candidates are populated until the GPM candidate list is complete.

[00108] The geometric partitioning mode motion vector difference fusion mode (GPM-MMVD) and the geometric partitioning mode - template matching (GPM-TM) can be enabled exclusively for a GPM mode CU. This can be done by first signaling the GPM-MMVD syntax. For example, video encoder 200 can signal the GPM-MMVD syntax. When both GPM-MMVD control flags are set to false (by Petition 870250090174, dated 03 / 10 / 2025, pp. 167 / 261 48 / 112 example, GPM-MMVD is disabled for two GPM partitions), the GPM-TM flag can be set to indicate whether template matching is applied to both GPM partitions. For example, video encoder 200 can set the GPM-TM flag. Otherwise (at least one GPM-MMVD flag is set to true), the value of the GPM-TM flag can be inferred to be false. For example, if the GPM-TM flag is not set, video decoder 300 can infer that the GPM-TM flag has a false value.

[00109] The Video Encoder 200 or Video Decoder 300 can use model matching in intrablock copy (IBC) for both intrablock merge mode (IBC) and IBC AMVP mode. The IBC-TM merge list can be modified compared to that used by the regular IBC merge mode, so that candidates are selected according to a pruning technique with a motion distance between candidates as in the regular TM merge mode. The final zero motion padding can be replaced by left (W, 0), top (0, -H) and top left (-W, -H) motion vectors, where W is the width and H the height of the current CU.

[00110] In intrablock copy - model matching merge mode (IBC-TM), selected candidates can be refined using model matching techniques before the rate-distortion optimization (RDO) or decoding process. For example, video encoder 200 or video decoder 300 can refine the selected candidates. The IBC-TM merge mode can be put into competition with the regular IBC merge mode and a flag of Petition 870250090174, dated 03 / 10 / 2025, pp. 168 / 261 49 / 112 TM merger may be signaled.

[00111] In IBC-TM AMVP mode, up to 3 candidates can be selected from the IBC-TM merge list. Each of these 3 selected candidates can be refined using the template matching technique and ranked according to its resulting template matching cost. Only the first 2 can then be considered in the motion estimation process as usual.

[00112] Figures 8A to 8D are conceptual diagrams illustrating example IBC reference regions depending on the current position of a coding unit (CU). In Figures 8A to 8D, the shaded blocks are causal with respect to a current block 800A, 800B, 800C, or 800D (collectively, current blocks 800). In other words, the shaded blocks are encoded or decoded before the current blocks 800. The blocks marked with an X are reference regions that can be used with respect to the current blocks 800 for IBC-TM. Refining the template matching for both IBC-TM and AMVP fusion modes is quite straightforward, since the IBC motion vectors are restricted (i) to being integers and (ii) within a reference region, as shown in Figures 8A to 8D.Thus, in IBC-TM fusion mode, all refinements are performed with integer precision, and in IBC-TM AMVP mode, they are performed with integer precision or 4 pel precision, depending on the AMVR value. Such refinement accesses only samples without interpolation. In both cases, the refined motion vectors and the template used in each refinement step can (and in) Petition 870250090174, dated 03 / 10 / 2025, pp. 169 / 261 50 / 112 some examples, need) to respect the restriction of the reference region.

[00113] To improve the encoding efficiency of template matching and / or the quality of encoded video data, instead of using only one template matching standard and process, template matching according to the techniques of this disclosure may include the use of different template types, storing more candidates and / or applying merging to combine these different candidates that are found by the different template matching techniques.

[00114] Current search algorithms may have excessive limitations for the search area near an image boundary and for the reconstructed area boundary, which may limit potential reference blocks and thus potential MV candidates for some video content. The techniques in this disclosure expand the potential choices when dealing with questions with search areas near image boundaries and reconstructed area boundaries.

[00115] For example, a current search algorithm might test an above-left part, then test a left part, then test an above part, to determine the availability of each of these parts. If the current search algorithm finds that the above-left part is unavailable, for example because the above-left part might cross an image boundary or a reconstructed area boundary, the algorithm might terminate that search and thus discard a block of Petition 870250090174, dated 03 / 10 / 2025, pp. 170 / 261 51 / 112 potential reference or you can go ahead and check the above part without checking the left part. However, there are cases where an above-left part may be unavailable, while a left part may be available or an above part may be available. The techniques in this disclosure include considering blocks having such models as potential reference blocks. While such techniques may be computationally more expensive, since more potential reference blocks may need to be checked, these techniques can lead to a better reference block for predicting the movement of a current block and thus increase coding quality and / or coding efficiency in the end.

[00116] For simplicity, the TM discussed from this point onward may refer to intratemplate matching, intertemplate matching, adaptive reordering of merge candidates with template matching (ARMC-TM), and / or IBC template matching. The techniques disclosed may be used alone or in any combination.

[00117] Figure 9 is a conceptual diagram illustrating parts of an example template. For example, a current block 900 may have a template that includes an above part 904, an above-left part 902, and / or a left part 906. The above part 904 may be a template or portion thereof that is directly above the current block 900. The left part 906 may be a template or portion thereof that is directly to the left of the current block 900. The current block 900 may have a height of H and a width of W. The above part 904 may have a height of T and the left part 906 may have a height of T. Petition 870250090174, dated 03 / 10 / 2025, pp. 171 / 261 52 / 112 left 906 can have a width of T. The top-left part can be directly to the left of the top part 904 and directly above the left part 906 and have a height of T and a width of T. In this way, it can be said that the top-left part 902 is above and to the left of the current block 900.

[00118] In some examples, the availability of template parts is determined based on the availability of neighboring blocks. For example, video encoder 200 or video decoder 300 can determine which template parts (top part, left part, and / or top-left part) are available based on the availability of neighboring blocks.

[00119] For example, a left template part (e.g., left part 906) is used when all CUs adjacent to the left of the current block are available. For example, video encoder 200 or video decoder 300 can use left part 906 when all CUs adjacent to the left of the current block 900 are available. In one example, at least one block adjacent to the top image edge, but not adjacent to the left image edge, has the left template part. In such an example, video encoder 200 or video decoder 300 can use left part 906. In an existing design example, the left template part for that block is treated as unavailable.

[00120] For example, a template part above (e.g., part above 904) is used when all adjacent CUs above the current block are available. For example, video encoder 200 or decoder of Petition 870250090174, dated 03 / 10 / 2025, pp. 172 / 261 53 / 112 video 300 can use the above 904 part when all adjacent CUs above the current 900 block are available. In one example, at least one block adjacent to the left image edge, but not adjacent to the top image edge, has the above model part. In such an example, video encoder 200 or video decoder 300 can use the above 904 part.

[00121] For example, an above-left template part (e.g., above-left part 902) is used when the neighboring CU above the current block is available. For example, video encoder 200 or video decoder 300 might use above-left part 902 when the CU above the current block 900 is available.

[00122] Similarly, templates can be extended to include above-right and / or below-left portions when such portions are available. For example, video encoder 200 or video decoder 300 can extend a template to include an above-right portion and / or a below-left portion. An above-right portion would include samples to the right of the above portion 904. A below-left portion would include samples from the below-left portion 906. For example, the left portion 906 can be extended downwards (e.g., towards the bottom of an image) if the below-left CUs of the current block 900 are available. This left portion can be called an extended left portion. In one example, at least one block not adjacent to the image boundaries has a template that includes an extended left portion.

[00123] For example, the part above 904 can be Petition 870250090174, dated 03 / 10 / 2025, pp. 173 / 261 54 / 112 extended to the right if the CUs above-to-the-right of the current 900 block are available. This above portion can be called an extended above portion. In one example, at least one block not adjacent to the image boundaries has a template that includes an extended above portion.

[00124] When no template part is available, the TM may not be applied.

[00125] The area of ​​reference block search for TM is now discussed. To handle image boundary handling, in one example, in the template matching search process, the reference block may be (e.g., must be) located within the predefined search range within the image. For example, using a reference block outside or partially outside the predefined search range within the image may be penalized or prohibited. Furthermore, a restriction may be imposed that the reference block, or the reference block that includes its templates, may be (e.g., must be or needs to be) completely located within the image. For example, video encoder 200 or video decoder 300 may perform template matching with the reference block located within the predefined search range within the image.In some examples, the 200 video encoder or the 300 video decoder can perform template matching with potential reference blocks if the potential reference block and the template of the potential reference block are both entirely located within the image (i.e., they do not cross an image boundary).

[00126] Figures 10A to 10C are diagrams Petition 870250090174, dated 03 / 10 / 2025, pp. 174 / 261 55 / 112 conceptual examples illustrating image boundary treatment that depends on the template type. In Figure 10A, the current block 1000 has an L-shaped template 1010 that includes the top, left, and top-left parts. Similarly, the reference blocks 1002 and 1004 have L-shaped templates 1012 and 1014, respectively. In Figure 10B, the current block 1020 has an above-shaped template 1030 that includes an above part. Similarly, the reference blocks 1022 and 1024 have above-shaped templates 1032 and 1034, respectively. In Figure 10C, the current block 1040 has a left-shaped template 1050 that includes a left part. Similarly, reference blocks 1042 and 1044 have left-shaped templates 1052 and 1054, respectively.

[00127] In one example, when the template shape includes left, top-left, and top-up template parts (for example, as in Figure 10A), or at least two of these parts, the top-left sample of the reference block may (for example, must) have an offset of at least T vertically and horizontally from the image boundary (which may, in some examples, be called an image border), where T represents the size of the template. For example, in Figure 10A, reference block 1002 has a vertical offset of T from the top image border 1016 and a horizontal offset greater than T from the left image border 1018. Reference block 1004 has a vertical offset greater than T from the top image border 1016 and a horizontal offset of T from the left image border 1018. Both reference block 1002 Petition 870250090174, dated 03 / 10 / 2025, pp. 175 / 261 56 / 112 as well as the reference block 1004 would be available as potential reference blocks for the current block 1000.

[00128] In one example, when the template shape includes only the top template portion (as in Figure 10B), the top left sample of the reference block may (e.g., must) have an offset of at least T only vertically from the image boundary (e.g., top image boundary 1036). In one example, at least one searched reference block is adjacent to the left image boundary (e.g., left image boundary 1038) but not adjacent to the top image boundary (e.g., top image boundary 1036), whereas in an existing design example this reference block is excluded from the search area. For example, in Figure 10B, both reference block 1022 and reference block 1024 have a vertical offset of at least T from top image boundary 1036.In this way, both the 1022 reference block and the 1024 reference block would be available as potential reference blocks for the current 1020 block.

[00129] In one example, when the template shape includes only a left-hand template portion (as shown in Figure 10C), the upper-left sample of the reference block may (e.g., must) have an offset of at least T horizontally from the image boundary (e.g., left image boundary 1058). In one example, at least one searched reference block (e.g., reference block 1042) is adjacent to the upper image boundary (by Petition 870250090174, dated 03 / 10 / 2025, pp. 176 / 261 57 / 112 example, top image boundary 1056), but not adjacent to the left image boundary (e.g., left image boundary 1058), whereas in an existing design example this reference block is excluded from the search area. For example, in Figure 10C, both reference block 1042 and reference block 1044 have a horizontal offset of at least T from left image boundary 1058. Thus, both reference block 1042 and reference block 1044 would be available as potential reference blocks for the current block 1040.

[00130] Figure 11 is a conceptual diagram illustrating an alternative image border handling example for an example of an L-shaped template. In the example in Figure 11, the current block 1100 has an L-shaped template 1110 that includes an above part, a left part, and an above-left part. The reference block 1102 has an L-shaped template 1112. The L-shaped template 1112 may include unavailable samples of the left part 1104 that are on the other side of a left image border (e.g., left image border 1118).

[00131] In another example, only the reference block without its template can (i.e., must) be located within the image. In other words, if the template (or portions thereof) of the reference block is located outside the image, the 200 video encoder or the 300 video decoder can still use that reference block. In that case, the 200 video encoder or the 300 video decoder can derive the template portions. Petition 870250090174, dated 03 / 10 / 2025, pp. 177 / 261 58 / 112 unavailable filling the left portion 1104 using available samples, as shown in Figure 11. In one example, the reference block with an L-shaped template may be adjacent to the left image border or the top image border, while an existing design example excludes this block from the search area.

[00132] The treatment of reconstructed area boundaries will be discussed below. In an existing design example, reference blocks with samples in the current CTU below or to the right of the bottom-right sample (which may also be called below-right) of the current block are excluded from the search area.

[00133] The 200 video encoder or the 300 video decoder can determine a search region. For example, the search region can be determined from the block decoding order; if a neighboring area is already decoded, then such an area can be used for the search. In one example, all blocks wholly or partially located within the current CTU and belonging entirely to the reconstructed area are included in the search area. In one example, in the disclosed technique, the lower-left reconstructed area (which can also be called below-left) relative to the current block and the upper-right reconstructed area relative to the current block can be included in the search area (for example, if these areas are already reconstructed based on the encoding order), while such areas are excluded from the search in an example of the current intratemplate matching design.

[00134] The refinement of the search will now be Petition 870250090174, dated 03 / 10 / 2025, pp. 178 / 261 59 / 112 discussed. In an existing design example, the TM search is a multi-stage process: in the first stage, the search is conducted in a composite area that includes regions R1, R2, R3, R4, as shown in Figure 2. The vertical and horizontal offsets of the reference block are constrained by absolute value to predefined thresholds. A subsampling search is applied in the first stage by choosing a search step size greater than 1, and the best block vector (BV) minimizing the search cost is identified. In the subsequent stage, the search area is restricted to the best region of the set R1, R2, R3, R4 to which the best BV obtained in the subsampled search is pointing. In the next stage, refined search with a sample step size of 1 is performed around the best BV in a predefined neighborhood.However, the neighborhood is restricted to being located in the best region, therefore, when the neighborhood crosses a region boundary (for example, between R2 and R3), the positions of the neighborhood located in the other region are not checked, which is suboptimal, especially for cases where the best BV points to samples near the region boundary.

[00135] In one example, the refinement stage search area is not restricted to being performed within only one of the regions R1, R2, R3, R4, but instead, it can be performed using a combination of regions R1, R2, R3, R4. For example, video encoder 200 or video decoder 300 can perform a template matching refinement search in a plurality of regions. In one example, the restriction on Petition 870250090174, dated 03 / 10 / 2025, pp. 179 / 261 60 / 112 The neighborhood being within only one of the regions is removed.

[00136] In one example, the best match ultimately determined has the lowest template cost in a predefined region being a rectangle [x-dx1, x+dx2]*[y-dy1, y+dy2] where the samples (x-dx1,y) and (x+dx2,y) can belong to different search regions, whereas in an existing design example, these samples must be from the single search range. In one example, video encoder 200 or video decoder 300 can determine a list of matches ordered by template match cost based on samples in a plurality of search regions.

[00137] Unavailable reference block samples and TM filler will be discussed below. The Video Encoder 200 or Video Decoder 300 can utilize the TM filler techniques described in the present invention.

[00138] Figure 12 is a conceptual diagram illustrating the example filling of unavailable samples by copying values ​​from available samples. In one example, reference block samples that are unavailable due to a current block location of 1200 (for example, in one instance, the reference block overlaps the current block) are derived recursively by copying samples from the positions in the reference block corresponding to their positions in the current block, as shown in Figure 12, where each sample is represented by a number and a sample with the same number in the unreconstructed area with the block's hatch patterns. Petition 870250090174, dated 03 / 10 / 2025, pp. 180 / 261 The current 61 / 112 is copied from the already reconstructed sample (represented with diagonal patterns) with the same sample number. For example, video encoder 200 or video decoder 300 can perform such padding.

[00139] Given the block vector (BVx, BVy) and the current position (x, y) in the reference block, the unavailable value is copied from the position (x-BVx, y-BVy). If the referenced position is located in the current block 1200, the unavailable value is derived in the same way: (x-2*BVx, y-2*BVy) etc.

[00140] In another example, other filling techniques can be applied, for example copying the nearest available samples, or any other filling technique can be used. In another example, unavailable samples of a reference block located outside the image boundaries can be derived using any image boundary filling technique.

[00141] Figure 13 is a flowchart illustrating example template matching techniques according to one or more aspects of this disclosure. Video encoder 200 or video decoder 300 can determine a current template of a current block in an image of the video data (1300). For example, video encoder 200 or video decoder 300 can generate a current template for the current block based on the availability of adjacent blocks.

[00142] Video encoder 200 or video decoder 300 can determine a potential reference block in the image for the current block (1302). Petition 870250090174, dated 03 / 10 / 2025, pp. 181 / 261 62 / 112 For example, video encoder 200 or video decoder 300 can determine which blocks are available within a search range to determine one or more potential reference blocks.

[00143] Video encoder 200 or video decoder 300 can determine that the potential reference block and a reference template for the potential reference block are entirely within the image, the reference template having the same shape as the current template (1304). For example, video encoder 200 or video decoder 300 can determine a reference template for the reference block that matches the shape of the current template. Video encoder 200 or video decoder 300 can determine that the potential reference block and the reference template for the potential reference block are entirely within the image. A potential reference block can be entirely within the image if all samples of a type (e.g., all luma samples) of the potential reference block are within the image.A reference model can be entirely within the image if all type samples (e.g., all luma samples) of the reference model are within the image. For example, video encoder 200 or video decoder 300 can determine that neither the potential reference block nor the reference model crosses any image boundary.

[00144] Based on the potential reference block and the reference template both being entirely within the image, the 200 video encoder or the 300 video decoder can perform the matching. Petition 870250090174, dated 03 / 10 / 2025, pp. 182 / 261 63 / 112 template between the reference template and the current template (1306). For example, video encoder 200 or video decoder 300 can perform template matching by calculating a template matching cost associated with the reference template.

[00145] Video encoder 200 or video decoder 300 can encode the current block based on template matching (1308). For example, video encoder 200 or video decoder 300 can encode the current block using a potential reference block with the lowest template matching cost as the reference block for the current block when encoding or decoding the current block. In another example, video encoder 200 or video decoder 300 can construct a list of potential reference blocks ordered using template matching cost, and the index of the reference block used to encode the current block in the list can be flagged. In another example, video encoder 200 or video decoder 300 can use a plurality of reference blocks from the list when encoding or decoding the current block.

[00146] In some examples, the potential reference block is a first potential reference block and the reference template is a first reference template. In some examples, video encoder 200 or video decoder 300 may determine that at least one of a second potential reference block or a second reference template of the second potential reference block is not entirely within the image. In some examples, video encoder 200 or the Petition 870250090174, dated 03 / 10 / 2025, pp. 183 / 261 64 / 112 video decoder 300 may, based on at least one of the second potential reference block or a second reference template not being entirely within the image, fail to perform template matching between the second reference template and an actual template of a current block of video data. In some instances, video encoder 200 or video decoder 300 may encode the current block using a different reference block than the second potential reference block. For example, based on either one, or both, of the second potential reference block or the second reference template crossing one or more image boundaries, video encoder 200 or video decoder 300 may exclude the second potential reference block from being the reference block for the current block.

[00147] In some examples, the reference template includes at least two of a left portion, an above-left portion, or an above portion. In some examples, an upper-left sample of the potential reference block is offset vertically by a width of at least one of the above-left portions or the above portion from a top image boundary, and offset horizontally by a width of at least one of the left portions or the above-left portion from a left image boundary.

[00148] In some examples, the reference model includes only a portion on the left. In some examples, an upper-left sample of the potential reference block is shifted in a horizontal direction. Petition 870250090174, dated 03 / 10 / 2025, pp. 184 / 261 65 / 112 in a width of the left portion from a left image border. In some examples, the potential reference block is adjacent to a top image border, but not adjacent to the left image border.

[00149] In some examples, the reference model includes only a portion above. In some examples, a top-left sample of the potential reference block is offset in a vertical direction by a width of the portion above from a top image boundary. In some examples, the potential reference block is adjacent to a left image boundary but not adjacent to a top image boundary.

[00150] In some instances, the potential reference block is one of a plurality of potential reference blocks. In some instances, the 200 video encoder or the 300 video decoder may determine an image search region for the plurality of potential reference blocks to include all blocks wholly or partially located within a current coding tree unit (CTU) of the video data that are fully reconstructed. In some instances, the 200 video encoder or the 300 video decoder may determine that the potential reference block is within the search region.

[00151] In some examples, the search region includes a search region from a plurality of search regions. In some examples, video encoder 200 or video decoder 300 may perform a refinement template match search on the template match search results. In some Petition 870250090174, dated 03 / 10 / 2025, pages 185 / 261 66 / 112 examples, the template matching refinement search includes searching across multiple search regions.

[00152] In some instances, the current template includes at least one part. In some instances, as part of determining the current template, video encoder 200 or video decoder 300 may determine at least one part based on the availability of blocks adjacent to the current block.

[00153] In some examples, at least one part includes a part to the left. In some examples, as part of determining at least one part, video encoder 200 or video decoder 300 may determine that all blocks adjacent to the left of the current block are available. In some examples, the current block includes a block adjacent to a top picture edge, but not adjacent to a left picture edge.

[00154] In some examples, at least one part includes a part above. In some examples, as part of determining at least one part, video encoder 200 or video decoder 300 may determine that all adjacent blocks above the current block are available. In some examples, the current block includes a block not adjacent to a top picture border, but adjacent to a left picture border.

[00155] In some examples, at least one part includes an above-left part. In some examples, as part of determining at least one part, video encoder 200 or video decoder 300 may determine that a block neighboring the left and above the Petition 870250090174, dated 03 / 10 / 2025, pp. 186 / 261 The current block 67 / 112 is available.

[00156] In some instances, the 200 video encoder or the 300 video decoder can determine which blocks neighboring the left and below the current block are available. In some instances, based on which blocks neighboring the left and below the current block are available, the 200 video encoder or the 300 video decoder can extend a left portion downwards so that a bottom of the left portion is lower in a vertical direction than a bottom of the current block.

[00157] In some instances, the 200 video encoder or the 300 video decoder may determine which neighboring blocks above and to the right of the current block are available. In some instances, based on which neighboring blocks above and to the right of the current block are available, the 200 video encoder or the 300 video decoder may extend a portion above to the right, so that a right edge of the portion above is further to the right in a horizontal direction than a right edge of the current block.

[00158] In some examples, encoding includes decoding. In some examples, encoding includes encoding.

[00159] Figure 14 is a block diagram illustrating an example 200 video encoder that can perform the techniques of this disclosure. Figure 14 is provided for explanatory purposes and should not be considered limiting of the techniques as extensively exemplified and described in this disclosure. For explanatory purposes, this disclosure describes the encoder of Petition 870250090174, dated 03 / 10 / 2025, pp. 187 / 261 68 / 112 video 200 according to VVC and HEVC techniques. However, the techniques of this disclosure can be performed by video encoding devices that are configured for other video encoding standards and video encoding formats, such as AV1 and successors to the AV1 video encoding format.

[00160] In the example in Figure 14, the video encoder 200 includes video data memory 230, mode selection unit 202, residual generation unit 204, transform processing unit 206, quantization unit 208, inverse quantization unit 210, inverse transform processing unit 212, reconstruction unit 214, filter unit 216, decoded picture buffer (DPB) 218, and entropy encoding unit 220. Any or all of the following are included: video data memory 230, mode selection unit 202, residual generation unit 204, transform processing unit 206, quantization unit 208, inverse quantization unit 210, inverse transform processing unit 212, reconstruction unit 214, and entropy encoding unit 220. Filter 216, DPB 218, and entropic encoding unit 220 can be implemented in one or more processors or in a set of processing circuits.For example, the video encoder 200 units can be implemented as one or more circuits or logic elements as part of the hardware circuitry or as part of a processor, ASIC, or FPGA. Furthermore, the video encoder 200 can include additional or alternative processing circuits or sets to perform these and other functions. Petition 870250090174, dated 03 / 10 / 2025, pp. 188 / 261 69 / 112

[00161] Video data memory 230 can store video data to be encoded by the components of video encoder 200. Video encoder 200 can receive video data stored in video data memory 230 from, for example, video source 104 (Figure 1). DPB 218 can act as a reference image memory that stores reference video data for use in predicting subsequent video data by video encoder 200. Video data memory 230 and DPB 218 can be formed by any of several memory devices, such as dynamic random access memory (DRAM), including synchronous DRAM (SDRAM), magnetoresistive random access memory (MRAM), resistive RAM (RRAM), or other types of memory devices.The video data memory 230 and the DPB 218 may be provided by the same memory device or by separate memory devices. In several examples, the video data memory 230 may be inside the chip with other video encoder components 200, as illustrated, or outside the chip relative to the components.

[00162] In this disclosure, the reference to video data memory 230 should not be interpreted as being limited to the internal memory of video encoder 200, unless specifically described as such, or to the external memory of video encoder 200, unless specifically described as such. Instead, the reference to video data memory 230 should be understood as a reference memory that stores video data. Petition 870250090174, dated 03 / 10 / 2025, pp. 189 / 261 70 / 112 that the video encoder 200 receives to encode (for example, video data for a current block that needs to be encoded). Memory 106 in Figure 1 can also provide temporary storage of outputs from the various units of the video encoder 200.

[00163] The various units in Figure 14 are illustrated to aid in understanding the operations performed by the 200 video encoder. The units can be implemented as fixed-function circuits, programmable circuits, or a combination thereof. Fixed-function circuits refer to circuits that provide particular functionality and are predefined in the operations that can be performed. Programmable circuits refer to circuits that can be programmed to perform various tasks and to provide flexible functionality in the operations that can be performed. For example, programmable circuits can execute software or firmware that causes the programmable circuits to operate in the manner defined by the software or firmware instructions.Fixed-function circuits can execute software instructions (for example, to receive parameters or to emit parameters), but the types of operations that fixed-function circuits perform are generally immutable. In some examples, one or more of the units may be distinct circuit blocks (fixed-function or programmable), and in some examples, one or more of the units may be integrated circuits.

[00164] The 200 video encoder may include arithmetic logic units (ALUs), elementary function units (EFUs), digital circuits, analog circuits. Petition 870250090174, dated 03 / 10 / 2025, pp. 190 / 261 71 / 112 and / or programmable cores, formed from programmable circuits. In examples where the operations of the video encoder 200 are performed using software executed by the programmable circuits, memory 106 (Figure 1) can store the instructions (e.g., object code) of the software that the video encoder 200 receives and executes, or another memory in the video encoder 200 (not shown) can store these instructions.

[00165] Video data memory 230 is configured to store received video data. Video encoder 200 can retrieve an image from the video data in video data memory 230 and provide the video data to the residual generation unit 204 and the mode selection unit 202. The video data in video data memory 230 can be raw video data that needs to be encoded.

[00166] The mode selection unit 202 includes a motion estimation unit 222, a motion compensation unit 224, and an intraprediction unit 226. The mode selection unit 202 may include additional functional units to perform video prediction according to other prediction modes. As examples, the mode selection unit 202 may include a palette unit, an intrablock copy unit (which may be part of the motion estimation unit 222 and / or the motion compensation unit 224), an affine unit, a linear model (LM) unit, or similar units.

[00167] The mode selection unit 202 generally coordinates multiple encoding passes to test combinations of encoding parameters and Petition 870250090174, dated 03 / 10 / 2025, pp. 191 / 261 72 / 112 resulting rate-distortion values ​​for these combinations. The coding parameters may include partitioning of CTUs into CUs, prediction modes for the CUs, transform types for residual data of the CUs, quantization parameters for residual data of the CUs, etc. The mode selection unit 202 may ultimately select the combination of coding parameters with rate-distortion values ​​that are better than the other combinations tested.

[00168] The video encoder 200 can partition an image retrieved from the video data memory 230 into a series of CTUs and encapsulate one or more CTUs in a slice. The mode selection unit 202 can partition a CTU of the image according to a tree structure, such as the MTT structure, the QTBT structure, the superblock structure, or the quadtree structure described above. As described above, the video encoder 200 can form one or more CUs from the partitioning of a CTU according to the tree structure. This CU can also be generally called a video block or a block.

[00169] In general, the mode selection unit 202 also controls its components (e.g., motion estimation unit 222, motion compensation unit 224, and intraprediction unit 226) to generate a prediction block for a current block (e.g., a current CU or, in HEVC, the overlapping portion of a PU and a TU). For the interprediction of a current block, the motion estimation unit 222 can perform a motion search to identify one or more blocks of Petition 870250090174, dated 03 / 10 / 2025, pp. 192 / 261 73 / 112 closely matching references in one or more reference images (e.g., one or more previously encoded images stored in DPB 218). In particular, motion estimation unit 222 can calculate a representative value of how similar a potential reference block is to the current block, for example, according to the sum of absolute differences (SAD), the sum of squared differences (SSD), the mean absolute difference (MAD), the mean squared differences (MSD), or the like. Motion estimation unit 222 can generally perform these calculations using sample-by-sample differences between the current block and the reference block being considered. Motion estimation unit 222 can identify a reference block that has the lowest resulting value from these calculations, indicating a reference block that most closely matches the current block.

[00170] The motion estimation unit 222 can form one or more motion vectors (MVs) that define the positions of the reference blocks in the reference images relative to the position of the current block in a current image. The motion estimation unit 222 can then provide the motion vectors to the motion compensation unit 224. For example, for one-way interprediction, the motion estimation unit 222 can provide a single motion vector, while for two-way interprediction, the motion estimation unit 222 can provide two motion vectors. The motion compensation unit 224 can then generate a prediction block using the motion vectors. For example, the motion compensation unit Petition 870250090174, dated 03 / 10 / 2025, pp. 193 / 261 74 / 112 The 224 can retrieve data from the reference block using the motion vector. As another example, if the motion vector has fractional sample precision, the 224 motion compensation unit can interpolate values ​​for the prediction block according to one or more interpolation filters. Furthermore, for bidirectional interprediction, the 224 motion compensation unit can retrieve data for two reference blocks identified by their respective motion vectors and can combine the retrieved data, for example, by calculating sample-by-sample averaging or weighted averaging.

[00171] When operating in accordance with the AV1 video encoding format, the motion estimation unit 222 and the motion compensation unit 224 can be configured to encode video data encoding blocks (e.g., both luma and chroma encoding blocks) using translational motion compensation, affine motion compensation, overlapped block motion compensation (OBMC), and / or composite inter / intraprediction.

[00172] As another example, for intraprediction or intraprediction coding, the 226 intraprediction unit can generate the prediction block from samples neighboring the current block. For example, for directional modes, the 226 intraprediction unit can generally mathematically combine the values ​​of neighboring samples and fill in these calculated values ​​in the direction defined in the current block to produce the prediction block. As another example, for DC mode, the 226 intraprediction unit can calculate an average of the samples. Petition 870250090174, dated 03 / 10 / 2025, pp. 194 / 261 75 / 112 neighbors for the current block and generate the prediction block to include this resulting average for each sample in the prediction block.

[00173] When operating according to the AV1 video encoding format, the intraprediction unit 226 can be configured to encode video data encoding blocks (e.g., both luma and chroma encoding blocks) using directional intraprediction, non-directional intraprediction, recursive filter intraprediction, chroma-from-luma (CFL) prediction, intra-block copy (IBC), and / or color palette mode. The mode selection unit 202 can include additional functional units to perform video prediction according to other prediction modes. The mode selection unit 202 (e.g., motion estimation unit 222, motion compensation unit 224, and / or intraprediction unit 226) can perform the template matching techniques of Figure 13.

[00174] Mode selection unit 202 provides the prediction block to residual generation unit 204. Residual generation unit 204 receives a raw, unencoded version of the current block from video data memory 230 and the prediction block from mode selection unit 202. Residual generation unit 204 calculates sample-by-sample differences between the current block and the prediction block. The resulting sample-by-sample differences define a residual block for the current block. In some examples, residual generation unit 204 may also determine differences between sample values ​​in Petition 870250090174, dated 03 / 10 / 2025, pp. 195 / 261 76 / 112 residual block to generate a residual block using residual differential pulse code modulation (RDPCM). In some examples, the residual generation unit 204 can be formed using one or more subtractor circuits that perform binary subtraction.

[00175] In examples where the mode selection unit 202 partitions CUs into PUs, each PU can be associated with a luma prediction unit and corresponding chroma prediction units. The video encoder 200 and video decoder 300 can support PUs that have various sizes. As indicated above, the size of a CU can refer to the luma encoding block size of the CU, and the size of a PU can refer to the size of a luma prediction unit of the PU. Assuming that the size of a particular CU is 2Nx2N, the video encoder 200 can support PU sizes of 2Nx2N or NxN for intraprediction and symmetrical PU sizes of 2Nx2N, 2NxN, Nx2N, NxN, or similar, for interprediction. The 200 video encoder and 300 video decoder can also support asymmetric partitioning for PU sizes of 2NxnU, 2NxnD, nLx2N, and nRx2N for interprediction.

[00176] In instances where the 202 mode selection unit does not further partition a CU into PUs, each CU can be associated with a luma encoding block and corresponding chroma encoding blocks. As above, the size of a CU can refer to the size of the CU's luma encoding block. The 200 video encoder and the 300 video decoder can support CU sizes of 2Nx2N, 2NxN, or Nx2N. Petition 870250090174, dated 03 / 10 / 2025, pp. 196 / 261 77 / 112

[00177] For other video coding techniques, such as intrablock copy mode coding, affine mode coding, and linear model (LM) mode coding, as some examples, the mode selection unit 202, via the respective units associated with the coding techniques, generates a prediction block for the current block being coded. In some examples, such as palette mode coding, the mode selection unit 202 may not generate a prediction block and instead generates syntax elements that indicate the manner in which to reconstruct the block based on a selected palette. In these modes, the mode selection unit 202 may provide these syntax elements to the entropic coding unit 220 to be coded.

[00178] As described above, residual generation unit 204 receives the video data for the current block and the corresponding prediction block. Residual generation unit 204 then generates a residual block for the current block. To generate the residual block, residual generation unit 204 calculates the sample-by-sample differences between the prediction block and the current block.

[00179] The transform processing unit 206 applies one or more transforms to the residual block to generate a transform coefficient block (referred to in the present invention as a transform coefficient block). The transform processing unit 206 can apply multiple transforms to a residual block to form the transform coefficient block. For example, the transform processing unit 206 can apply a discrete cosine transform (DCT), a Petition 870250090174, dated 03 / 10 / 2025, pp. 197 / 261 78 / 112 directional transform, a Karhunen-Loeve transform (KLT), or a transform conceptually similar to a residual block. In some examples, the 206 transform processing unit can perform multiple transforms on a residual block, for example, a primary transform and a secondary transform, such as a rotational transform. In some examples, the 206 transform processing unit does not apply transforms to a residual block.

[00180] When operating in accordance with AV1, the transform processing unit 206 can apply one or more transforms to the residual block to generate a transform coefficient block (referred to in the present invention as a transform coefficient block). The transform processing unit 206 can apply multiple transforms to a residual block to form the transform coefficient block. For example, the transform processing unit 206 can apply a horizontal / vertical transform combination that may include a discrete cosine transform (DCT), an asymmetric discrete sine transform (ADST), an inverted ADST (e.g., an ADST in reverse order), and an identity transform (IDTX). When an identity transform is used, the transform is ignored in either the vertical or horizontal direction.In some examples, transform processing can be skipped.

[00181] The quantization unit 208 can quantize the transform coefficients into a transform coefficient block to produce a block of Petition 870250090174, dated 03 / 10 / 2025, pp. 198 / 261 79 / 112 quantized transform coefficients. The quantization unit 208 can quantize the transform coefficients of a transform coefficient block according to a quantization parameter (QP) value associated with the current block. The video encoder 200 (e.g., via the mode selection unit 202) can adjust the degree of quantization applied to the transform coefficient blocks associated with the current block by adjusting the QP value associated with the CU. Quantization can introduce loss of information, and therefore the quantized transform coefficients may have lower precision than the original transform coefficients produced by the transform processing unit 206.

[00182] The inverse quantization unit 210 and the inverse transform processing unit 212 can apply inverse quantization and inverse transforms to a block of quantized transform coefficients, respectively, to reconstruct a residual block from the block of transform coefficients. The reconstruction unit 214 can produce a reconstructed block corresponding to the current block (although potentially with some degree of distortion) based on the reconstructed residual block and a prediction block generated by the mode selection unit 202. For example, the reconstruction unit 214 can add samples from the reconstructed residual block to the corresponding samples from the prediction block generated by the mode selection unit 202 to produce the reconstructed block.

[00183] The 216 filter unit can perform one or more filter operations on rebuilt blocks. By Petition 870250090174, dated 03 / 10 / 2025, pp. 199 / 261 For example, filter unit 216 can perform unblocking operations to reduce blocking artifacts along the edges of the CUs. The filter unit 216 operations can be ignored in some instances.

[00184] When operating in accordance with AV1, filter unit 216 can perform one or more filter operations on reconstructed blocks. For example, filter unit 216 can perform unblocking operations to reduce blocking artifacts along the edges of the CUs. In other examples, filter unit 216 can apply a constrained directional enhancement filter (CDEF), which can be applied after unblocking, and may include the application of non-separable non-linear low-pass directional filters, based on estimated edge directions. Filter unit 216 can also include a loop restoration filter, which is applied after the CDEF, and may include a separable symmetric normalized Wiener filter or a dual self-guided filter.

[00185] Video encoder 200 stores reconstructed blocks in DPB 218. For example, in instances where filter unit 216 operations are not performed, reconstruction unit 214 can store reconstructed blocks in DPB 218. In instances where filter unit 216 operations are performed, filter unit 216 can store the filtered reconstructed blocks in DPB 218. Motion estimation unit 222 and motion compensation unit 224 can retrieve a DPB 218 reference image, formed from the reconstructed (and potentially filtered) blocks. Petition 870250090174, dated 03 / 10 / 2025, pages 200 / 261 81 / 112 to interpredict subsequently encoded image blocks. Additionally, the intraprediction unit 226 can use DPB 218 reconstructed blocks from a current image to intrapredict other blocks in the current image.

[00186] In general, the entropy coding unit 220 can entropically encode syntax elements received from other functional components of the video encoder 200. For example, the entropy coding unit 220 can entropically encode quantized transform coefficient blocks from the quantization unit 208. As another example, the entropy coding unit 220 can entropically encode prediction syntax elements (e.g., motion information for interprediction or intramode information for intraprediction) from the mode selection unit 202. The entropy coding unit 220 can perform one or more entropy coding operations on syntax elements, which are another example of video data, in order to generate entropically encoded data.For example, the 220 entropic coding unit can perform a context-adaptive variable length coding (CAVLC) operation, a CABAC operation, a variable-to-variable (V2V) coding operation, a syntax-based context-adaptive binary arithmetic coding (SBAC) operation, and a probability interval partitioning (PIPE) entropy coding operation. Petition 870250090174, dated 03 / 10 / 2025, pages 201 / 261 82 / 112 entropy), an Exponential-Golomb encoding operation or another type of entropic encoding operation on the data. In some examples, the 220 entropic encoding unit may operate in bypass mode, where the syntax elements are not entropically encoded.

[00187] Video encoder 200 can output a bitstream that includes the entropically encoded syntax elements needed to reconstruct blocks of a slice or image. In particular, entropic encoding unit 220 can output the bitstream.

[00188] According to AV1, the 220 entropic encoding unit can be configured as an adaptive symbol-to-symbol multisymbol arithmetic encoder. A syntax element in AV1 includes an alphabet of N elements, and a context (e.g., probability model) includes a set of N probabilities. The 220 entropic encoding unit can store the probabilities as n-bit cumulative distribution functions (CDFs) (e.g., 15 bits). The 220 entropic encoding unit can perform recursive scaling, with an update factor based on alphabet size, to update the contexts.

[00189] The operations described above are described in relation to a block. This description should be understood as operations for a luma encoding block and / or for chroma encoding blocks. As described above, in some examples, the luma encoding block and the chroma encoding blocks are luma and chroma components of a CU. In some examples, the block of Petition 870250090174, dated 03 / 10 / 2025, pages 202 / 261 83 / 112 luma encoding and chroma encoding blocks are luma and chroma components of a PU.

[00190] In some examples, the operations performed on a luma coding block do not need to be repeated for the chroma coding blocks. As an example, the operations to identify a motion vector (MV) and a reference image for a luma coding block do not need to be repeated to identify an MV and a reference image for the chroma blocks. Instead, the MV for the luma coding block can be scaled to determine the MV for the chroma blocks, and the reference image can be the same. As another example, the intraprediction process can be the same for the luma coding block and for the chroma coding blocks.

[00191] Video encoder 200 represents an example of a device configured to encode video data that includes one or more memories configured to store the video data; and one or more processors implemented in a circuit set and communicatively coupled to one or more memories, the one or more processors being configured to: determine a current template of a current block of video data; determine a potential reference block in an image of the video data for the current block; determine that the potential reference block and a reference template of the potential reference block are entirely within the image, the reference template having the same shape as the current template; based on the potential reference block and the reference template both being entirely within the Petition 870250090174, dated 03 / 10 / 2025, pages 203 / 261 84 / 112 image, perform template matching between the reference template and the current template; and encode or decode the current block based on the template match.

[00192] Video encoder 200 represents an example of a device configured to encode video data that includes a memory configured to store video data, and one or more processing units implemented in a circuit set and configured to determine at least part of a template based on the availability of neighboring blocks of video data, neighboring blocks being adjacent to a current block of video data; perform template matching based on the template; and encode or decode the current block based on the template matching.

[00193] The 200 video encoder also represents an example of a device configured to encode video data that includes a memory configured to store video data, and one or more processing units implemented in a circuit set and configured to: determine a search range; determine that a reference block of video data is entirely within the search range; based on the reference block being entirely within the search range, perform template matching between the reference block and an actual block of video data; and encode or decode the actual block based on the template matching.

[00194] The 200 video encoder also represents an example of a device configured for Petition 870250090174, dated 03 / 10 / 2025, pp. 204 / 261 85 / 112 video data encoding that includes a memory configured to store video data, and one or more processing units implemented in a circuit set and configured to: determine a search region based on areas that are already decoded; perform template matching based on the search region; and encode a current block of video data based on the template matching.

[00195] Video encoder 200 also represents an example of a device configured to encode video data that includes a memory configured to store video data, and one or more processing units implemented in a circuit set and configured to: perform a template matching search; perform a refinement template matching search on the results of the template matching search, wherein the refinement template matching search comprises searching in a plurality of search regions; and encode a current block of video data based on the refinement template matching search.

[00196] The 200 video encoder also represents an example of a device configured to encode video data that includes a memory configured to store video data, and one or more processing units implemented in a circuit set and configured to: determine that samples from a reference block of video data are unavailable; based on the samples from the reference block being unavailable, copy samples from the respective positions Petition 870250090174, dated 03 / 10 / 2025, pages 205 / 261 86 / 112 matches in a current block of video data; and encode the current block based on the reference block.

[00197] Figure 15 is a block diagram illustrating an example 300 video decoder that can perform the techniques of this disclosure. Figure 15 is provided for explanatory purposes and is not limiting to the techniques as extensively exemplified and described in this disclosure. For explanatory purposes, this disclosure describes the 300 video decoder according to VVC and HEVC techniques. However, the techniques of this disclosure can be performed by video encoding devices that are configured for other video encoding standards.

[00198] In the example of Figure 15, the video decoder 300 includes a coded picture buffer (CPB) memory 320, an entropic decoding unit 302, a prediction processing unit 304, an inverse quantization unit 306, an inverse transform processing unit 308, a reconstruction unit 310, a filter unit 312, and a DPB 314. Any or all of the CPB memory 320, the entropic decoding unit 302, the prediction processing unit 304, the inverse quantization unit 306, the inverse transform processing unit 308, the reconstruction unit 310, the filter unit 312, and the DPB 314 can be implemented in one or more processors or in a set of processing circuits. For example, the 300 video decoder units can be implemented as one or more circuits or logic elements as part of the circuit assembly of Petition 870250090174, dated 03 / 10 / 2025, pp. 206 / 261 87 / 112 hardware or as part of a processor, ASIC, or FPGA. Additionally, the 300 video decoder may include additional or alternative processors or circuitry to perform these and other functions.

[00199] Prediction processing unit 304 includes a motion compensation unit 316 and an intraprediction unit 318. Prediction processing unit 304 may include additional units to perform prediction according to other prediction modes. As examples, prediction processing unit 304 may include a palette unit, an intrablock copy unit (which may be part of motion compensation unit 316), an affine unit, a linear model (LM) unit, or similar units. In other examples, video decoder 300 may include more, fewer, or different functional components. Prediction processing unit 304 (e.g., motion compensation unit 316 and / or intraprediction unit 318) may perform the template matching techniques of Figure 13.

[00200] When operating in accordance with AV1, the motion compensation unit 316 can be configured to decode video data coding blocks (e.g., both luma and chroma coding blocks) using translational motion compensation, affine motion compensation, OBMC, and / or composite inter-intraprediction, as described above. The intraprediction unit 318 can be configured to decode video data coding blocks (e.g., both luma and chroma coding blocks) using Petition 870250090174, dated 03 / 10 / 2025, pp. 207 / 261 88 / 112 directional intraprediction, non-directional intraprediction, recursive filter intraprediction, CFL, IBC and / or color palette mode, as described above.

[00201] The CPB 320 memory can store video data, such as an encoded video bitstream, to be decoded by the components of the video decoder 300. The video data stored in the CPB 320 memory can be obtained, for example, from computer-readable media 110 (Figure 1). The CPB 320 memory may include a CPB that stores encoded video data (e.g., syntax elements) of an encoded video bitstream. In addition, the CPB 320 memory may store video data beyond the syntax elements of an encoded image, such as temporary data representing outputs from the various units of the video decoder 300. The DPB 314 generally stores decoded images, which the video decoder 300 can output and / or use as reference video data when decoding subsequent data or images from the encoded video bitstream.The CPB 320 and DPB 314 memory can be comprised of any of several memory devices, such as DRAM, including SDRAM, MRAM, RRAM, or other types of memory devices. The CPB 320 and DPB 314 memory can be provided by the same memory device or by separate memory devices. In many instances, the CPB 320 memory may be on-chip with other components of the 300 video decoder or off-chip relative to those components.

[00202] Additionally or alternatively, in some examples, the video decoder 300 can recover encoded video data from memory 120 (Figure 1). That is, the Petition 870250090174, dated 03 / 10 / 2025, pp. 208 / 261 Memory 120, as discussed above, can store data with CPB 320 memory. Similarly, memory 120 can store instructions to be executed by video decoder 300, when some or all of the video decoder 300 functionalities are implemented in software to be executed by the video decoder 300 processing circuitry.

[00203] The various units shown in Figure 15 are illustrated to aid in understanding the operations performed by the 300 video decoder. The units can be implemented as fixed-function circuits, programmable circuits, or a combination thereof. Similar to Figure 14, fixed-function circuits refer to circuits that provide particular functionality and are predefined in the operations that can be performed. Programmable circuits refer to circuits that can be programmed to perform various tasks and to provide flexible functionality in the operations that can be performed. For example, programmable circuits can execute software or firmware that causes the programmable circuits to operate in the manner defined by the software or firmware instructions.Fixed-function circuits can execute software instructions (for example, to receive parameters or to emit parameters), but the types of operations that fixed-function circuits perform are generally immutable. In some examples, one or more of the units may be distinct circuit blocks (fixed-function or programmable), and in some examples, one or more of the units may be integrated circuits.

[00204] The 300 video decoder can Petition 870250090174, dated 03 / 10 / 2025, pp. 209 / 261 90 / 112 include ALUs, EFUs, digital circuits, analog circuits, and / or programmable cores, formed from programmable circuits. In examples where the operations of the 300 video decoder are performed by software running on programmable circuits, the on-chip memory or off-chip memory may store instructions (e.g., object code) from the software that the 300 video decoder receives and executes.

[00205] The entropic decoding unit 302 can receive encoded video data from the CPB and entropically decode the video data to reproduce syntax elements. The prediction processing unit 304, the inverse quantization unit 306, the inverse transform processing unit 308, the reconstruction unit 310, and the filter unit 312 can generate decoded video data based on the syntax elements extracted from the bitstream.

[00206] In general, the 300 video decoder reconstructs an image on a block-by-block basis. The 300 video decoder can perform a reconstruction operation on each block individually (where the block that is currently being reconstructed, i.e., decoded, can be called the current block).

[00207] The entropic decoding unit 302 can entropically decode syntax elements that define quantized transform coefficients from a block of quantized transform coefficients, as well as transform information such as a quantization parameter (QP) and / or transform mode indication(s). The inverse quantization unit 306 can use Petition 870250090174, dated 03 / 10 / 2025, pages 210 / 261 91 / 112 the QP associated with the block of quantized transform coefficients to determine a degree of quantization and, similarly, an inverse degree of quantization for the inverse quantization unit 306 to apply. The inverse quantization unit 306 can, for example, perform a left shift operation in the bit direction to inversely quantize the quantized transform coefficients. The inverse quantization unit 306 can thus form a block of transform coefficients that includes transform coefficients.

[00208] After the inverse quantization unit 306 forms the transform coefficient block, the inverse transform processing unit 308 can apply one or more inverse transforms to the transform coefficient block to generate a residual block associated with the current block. For example, the inverse transform processing unit 308 can apply an inverse DCT, an inverse integer transform, an inverse Karhunen-Loeve transform (KLT), an inverse rotational transform, an inverse directional transform, or another inverse transform to the transform coefficient block.

[00209] In addition, prediction processing unit 304 generates a prediction block according to the syntax elements of the prediction information that were entropically decoded by the entropic decoding unit 302. For example, if the syntax elements of the prediction information indicate that the current block is interpredicted, motion compensation unit 316 may generate the prediction block. In this case, the elements Petition 870250090174, dated 03 / 10 / 2025, pages 211 / 261 92 / 112 of the prediction information syntax can indicate a reference image in DPB 314 from which it is possible to retrieve a reference block, as well as a motion vector that identifies a location of the reference block in the reference image relative to the location of the current block in the current image. The motion compensation unit 316 can generally perform the interprediction process in a manner that is substantially similar to that described in relation to the motion compensation unit 224 (Figure 14).

[00210] As another example, if the prediction information syntax elements indicate that the current block is intrapredicted, the intraprediction unit 318 can generate the prediction block according to an intraprediction mode indicated by the prediction information syntax elements. Again, the intraprediction unit 318 can generally perform the intraprediction process in a manner that is substantially similar to that described in relation to the intraprediction unit 226 (Figure 14). The intraprediction unit 318 can retrieve data from samples neighboring the current DPB block 314.

[00211] Reconstruction unit 310 can reconstruct the current block using the prediction block and the residual block. For example, reconstruction unit 310 can add samples from the residual block to the corresponding samples from the prediction block to reconstruct the current block.

[00212] The 312 filter unit can perform one or more filter operations on rebuilt blocks. By Petition 870250090174, dated 03 / 10 / 2025, pp. 212 / 261 In example 93 / 112, filter unit 312 can perform unblocking operations to reduce blocking artifacts along the edges of the reconstructed blocks. Filter unit 312 operations are not necessarily performed in all examples.

[00213] Video decoder 300 can store reconstructed blocks in DPB 314. For example, in instances where filter unit 312 operations are not performed, reconstruction unit 310 can store reconstructed blocks in DPB 314. In instances where filter unit 312 operations are performed, filter unit 312 can store filtered reconstructed blocks in DPB 314. As discussed above, DPB 314 can provide reference information, such as samples of a current image for intraprediction and previously decoded images for subsequent motion compensation, to the prediction processing unit 304. Furthermore, video decoder 300 can output decoded images (e.g., decoded video) from DPB 314 for subsequent presentation on a display device, such as display device 118 in Figure 1.

[00214] In this way, the 300 video decoder represents an example video decoding device that includes one or more memories configured to store video data; and one or more processors implemented in a circuit assembly and communicatively coupled to one or more memories, the one or more processors being configured to: determine a current template of a current block of video data; determine a potential reference block in an image. Petition 870250090174, dated 03 / 10 / 2025, pp. 213 / 261 94 / 112 of the video data for the current block; determine that the potential reference block and a reference template of the potential reference block are entirely within the image, the reference template having the same shape as the current template; based on the potential reference block and the reference template both being entirely within the image, perform template matching between the reference template and the current template; and decode the current block based on the template matching.

[00215] The 300 video decoder also represents an example of a video decoding device that includes a memory configured to store video data, and one or more processing units implemented in a circuit set and configured to: determine at least part of a template based on the availability of neighboring blocks of video data, the neighboring blocks being adjacent to a current block of video data; perform template matching based on the template; and decode the current block based on the template matching.

[00216] The 300 video decoder also represents an example of a device configured to decode video data that includes a memory configured to store video data, and one or more processing units implemented in a circuit set and configured to: determine a search range; determine that a reference block of the video data is entirely within the search range; based on the reference block being entirely within the search range, perform the matching of Petition 870250090174, dated 03 / 10 / 2025, pp. 214 / 261 95 / 112 template matching between the reference block and a current block of video data; and decoding the current block based on the template match.

[00217] The 300 video decoder also represents an example of a device configured to decode video data that includes a memory configured to store video data, and one or more processing units implemented in a circuit set and configured to: determine a search region based on areas that are already decoded; perform template matching based on the search region; and decode a current block of video data based on the template matching.

[00218] The 300 video decoder also represents an example of a device configured to decode video data that includes a memory configured to store video data, and one or more processing units implemented in a circuit set and configured to: perform a template matching search; perform a refinement template matching search on the results of the template matching search, wherein the refinement template matching search comprises searching in a plurality of search regions; and decode a current block of video data based on the refinement template matching search.

[00219] The 300 video decoder also represents an example of a device configured to decode video data that includes a memory configured to store video data, and one or more units of Petition 870250090174, dated 03 / 10 / 2025, pages 215 / 261 96 / 112 processing implemented in a set of circuits and configured to: determine that samples from a reference block of video data are unavailable; based on the samples from the reference block being unavailable, copy samples from their respective corresponding positions in a current block of video data; and decode the current block based on the reference block.

[00220] Figure 16 is a flowchart illustrating an example method for encoding a current block according to the techniques of the present disclosure. The current block may be or include a current CU. Although described in relation to the Video Encoder 200 (Figures 1 and 14), it should be understood that other devices may be configured to perform a method similar to that of Figure 16.

[00221] In this example, video encoder 200 initially predicts the current block (350). For example, video encoder 200 can form a prediction block for the current block. When forming the prediction block for the current block, video encoder 200 can perform the template matching techniques of Figure 13. Video encoder 200 can then calculate a residual block for the current block (352). To calculate the residual block, video encoder 200 can calculate a difference between the original, unencoded block and the prediction block for the current block. Video encoder 200 can then transform the residual block and quantize the transform coefficients of the residual block (354). Next, video encoder 200 can scan the quantized transform coefficients of the residual block (356). During or after scanning, the Petition 870250090174, dated 03 / 10 / 2025, pages 216 / 261 97 / 112 video encoder 200 can entropically encode the transform coefficients (358). For example, video encoder 200 can encode the transform coefficients using CAVLC or CABAC. Video encoder 200 can then output the entropically encoded block data (360).

[00222] Figure 17 is a flowchart illustrating an example method for decoding a current block of video data according to the techniques of the present disclosure. The current block may be or include a current CU. Although described in relation to the 300 video decoder (Figures 1 and 15), it should be understood that other devices may be configured to perform a method similar to that of Figure 17.

[00223] The video decoder 300 can receive entropically encoded data for the current block, such as entropically encoded prediction information and entropically encoded data for transform coefficients of a residual block corresponding to the current block (370). The video decoder 300 can entropically decode the entropically encoded data to determine prediction information for the current block and to reproduce transform coefficients of the residual block (372). The video decoder 300 can predict the current block (374), for example using an intraprediction or interprediction mode, as indicated by the prediction information for the current block, to calculate a prediction block for the current block. For example, in predicting the current block, the video decoder 300 can use the template matching techniques of Figure Petition 870250090174, dated 03 / 10 / 2025, pp. 217 / 261 98 / 112 13. The video decoder 300 can then perform an inverse scan on the reproduced transform coefficients (376) to create a block of quantized transform coefficients. The video decoder 300 can then inversely quantize the transform coefficients and apply an inverse transform to the transform coefficients to produce a residual block (378). The video decoder 300 can finally decode the current block by combining the prediction block and the residual block (380).

[00224] The following numbered clauses illustrate one or more aspects of the techniques and devices described in this disclosure.

[00225] Clause 1A. A method for encoding video data comprising: determining at least part of a template based on the availability of neighboring blocks of video data, neighboring blocks being adjacent to a current block of video data; performing template matching based on the template; and encoding the current block based on the template matching.

[00226] Clause 2A. The method of clause 1A, wherein at least one part comprises a part to the left, and wherein the determination of at least one part comprises determining that all blocks adjacent to the left of the current block are available.

[00227] Clause 3A. The method of clause 2A, where the current block comprises a block adjacent to a top image border, but not adjacent to a left image border.

[00228] Clause 4A. The method of any of the Petition 870250090174, dated 03 / 10 / 2025, pp. 218 / 261 99 / 112 clauses 1A to 3A, wherein at least one part comprises a part above, and wherein the determination of at least one part comprises determining that all adjacent blocks above the current block are available.

[00229] Clause 5A. The method of clause 4A, where the current block comprises a block not adjacent to a top image border, but adjacent to a left image border.

[00230] Clause 6A. The method of any of clauses 1A to 5A, wherein at least one part comprises an above-left part, and wherein the determination of at least one part comprises determining that a neighboring block to the left and above the current block is available.

[00231] Clause 7A. The method of any of clauses 1A to 6A which further comprises: determining which blocks to the left and below the current block are available; and based on which blocks to the left and below the current block are available, extending the leftmost portion downwards.

[00232] Clause 8A. The method of any of clauses 1A to 7A which further comprises: determining which neighboring blocks above and to the right of the current block are available; and based on which neighboring blocks above and to the right of the current block are available, extending the above portion to the right.

[00233] Clause 9A. A method for encoding video data comprising: determining a search range; determining that a reference block of the video data is entirely within the search range; based on the reference block being entirely within the Petition 870250090174, dated 03 / 10 / 2025, pp. 219 / 261 Using a 100 / 112 search interval, perform a template match between the reference block and an actual block of video data; and encode the actual block based on the template match.

[00234] Clause 10A. The method of clause 9A which further comprises determining that the reference block and a reference block template are entirely within an image, and wherein the realization of the template matching is further based on the reference block and the reference block template being entirely within the image.

[00235] Clause 11A. The method of clause 9A or clause 10A, wherein a reference block template comprises at least two of a left part, an upper-left part or an upper part, and wherein an upper-left sample of the reference block is offset in both a vertical and a horizontal direction by a template size from an image border.

[00236] Clause 12A. The method of clause 9A or clause 10A, wherein a template of the reference block comprises only a left portion, and wherein an upper left sample of the reference block is offset in a horizontal direction by one template size from an image border.

[00237] Clause 13A. The method of clause 12A, where at least one searched reference block of the template match is adjacent to a top image border, but not adjacent to a left image border. Petition 870250090174, dated 03 / 10 / 2025, pp. 220 / 261 101 / 112

[00238] Clause 14A. The method of clause 9A or clause 10A, wherein a reference block template comprises only a portion above, and wherein an upper left sample of the reference block is offset in a vertical direction by one template size from an image border.

[00239] Clause 15A. The method of clause 14A, where at least one searched reference block of the template match is adjacent to a left image border, but not adjacent to a top image border.

[00240] Clause 16A. The method of clause 9A which further comprises: determining that a reference block template is not entirely within an image; and based on the reference block template not being entirely within the image, filling in an unavailable template portion.

[00241] Clause 17A. The method of clause 16A, wherein the reference block has an L-shaped template and is adjacent to at least one of either a left image border or a top image border.

[00242] Clause 18A. A method for encoding video data comprising: determining a search region based on areas that are already decoded; performing template matching based on the search region; and encoding a current block of video data based on the template matching.

[00243] Clause 19A. The method of clause 18A, wherein the search region comprises all blocks wholly or partially located within a current block and that Petition 870250090174, dated 03 / 10 / 2025, pages 221 / 261 102 / 112 are completely rebuilt.

[00244] Clause 20A. A method for encoding video data comprising: performing a template match search; performing a refinement template match search on the results of the template match search, wherein the refinement template match search comprises searching in a plurality of search regions; and encoding a current block of video data based on the refinement template match search.

[00245] Clause 21A. The method of clause 20A which further comprises determining the best match having the lowest template cost based on samples in a plurality of research regions.

[00246] Clause 22A. A method for encoding video data comprising: determining that samples from a reference block of video data are unavailable; based on the samples from the reference block being unavailable, copying samples from their respective corresponding positions in a current block of video data; and encoding the current block based on the reference block.

[00247] Clause 23A. The method of any of clauses 1A to 22A, wherein encoding comprises decoding.

[00248] Clause 24A. The method of any of clauses 1A to 23A, wherein encoding comprises encoding.

[00249] Clause 25A. A device for encoding video data comprising one or more media Petition 870250090174, dated 03 / 10 / 2025, pp. 222 / 261 103 / 112 to perform the method of any of clauses 1A to 24A.

[00250] Clause 26A. The device of clause 25A, wherein the one or more means comprise one or more processors implemented in a circuit assembly.

[00251] Clause 27A. The device of either clause 25A and 26A which additionally comprises a memory for storing video data.

[00252] Clause 28A. The device of any of clauses 25A to 27A additionally comprising a display configured to display decoded video data.

[00253] Clause 29A. The device of any of clauses 25A to 28A, comprising one or more of a camera, a computer, a mobile device, a broadcast receiver or a set-top box.

[00254] Clause 30A. The device of any of clauses 25A to 29A comprising a video decoder.

[00255] Clause 31A. The device of any of clauses 25A to 30A comprising a video encoder.

[00256] Clause 32A. A computer-readable storage medium that has stored therein instructions which, when executed, cause one or more processors to perform the method of any of clauses 1A to 24A.

[00257] Clause 33A. A device for encoding video data comprising: means for carrying out the method of any of clauses 1A to 24A.

[00258] Clause 1B. A method for encoding Petition 870250090174, dated 03 / 10 / 2025, pp. 223 / 261 104 / 112 video data comprising: determining a current template of a current block of video data; determining a potential reference block in an image of video data for the current block; determining that the potential reference block and a reference template of the potential reference block are entirely within the image, the reference template having the same shape as the current template; based on the potential reference block and the reference template both being entirely within the image, performing template matching between the reference template and the current template; and encoding the current block based on the template matching.

[00259] Clause 2B. The method of clause 1B, wherein the potential reference block is a first potential reference block, and wherein the reference template is a first reference template, and wherein the method further comprises: determining that at least one of a second potential reference block or a second reference template of the second potential reference block is not entirely within the image; and based on at least one of the second potential reference block or a second reference template not being entirely within the image, not performing template matching between the second reference template and an actual template of an actual block of video data; and encoding the actual block using a reference block different from the second potential reference block.

[00260] Clause 3B. The method of clause 1B or clause 2B, wherein the reference template comprises at least two of a left-hand part, an above part— Petition 870250090174, dated 03 / 10 / 2025, pp. 224 / 261 105 / 112 left or a portion above, and wherein an upper-left sample of the potential reference block is offset in a vertical direction by a width of at least one of the upper-left portion or the portion above from an upper image boundary, and offset in a horizontal direction by at least a width of at least one of the left portion or the upper-left portion from a left image boundary.

[00261] Clause 4B. The method of clause 1B or clause 2B, wherein the reference template comprises only a left portion, and wherein an upper left sample of the potential reference block is offset in a horizontal direction by a width of the left portion from a left image boundary, and wherein the potential reference block is adjacent to an upper image boundary, but not adjacent to the left image boundary.

[00262] Clause 5B. The method of clause 1B or clause 2B, wherein the reference template comprises only an upper portion, and wherein an upper left sample of the potential reference block is offset in a vertical direction by a width of the upper portion from an upper image boundary, and wherein the potential reference block is adjacent to a left image boundary, but not adjacent to an upper image boundary.

[00263] Clause 6B. The method of any of clauses 1B to 5B, wherein the potential reference block is one of a plurality of potential reference blocks, the method further comprising: determining a search region of the image for the plurality of blocks of Petition 870250090174, dated 03 / 10 / 2025, pages 225 / 261 106 / 112 potential reference blocks to include all blocks wholly or partially located within a current coding tree unit (CTU) of the video data that are fully reconstructed; and determine that the potential reference block is within the search region.

[00264] Clause 7B. The method of clause 6B, wherein the search region comprises a search region from a plurality of search regions, the method further comprising performing a refinement template matching search on the results of the template matching search, wherein the refinement template matching search comprises searching across the plurality of search regions.

[00265] Clause 8B. The method of any of clauses 1B to 7B, wherein the current template comprises at least one part, and wherein the determination of the current template comprises determining at least one part based on the availability of blocks adjacent to the current block.

[00266] Clause 9B. The method of clause 8B, wherein at least one part comprises a part to the left, and wherein the determination of at least one part comprises determining that all blocks adjacent to the left of the current block are available, and wherein the current block comprises a block adjacent to a top picture border, but not adjacent to a left picture border.

[00267] Clause 10B. The method of clause 8B, wherein at least one party comprises a party above, and wherein the determination of at least one party comprises determining that all adjacent blocks above the current block are available, and wherein the current block comprises Petition 870250090174, dated 03 / 10 / 2025, pp. 226 / 261 107 / 112 a block not adjacent to a top image border, but adjacent to a left image border.

[00268] Clause 11B. The method of clause 8B, wherein at least one part comprises a part above-the-left, and wherein the determination of at least one part comprises determining that a neighboring block to the left and above the current block is available.

[00269] Clause 12B. The method of clause 8B or clause 9B which further comprises: determining which blocks to the left and below the current block are available; and based on which blocks to the left and below the current block are available, extending a left portion downwards so that a bottom of the left portion is lower in a vertical direction than a bottom of the current block.

[00270] Clause 13B. The method of clause 8B or clause 10B which further comprises: determining which neighboring blocks above and to the right of the current block are available; and based on which neighboring blocks above and to the right of the current block are available, extending a portion above to the right so that a right edge of the portion above is further to the right in a horizontal direction than a right edge of the current block.

[00271] Clause 14B. The method of any of clauses 1B to 13B, where encoding comprises decoding.

[00272] Clause 15B. The method of any of clauses 1B to 13B, wherein encoding comprises encoding.

[00273] Clause 16B. A device for Petition 870250090174, dated 03 / 10 / 2025, pp. 227 / 261 108 / 112 Encoding video data comprises: one or more memories configured to store the video data; and one or more processors implemented in a circuit set and communicatively coupled to one or more memories, the one or more processors being configured to: determine a current template of a current block of video data; determine a potential reference block in an image of the video data for the current block; determine that the potential reference block and a reference template of the potential reference block are entirely within the image, the reference template having the same shape as the current template; based on the potential reference block and the reference template both being entirely within the image, perform template matching between the reference template and the current template; and encode the current block based on the template matching.

[00274] Clause 17B. The device of clause 16B, wherein the current template comprises at least one part, and wherein, as part of the determination of the current template, one or more processors are configured to determine at least one part based on the availability of blocks adjacent to the current block.

[00275] Clause 18B. The device of clause 16B or clause 17B, wherein the encoding comprises decoding, and wherein the device further comprises a display configured to display decoded video data.

[00276] Clause 19B. The provision of clause 16B or clause 17B, wherein the coding includes coding, and wherein the provision additionally includes Petition 870250090174, dated 03 / 10 / 2025, pages 228 / 261 109 / 112 a camera configured to capture video data.

[00277] Clause 20B. Computer-readable storage media having stored in them the same instructions which, when executed, cause one or more processors to: determine a current template of a current block of video data; determine a potential reference block in an image of the video data for the current block; determine that the potential reference block and a reference template of the potential reference block are entirely within the image, the reference template having the same shape as the current template; based on the potential reference block and the reference template both being entirely within the image, perform template matching between the reference template and the current template; and encode the current block based on the template matching.

[00278] It should be recognized that, depending on the example, certain actions or events of any of the techniques described in the present invention may be performed in a different sequence, may be added, combined or completely omitted (for example, not all actions or events described are necessary for the practice of the techniques). Furthermore, in certain examples, the actions or events may be performed simultaneously, for example, through multi-threaded processing, interrupt processing or multiple processors, instead of sequentially.

[00279] In one or more examples, the functions described may be implemented in hardware, software, firmware, or any combination thereof. If implemented Petition 870250090174, dated 03 / 10 / 2025, pp. 229 / 261 110 / 112 In software, functions can be stored or transmitted as one or more instructions or code in a computer-readable medium and executed by a hardware-based processing unit. Computer-readable media can include computer-readable storage media, which correspond to a tangible medium, such as data storage media, or communication media, including any medium that facilitates the transfer of a computer program from one place to another, for example, according to a communication protocol. In this way, computer-readable media can generally correspond to (1) tangible computer-readable storage media that are non-transient or (2) a communication medium, such as a signal or a carrier wave.The data storage medium can be any available medium that can be accessed by one or more computers or one or more processors to retrieve instructions, code, and / or data structures for implementing the techniques described in this disclosure. A computer program product may include a computer-readable medium.

[00280] By way of example, and not limitation, such computer-readable storage media may include one or more of the following: RAM, ROM, EEPROM, CD-ROM or other optical disk storage, magnetic disk storage or other magnetic storage devices, flash memory or any other media that can be used to store the desired program code in the form of instructions or data structures and that can be accessed by a computer. In addition, any connection is properly termed a computer-readable medium. Petition 870250090174, dated 03 / 10 / 2025, pp. 230 / 261 111 / 112 For example, if instructions are transmitted from a website, server, or other remote source using a coaxial cable, fiber optic cable, twisted pair, digital subscriber line (DSL), or wireless technologies such as infrared, radio, and microwave, then the coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave will be included in the definition of medium. It should be understood, however, that computer-readable storage media and data storage media do not include connections, carrier waves, signals, or other transient media, but instead refer to tangible, non-transient storage media.As used in the present invention, disks (disk and disc) include compact disc (CD), laser disc, optical disc, digital versatile disc (DVD), floppy disk, and Blu-ray disc, where disks typically reproduce data magnetically, while discs reproduce data optically by means of lasers. Combinations of the above items should also be included within the scope of computer-readable media.

[00281] The instructions may be executed by one or more processors, such as one or more DSPs, general-purpose microprocessors, ASICs, FPGAs, or other equivalent discrete or integrated logic circuitry. Consequently, the terms processor and processing circuitry, as used in the present invention, may refer to any of the foregoing structures or any other structure suitable for implementing the techniques described herein. Petition 870250090174, dated 03 / 10 / 2025, pages 231 / 261 112 / 112 invention. Furthermore, in some aspects, the functionality described in the present invention can be provided in dedicated hardware and / or software modules configured for encoding and decoding, or can be incorporated into a combined codec. Additionally, the techniques can be fully implemented in one or more circuits or logic elements.

[00282] The techniques in this disclosure can be implemented in a wide variety of devices or appliances, including a wireless handset, an integrated circuit (IC), or a set of ICs (e.g., a chipset). Several components, modules, or units are described in this disclosure to emphasize functional aspects of devices configured to perform the disclosed techniques, but do not necessarily require implementation by different hardware units. Instead, as described above, several units can be combined into a codec hardware unit or provided by a collection of interoperable hardware units, including one or more processors, as described above, in conjunction with suitable software and / or firmware.

[00283] Several examples have been described. These and other examples are within the scope of the following claims. Petition 870250090174, dated 03 / 10 / 2025, pages 232 / 261

Claims

1 / 7 CLAIMS 1. A method for encoding video data, characterized by comprising: determining a current template of a current block of video data; determining a potential reference block in an image of the video data for the current block; determining that the potential reference block and a reference template of the potential reference block are entirely within the image, the reference template having the same shape as the current template; based on the potential reference block and the reference template both being entirely within the image, performing template matching between the reference template and the current template; and encoding the current block based on the template matching.

2. A method according to claim 1, characterized in that the potential reference block is a first potential reference block and in that the reference template is a first reference template, and in that the method further comprises: determining that at least one of a second potential reference block or a second reference template of the second potential reference block is not entirely within the image; and based on at least one of the second potential reference block or a second reference template not being entirely within the image, not performing template matching between the second reference template and an actual template of an actual block of video data; and encoding the actual block using a reference block different from the second potential reference block.

3. A method according to claim 1, characterized in that the reference template comprises at least two of a left portion, an upper-left portion, or an upper portion, and wherein an upper-left sample of the potential reference block is offset in a vertical direction by a width of at least one of the upper-left portion or the upper portion from an upper image boundary, and offset in a horizontal direction by at least one width of at least one of the left portion or the upper-left portion from a left image border.

4. A method according to claim 1, characterized in that the reference template comprises only a left portion, and wherein an upper left sample of the potential reference block is displaced in a horizontal direction by a width of the left portion from a left image boundary, and wherein the potential reference block is adjacent to an upper image boundary but not adjacent to the left image boundary.

5. Method, according to claim 1, characterized in that the reference template comprises only an upper part, and in which an upper left sample of the potential reference block is offset in a vertical direction by a width of the upper part from an upper image boundary, and in which the potential reference block is adjacent to a left image boundary, but not adjacent to an upper image boundary.

6. A method according to claim 1, characterized in that the potential reference block is one of a plurality of potential reference blocks, further comprising: determining an image search region for the plurality of potential reference blocks to include all blocks wholly or partially located within a current coding tree unit (CTU) of the video data that are completely reconstructed; and determining that the potential reference block is within the search region.

7. A method according to claim 6, characterized in that the search region comprises a search region from a plurality of search regions, the method further comprising performing a refinement template matching search on the results of the template matching search, wherein the refinement template matching search comprises searching across the plurality of search regions.

8. A method according to claim 1, characterized in that the current template comprises at least one part, and wherein the determination of the current template comprises determining at least one part based on the availability of blocks adjacent to the current block.

9. Method according to claim 8, characterized in that at least one part comprises a left part, and wherein the determination of at least one part comprises determining that all blocks adjacent to the left of the current block are available, and where the current block comprises a block adjacent to a top image border, but not adjacent to a left image border.

10. A method according to claim 8, characterized in that at least one part comprises a part above, and wherein the determination of the at least one part comprises determining that all adjacent blocks above the current block are available, and wherein the current block comprises a block not adjacent to a top image border, but adjacent to a left image border.

11. A method according to claim 8, characterized in that at least one part comprises an above-left part, and wherein the determination of the at least one part comprises determining that a neighboring block to the left and above the current block is available.

12. A method according to claim 8, characterized by further comprising: determining which blocks adjacent to the left and below the current block are available; and based on which blocks adjacent to the left and below the current block are available, extending a left portion downwards so that a bottom of the left portion is lower in a vertical direction than a bottom of the current block.

13. Method according to claim 8, characterized by further comprising: determining which neighboring blocks above and to the right of the current block are available; and Petition 870250090174, dated 10 / 03 / 2025, pp. 236 / 261 5 / 7 based on neighboring blocks above and to the right of the current block being available, extending a portion above to the right so that a right edge of the portion above is further to the right in a horizontal direction than a right edge of the current block.

14. Method according to claim 1, characterized in that the encoding comprises decoding.

15. Method, according to claim 1, characterized in that the encoding comprises encoding.

16. Device for encoding video data, characterized by comprising: one or more memories configured to store video data; and one or more processors implemented in a circuit assembly and communicatively coupled to one or more memories, the one or more processors being configured to: determine a current template of a current block of video data; determine a potential reference block in an image of the video data for the current block; determine that the potential reference block and a reference template of the potential reference block are entirely within the image, the reference template having the same shape as the current template; based on the potential reference block and the reference template both being entirely within the image, perform template matching between the reference template and the current template; and encode the current block based on Petition 870250090174, dated 03 / 10 / 2025, p.237 / 261 6 / 7 template matching.

17. Device according to claim 16, characterized in that the current template comprises at least one part, and wherein, as part of the determination of the current template, one or more processors are configured to determine at least one part based on the availability of blocks adjacent to the current block.

18. Device according to claim 16, characterized in that the encoding comprises decoding, and wherein the device further comprises a display configured to display decoded video data.

19. Device according to claim 16, characterized in that the encoding comprises encoding, and wherein the device further comprises a camera configured to capture video data.

20. Computer-readable storage media characterized by having stored in them instructions that, when executed, cause one or more processors to: determine a current template of a current block of video data; determine a potential reference block in an image of video data for the current block; determine that the potential reference block and a reference template of the potential reference block are entirely within the image, the reference template having the same shape as the current template; based on the potential reference block and the reference template both being entirely within the image, perform template matching between the reference template and the current template; and encode the current block based on template matching. (Petition 870250090174, dated 10 / 03 / 2025, pp. 238 / 261 7 / 7)