Template Matching in Video Coding

JP2024501137A5Active Publication Date: 2024-12-16QUALCOMM INC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
JP2023532810
Authority / Receiving Office
JP · JP
Patent Type
Applications
Current Assignee / Owner
Priority Date
2021-12-21
Filing Date
2021-12-22
Publication Date
2024-12-16
Estimated Expiration
2041-12-22

AI Technical Summary

Benefits of technology

【0014】 1つまたは複数の例の詳細が、添付図面および以下の説明に記載される。他の特徴、目的、および利点が、説明、図面、および特許請求の範囲から明らかとなろう。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 00000000_0000_ABST
    Figure 00000000_0000_ABST
Patent Text Reader

Abstract

The video decoder may be configured to determine a motion vector and motion vector precision for a current block, identify a current block template in the current picture, and search within a search area for a final reference block template corresponding to the current block template, where to search within the search area, the one or more processors are further configured to identify an initial reference block template based on the motion vector, search other reference block templates around the initial reference block template using a step size set to the initial step size, iteratively reduce the step size from the initial step size until the step size is set to a final step size equal to the motion vector precision, and determine a predictive block for the current block based on the final reference block template.
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

[0001] This application claims priority to U.S. Patent Application No. 17 / 558,119, filed December 21, 2021, and U.S. Provisional Patent Application No. 63 / 131,676, filed December 29, 2020, the entire contents of which are incorporated herein by reference. U.S. Patent Application No. 17 / 558,119, filed December 21, 2021, claims the benefit of U.S. Provisional Patent Application No. 63 / 131,676, filed December 29, 2020.

[0002] TECHNICAL FIELD This disclosure relates to video encoding and decoding. [Background technology]

[0003] Digital video capabilities may 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-book readers, digital cameras, digital recording devices, digital media players, video gaming devices, video game consoles, cellular or satellite radiotelephones, so-called "smartphones," video teleconferencing devices, video streaming devices, and the like. Digital video devices implement video coding techniques, such as those described in standards defined by MPEG-2, MPEG-4, ITU-T H.263, ITU-T H.264 / MPEG-4, Part 10, Advanced Video Coding (AVC), ITU-T H.265 / High Efficiency Video Coding (HEVC), and extensions to such standards. By implementing such video coding techniques, video devices may more efficiently transmit, receive, encode, decode, and / or store digital video information.

[0004] Video coding techniques include spatial (intra-picture) prediction and / or temporal (inter-picture) prediction to reduce or remove redundancy inherent in video sequences. For block-based video coding, a video slice (e.g., a video picture or a portion of a video picture) may be partitioned into video blocks, which may also be referred to as coding tree units (CTUs), coding units (CUs), and / or coding nodes. Video blocks in an intra-coded (I) slice of a picture are encoded using spatial prediction with respect to reference samples in neighboring blocks in the same picture. Video blocks in an inter-coded (P or B) slice of a picture may use spatial prediction with respect to reference samples in neighboring blocks in the same picture or temporal prediction with respect to reference samples in other reference pictures. A picture may be referred to as a frame, and a reference picture may be referred to as a reference frame. [Prior art documents] [Patent documents]

[0005] [Patent Document 1] U.S. Provisional Patent Application No. 63 / 129,221 Summary of the Invention [Problem to be solved by the invention]

[0006] The video decoder may be configured to perform template matching. When decoding video data according to the template matching mode, some or all of the motion information for the block is not signaled, but instead is derived by the video decoder. Template matching may be performed for one or both of selecting a motion vector candidate from a candidate list or motion vector refinement. Template matching may be applied in both advanced motion vector predictor (AMVP) mode and normal merge mode. In the AMVP mode, a motion vector predictor (MVP) candidate may be selected from a list of candidates using template matching to identify a candidate in the list that has the smallest difference between the current block template and the reference block template. In the normal merge mode, a template matching mode flag may be signaled to indicate the use of template matching, and template matching may then be used for motion vector refinement of a motion vector selected from the merge candidate list.

[0007] When performing template matching, the video decoder finds the closest match between a reference template in the current picture (a neighboring block above and / or to the left of the current CU) and a corresponding template region in a reference picture search area that is the same size as the reference template. The search area in the reference picture may be identified for the current CU, for example.

[0008] As introduced above, a video decoder may be configured to perform motion vector refinement. Some motion vector refinement processes utilize a pattern-based motion vector search process that may include a hierarchical structure. Using a specified search pattern, the video decoder determines a template matching cost for a reference template and corresponding template regions in a current picture. The hierarchical structure specifies an iterative process for motion refinement that starts at a coarse precision (e.g., 1 / 4 pel) and ends at a fine precision (e.g., 1 / 8 pel). In one example, the video decoder may be configured to first search for motion vectors at 1 / 4 luma sample precision using a diamond pattern, followed by 1 / 4 luma sample precision using a cross pattern, and then 1 / 8 luma sample precision using a cross pattern.

[0009] Starting the motion vector refinement process with a step size of 1 / 4 pel may introduce both undesirable complexity and rounding errors in some coding scenarios, regardless of whether the motion vector precision of the motion vector is improved. This may result in lower performance in terms of coding gain for those coding scenarios. To address this potential problem, this disclosure describes techniques for aligning the finest motion vector precision used in template matching with the motion vector precision of the motion vector being refined. By iteratively reducing the step size from an initial step size until the step size is set to a final step size equal to the motion vector precision, the techniques of this disclosure may yield the advantage of reducing the complexity and rounding errors introduced by the motion vector refinement process. [Means for solving the problem]

[0010] According to one example, a device for decoding video data includes one or more processors implemented in a circuit configuration, the one or more processors are configured to: determine that a current block of a current picture is coded in an inter prediction mode; determine a motion vector for the current block based on the inter prediction mode; determine a motion vector accuracy for the motion vector; identify a current block template in the current picture; and search within a search area for a final reference block template corresponding to the current block template, where to search within the search area, the one or more processors are further configured to identify an initial reference block template based on the motion vector, search other reference block templates around the initial reference block template using a step size set to the initial step size, and iteratively reduce the step size from the initial step size until the step size is set to a final step size equal to the motion vector accuracy; determine a predictive block for the current block based on the final reference block template; decode the current picture based on the determined predictive block; and output a decoded version of the current picture.

[0011] According to another example, a method for decoding video data includes determining that a current block of a current picture is coded in an inter-prediction mode, determining a motion vector for the current block based on the inter-prediction mode, determining a motion vector accuracy for the motion vector, identifying a current block template in the current picture, searching within a search area for a final reference block template corresponding to the current block template, where searching within the search area comprises identifying an initial reference block template based on the motion vector, searching other reference block templates around the initial reference block template using a step size set to the initial step size, and iteratively reducing the step size from the initial step size until the step size is set to a final step size equal to the motion vector accuracy, determining a predictive block for the current block based on the final reference block template, decoding the current picture based on the determined predictive block, and outputting a decoded version of the current picture.

[0012] According to another example, a computer-readable storage medium stores instructions that, when executed by one or more processors, cause the one or more processors to determine that a current block of a current picture is coded in an inter prediction mode, determine a motion vector for the current block based on the inter prediction mode, determine a motion vector accuracy for the motion vector, identify a current block template in the current picture, and search within a search area for a final reference block template corresponding to the current block template, where to search within the search area, the instructions cause the one or more processors to identify an initial reference block template based on the motion vector, search other reference block templates around the initial reference block template using a step size set to the initial step size, and iteratively reduce the step size from the initial step size until the step size is set to a final step size equal to the motion vector accuracy, determine a predictive block for the current block based on the final reference block template, decode the current picture based on the determined predictive block, and output a decoded version of the current picture.

[0013] According to another example, a device for decoding video data includes means for determining that a current block of a current picture is coded in an inter prediction mode, means for determining a motion vector for the current block based on the inter prediction mode, means for determining a motion vector accuracy for the motion vector, means for identifying a current block template in the current picture, and means for searching within a search area for a final reference block template corresponding to the current block template, wherein the means for searching within the search area includes means for identifying an initial reference block template based on the motion vector, means for searching other reference block templates around the initial reference block template using a step size set to the initial step size, and means for iteratively reducing the step size from the initial step size until the step size is set to a final step size equal to the motion vector accuracy, means for determining a predictive block for the current block based on the final reference block template, means for decoding the current picture based on the determined predictive block, and means for outputting a decoded version of the current picture.

[0014] The details of one or more examples are set forth in the accompanying drawings and the description below. Other features, objects, and advantages will become apparent from the description, drawings, and claims. [Brief description of the drawings]

[0015] [Figure 1] FIG. 1 is a block diagram illustrating an example video encoding and decoding system that may implement the techniques of this disclosure. [Figure 2A] FIG. 1 is a conceptual diagram illustrating an exemplary quad-tree binary tree (QTBT) structure. [Figure 2B] FIG. 2 is a conceptual diagram illustrating a corresponding coding tree unit (CTU). [Figure 3A] FIG. 1 is a conceptual diagram illustrating spatial motion vector candidates for merge mode. [Figure 3B]FIG. 2 is a conceptual diagram showing spatial motion vector candidates for Advanced Motion Vector Prediction (AMVP) mode. [Figure 4A] FIG. 13 is a conceptual diagram showing temporal motion vector candidates. [Figure 4B] FIG. 1 is a conceptual diagram showing motion vector scaling. [Diagram 5] FIG. 2 illustrates an exemplary template matching process. [Figure 6] FIG. 13 is a diagram illustrating an example of motion vector difference versus time distance. [Figure 7] FIG. 13 is a diagram illustrating an example of motion vector difference versus time distance. [Figure 8] FIG. 2 illustrates an exemplary search pattern for two-way matching. [Figure 9] FIG. 1 illustrates an exemplary decode-side motion vector refinement process. [Figure 10] FIG. 13 illustrates an example of a merge mode with motion vector difference (MMVD) search points. [Figure 11] 1 is a block diagram illustrating an example video encoder that may perform the techniques of this disclosure. [Figure 12] 1 is a block diagram illustrating an example video decoder that may perform the techniques of this disclosure. [Figure 13] 11 is a flowchart illustrating an example process for encoding a current block in accordance with techniques of this disclosure. [Figure 14] 10 is a flowchart illustrating an example process for decoding a current block in accordance with techniques of this disclosure. [Figure 15] 10 is a flowchart illustrating an example process for decoding a current block in accordance with techniques of this disclosure. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0016] Video coding (e.g., video encoding and / or video decoding) typically involves predicting blocks of video data from either already coded blocks of video data in the same picture (e.g., intra prediction) or already coded blocks of video data in a different picture (e.g., inter prediction). In some instances, the video encoder also calculates residual data by comparing the predicted block to the original block. The residual data thus represents the difference between the predicted block and the original block. To reduce the number of bits required to signal the residual data, the video encoder transforms and quantizes the residual data and signals the transformed and quantized residual data in the encoded bitstream. The compression achieved by the transform and quantization processes may be lossy, meaning that the transform and quantization processes may introduce distortions into the decoded video data.

[0017] A video decoder decodes the residual data and adds it to the predictive block to generate a reconstructed video block that matches the original video block more closely than the predictive block alone. Due to losses introduced by transforming and quantizing the residual data, the originally reconstructed block may have distortions or artifacts. One common type of artifact or distortion is called blockiness, where boundaries of blocks used to code the video data are visible.

[0018] To further improve the quality of the decoded video, the video decoder may perform one or more filtering operations on the reconstructed video blocks. Examples of these filtering operations include deblocking filtering, sample adaptive offset (SAO) filtering, and adaptive loop filtering (ALF). Parameters for these filtering operations may either be determined by the video encoder and explicitly signaled in the encoded video bitstream, or may be implicitly determined by the video decoder without the parameters having to be explicitly signaled in the encoded video bitstream.

[0019] The video decoder may be configured to perform template matching. With this mode, some or all of the motion information for a block is not signaled, but instead is derived by the video decoder. Template matching may be performed for one or both of selecting a motion vector candidate from a candidate list or motion vector refinement. Template matching may be applied in both advanced motion vector predictor (AMVP) mode and normal merge mode. In AMVP mode, a motion vector predictor (MVP) candidate may be selected from a list of candidates using template matching to identify a candidate in the list that has the smallest difference between the current block template and the reference block template. In normal merge mode, a template matching mode flag may be signaled to indicate the use of template matching, and template matching may then be used for motion vector refinement of a motion vector selected from the merge candidate list.

[0020] When performing template matching, the video decoder finds the closest match between a reference template in the current picture (a neighboring block above and / or to the left of the current CU) and a corresponding template region in a reference picture search area that is the same size as the reference template. The search area in the reference picture may be identified for the current CU, for example.

[0021] As introduced above, a video decoder may be configured to perform motion vector refinement. Motion vector refinement is a pattern-based motion vector search process with a hierarchical structure. Using a specified search pattern, the video decoder determines a template matching cost for a reference template and corresponding template regions in a current picture. The hierarchical structure specifies an iterative process for motion refinement that starts at a coarse precision (e.g., 1 / 4 pel) and ends at a fine precision (e.g., 1 / 8 pel). In one example, the video decoder may be configured to first search for a motion vector at 1 / 4 luma sample precision using a diamond pattern, followed by 1 / 4 luma sample precision using a cross pattern, and then 1 / 8 luma sample precision using a cross pattern. The search range for motion vector refinement may be set, for example, equal to (-8, +8) luma samples around the initial motion vector.

[0022] Starting the motion vector refinement process with a step size of 1 / 4 pel may introduce both undesirable complexity and rounding errors in some coding scenarios, which may result in poorer performance in terms of coding gain for those coding scenarios. To address this potential issue, this disclosure describes techniques for aligning the finest motion vector precision used in template matching with the motion vector precision of the motion vector being refined. That is, for a determined motion vector precision (i.e., 4-pel, 1-pel, 1 / 2-pel, 1 / 4-pel, 1 / 8-pel, 1 / 16-pel, etc. for all power-of-two precisions), the video decoder may be configured such that the template matching refinement process stops at and does not exceed the same motion vector precision as the precision of the motion vector specified. Thus, the template matching refinement type motion vector has a motion vector precision equal to or greater than the motion vector precision of the initial motion vector.

[0023] The initial step size of the template matching motion vector refinement process using the hierarchical search pattern may be determined based on the motion vector precision of the initial motion vector. The initial step size may be the same precision as the precision of the initial motion vector or somewhat larger. In general, when the initial motion vector has a motion vector precision of N-pels (e.g., N is a power of 2, including 4, 1, ½, ¼, ⅛, ⅛6), the initial step size may be M-pels, and M-pels is set equal to or somewhat larger than N, 2N, 4N with a power of 2 scale. By iteratively reducing the step size from the initial step size until the step size is set to a final step size equal to the motion vector precision, the technique of this disclosure may produce the advantages of reducing the complexity and rounding errors described above.

[0024] This disclosure generally describes techniques related to decoder-side motion vector derivation techniques, such as template matching, bi-directional matching, and decoder-side MV refinement. Although these techniques are referred to as being performed at the decoder side, it should be understood that the decoder-side motion vector derivation techniques described herein may also be performed by a video encoder as part of determining how to encode a block of video data. The techniques of this disclosure may be applied to any of the existing video codecs, such as High Efficiency Video Coding (HEVC), Versatile Video Coding (VVC), Essential Video Coding (EVC), or may be efficient coding tools in future video coding standards.

[0025] 1 is a block diagram illustrating an example video encoding and decoding system 100 that may perform techniques of this disclosure. The techniques of this disclosure are generally directed to coding (encoding and / or decoding) video data. In general, video data includes any data for processing video. Thus, video data may include raw uncoded video, coded video, decoded (e.g., reconstructed) video, and video metadata, such as signaling data.

[0026] 1, 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, source device 102 provides video data to destination device 116 via a computer-readable medium 110. Source device 102 and destination device 116 may comprise any of a wide range of devices, including desktop computers, notebook (i.e., laptop) computers, mobile devices, tablet computers, set-top boxes, telephone handsets such as smartphones, televisions, cameras, display devices, digital media players, video gaming consoles, video streaming devices, broadcast receiver devices, and the like. In some cases, source device 102 and destination device 116 may be equipped for wireless communication and therefore may be referred to as wireless communication devices.

[0027] In the example of FIG. 1, source device 102 includes a video source 104, memory 106, video encoder 200, and output interface 108. Destination device 116 includes an input interface 122, a video decoder 300, memory 120, and a display device 118. According to this disclosure, the video encoder 200 of source device 102 and the video decoder 300 of destination device 116 may be configured to apply the decoder-side motion vector derivation techniques described herein. Thus, source device 102 represents an example of a video encoding device, and destination device 116 represents an example of a video decoding device. In other examples, the source device and destination device may include other components or configurations. 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.

[0028] System 100 as shown in FIG. 1 is merely an example. In general, any digital video encoding and / or decoding device may perform the decoder-side motion vector derivation techniques described herein. Source device 102 and destination device 116 are merely examples of coding devices, such that source device 102 generates coded video data for transmission to destination device 116. This disclosure refers to a "coding" device as a device that performs coding (encoding and / or decoding) of data. Thus, video encoder 200 and video decoder 300 represent examples of coding devices, specifically, video encoders and video decoders, respectively. In some examples, source device 102 and destination device 116 may operate substantially symmetrically, such that each of source device 102 and destination device 116 includes video encoding and decoding components. Thus, system 100 may support one-way or two-way video transmission between source device 102 and destination device 116, for example, video streaming, video playback, video broadcasting, or video telephony.

[0029] In general, video source 104 represents a source of video data (i.e., raw, unencoded video data) and provides a continuous series of pictures (also called “frames”) of the video data to video encoder 200, which encodes the data for the pictures. Video source 104 of source device 102 may include a video capture device, such as a video camera, a video archive containing previously captured raw video, and / or a video feed interface for receiving video from a video content provider. As a further alternative, video source 104 may generate computer graphics-based data as source video, or a combination of live video, archived video, and computer-generated video. In each case, video encoder 200 encodes the captured video data, pre-captured video data, or computer-generated video data. Video encoder 200 may reorder the pictures from the order in which they were received (sometimes called “display order”) to a coding order for coding. Video encoder 200 may generate a bitstream including the encoded video data. The source device 102 may then output the encoded video data onto a computer-readable medium 110 via an output interface 108, for receipt and / or retrieval by an input interface 122 of the destination device 116, for example.

[0030] The memory 106 of the source device 102 and the memory 120 of the destination device 116 represent general-purpose memories. In some examples, the memories 106, 120 may store raw video data, e.g., raw video from the video source 104 and raw decoded video data from the video decoder 300. Additionally or alternatively, the memories 106, 120 may store software instructions executable by, e.g., the video encoder 200 and the video decoder 300, respectively. Although the memories 106 and 120 are shown separate from the video encoder 200 and the video decoder 300 in this example, it should be understood that the video encoder 200 and the video decoder 300 may also include internal memories for functionally similar or equivalent purposes. Additionally, the memories 106, 120 may store encoded video data, e.g., the output from the video encoder 200 and the input to the video decoder 300. In some examples, portions of the memories 106, 120 may be allocated as one or more video buffers, for example, for storing raw decoded video data and / or encoded video data.

[0031] The computer-readable medium 110 may represent any type of medium or device capable of transporting 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 that allows 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 a computer-based network. The output interface 108 may modulate a transmission signal including the encoded video data, and the input interface 122 may demodulate a received transmission signal according to a communication standard, such as a wireless communication protocol. The communication medium may comprise any wireless or wired communication medium, such as a radio frequency (RF) spectrum or one or more physical transmission lines. The communication medium may form 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 to facilitate communication from the source device 102 to the destination device 116.

[0032] In some examples, source device 102 may output the encoded data from output interface 108 to storage device 112. Similarly, destination device 116 may access the 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 drive, a Blu-ray disc, a DVD, a CD-ROM, flash memory, volatile or non-volatile memory, or any other suitable digital storage medium for storing encoded video data.

[0033] In some examples, source device 102 may output the encoded video data to a file server 114 or another intermediate storage device, which may store the encoded video data generated by source device 102. Destination device 116 may access the stored video data from file server 114 via streaming or download.

[0034] The file server 114 may be any type of server device capable of storing encoded video data and transmitting the encoded video data to a destination device 116. The file server 114 may represent a web server (e.g., for a website), a server configured to provide file transfer protocol services (such as File Transfer Protocol (FTP) or File Delivery over Unidirectional Transport (FLUTE) protocol), 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. The 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), HTTP Dynamic Streaming, etc.

[0035] Destination device 116 may access the encoded video data from file server 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., a digital subscriber line (DSL), a cable modem, etc.), or a combination of both suitable for accessing encoded video data stored on file server 114. Input interface 122 may be configured to operate according to any one or more of the various protocols discussed above for retrieving or receiving media data from file server 114 or other such protocols for retrieving media data.

[0036] The output interface 108 and the input interface 122 may represent wireless transmitters / receivers, modems, wired networking components (e.g., Ethernet cards), wireless communication components operating according to any of the various IEEE 802.11 standards, or other physical components. In examples in which the output interface 108 and the input interface 122 comprise wireless components, the output interface 108 and the input interface 122 may be configured to transfer data, such as encoded video data, according to a cellular communication standard, such as 4G, 4G-LTE (Long Term Evolution), LTE Advanced, 5G, etc. In some examples in which the output interface 108 comprises a wireless transmitter, the output interface 108 and the input interface 122 may be configured to transfer data, such as encoded video data, according to other wireless standards, such as the IEEE 802.11 specification, the IEEE 802.15 specification (e.g., ZigBee™), the Bluetooth™ standard, etc. In some examples, the source device 102 and / or the destination device 116 may include respective system-on-chip (SoC) devices. For example, the source device 102 may include a SoC device for performing functionality attributed to the video encoder 200 and / or the output interface 108, and the destination device 116 may include a SoC device for performing functionality attributed to the video decoder 300 and / or the input interface 122.

[0037] The techniques of this disclosure may be applied to video coding to support any of a variety of multimedia applications, such as over-the-air television broadcast, cable television transmission, satellite television transmission, Internet streaming video transmission such as Dynamic Adaptive Streaming over HTTP (DASH), digital video being encoded on a data storage medium, decoding of digital video stored on a data storage medium, or other applications.

[0038] An input interface 122 of the destination device 116 receives an encoded video bitstream from a computer-readable medium 110 (e.g., a communication medium, a storage device 112, a file server 114, etc.). The encoded video bitstream may include signaling information defined by the video encoder 200 that is also used by the video decoder 300, such as syntax elements having values ​​that describe characteristics and / or processing of video blocks or other coded units (e.g., slices, pictures, groups of pictures, sequences, etc.). The display device 118 displays decoded pictures of the decoded video data to a user. The display device 118 may represent any of a variety of 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.

[0039] 1, in some examples, the video encoder 200 and the video decoder 300 may each be integrated with an audio encoder and / or an audio decoder and may include appropriate MUX-DEMUX units, or other hardware and / or software, to process multiplexed streams that include both audio and video in a common data stream. Where applicable, the MUX-DEMUX units may conform to the ITU H.223 multiplexer protocol or other protocols, such as the User Datagram Protocol (UDP).

[0040] The video encoder 200 and the video decoder 300 may each be implemented as any of a variety of suitable encoder and / or decoder circuit configurations, 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 implemented partially in software, the device may store instructions for the software on a suitable non-transitory 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 the video decoder 300 may be included in one or more encoders or decoders, any of which may be integrated as part of a combined encoder / decoder (codec) in the respective device. The device including the video encoder 200 and / or the video decoder 300 may comprise an integrated circuit, a microprocessor, and / or a wireless communication device such as a cellular phone.

[0041] Video encoder 200 and video decoder 300 may operate according to a video coding standard, such as ITU-T H.265, also known as High Efficiency Video Coding (HEVC), or extensions thereof, such as range extension, multiview extension (MV-HEVC), or scalable extension (SHVC). Additionally or alternatively, video encoder 200 and video decoder 300 may operate according to other proprietary or industry standards, such as ITU-T H.266, also known as Versatile Video Coding (VVC).

[0042] In general, the video encoder 200 and the video decoder 300 may perform block-based coding of pictures. The term “block” generally refers to a structure that includes data to be processed (e.g., encoded, decoded, or otherwise used in an encoding and / or decoding process). For example, a block may include a two-dimensional matrix of samples of luminance and / or chrominance data. In general, the video encoder 200 and the video decoder 300 may code video data represented in a YUV (e.g., Y, Cb, Cr) format. That is, rather than coding red, green, and blue color (RGB) data for samples of a picture, the video encoder 200 and the video decoder 300 may code luminance and chrominance components, where the chrominance components may include chrominance components of both red and blue colors. In some examples, the video encoder 200 converts the received RGB formatted data to a YUV representation before encoding, and the video decoder 300 converts the YUV representation to an RGB format. Alternatively, pre-processing and post-processing units (not shown) may perform these transformations.

[0043] This disclosure may generally refer to coding (e.g., encoding and decoding) a picture to include the process of encoding or decoding data for a picture. Similarly, this disclosure may refer to coding of a block of a picture, e.g., predictive and / or residual coding, to include the process of encoding or decoding data for the block. A coded video bitstream generally includes a set of values ​​for syntax elements that represent coding decisions (e.g., coding modes) and partitioning of a picture into blocks. Thus, references to coding a picture or a block should generally be understood as coding values ​​for the syntax elements that form the picture or block.

[0044] HEVC defines various blocks, including coding units (CUs), prediction units (PUs), and transform units (TUs). According to HEVC, a video coder (such as video encoder 200) partitions coding tree units (CTUs) into CUs according to a quadtree structure. That is, the video coder partitions CTUs and CUs into four equal non-overlapping squares, and each node of the quadtree has either zero or four child nodes. A node with no child nodes may be called a "leaf node", and a CU of such a leaf node may include one or more PUs and / or one or more TUs. A video coder may further partition PUs and TUs. For example, in HEVC, a residual quadtree (RQT) represents a partition of TUs. In HEVC, a PU represents inter-predicted data, and a TU represents residual data. An intra-predicted CU includes intra-prediction information, such as an intra-mode indication.

[0045] As another example, the video encoder 200 and the video decoder 300 may be configured to operate according to VVC. According to VVC, a video coder (such as the video encoder 200) partitions a picture into multiple coding tree units (CTUs). The video encoder 200 may partition the CTUs according to a tree structure, such as a quad-tree binary tree (QTBT) structure or a multi-type tree (MTT) structure. The QTBT structure eliminates the concept of multiple partition types, such as the separation between CUs, PUs, and TUs in HEVC. The QTBT structure includes two levels, a first level partitioned according to a quad-tree partition, and a second level partitioned according to a binary tree partition. The root node of the QTBT structure corresponds to a CTU. The leaf nodes of the binary tree correspond to CUs.

[0046] In the MTT partitioning structure, blocks may be partitioned using quad tree (QT) partitioning, binary tree (BT) partitioning, and one or more types of triple tree (TT) (also called ternary tree (TT)) partitioning. A triple tree partitioning or ternary tree partitioning is a partitioning in which a block is divided into three sub-blocks. In some examples, a triple tree partitioning or ternary tree partitioning divides a block into three sub-blocks without splitting the original block through the center. The partition types in MTT (e.g., QT, BT, and TT) may be symmetric or asymmetric.

[0047] In some examples, the video encoder 200 and the video decoder 300 may use a single QTBT or MTT structure to represent each of the luminance and chrominance components, while in other examples, the video encoder 200 and the video decoder 300 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 each chrominance component).

[0048] Video encoder 200 and video decoder 300 may be configured to use quadtree partitioning, QTBT partitioning, MTT partitioning, or other partition structures according to HEVC. For purposes of illustration, the description of the techniques of this disclosure is presented with respect to QTBT partitioning. However, it should be understood that the techniques of this disclosure may also be applied to video coders configured to use quadtree partitioning or other types of partitioning.

[0049] In some examples, the CTU includes a coding tree block (CTB) of luma samples, two corresponding CTBs of chroma samples for a picture with three sample arrays, or a CTB of samples for a monochrome picture, or a picture encoded using three separate color planes and syntax structures used to code the samples. The CTB may be an N×N block of samples for some value of N such that the division of the components into the CTB is partitioned. A component is an array or a single sample from one of the three arrays (luma and two chromas) that make up a picture in 4:2:0, 4:2:2, or 4:4:4 color format, or an array or a single sample of an array that creates a picture in monochrome format. In some examples, the coding block is an M×N block of samples for some value of M and N such that the division of the CTB into the coding block is partitioned.

[0050] Blocks (e.g., CTUs or CUs) may be grouped in various ways within a picture. As an example, a brick may refer to a rectangular region of a CTU row within a particular tile within a picture. A tile may be a rectangular region of CTUs within a particular tile column and a particular tile row within a picture. A tile column refers to a rectangular region of CTUs with a height equal to the height of the picture and a width specified by a syntax element (e.g., in a picture parameter set). A tile row refers to a rectangular region of CTUs with a height specified by a syntax element (e.g., in a picture parameter set) and a width equal to the width of the picture.

[0051] In some examples, a tile may be partitioned into multiple bricks, each of which may include one or more CTU rows within the tile. A tile that is not partitioned into multiple bricks may also be referred to as a brick. However, a brick that is a true subset of a tile may not be referred to as a tile.

[0052] The bricks in a picture may also be arranged into slices. A slice may be an integer number of bricks of a picture that may be contained exclusively within a single Network Abstraction Layer (NAL) unit. In some examples, a slice includes either several complete tiles or only a contiguous sequence of complete bricks of one tile.

[0053] This disclosure may use "NxN" and "N by N" interchangeably, e.g., 16x16 samples or 16 by 16 samples, to refer to the sample dimensions of a block (such as a CU or other video block) in terms of the vertical and horizontal dimensions. In general, a 16x16 CU has 16 samples in the vertical direction (y=16) and 16 samples in the horizontal direction (x=16). Similarly, an NxN CU generally has N samples in the vertical direction and N samples in the horizontal direction, where N represents a non-negative integer value. Samples in a CU may be arranged in rows and columns. Moreover, a CU does not necessarily have to have the same number of samples in the horizontal direction as in the vertical direction. For example, a CU may comprise NxM samples, where M is not necessarily equal to N.

[0054] The video encoder 200 encodes video data for a CU that represents prediction and / or residual information, as well as other information. The prediction information indicates how the CU will be predicted to form a predictive block for the CU. The residual information generally represents sample-by-sample differences between samples of the CU and samples of the predictive block before encoding.

[0055] To predict a CU, video encoder 200 may generally form a predictive block for the CU through inter-prediction or intra-prediction. Inter-prediction generally refers to predicting a CU from data of a previously coded picture, and intra-prediction generally refers to predicting a CU from previously coded data of the same picture. To perform inter-prediction, video encoder 200 may generate a predictive block using one or more motion vectors. Video encoder 200 may generally perform a motion search to identify a reference block that closely matches the CU with respect to the difference between the CU and the reference block, for example. Video encoder 200 may calculate a difference metric using a sum of absolute differences (SAD), sum of squared differences (SSD), mean absolute difference (MAD), mean squared difference (MSD), or other such difference calculation to determine whether the reference block closely matches the current CU. In some examples, video encoder 200 may predict the current CU using unidirectional prediction or bidirectional prediction.

[0056] Some examples of VVC also provide an affine motion compensation mode, which may be considered an inter-prediction mode. In an affine motion compensation mode, the video encoder 200 may determine two or more motion vectors that represent non-translational motion, such as zooming in or out, rotation, viewpoint shifting, or other irregular motion types.

[0057] To perform intra prediction, the video encoder 200 may select an intra prediction mode to generate a prediction block. Some examples of VVC provide 67 intra prediction modes, including various orientation modes, as well as a planar mode and a DC mode. In general, the video encoder 200 selects an intra prediction mode that describes neighboring samples to a current block (e.g., a block of a CU) from which samples of the current block should be predicted. Such samples may generally be above, above and to the left, or to the left of the current block in the same picture as the current block, assuming that the video encoder 200 codes CTUs and CUs in raster scan order (left to right, top to bottom).

[0058] Video encoder 200 encodes data representing a prediction mode for the current block. For example, in the case of an inter prediction mode, video encoder 200 may encode data representing which of various available inter prediction modes is used as well as motion information for the corresponding mode. In the case of unidirectional or bidirectional inter prediction, for example, video encoder 200 may encode motion vectors using AMVP mode or merge mode. Video encoder 200 may use a similar mode to encode motion vectors for affine motion compensation modes.

[0059] Following prediction, such as intra- or inter-prediction, of a block, the video encoder 200 may compute residual data for the block. The residual data, such as a residual block, represents sample-by-sample differences between the block and a predictive block for that block formed using a corresponding prediction mode. The video encoder 200 may apply one or more transforms to the residual block to generate transform data in a transform domain rather than the sample domain. For example, the video encoder 200 may 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 may apply a secondary transform, such as a mode-dependent non-separable secondary transform (MDNSST), a signal-dependent transform, a Karhunen-Loeve transform (KLT), etc., following the initial transform. The video encoder 200 generates transform coefficients following application of the one or more transforms.

[0060] As mentioned above, following any transformation to generate transform coefficients, the video encoder 200 may 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 further compression. By performing a quantization process, the video encoder 200 may reduce the bit depth associated with some or all of the transform coefficients. For example, the video encoder 200 may truncate an n-bit value to an m-bit value during quantization, where n is greater than m. In some examples, to perform quantization, the video encoder 200 may perform a bitwise right shift of the value to be quantized.

[0061] Following quantization, the video encoder 200 may scan the transform coefficients to generate a one-dimensional vector from the two-dimensional matrix including the quantized transform coefficients. The scan may be designed to place transform coefficients of higher energy (and therefore lower frequency) at the front of the vector and transform coefficients of lower energy (and therefore higher frequency) at the back of the vector. In some examples, the video encoder 200 may utilize a default scan order to scan the quantized transform coefficients to generate the serialized vector and then entropy encode the quantized transform coefficients of the vector. In other examples, the video encoder 200 may perform an adaptive scan. After scanning the quantized transform coefficients to form the one-dimensional vector, the video encoder 200 may entropy encode the one-dimensional vector, for example, according to context-adaptive binary arithmetic coding (CABAC). The video encoder 200 may also entropy encode values ​​for syntax elements describing metadata associated with the encoded video data for use by the video decoder 300 in decoding the video data.

[0062] To perform CABAC, the video encoder 200 may assign a context in a context model to a symbol to be transmitted. The context may relate, for example, to whether neighboring values ​​of the symbol are zero-valued or not. The probability determination may be based on the context assigned to the symbol.

[0063] Video encoder 200 may further generate syntax data, such as block-based syntax data, picture-based syntax data, and sequence-based syntax data, among other syntax data, such as a picture header, a block header, a slice header, or a sequence parameter set (SPS), a picture parameter set (PPS), or a video parameter set (VPS), to video decoder 300. Video decoder 300 may similarly decode such syntax data to determine how to decode corresponding video data.

[0064] In this manner, video encoder 200 may generate a bitstream including encoded video data, e.g., syntax elements that describe partitions of a picture into blocks (e.g., CUs) and prediction and / or residual information for the blocks. Finally, video decoder 300 may receive the bitstream and may decode the encoded video data.

[0065] In general, video decoder 300 performs a reciprocal process to that performed by video encoder 200 to decode encoded video data of a bitstream. For example, video decoder 300 may decode values ​​for syntax elements of a bitstream using CABAC in a manner that is reciprocal but substantially similar to the CABAC encoding process of video encoder 200. The syntax elements may specify partition information for the partition of a picture into CTUs and the partition of each CTU according to a corresponding partition structure, such as a QTBT structure, to specify CUs of the CTUs. The syntax elements may further specify prediction and residual information for blocks (e.g., CUs) of video data.

[0066] The residual information may be represented, for example, by quantized transform coefficients. The video decoder 300 may inverse quantize and inverse transform the quantized transform coefficients of the block to reconstruct a residual block for the block. The video decoder 300 may use the signaled prediction mode (intra-prediction or inter-prediction) and associated prediction information (e.g., motion information for inter-prediction) to form a predictive block for the block. The video decoder 300 may then combine (sample-by-sample) the predictive block and the residual block to reconstruct the original block. The video decoder 300 may perform additional processing, such as performing a deblocking process to reduce visual artifacts along block boundaries.

[0067] This disclosure may generally refer to "signaling" some information, such as syntax elements. The term "signaling" may generally refer to communication of values ​​for syntax elements and / or other data used to decode encoded video data. That is, video encoder 200 may signal values ​​for syntax elements in a bitstream. Generally, signaling refers to generating values ​​in a bitstream. As mentioned above, source device 102 may transport the bitstream to destination device 116 in substantially real-time or not in real-time, as may be done when storing syntax elements in storage device 112 for later retrieval by destination device 116.

[0068] 2A and 2B are conceptual diagrams illustrating an exemplary quad-tree bi-tree (QTBT) structure 130 and corresponding coding tree unit (CTU) 132. Solid lines represent quad-tree partitioning, and dotted lines indicate bi-tree partitioning. At each partitioned (i.e., non-leaf) node of the bi-tree, one flag is signaled to indicate which partition type (e.g., horizontal or vertical) is used, where in this example, 0 indicates horizontal partitioning and 1 indicates vertical partitioning. For quad-tree partitioning, there is no need to indicate the partition type, since the quad-tree node divides the block horizontally and vertically into four sub-blocks of equal size. Thus, the video encoder 200 may encode and the video decoder 300 may decode syntax elements (e.g., partition information) for the region tree level (i.e., solid lines) of the QTBT structure 130 and syntax elements (e.g., partition information) for the prediction tree level (i.e., dashed lines) of the QTBT structure 130. Video data, such as prediction data and transformation data, for CUs represented by terminal leaf nodes of QTBT structure 130 may be encoded by video encoder 200 and decoded by video decoder 300.

[0069] 2B may be associated with parameters that define the size of blocks corresponding to nodes of the QTBT structure 130 at the first and second levels. These parameters may include a CTU size (representing the size of the CTU 132 in samples), a minimum quadtree size (MinQTSize, representing the minimum allowed quadtree leaf node size), a maximum bi-tree size (MaxBTSize, representing the maximum allowed bi-tree root node size), a maximum bi-tree depth (MaxBTDepth, representing the maximum allowed bi-tree depth), and a minimum bi-tree size (MinBTSize, representing the minimum allowed bi-tree leaf node size).

[0070] The root node of the QTBT structure corresponding to the CTU may have four child nodes at the first level of the QTBT structure, and each of the child nodes may be partitioned according to a quadtree partition. That is, the nodes at the first level are either leaf nodes (without child nodes) or have four child nodes. The example QTBT structure 130 represents such nodes including parent and child nodes with solid lines for branching. If the nodes at the first level are not larger than the maximum allowed binary tree root node size (MaxBTSize), the nodes may be further partitioned by their respective binary trees. The binary tree partitioning of one node may be repeated until the node resulting from the partitioning reaches the minimum allowed binary tree leaf node size (MinBTSize) or the maximum allowed binary tree depth (MaxBTDepth). The example QTBT structure 130 represents such nodes with dashed lines for branching. The binary tree leaf nodes are called CUs, and the CUs are used for prediction (e.g., intra-picture prediction or inter-picture prediction) and transformation without further partitioning. As explained above, a CU is sometimes called a "video block" or a "block."

[0071] In one example of a QTBT partitioning structure, the CTU size is set as 128x128 (luma samples and two corresponding 64x64 chroma samples), MinQTSize is set as 16x16, MaxBTSize is set as 64x64, MinBTSize (for both width and height) is set as 4, and MaxBTDepth is set as 4. To generate a quadtree leaf node, quadtree partitioning is first applied to the CTU. The quadtree leaf node may have a size from 16x16 (i.e., MinQTSize) to 128x128 (i.e., CTU size). If the quadtree leaf node is 128x128, the leaf quadtree node may not be further divided by the binary tree since the size exceeds MaxBTSize (i.e., 64x64 in this example). If not, the quadtree leaf node may be further partitioned by the binary tree. Thus, the quadtree leaf node is also the root node for the binary tree and has the binary tree depth as 0. Once the binary tree depth reaches MaxBTDepth (4 in this example), no further splits are allowed. A binary tree node with a width equal to MinBTSize (4 in this example) implies that no further vertical splits (i.e., width splits) are allowed for that binary tree node. Similarly, a binary tree node with a height equal to MinBTSize implies that no further horizontal splits (i.e., height splits) are allowed for that binary tree node. As mentioned above, the leaf nodes of the binary tree are called CUs and are further processed according to the prediction and transformation without further partitioning.

[0072] In HEVC, the largest coding unit in a slice is the CTB, also called the CTU. The CTB contains a quadtree, and the nodes of the quadtree are the CUs. The size of the CTB can typically range from 16x16 to 64x64 in the HEVC Main Profile, but in some scenarios, a CTB size of 8x8 may also be supported. The CUs can range in size from the same size as the CTB to as small as 8x8. Each CU is coded using one coding mode, e.g., an inter-coding mode or an intra-coding mode. When a CU is inter-coded, it may be further partitioned into two or four PUs, or may be just one PU if no further partitioning applies. When there are two PUs in one CU, the two PUs may be a rectangle with half the size, or two rectangles with ¼ or ¾ the size of the CU.

[0073] When a CU is inter-coded, each PU has one set of motion information derived using a unique inter prediction mode. In the HEVC standard, there are two inter prediction modes for a PU, called merge mode (skip mode is considered as a special case of merge mode) and AMVP mode, respectively.

[0074] In either the AMVP mode or the merge mode, the video encoder 200 and the video decoder 300 may be configured to maintain a motion vector (MV) candidate list, which includes multiple motion vector predictors. The video encoder 200 and the video decoder 300 may be configured to generate a motion vector, as well as a reference index in the merge mode, for a current PU by selecting a candidate from the MV candidate list.

[0075] In HEVC, the MV candidate list includes up to five candidates for merge mode and only two candidates for AMVP mode. The merge candidate may include a set of motion information, e.g., a motion vector corresponding to both the reference picture lists (list 0 and list 1) and a reference index. If a merge candidate is identified by the merge index, the video encoder 200 and the video decoder 300 may be configured to determine the reference picture used for prediction of the current block, as well as the associated motion vector, based on the selected candidate. In contrast, for the AMVP mode, for each possible prediction direction from either list 0 or list 1, a reference index is explicitly signaled along with the MV predictor (MVP) index to the MV candidate list. In the AMVP mode, the predicted motion vector may be further improved, e.g., by receiving a motion vector differential that may be added to the MVP. The candidates for the candidate list in both modes may be derived similarly from the same spatial and temporal neighboring blocks.

[0076] FIG. 3A is a conceptual diagram illustrating an example of spatially neighboring motion vector candidates for merge mode. Video decoder 300 may generate a candidate list by adding motion information of spatially neighboring candidates to the candidate list. Although spatial MV candidates are derived from neighboring blocks shown in FIG. 3A and FIG. 3B for a particular PU (PU0), the process for generating candidates from that block may be different for merge mode and AMVP mode. In merge mode, up to five spatial MV candidates may be derived for block 140 (PU0) with the order shown in FIG. 3A. The order is as follows, as shown in FIG. 3A: left (0), top (1), top right (2), bottom left (3), and top left (4).

[0077] FIG. 3B is a conceptual diagram showing an example of spatially adjacent motion vector candidates for AMVP. In AMVP mode, the neighboring blocks of block 142 (PU0) are divided into two groups, a left group including blocks 0 and 1, and an upper group including blocks 2, 3, and 4, as shown in FIG. 3B. For each group, possible candidates among the neighboring blocks that refer to the same reference picture as indicated by the signaled reference are prioritized to form the final candidate of the group. It may be that all neighboring blocks do not contain motion vectors that point to the same reference picture. Therefore, if such a candidate cannot be found, the first available candidate may be scaled to form the final candidate, allowing the temporal distance difference to be compensated.

[0078] Temporal motion vector prediction in HEVC is described next. Video encoder 200 and video decoder 300 may be configured to add a temporal motion vector predictor (TMVP) candidate into the MV candidate list after the spatial motion vector candidate is added, if enabled and available. The process of motion vector derivation for a TMVP candidate may be the same for both merge mode and AMVP mode. However, in HEVC, the target reference index for a TMVP candidate in merge mode may be set to 0.

[0079] Figure 4A is a conceptual diagram illustrating an example of a TMVP candidate for block 144 (PU0). The primary block location for TMVP candidate derivation is the outer, bottom-right block of the co-located PU, shown as block "T" in Figure 4A, to compensate for the bias towards the blocks above and to the left used to generate spatially neighboring candidates. However, if the block is currently located outside the CTB row or motion information is not available, the block is replaced with the center block of the PU.

[0080] The video decoder 300 may derive motion vectors for TMVP candidates from the co-located PUs of the co-located pictures, which are indicated at the slice level. The motion vectors for the co-located PUs are called co-located MVs. A block in a reference picture may be considered to be co-located with a block in a current picture, for example, if the block in the reference picture and the current block each include at least one pixel that corresponds to the same relative position in the reference picture and the current picture.

[0081] FIG. 4B is a conceptual timing diagram illustrating an example of the motion vector scaling process 146. Similar to the temporal direct mode in AVC, to derive TMVP candidate motion vectors, the video decoder 300 may scale the collocated MVs to compensate for the temporal distance difference, as shown in FIG. 4B. With motion vector scaling, it is generally assumed that the value of the motion vector is proportional to the distance of the pictures in presentation time. A motion vector relates two pictures, namely, a reference picture and a picture that contains the motion vector (i.e., a stored picture). When a motion vector is utilized to predict other motion vectors, the distance between the stored picture and the reference picture is calculated based on a picture order count (POC) value.

[0082] When a motion vector is predicted, the associated stored picture and reference picture may be different. Therefore, a new distance based on POC may be calculated, and the motion vector may be scaled based on the two POC distances. For spatially adjacent candidates, the stored pictures for the two motion vectors are the same, but the reference pictures are different. In HEVC, motion vector scaling is applied to both TMVP and AMVP for spatially and temporally adjacent candidates.

[0083] Video encoder 200 and video decoder 300 may be configured to perform artificial motion vector candidate generation. If the motion vector candidate list is not complete (e.g., has fewer than some predetermined number of candidates), artificial motion vector candidates are generated and inserted at the end of the list until the list has the specified number of candidates.

[0084] In merge mode, there are two types of artificial MV candidates: composite candidates, which are derived only for B slices, and zero motion vector candidates, which are used for AMVP if the first type does not provide enough artificial candidates.

[0085] For each pair of candidates already in the candidate list and having the necessary motion information, a bidirectional composite motion vector candidate is derived by combining the motion vector of the first candidate that references a picture in list 0 and the motion vector of the second candidate that references a picture in list 1.

[0086] The video encoder 200 and the video decoder 300 may be configured to perform a pruning process for candidate insertion. Candidates from different blocks may happen to be the same, which reduces the efficiency of the merge / AMVP candidate list. To solve this problem, the pruning process is applied. The pruning process compares one candidate against others in the current candidate list to avoid inserting the same candidate to some extent. To reduce complexity, the pruning process is applied only a limited number of times, rather than comparing each possible candidate with all other existing candidates.

[0087] The video encoder 200 and the video decoder 300 may be configured to perform template matching (TM) prediction. TM prediction is a special merge mode based on the frame rate up-conversion (FRUC) technique. In this mode, motion information for a block is not signaled but is derived at the decoder side. TM prediction may be applied to both AMVP mode and normal merge mode. In AMVP mode, MVP candidate selection is determined based on template matching that identifies the candidate that results in the smallest difference between the current block template and the reference block template. In normal merge mode, a TM mode flag may be signaled to indicate the use of TM, and then TM may be applied to the merge candidate indicated by the merge index for MV improvement.

[0088] FIG. 5 illustrates an exemplary template matching process being performed on a search area around an initial MV. As shown in FIG. 5, video encoder 200 and video decoder 300 may be configured to derive motion information of a current CU using template matching by finding the closest match between current template 148 (a neighboring block above and / or to the left of the current CU) in current picture 150 and a template in reference template 152 for a reference block (the same size as that template) in reference picture 154. With an AMVP candidate selected based on the initial matching error, video encoder 200 and video decoder 300 may improve the MVP using template matching. With a merge candidate indicated by a signaled merge index, merged MVs corresponding to L0 and L1 may be independently improved by template matching. Less accurate ones of the merged MVs may then be further improved based on the merged more accurate MVs.

[0089] The video encoder 200 and the video decoder 300 may be configured to implement a cost function. When the motion vector points to a fractional sample position, motion compensated interpolation is needed. To reduce complexity, bilinear interpolation may be used instead of the usual 8-tap DCT-IF interpolation for both template matching to generate the template in the reference picture. An exemplary matching cost C for template matching is as follows:

[0090]

number

[0091] where w is a weighting factor empirically set to 4, and MV and MV s Let ,denote the MV currently being tested and the initial MV (e.g., the MVP candidate in AMVP mode, or the merged MV in merge mode), respectively.,The SAD is used as the matching cost of template matching.

[0092] When TM is used, the video encoder 200 and the video decoder 300 may be configured to refine the motion vectors (e.g., initial MV) using only luma samples. However, the motion vectors determined based on the refinement may be used for both luma and chroma for MC inter prediction. After the MV is determined, the final MC may be performed using an 8-tap interpolation filter for luma and a 4-tap interpolation filter for chroma.

[0093] The video encoder 200 and the video decoder 300 may be configured to perform a search process. The MV refinement may include a pattern-based MV search process that utilizes a hierarchical structure with a criterion of template matching cost. Two search patterns are supported for the MV refinement: diamond search and cross search. The hierarchical structure specifies an iterative process for refinement of the MV, starting at a coarse MVD precision (e.g., 1 / 4-pel) and ending at a finer precision (e.g., 1 / 8-pel). For example, a 1 / 4-pel MV precision implies that a template matching process is performed on a search area around the initial MV to identify the refined MV, where the search step size uses 1 / 4 of the luma sample distance (or resolution) (between the initial MV and the refined MV) as the MVD precision. The MV is directly searched at 1 / 4 luma sample MVD precision using the diamond pattern, followed by 1 / 4 luma sample MVD precision using the cross pattern, and then followed by 1 / 8 luma sample MVD refinement using the cross pattern. The search range for MV improvement is set equal to (-8, +8) luma samples around the initial MV. When the current block is bi-predictive, both MVs are improved independently, and then the best one among them (in terms of matching cost) is set as the priority for further improving the other MV with the BCW weight value.

[0094] The video encoder 200 and the video decoder 300 may be configured to perform bidirectional matching prediction. Bidirectional matching (BM) prediction, also called bidirectional merging, is another merging mode based on the FRUC technique. When applying the BM mode to a block, the video encoder 200 and the video decoder 300 may derive two initial motion vectors MV0 and MV1 using the signaled merge candidate index to select a merge candidate in the constructed merge list. When implementing bidirectional matching, the video encoder 200 and the video decoder 300 search around MV0 and MV1 and derive the final MV0′ and MV1′ based on the minimum bidirectional matching cost.

[0095] The motion vector differentials MVD0 (denoted by MV0'-MV0) and MVD1 (denoted by MV1'-MV1) pointing to two reference blocks may be proportional to the temporal distance (TD) between the current picture and the two reference pictures, e.g., TD0 and TD1. Figure 6 shows an example of MVD0 and MVD1, where the distance (TD1) between the current picture 156 and the reference picture 158 is four times the distance (TD0) between the current picture 156 and the reference picture 160. Figure 6 shows an example of MVD0 and MVD1 being proportional based on the temporal distance.

[0096] However, there is an optional design where MVD0 and MVD1 are mirror-reflective regardless of the temporal distances TD0 and TD1. Figure 7 shows an example where MVD0 and MVD1 are mirror-reflective regardless of the temporal distance (TD1) between the current picture 162 and the reference picture 164 and the temporal distance (TD0) between the current picture 162 and the reference picture 166. Figure 7 shows an example of mirror-reflective MVD0 and MVD1, where TD1 is four times TD0.

[0097] FIG. 8 shows an example of a 3×3 square search pattern in a search range [−8, 8] for performing bidirectional matching. When performing bidirectional matching, the video encoder 200 and the video decoder 300 may be configured to perform a local search around the initial MV0 and MV1 to derive the final MV0′ and MV1′. In the example of FIG. 8, the initial MV points to sample 170, and the final MV points to sample 172. The local search applies a 3×3 square search pattern to a loop through the search range [−8, 8]. Sample 174 represents an example of a sample in the search range around samples 170, 172, and sample 176. Sample 176 represents an example of a sample corresponding to an MV determined during a middle iteration of the search process. In each search iteration, the bidirectional matching costs of the surrounding eight MVs in the search pattern are calculated and compared with the bidirectional matching cost of the central MV. The MV with the smallest bidirectional matching cost becomes the new central MV in the next search iteration. The local search terminates when the current central MV has the minimum cost within a 3x3 square search pattern or when the local search reaches a predefined maximum search iterations.

[0098] The video encoder 200 and the video decoder 300 may be configured to perform decoder-side motion vector refinement (DMVR). In VVC, DMVR may be applied to improve the accuracy of the MV in the merge mode. In bi-predictive operation, the refined MV is searched around the initial MV in the reference picture list L0 and the reference picture list L1. The DMVR process calculates the distortion between two candidate blocks in the reference picture list L0 and the list L1.

[0099] Figure 9 shows an example of decoder-side motion vector refinement. As shown in Figure 9, the video encoder 200 and the video decoder 300 may be configured to calculate the SAD between the block 178 and the block 180 based on each MV candidate around the initial MV. The MV candidate with the smallest SAD becomes the refined MV and is used to generate the bi-predicted signal.

[0100] The improved MV derived by the DMVR process is used to generate inter prediction samples, which are also used in temporal motion vector prediction for future picture coding. The original MV is used in the deblocking process, but is also used in spatial motion vector prediction for future CU coding. DMVR is a sub-block-based merging mode with a default maximum processing unit of 16x16 luma samples. When the width and / or height of a CU is greater than 16 luma samples, the CU may be further divided into sub-blocks with width and / or height equal to 16 luma samples.

[0101] The video encoder 200 and the video decoder 300 may be configured to implement a search scheme. In the DVMR, the search points surround the initial MV, and the MV offset follows the MV difference mirroring rule. In other words, any point checked by the DMVR, indicated by a candidate MV pair (MV0, MV1), follows the following two formulas: MV0'=MV0+MV_offset MV1'=MV1-MV_offset where MV_offset represents the refinement offset between the initial MV in one of the reference pictures and the MV to be refined. In DMVR, the refinement search range is two integer luma samples from the initial MV. The search includes an integer sample offset search stage and a fractional sample refinement stage.

[0102] The video encoder 200 and the video decoder 300 may be configured to apply a 25-point full search for the integer sample offset search. The SAD of the initial MV pair is calculated first. If the SAD of the initial MV pair is smaller than a threshold, the integer sample offset search stage of the DMVR is terminated. Otherwise, the SAD of the remaining 24 points is calculated and checked in raster scan order. The point with the smallest SAD is selected as the output of the integer sample offset search stage. In order to reduce the uncertainty penalty of the DMVR improvement, it is proposed to prefer the original MV during the DMVR process. The SAD between the reference blocks referenced by the initial MV candidates is smaller by ¼ of the SAD value.

[0103] Following the integer sample search, the video encoder 200 and the video decoder 300 may be configured to perform fractional sample refinement. To save computational complexity, the fractional sample refinement is derived by using a parametric error surface equation rather than an additional search with SAD comparison. The fractional sample refinement is conditionally invoked based on the output of the integer sample search stage. When the integer sample search stage is terminated with the center having the smallest SAD in either the first iteration search or the second iteration search, the fractional sample refinement is further applied.

[0104] In parametric error surface based sub-pixel offset estimation, the center position cost and the costs at the four adjacent positions from the center are used to fit a 2D parabolic error surface equation of the following form: E(x,y)=A(xx min ) 2 +B(yy min ) 2 +C However, (x min ,y min ) corresponds to the fractional position with the lowest cost, and C corresponds to the minimum cost value. By solving the above equation using the cost values ​​of the five search points, (x min ,y min )but, xmin =(E(-1,0)-E(1,0)) / (2(E(-1,0)+E(1,0)-2E(0,0))) y min =(E(0,-1)-E(0,1)) / (2((E(0,-1)+E(0,1)-2E(0,0))) Since all the cost values ​​are positive and the minimum value is E(0,0), x min and y min The value of is automatically constrained to be between -8 and 8. This corresponds to a 1 / 2 pel offset with 1 / 16 pel MV precision in VVC. The calculated fraction (x min ,y min ) is added to the integer distance refinement MV to get the sub-pixel accuracy refinement delta MV.

[0105] The video encoder 200 and the video decoder 300 may be configured to perform bilinear interpolation and sample padding. In VVC, the maximum resolution of the MV is 1 / 16 luma samples. Samples at fractional positions are interpolated using an 8-tap interpolation filter. In DMVR, the search points surround the initial fractional pel MV with integer sample offsets, and therefore samples at those fractional positions need to be interpolated for the DMVR search process. To reduce computational complexity, a bilinear interpolation filter is used to generate fractional samples for the search process in DMVR. Another important effect is that by using a bilinear filter, with a search range of 2 samples, DVMR does not access more reference samples compared to the normal motion compensation process. After the improved MV is achieved using the DMVR search process, a normal 8-tap interpolation filter is applied to generate the final prediction. In order to not access more reference samples to the normal MC process, samples that are not needed for the original MV-based interpolation process but are needed for the improved MV-based interpolation process may be padded from their available samples.

[0106] Video encoder 200 and video decoder 300 may be configured to implement one or more enablement conditions for DMVR. In one example, video encoder 200 and video decoder 300 may be configured to enable DMVR if all of the following conditions are met, e.g., exist or are true: · CU level merge mode with bi-predictive MV. · For a current picture, there is one reference picture in the past and another in the future. · The distance from both reference pictures to the current picture (e.g., POC difference) is the same. The CU has more than 64 luma samples. · Both CU height and CU width are greater than or equal to 8 luma samples. · The BCW weight index indicates equal weights. · WP is not currently enabled for the block. · The combined intra and inter prediction (CIIP) mode is not used for the current block.

[0107] The video encoder 200 and the video decoder 300 may be configured to implement a merge mode with motion vector differential (MMVD). MMVD is a merge mode that allows for explicitly signaling additional motion vector differentials to improve the motion field of the merge mode. To indicate whether the MMVD mode is used for a CU, the MMVD flag may be signaled immediately after sending the skip flag, the merge flag, and the normal merge flag. In MMVD, after a merge candidate is selected, the merge candidate is further improved by the signaled MVD information. The further information includes a merge candidate flag, an index for specifying the magnitude of the motion, and an index for an indication of the motion direction. In the MMVD mode, one for the first two candidates in the merge list is selected to be used as the MV basis. A merge candidate flag is signaled to specify which merge candidate is used.

[0108] FIG. 10 shows an example of MMVD search points. Points 182 and 184 represent start points identified by the start MV. The other points correspond to refined motion vectors. The distance index specifies the motion magnitude information and indicates a predefined offset from the start point. As shown in FIG. 10, the offset may be added to either the horizontal or vertical component of the start MV. The relationship between the distance index and the predefined offset is 2 idx-2 where index (idx) is an integer ranging from 0 to 7. When the picture header syntax (e.g., pic_fpel_mmvd_enabled_flag) is set to enabled, the mapping from index to offset is 2 idx It can be modified to be:

[0109] The direction index represents the direction of the MVD relative to the starting point. The direction index can represent four directions as shown in the table below, where 00, 01, 10, and 11 indicate right, left, top, and bottom, respectively. The MVD code may change according to the type of the starting MV. When the starting MV is a non-predicted or bi-predicted MV with both list points to the same side of the current picture (i.e., when the POC of the two references are both greater than the POC of the current picture or both less than the POC of the current picture), the code in the table below specifies the sign of the MV offset added to the starting MV. When the starting MV is a bi-predicted MV with two MV points to different sides of the current picture (i.e., when the POC of one reference is greater than the POC of the current picture and the POC of the other reference is less than the POC of the current picture), the code in the table below specifies the sign of the MV offset added to the list 0 MV component of the starting MV, and the code for the list 1 MV has the opposite value.

[0110] [Table 1]

[0111] For example, previous techniques performing template matching (TM), such as those described above with respect to template matching prediction, may result in degraded performance when used with AMVP and merge modes. In AMVP mode, TM starts by improving an initial MV with a step size of 1 / 4 pel regardless of the MV precision of the adaptive motion vector resolution (AMVR). Nevertheless, to ensure that the improved MV has the expected precision from the AMVR (1 / 4 luma sample, 1 / 2 luma sample, integer luma sample, or 4 luma sample), the motion vector predictor for the CU in the previous techniques is rounded to the same precision as that of the MVD before being added together with the MVD. Thus, rounding errors in the improved MV may be unavoidable. In merge mode, TM acts as an independent mode that does not take into account possible combinations or interactions with other merge modes such as MMVD and bidirectional matching, resulting in lower performance in terms of coding gain. This disclosure describes techniques that may address these issues.

[0112] The video encoder 200 and the video decoder 300 may be configured to implement MV precision for the TM based on the AMVR. Techniques of this disclosure may align the finest MV precision of the TM with the indication of the AMVR. The TM always refines the initial MV with a step size of 1 / 4 pel, even when there is an explicit indication of the AMVR selection, as described above with respect to template matching prediction, resulting in potential rounding errors in the resulting refined MV. For example, if the initial MV is (0, 0) with an integer-pel AMVR, the TM refined MV may be (0.25, 0.25). Due to rounding, the TM refined MV may round to something other than what was searched, triggering unexpected rounding errors in the TM refined MV to the precision of the motion vector (e.g., as indicated with the AMVR), essentially wasting computational power dedicated to performing the decoder-side search. To avoid this potential source of error, this disclosure describes techniques for forcing the search step size of the TM to be aligned with the indicated AMVR. In particular, with a given AMVR mode (e.g., 4-pel, 1-pel, ½-pel, ¼-pel, ⅛-pel, 1 / 16-pel, etc., for all power-of-two precisions), the video encoder 200 and the video decoder 300 may be configured to stop the TM refinement process at the same MV precision indicated by the AMVR and not exceed that MV precision. In other words, the TM refined MV may be constrained to have an MV precision equal to or greater than, but not less than, the MV precision of the AMVR mode.

[0113] The video encoder 200 and the video decoder 300 may be configured to determine the initial step size of the TM MV improvement process using a hierarchical search pattern based on the MV accuracy of the AMVR mode. The initial step size may be the same precision as the accuracy of the AMVR or somewhat larger. In general, when the AMVR specifies an MV accuracy of N pels (e.g., N is a power of 2, including 4, 1, ½, ¼, ⅛, ⅛6), the initial step size may be, for example, M pels, where M pels is set equal to or somewhat larger than N, 2N, 4N with a power of 2 scale. Thus, the video encoder 200 and the video decoder 300 may be configured to implement a search process as described above for template matching prediction as a four-fold process.

[0114] First, the video encoder 200 or the video decoder 300 may search for an initial MV at a luma sample MV precision of M pels using a given search pattern (e.g., diamond, square, cross). Then, the video encoder 200 or the video decoder 300 may further improve the improved MV at the same luma sample MV precision of M pels using another search pattern, the same or different from that used in the previous process. Then, the video encoder 200 or the video decoder 300 may iteratively further improve the improved MV using a luma sample MV precision that is twice as fine as that of the previous iteration using the given search pattern (e.g., from n pels to n / 2 pels). The video encoder 200 or the video decoder 300 may continue the iterative process until the precision reaches the MV precision of N pels indicated by the AMVR.

[0115] In one example, given a ¼-pel AMVR coded block, the video encoder 200 or video decoder 300 may determine an initial step size of the TM MV refinement process to be equal to 1 pel. The video encoder 200 or video decoder 300 may then start the TM MV refinement process at 1 pel precision, followed by a second round of refinement at ½ pel precision, and stopped at a third round of refinement at ¼ pel precision.

[0116] In one example, the value of (M, N) can be (4, 4) for a 4-pel AMVR, (1, 1) for a 1-pel AMVR, (1, 1 / 2) for a 1 / 2-pel AMVR, (1, 1 / 4) for a 1 / 4-pel AMVR, (1, 1 / 8) for a 1 / 8-pel AMVR, and (1, 1 / 16) for a 1 / 16-pel AMVR. In some cases (e.g., merge mode), when the AMVR is not always explicitly indicated in the bitstream, the setting of (M, N) can be specified or predefined as (1, 1 / 4), (1, 1 / 8), or (1, 1 / 16) at the sequence level, picture level, slice level, tile level, or sub-picture level. In these examples, M represents an initial step size and N represents a final step size, where the final step size is greater than or equal to the precision of the initial MV.

[0117] In one example, the value of M may be sequence resolution dependent. In general, for higher resolution sequences, the video encoder 200 and the video decoder 300 may use a larger value of M, and for lower resolution sequences, the video encoder 200 and the video decoder 300 may use a smaller value of M.

[0118] The video encoder 200 and the video decoder 300 may be configured to perform a simplified bidirectional refinement for TM. The techniques of this disclosure may simplify TM by eliminating one of the unidirectional MV refinement processes for bi-predicted blocks. When the current inter block is encoded using bi-prediction, the TM as described above with respect to template matching prediction refines each unidirectional MV independently, and then the unidirectional MV with a larger matching error (i.e., referred to as the second MV hereinafter) is further refined by using the other unidirectional MV (i.e., referred to as the first MV hereinafter) as a priority for joint optimization. However, since both MVs are refined toward finding an optimal match for the same current block template, the joint optimization may be reducing the chances to reach a better prediction for the bi-prediction case. In general, the second MV in bi-prediction is used to better compensate the delta signal between the original block samples and the predicted samples corresponding to the first MV. Thus, this disclosure describes a technique for simplifying TM as a dual MV refinement process. The video encoder 200 and the video decoder 300 may first choose the first MV in bi-prediction for independent improvement, and then take the TM-improved first MV as a priority for improving the second MV.

[0119] There are several processes that can be used to specify the criteria for picking up the first MV for independent improvement. For example, Lxmay be the only one to be improved independently and set as a priority for improving other MVs with BCW weight values, where Lx may be predefined as either L0 or L1 or may be specified at the sequence level, picture level, slice level, tile level, sub-picture level, CTU level, or block level. Lx may be determined based on which reference picture has a shorter POC distance towards the current picture. In some examples, Lx may be determined based on which reference picture has a longer POC distance to the current picture. In some examples, Lx may be determined based on which reference picture has a smaller quantization parameter (QP) value. In some examples, Lx may be determined based on which reference picture has a larger QP value. In some examples, Lx may be set equal to be L0 when ph_mvd_l1_zero_flag is enabled. (ph_mvd_l1_zero_flag may be named differently in various video standards, but its functionality remains the same, i.e., MVD L1 Force MVD L1 (Note that syntax signaling for ph_mvd_l1_zero_flag is skipped.) In some examples, Lx may be set equal to L0 when ph_mvd_l1_zero_flag is disabled. In some examples, Lx may be determined based on which of MVL0 and MVL1 can produce a lower matching cost before the MV refinement process of TM is performed. The matching cost may be the same as the template matching cost (i.e., template matching prediction as described above) or a subsampled template matching cost that only considers every other N (e.g., 2nd, 3rd, 4th, ...) samples from the template block in the matching cost calculation.

[0120] In another example, Lx is the MV after the MV refinement process of TM has been performed on both MVs. L0 and M.V.L1 It may be determined based on which of them can generate the lower matching cost. Then, the best one among them (in terms of matching cost) is set as the priority for improving the original vector of the other MV (before MV improvement) with the BCW weight value.

[0121] Video encoder 200 and video decoder 300 may be configured to perform bi-directional matching for TM merge mode. The techniques of this disclosure may extend the concept of bi-directional matching to TM merge mode (bi-directional TM or TM bilateral With it, the matching process of TM is to find the best match that can minimize the difference between two reference block templates. Note that bidirectional TM is different from bidirectional matching as explained above in that bidirectional matching improves the MV based on the minimum cost between two reference blocks, but bidirectional TM improves the MV based on the minimum cost between two templates.

[0122] In one example, when a CU is bi-predictive for TM, the video encoder 200 and the video decoder 300 may perform an MV refinement process (i.e., TM 2uni ), but apply a bidirectional TM that finds the best match that should minimize the delta between the two reference block templates. bilateral}.

[0123] In another example, when a CU is bi-predictive for TM, the video encoder 200 and the video decoder 300 may be configured to still perform the MV refinement process independently for each unidirectional MV. Then, the video encoder 200 and the video decoder 300 may be configured to perform bi-directional TM on the refined MV to find the best match that should minimize the delta between the two reference block templates. In short, the processing order is {TM 2uni , TMbilateral}.

[0124] In some examples, when a CU is bi-predictive for TM, the video encoder 200 and the video decoder 300 still perform the normal MV refinement process to refine each unidirectional MV independently, and perform joint optimization as described above for template matching prediction for MVs that incur a larger matching cost (i.e., TM bi ) followed by the MV. The video encoder 200 and the video decoder 300 may then be configured to perform bidirectional matching on the refined MV to find the best match that should minimize the delta between the two reference block templates. In essence, the processing order is {TM 2uni , TM bi , TM bilateral}.

[0125] The processing order of some of the above examples may be reversed, with bidirectional TM being performed before normal TM. bilateral , TM 2uni} or {TM bilateral , TM 2uni , TM bi}.

[0126] Compared with some of the above examples, the two-way TM may be replaced by using normal two-way matching or PU-based DMVR. In short, the processing order is, but not limited to, {TM 2uni , BM}, {TM 2uni , TM bi , BM}, {BM, TM 2uni}, and {BM, TM 2uni , TM bi}. Note that depending on which of the two is implemented in the video codec, the BM may be replaced by using the DMVR.

[0127] In one example, when a CU is encoded using bi-prediction, the video encoder 200 and the video decoder 300 may be configured to apply sub-block-based DMVR or sub-block-based BM to the resulting motion field after both normal TM and bi-directional TM are performed. Thus, the processing order of these decoder-side modes is summarized as follows: · {TM 2uni , BM, subblock BM} or {TM 2uni , TM bilateral , sub-block BM}, · {TM 2uni , TM bi , BM, subblock BM} or {TM 2uni , TM bi , TM bilateral , sub-block BM}, · {BM, TM 2uni , subblock BM} or {TM bilateral , TM 2uni , sub-block BM}, · {BM, TM2 uni , TM bi , subblock BM} or {TM bilateral , TM2 uni , TM bi , subblock BM}. It should be noted that depending on whether the BM and DMVR are both implemented in the video codec, the BM may be replaced by using the DMVR.

[0128] In the above example, a PU-based BM or TM is constructed. bilateral can be eliminated to reduce the complexity overhead, yielding: · {TM 2uni , sub-block BM}, · {TM 2uni , TM bi , sub-block BM}, · {TM 2uni , subblock BM}, · {TM2 uni , TMbi , subblock BM}. It should be noted that depending on whether the BM and DMVR are both implemented in the video codec, the BM may be replaced by using the DMVR.

[0129] In one example, when the CU is bi-predictive, the video encoder 200 and the video decoder 300 may be configured to perform bi-directional TM conditionally according to the same enabling condition described above for DMVR. When the condition is not met, the video encoder 200 and the video decoder 300 may be configured to perform TM without bi-directional matching, otherwise, bi-directional matching works for TM as when the condition is met. Note that the same rules apply when the bi-directional BM is replaced by DMVR or BM.

[0130] In another example, building on the above example, when the TM cost of bi-prediction is N times larger than the best uni-prediction, the TM bi may degenerate the bi-predictive motion to unidirectional, where N may be a predefined scale such as 1.125, 1.25, 1.5, etc., or may be specified at the sequence level, picture level, slice level, tile level, sub-picture level, CTU level, or block level. When such a condition is met, the resulting motion field derived by the TM becomes unidirectional, which happens to skip the BM and sub-block BM.

[0131] In one example, the video encoder 200 and the video decoder 300 may be configured to conditionally skip the MV refinement process of the TM merge mode based on the matching cost of the BM or the bidirectional TM (e.g., depending on which approach is taken in Examples 4, 5, and 6 above). 2uni and T.M. bi ) before BM (or TM bilateral In cases where BM (or TM) is applied, bilateralIf the bidirectional matching cost of ) is less than a given threshold, the MV refinement process of normal TM may be skipped. The threshold is a function of the number of block samples, i.e., f(scale)=scale * number of block samples (or TM bilateral When f(scale) is used, it may be defined as f(scale)=scale *number of template block samples), where scale may be a positive real number such as 0.5, 0.75, 1.0, 1.25, 1.50, 1.75, 2.0, etc., specified per sequence, picture, subpicture, tile, slice, or may be predefined.

[0132] In one example, normal TM and / or bidirectional TM can be incorporated into the multi-path DMVR as one extra pass for MV improvement before the sub-block process. The normal TM or bidirectional TM can be present just before (or just after) the first pass of the multi-path DMVR. The following summarizes all possible combinations. · {TM 2uni , Multipath DMVR}, · {TM 2uni , TM bi , Multipath DMVR}, · {TM bilateral , Multipath DMVR}, · {TM bilateral , TM 2uni , Multipath DMVR}, · {TM bilateral , TM 2uni , TM bi , Multipath DMVR}, · {TM 2uni , TM bilateral , Multipath DMVR}, · {TM 2uni , TM bi , TM bilateral , Multipath DMVR}.

[0133] In one example, normal TM and / or bidirectional TM can replace the first path of a multipath DMVR, as described in US Provisional Patent Application No. 63 / 129,221. The following summarizes all possible combinations. · {TM 2uni , the multipath DMVR whose first path has been removed}, · {TM 2uni , TM bi , the multipath DMVR whose first path has been removed}, · {TM bilateral , the multipath DMVR whose first path has been removed}, · {TM bilateral , TM 2uni , the multipath DMVR whose first path has been removed}, · {TM bilateral , TM 2uni , TM bi , the multipath DMVR whose first path has been removed}, · {TM 2uni , TM bilateral , the multipath DMVR whose first path has been removed}, · {TM 2uni , TM bi , TM bilateral , multipath DMVR whose first path has been removed}.

[0134] Video encoder 200 and video decoder 300 may be configured to perform MMVD using TM. The techniques of this disclosure apply TM to MMVD candidates for MV improvement. TM may be applied to either the basis vectors of MMVD or each of the MMVD candidates.

[0135] In one example, TM is applied only to MMVD basis vectors. In one example, TM is applied only to MMVD basis vectors, and the best one among them is determined as the final MMVD basis vector for generating MMVD candidates. With this, the flag sent to indicate the selection of MMVD basis vectors does not need to be signaled. In other words, the index of the MMVD basis vector is derived from TM, not from decoding the bitstream. In one example, the MMVD basis vector selection in the previous example is simplified through a TM cost calculated for each MMVD basis vector without performing MV refinement. Only the MMVD basis vector with a lower TM cost is selected as the MMVD basis vector and applied to MV refinement. The TM-improved vector serves as the MMVD basis vector for generating MMVD candidates. Note that the flag sent to indicate the selection of the MMVD basis vector does not need to be signaled in this example. In one example, TM works for each possible MMVD candidate. This example can work independently or in combination with the above example of improving MMVD basis vectors. In one example, the MMVD basis vectors can be subsampled from a normal merge candidate list or a TM candidate list. The subsampling process can include subsampling the first N from the above candidate list, where N can be predefined as 1, 2, 3, 4, etc., or can be specified at the sequence level, slice level, tile level, picture level, or sub-picture level.

[0136] The video encoder 200 and the video decoder 300 may be configured to utilize a matching cost-based enabling condition. Bidirectional matching for the TM merge mode may be conditionally disabled based on the matching cost of the BM or the bidirectional TM (depending on which approach is taken in Examples 4, 5, and 6 above with respect to bidirectional matching for the TM merge mode). 2uni and T.M. bi ) before BM (or TM bilateralIn cases where BM (or TM) is applied, bilateral If the bidirectional matching cost of TM is less than a given threshold, the normal TM may be skipped. The threshold is a function of the number of block samples, i.e., f(scale)=scale * number of block samples (or TM bilateral When f(scale) is used, it may be defined as f(scale)=scale *number of template block samples), where scale may be a positive real number such as 0.5, 0.75, 1.0, 1.25, 1.50, 1.75, 2.0, etc., specified per sequence, picture, subpicture, tile, slice, or may be predefined.

[0137] FIG. 11 is a block diagram illustrating an example video encoder 200 that may perform techniques of this disclosure. FIG. 11 is provided for purposes of illustration and should not be considered a limitation of the techniques as broadly illustrated and described in this disclosure. For purposes of illustration, this disclosure describes a video encoder 200 in accordance with VVC (ITU-T H.266 under development) and HEVC (ITU-T H.265) techniques. However, the techniques of this disclosure may be performed by video encoding devices configured for other video coding standards.

[0138] In the example of Figure 11, the video encoder 200 includes a video data memory 230, a mode selection unit 202, a residual generation unit 204, a transform processing unit 206, a quantization unit 208, an inverse quantization unit 210, an inverse transform processing unit 212, a reconstruction unit 214, a filter unit 216, a decoded picture buffer (DPB) 218, and an entropy coding unit 220. Any or all of the video data memory 230, the mode selection unit 202, the residual generation unit 204, the transform processing unit 206, the quantization unit 208, an inverse quantization unit 210, an inverse transform processing unit 212, a reconstruction unit 214, a filter unit 216, a DPB 218, and an entropy coding unit 220 may be implemented in one or more processors or processing circuitry. For example, the units of the video encoder 200 may be implemented as one or more circuits or logic elements as part of a hardware circuitry, or as part of a processor, an ASIC, or an FPGA. Moreover, video encoder 200 may include additional or alternative processors or processing circuitry for performing these and other functions.

[0139] The video data memory 230 may store video data to be encoded by the components of the video encoder 200. The video encoder 200 may receive video data stored in the video data memory 230, for example, from the video source 104 (FIG. 1). The DPB 218 may act as a reference picture memory, storing reference video data for use in predicting subsequent video data by the video encoder 200. The video data memory 230 and the DPB 218 may be formed by any of a variety of memory devices, such as dynamic random access memory (DRAM), including synchronous DRAM (SDRAM), magnetoresistive RAM (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 separate memory devices. In various examples, the video data memory 230 may be on-chip with other components of the video encoder 200, as shown, or may be off-chip relative to those components.

[0140] In this disclosure, references to video data memory 230 should not be construed as limited to memory internal to video encoder 200 unless specifically stated as such, or to memory external to video encoder 200 unless specifically stated as such. Rather, references to video data memory 230 should be understood as a reference memory that stores video data that video encoder 200 receives for encoding (e.g., video data for a current block to be encoded). Memory 106 of FIG. 1 may also provide temporary storage of outputs from various units of video encoder 200.

[0141] The various units in FIG. 11 are shown to aid in understanding the operations performed by the video encoder 200. The units may be implemented as fixed-function circuits, programmable circuits, or a combination thereof. A fixed-function circuit refers to a circuit that provides a specific functionality and is preconfigured for the operations that may be performed. A programmable circuit refers to a circuit that may be programmed to perform various tasks and provides flexible functionality in the operations that may be performed. For example, a programmable circuit may execute software or firmware that causes the programmable circuit to operate in a manner defined by the software or firmware instructions. Although a fixed-function circuit may execute software instructions (e.g., to receive parameters or output parameters), the type of operations that the fixed-function circuit performs is generally invariant. In some examples, one or more of the units may be different circuit blocks (fixed function or programmable), and in some examples, one or more of the units may be an integrated circuit.

[0142] The video encoder 200 may include an arithmetic logic unit (ALU), an elementary function unit (EFU), digital circuits, analog circuits, and / or a programmable core formed from programmable circuits. In examples in which the operations of the video encoder 200 are performed using software executed by programmable circuits, the memory 106 (FIG. 1) may store instructions (e.g., object code) of the software that the video encoder 200 receives and executes, or another memory (not shown) within the video encoder 200 may store such instructions.

[0143] The video data memory 230 is configured to store the received video data. The video encoder 200 may retrieve pictures of the video data from the 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 the video data memory 230 may be raw video data to be encoded.

[0144] The mode selection unit 202 includes a motion estimation unit 222, a motion compensation unit 224, and an intra prediction unit 226. The mode selection unit 202 may include additional functional units for performing video prediction according to other prediction modes. By way of example, the mode selection unit 202 may include a palette unit, an intra block 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, etc.

[0145] The mode selection unit 202 typically coordinates multiple encoding passes to test combinations of encoding parameters and resulting rate-distortion values ​​for such combinations. The encoding parameters may include partitioning of the CTU 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 a combination of encoding parameters that has a better rate-distortion value than other combinations tested.

[0146] Video encoder 200 may partition a picture retrieved from video data memory 230 into a series of CTUs and may encapsulate one or more CTUs within a slice. Mode selection unit 202 may partition the CTUs of a picture according to a tree structure, such as the QTBT structure or quadtree structure of HEVC described above. As described above, video encoder 200 may form one or more CUs from partitioning the CTUs according to the tree structure. Such a CU may also be generally referred to as a "video block" or "block."

[0147] In general, the mode selection unit 202 also controls its components (e.g., the motion estimation unit 222, the motion compensation unit 224, and the intra prediction unit 226) to generate a prediction block for a current block (e.g., a current CU, or in HEVC, an overlapping portion of a PU and a TU). In the case of inter prediction of a current block, the motion estimation unit 222 may perform a motion search to identify one or more closely matching reference blocks in one or more reference pictures (e.g., one or more previously coded pictures stored in the DPB 218). In particular, the motion estimation unit 222 may calculate a value representing how similar a possible reference block is to the current block according to, for example, a sum of absolute differences (SAD), a sum of squared differences (SSD), a mean absolute difference (MAD), a mean squared difference (MSD), etc. The motion estimation unit 222 may generally perform these calculations using a sample-by-sample difference between the current block and the reference block under consideration. Motion estimation unit 222 may identify the reference block having the smallest resulting value from these calculations, indicating the reference block that most closely matches the current block.

[0148] The motion estimation unit 222 may form one or more motion vectors (MVs) that define the position of a reference block in a reference picture relative to the position of a current block in the current picture. The motion estimation unit 222 may then provide the motion vectors to the motion compensation unit 224. For example, in the case of unidirectional inter prediction, the motion estimation unit 222 may provide a single motion vector, while in the case of bidirectional inter prediction, the motion estimation unit 222 may provide two motion vectors. The motion compensation unit 224 may then generate a predictive block using the motion vectors. For example, the motion compensation unit 224 may use the motion vectors to retrieve data of the reference block. As another example, if the motion vector has fractional sample accuracy, the motion compensation unit 224 may interpolate values ​​for the predictive block according to one or more interpolation filters. Moreover, in the case of bidirectional inter prediction, the motion compensation unit 224 may retrieve data for the two reference blocks identified by the respective motion vectors and combine the retrieved data, for example, through sample-wise averaging or weighted averaging.

[0149] In some coding scenarios, the motion compensation unit 224 may generate a prediction block using a motion vector and a motion vector refinement. The motion vector refinement may be based on template matching, for example. For example, the motion compensation unit 224 may identify an initial current block template based on the motion vector, may search other templates around the initial current block template using a step size set to the initial step size, and may iteratively reduce the step size from the initial step size until the step size is set to a final step size equal to the motion vector precision. The motion compensation unit 224 may perform the search using a variety of different search patterns.

[0150] As another example, in the case of intra prediction or intra predictive coding, the intra prediction unit 226 may generate a predictive block from samples neighboring the current block. For example, in the case of a directional mode, the intra prediction unit 226 may generally mathematically combine values ​​of neighboring samples and distribute these calculated values ​​in a predefined direction across the current block to generate a predictive block. As another example, in the case of a DC mode, the intra prediction unit 226 may calculate an average of the neighboring samples for the current block and generate a predictive block to include this resulting average for each sample of the predictive block.

[0151] The mode select unit 202 provides the prediction block to the residual generation unit 204. The residual generation unit 204 receives a raw, uncoded version of the current block from the video data memory 230 and the prediction block from the mode select unit 202. The 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, the residual generation unit 204 may also determine differences between sample values ​​in the residual block to generate the residual block using residual differential pulse code modulation (RDPCM). In some examples, the residual generation unit 204 may be formed using one or more subtractor circuits that perform binary subtraction.

[0152] In an example where the mode selection unit 202 partitions a CU into PUs, each PU may be associated with a luma prediction unit and a corresponding chroma prediction unit. The video encoder 200 and the video decoder 300 may support PUs having various sizes. As indicated above, the size of a CU may refer to the size of the luma coding block of the CU, and the size of a PU may refer to the size of the luma prediction unit of the PU. Assuming that the size of a particular CU is 2N×2N, the video encoder 200 may support a PU size of 2N×2N or N×N for intra prediction, and a symmetric PU size of 2N×2N, 2N×N, N×2N, N×N, or similar for inter prediction. The video encoder 200 and the video decoder 300 may also support asymmetric partitioning for PU sizes of 2N×nU, 2N×nD, nL×2N, and nR×2N for inter prediction.

[0153] In examples where the mode selection unit 202 does not further partition the CUs into PUs, each CU may be associated with a luma coding block and a corresponding chroma coding block. As mentioned above, the size of a CU may refer to the size of the luma coding block of the CU. The video encoder 200 and the video decoder 300 may support CU sizes of 2N×2N, 2N×N, or N×2N.

[0154] For other video coding techniques, such as intra block copy mode coding, affine mode coding, and linear model (LM) mode coding, as some examples, the mode selection unit 202 generates a predictive block for the current block being coded via a respective unit associated with the coding technique. In some examples, such as palette mode coding, the mode selection unit 202 may not generate a predictive block, but instead generate syntax elements that indicate a scheme for reconstructing the block based on a selected palette. In such modes, the mode selection unit 202 may provide these syntax elements to be coded to the entropy coding unit 220.

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

[0156] Transform processing unit 206 applies one or more transforms to the residual block to generate a block of transform coefficients (referred to herein as a "transform coefficient block"). Transform processing unit 206 may apply various transforms to the residual block to form the transform coefficient block. For example, transform processing unit 206 may apply a discrete cosine transform (DCT), a directional transform, a Karhunen-Loeve transform (KLT), or a conceptually similar transform to the residual block. In some examples, transform processing unit 206 may perform multiple transforms, e.g., a first-order transform and a second-order transform such as a rotation transform, on the residual block. In some examples, transform processing unit 206 does not apply a transform to the residual block.

[0157] The quantization unit 208 may quantize the transform coefficients in the transform coefficient block to generate a quantized transform coefficient block. The quantization unit 208 may quantize the transform coefficients of the 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) may adjust the degree of quantization applied to the transform coefficient block associated with the current block by adjusting the QP value associated with the CU. Quantization may result in loss of information, and thus the quantized transform coefficients may have less precision than the original transform coefficients generated by the transform processing unit 206.

[0158] Inverse quantization unit 210 and inverse transform processing unit 212 may apply inverse quantization and inverse transform, respectively, to the quantized transform coefficient block to reconstruct a residual block from the transform coefficient block. Reconstruction unit 214 may generate a reconstructed block that corresponds to the current block (potentially with some degree of distortion) based on the reconstructed residual block and the predictive block generated by mode selection unit 202. For example, reconstruction unit 214 may add samples of the reconstructed residual block to corresponding samples from the predictive block generated by mode selection unit 202 to generate the reconstructed block.

[0159] The filter unit 216 may perform one or more filter operations on the reconstructed block. For example, the filter unit 216 may perform a deblocking operation to reduce blockiness artifacts along the edges of a CU. In some examples, the operations of the filter unit 216 may be skipped.

[0160] Video encoder 200 stores reconstructed blocks in DPB 218. For example, in examples where the operations of filter unit 216 are not performed, reconstruction unit 214 may store reconstructed blocks in DPB 218. In examples where the operations of filter unit 216 are performed, filter unit 216 may store filtered reconstructed blocks in DPB 218. Motion estimation unit 222 and motion compensation unit 224 may retrieve reference pictures formed from reconstructed (and potentially filtered) blocks from DPB 218 to inter predict blocks of a later-encoded picture. In addition, intra prediction unit 226 may use reconstructed blocks in DPB 218 of a current picture to intra predict other blocks in the current picture.

[0161] In general, the entropy encoding unit 220 may entropy encode syntax elements received from other functional components of the video encoder 200. For example, the entropy encoding unit 220 may entropy encode quantized transform coefficient blocks from the quantization unit 208. As another example, the entropy encoding unit 220 may entropy encode predictive syntax elements (e.g., motion information for inter prediction or intra mode information for intra prediction) from the mode selection unit 202. The entropy encoding unit 220 may perform one or more entropy encoding operations on syntax elements, which are another example of video data, to generate entropy encoded data. For example, the entropy encoding unit 220 may perform a context-adaptive variable length coding (CAVLC) operation, a CABAC operation, a variable-to-variable (V2V) length coding operation, a syntax-based context-adaptive binary arithmetic coding (SBAC) operation, a probability interval partitioned entropy (PIPE) coding operation, an exponential-Golomb coding operation, or another type of entropy coding operation on the data. In some examples, the entropy encoding unit 220 may operate in a bypass mode in which syntax elements are not entropy coded.

[0162] The video encoder 200 may output a bitstream that includes entropy coding syntax elements needed to reconstruct blocks of a slice or picture. In particular, the entropy coding unit 220 may output the bitstream.

[0163] The operations described above are described with respect to blocks. Such descriptions should be understood as being operations for luma coding blocks and / or chroma coding blocks. As described above, in some examples, the luma coding blocks and chroma coding blocks are luma and chroma components of a CU. In some examples, the luma coding blocks and chroma coding blocks are luma and chroma components of a PU.

[0164] In some examples, operations performed with respect to luma coding blocks do not need to be repeated for chroma coding blocks. As an example, operations to identify motion vectors (MVs) and reference pictures for luma coding blocks do not need to be repeated to identify MVs and reference pictures for chroma blocks. Rather, MVs for luma coding blocks may be scaled to determine MVs for chroma blocks, and the reference pictures may be the same. As another example, the intra prediction process may be the same for luma coding blocks and chroma coding blocks.

[0165] FIG. 12 is a block diagram illustrating an example video decoder 300 that may perform techniques of this disclosure. FIG. 12 is provided for purposes of explanation and not to limit the techniques as broadly illustrated and described in this disclosure. For purposes of explanation, this disclosure describes a video decoder 300 in accordance with VVC (ITU-T H.266 under development) and HEVC (ITU-T H.265) techniques. However, the techniques of this disclosure may be performed by video coding devices configured for other video coding standards.

[0166] In the example of FIG. 12, the video decoder 300 includes a coded picture buffer (CPB) memory 320, an entropy 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 decoded picture buffer (DPB) 314. Any or all of the CPB memory 320, the entropy 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 may be implemented in one or more processors or processing circuitry. For example, the units of the video decoder 300 may be implemented as one or more circuits or logic elements as part of hardware circuitry, or as part of a processor, ASIC, or FPGA. Moreover, the video decoder 300 may include additional or alternative processors or processing circuitry for performing these and other functions.

[0167] The prediction processing unit 304 includes a motion compensation unit 316 and an intra prediction unit 318. The prediction processing unit 304 may include additional units for performing prediction according to other prediction modes. By way of example, the prediction processing unit 304 may include a palette unit, an intra block copy unit (which may form part of the motion compensation unit 316), an affine unit, a linear model (LM) unit, etc. In other examples, the video decoder 300 may include more, fewer, or different functional components.

[0168] The CPB memory 320 may store video data, such as an encoded video bitstream, to be decoded by components of the video decoder 300. The video data stored in the CPB memory 320 may be obtained, for example, from the computer-readable medium 110 (FIG. 1). The CPB memory 320 may include a CPB that stores encoded video data (e.g., syntax elements) from the encoded video bitstream. The CPB memory 320 may also store video data other than syntax elements of coded pictures, such as temporary data representing output from various units of the video decoder 300. The DPB 314 generally stores decoded pictures that the video decoder 300 may output and / or use as reference video data when decoding subsequent data or pictures of the encoded video bitstream. The CPB memory 320 and the DPB 314 may be formed by any of a variety of memory devices, such as DRAM, including SDRAM, MRAM, RRAM, or other types of memory devices. The CPB memory 320 and the DPB 314 may be provided by the same memory device or separate memory devices. In various examples, the CPB memory 320 may be on-chip with other components of the video decoder 300, or may be off-chip relative to those components.

[0169] Additionally or alternatively, in some examples, video decoder 300 may retrieve coded video data from memory 120 (FIG. 1). That is, memory 120 may store data as described above using CPB memory 320. Similarly, memory 120 may store instructions to be executed by video decoder 300 when some or all of the functionality of video decoder 300 is implemented in software to be executed by processing circuitry of video decoder 300.

[0170] The various units shown in FIG. 12 are presented to aid in understanding the operations performed by the video decoder 300. The units may be implemented as fixed-function circuits, programmable circuits, or a combination thereof. As with FIG. 11, fixed-function circuits refer to circuits that provide specific functionality and are preconfigured for the operations that may be performed. Programmable circuits refer to circuits that may be programmed to perform various tasks and provide flexible functionality in the operations that may be performed. For example, a programmable circuit may execute software or firmware that causes the programmable circuit to operate in a manner defined by the software or firmware instructions. Although a fixed-function circuit may execute software instructions (e.g., to receive parameters or output parameters), the type of operations that the fixed-function circuit performs is generally invariant. In some examples, one or more of the units may be different circuit blocks (fixed function or programmable), and in some examples, one or more of the units may be an integrated circuit.

[0171] The video decoder 300 may include a programmable core formed from ALUs, EFUs, digital circuits, analog circuits, and / or programmable circuits. In examples in which the operations of the video decoder 300 are performed by software executing on programmable circuits, on-chip or off-chip memory may store instructions (e.g., object code) of the software that the video decoder 300 receives and executes.

[0172] The entropy decoding unit 302 may receive the encoded video data from the CPB and entropy decode the video data to recover the 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 may generate decoded video data based on the syntax elements extracted from the bitstream.

[0173] In general, the video decoder 300 reconstructs a picture on a block-by-block basis. The video decoder 300 may perform a reconstruction operation on each block individually (wherein the block currently being reconstructed, i.e., decoded, may be referred to as the “current block”).

[0174] The entropy decoding unit 302 may entropy decode syntax elements that specify the quantized transform coefficients of the quantized transform coefficient block, as well as transform information, such as a quantization parameter (QP) and / or a transform mode indication. The inverse quantization unit 306 may use the QP associated with the quantized transform coefficient block to determine the degree of quantization, and similarly the degree of inverse quantization that the inverse quantization unit 306 should apply. The inverse quantization unit 306 may, for example, perform a bitwise left shift operation to inverse quantize the quantized transform coefficients. The inverse quantization unit 306 may thereby form a transform coefficient block including the transform coefficients.

[0175] After the inverse quantization unit 306 forms the transform coefficient block, the inverse transform processing unit 308 may 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 may apply an inverse DCT, an inverse integer transform, an inverse Karhunen-Loeve transform (KLT), an inverse rotational transform, an inverse transform, or another inverse transform to the transform coefficient block.

[0176] Further, prediction processing unit 304 generates a predictive block according to the prediction information syntax element entropy decoded by entropy decoding unit 302. For example, if the prediction information syntax element indicates that the current block is inter predicted, motion compensation unit 316 may generate a predictive block. In this case, the prediction information syntax element may indicate a reference picture in DPB 314 from which to retrieve a reference block, as well as a motion vector that identifies the location of the reference block in the reference picture relative to the location of the current block in the current picture. Motion compensation unit 316 may generally perform an inter prediction process in a manner substantially similar to that described with respect to motion compensation unit 224 (FIG. 11).

[0177] The motion compensation unit 316 includes a DMVR unit 317, which may perform various techniques described in this disclosure, including the TM techniques described herein. The DMVR unit 317 may be configured to improve the motion vector based on the TM, for example, by identifying a current block template in a current picture and searching within a search area for a final reference block template corresponding to the current block template. To search within the search area, the DMVR unit 317 may be configured to identify an initial reference block template based on the motion vector, search other reference block templates around the initial reference block template using a step size set to the initial step size, and iteratively reduce the step size from the initial step size until the step size is set to a final step size equal to the motion vector precision. The DMVR unit 317 may then determine a predictive block for the block based on the final reference block template. The predictive block may be, for example, a block to the lower right of the final reference block template, as illustrated by FIG. 5.

[0178] As another example, if the prediction information syntax element indicates that the current block is intra predicted, the intra prediction unit 318 may generate a prediction block according to the intra prediction mode indicated by the prediction information syntax element. Again, the intra prediction unit 318 may generally perform an intra prediction process in a manner substantially similar to that described with respect to the intra prediction unit 226 (FIG. 11). The intra prediction unit 318 may retrieve data of neighboring samples to the current block from the DPB 314.

[0179] The reconstruction unit 310 may reconstruct the current block using the predictive block and the residual block. For example, the reconstruction unit 310 may add samples of the residual block to corresponding samples of the predictive block to reconstruct the current block.

[0180] The filter unit 312 may perform one or more filter operations on the reconstructed block. For example, the filter unit 312 may perform a deblocking operation to reduce blockiness artifacts along the edges of the reconstructed block. The operations of the filter unit 312 may not be performed in all examples.

[0181] The video decoder 300 may store the reconstructed block in the DPB 314. For example, in examples where the operation of the filter unit 312 is not performed, the reconstruction unit 310 may store the reconstructed block in the DPB 314. In examples where the operation of the filter unit 312 is performed, the filter unit 312 may store the filtered reconstructed block in the DPB 314. As described above, the DPB 314 may provide reference information to the prediction processing unit 304, such as samples of a current picture for intra prediction and previously decoded pictures for subsequent motion compensation. Moreover, the video decoder 300 may output decoded pictures (e.g., decoded video) from the DPB 314 for later presentation on a display device, such as the display device 118 of FIG. 1.

[0182] 13 is a flowchart illustrating an example process for encoding a current block according to the techniques of this disclosure. The current block may comprise a current CU. Although described with respect to video encoder 200 (FIGS. 1 and 11), it should be understood that other devices may be configured to perform a process similar to that of FIG.

[0183] In this example, the video encoder 200 may first predict the current block (350). For example, the video encoder 200 may form a predictive block for the current block. The video encoder 200 may then calculate a residual block for the current block (352). To calculate the residual block, the video encoder 200 may calculate a difference between an original uncoded block and a predictive block for the current block. The video encoder 200 may then transform the residual block and may quantize the transform coefficients of the residual block (354). The video encoder 200 may then scan the quantized transform coefficients of the residual block (356). During or following the scan, the video encoder 200 may entropy code the transform coefficients (358). For example, the video encoder 200 may code the transform coefficients using CAVLC or CABAC. The video encoder 200 may then output entropy coded data for the block (360).

[0184] 14 is a flowchart illustrating an example process for decoding a current block of video data in accordance with the techniques of this disclosure. The current block may comprise a current CU. Although described with respect to video decoder 300 (FIGS. 1 and 12), it should be understood that other devices may be configured to perform a process similar to that of FIG.

[0185] The video decoder 300 may receive entropy coded data for the current block, such as entropy coded prediction information and entropy coded data for transform coefficients of a residual block that corresponds to the current block (370). The video decoder 300 may entropy decode the entropy coded data to determine prediction information for the current block and reconstruct transform coefficients of the residual block (372). The video decoder 300 may predict the current block, e.g., using an intra or inter prediction mode as indicated by the prediction information for the current block, to compute a predictive block for the current block (374). The video decoder 300 may then inverse scan the reconstructed transform coefficients to create a block of quantized transform coefficients (376). The video decoder 300 may then inverse quantize the transform coefficients and apply an inverse transform to the transform coefficients to generate a residual block (378). The video decoder 300 may finally decode the current block by combining the predictive block and the residual block (380).

[0186] FIG. 15 is a flowchart illustrating an example process for decoding a current block according to the techniques of this disclosure. The current block may comprise a current CU. FIG. 15 is described with respect to a generic video decoder, which may correspond to the video decoding loop of, for example, video decoder 300 (FIGS. 1 and 12) or video encoder 200 (FIGS. 1 and 11). However, it should be understood that other devices may be configured to perform a process similar to that of FIG. 15.

[0187] The video decoder determines that a block of a current picture is encoded in an inter-prediction mode (400). The inter-prediction mode may be, for example, AMVP mode or merge mode.

[0188] The video decoder determines a motion vector for the current block based on the inter prediction mode (402) and determines a motion vector precision for the motion vector (404). For example, if the inter prediction mode is AMVP mode, the video decoder may determine the motion vector precision for the current block by receiving a syntax element in the bitstream that indicates the motion vector precision. For example, if the inter prediction mode is merge mode, the video decoder may determine the motion vector precision for the current block by determining the motion vector precision from candidates in the merge list.

[0189] The video decoder identifies a current block template within the current picture (406). The video decoder may locate the template around the current block, including, for example, samples above and to the left of the current block, for example, as shown in FIG.

[0190] The video decoder searches within a search area for a final current block template that corresponds to the reference block template (408). The search area may be, for example, an area that is within 8 samples in the x-direction of a top-left sample of the reference block in the reference picture determined from the motion vector and within 8 samples in the y-direction of the top-left sample.

[0191] To search within the search area for a final reference block template that corresponds to the current block template, the video decoder identifies an initial reference block template based on the motion vector (410), searches other reference block templates around the initial reference block template using a step size that is set to the initial step size (412), and iteratively reduces the step size from the initial step size until the step size is set to a final step size that is equal to the motion vector precision (414).

[0192] In contrast to techniques that always use a default pel step size, such as a step size of 1 / 8 pel, according to the techniques of this disclosure, the final step size may be larger than 1 / 8 pel in some coding scenarios. All values ​​of the step size used to search within the search area may be larger than or equal to the motion vector precision. The initial step size may be equal to n pels, for example, and to iteratively reduce the step size from the initial step size until the step size is set to a final step size equal to the motion vector precision, the video decoder may reduce the step size from n pels to n / 2 pels, and continue to reduce the step size by a factor of 1 / 2 until the step size is equal to the motion vector precision.

[0193] To iteratively reduce the initial step size until the final step size is equal to the motion vector precision, the video decoder may, for example, determine that the step size is equal to the motion vector precision and may terminate the iterative reduction of the step size in response to determining that the step size is equal to the motion vector precision. Additionally or alternatively, to iteratively reduce the initial step size until the final step size is equal to the motion vector precision, the video decoder may, for example, search other templates around the initial current block template using the initial step size to determine a first improved motion vector, may iteratively reduce the step size from the initial step size to a high precision step size, may identify a new initial current block template based on the first improved motion vector, and may search a second group of other templates around the new initial current block template using the high precision step size to determine a second improved motion vector. Additionally or alternatively, to iteratively reduce the initial step size until the final step size is equal to the motion vector precision, the video decoder may search other templates around the initial current block template using the initial step size and a first search pattern to determine a first improved motion vector, may identify a new initial current block template based on the first improved motion vector, and may search a second group of other templates around the new initial current block template using the initial step size and a second search pattern to determine a second improved motion vector.

[0194] The video decoder determines a predictive block for the current block based on the final current block template (416). Due to the motion vector refinement process, the predictive block determined for the current block based on the final current block template may not be the same as the initial reference block identified by the motion vector.

[0195] The video decoder decodes the current picture based on the determined prediction block (418). The video decoder may, for example, add the determined prediction to the residual block to form a reconstructed block and may perform one or more filtering operations on the reconstructed block.

[0196] The video decoder outputs a decoded version of the current picture (420). To output the decoded version of the current picture, the video decoder may be configured to output the decoded version of the current picture for display. In cases where the video decoder is a component of a video encoder, the video decoder may be configured to output the decoded version of the current picture by storing the decoded version of the current picture for use in encoding subsequent blocks of video data.

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

[0198] Clause 1A. A method for decoding video data, the method comprising: determining that a current block of video data is encoded in an inter-prediction mode; and decoding the current block of video data using the inter-prediction mode.

[0199] Clause 2A. The method of clause 1A, wherein decoding the current block of video data using an inter prediction mode comprises maintaining a candidate list for the current block, selecting a candidate from the candidate list, and decoding the current block of video data using motion information of the selected candidate.

[0200] Clause 3A. The method of clause 1A or 2A, further comprising performing a template matching motion vector refinement process using an initial step size that is equal to or greater than the motion vector resolution of the motion vector used decoded block.

[0201] Clause 4A. The method of any of clauses 1A to 3A, wherein the inter-prediction mode comprises a bidirectional inter-prediction mode, and the method further comprises performing a template matching motion vector refinement process on a first unidirectional motion vector, and after performing the template matching motion vector refinement process on the first motion vector, performing a template matching motion vector refinement process on a second unidirectional motion vector.

[0202] Clause 5A. The method of clause 3A or 4A, wherein performing the template matching motion vector refinement process comprises identifying an initial location in the reference picture based on the motion vector and performing template matching within a search area about the initial location, and decoding the current block of video data using the motion information of the selected candidate comprises identifying the reference block based on the template matching.

[0203] Clause 6A. The method of any one of clauses 1A to 5A, wherein the decoding method is performed as a part of the encoding method.

[0204] Clause 7A. A device for coding video data, the device comprising one or more means for performing the methods of any of clauses 1A to 6A.

[0205] Clause 8A. The device of clause 7A, wherein the one or more means comprises one or more processors implemented in circuitry.

[0206] Clause 9A. The device of clause 7A or 8A, further comprising a memory for storing the video data.

[0207] Clause 10A. The device of any of clauses 7A to 9A, further comprising a display configured to display the decoded video data.

[0208] Clause 11A. The device of any of clauses 7A to 10A, wherein the device comprises one or more of a camera, a computer, a mobile device, a broadcast receiver device, or a set-top box.

[0209] Clause 12A. The device of any one of clauses 7A to 11A, wherein the device comprises a video decoder.

[0210] Clause 13A. The device of any one of clauses 7A to 12A, wherein the device comprises a video encoder.

[0211] Clause 14A. A computer-readable storage medium having stored thereon instructions that, when executed, cause one or more processors to perform the method of any of clauses 1A-6A.

[0212] Clause 15A. A device for encoding video data, the device comprising: means for determining that a current block of the video data is encoded in an inter-prediction mode; and means for decoding the current block of the video data using the inter-prediction mode.

[0213] Clause 1B. A device for decoding video data, the device comprising: a memory configured to store the video data; and one or more processors implemented in a circuit configuration, the one or more processors configured to: determine that a current block of a current picture is coded in an inter prediction mode; determine a motion vector for the current block based on the inter prediction mode; determine a motion vector accuracy for the motion vector; identify a current block template in the current picture; search within a search area for a final reference block template corresponding to the current block template, where to search within the search area, the one or more processors are further configured to identify an initial reference block template based on the motion vector, search other reference block templates around the initial reference block template using a step size set to an initial step size, and iteratively reduce the step size from the initial step size until the step size is set to a final step size equal to the motion vector accuracy; determine a predictive block for the current block based on the final reference block template; decode the current picture based on the determined predictive block; and output a decoded version of the current picture.

[0214] Clause 2B. The device of clause 1B, wherein for iteratively reducing the step size from an initial step size until the step size is set to a final step size equal to the motion vector precision, the one or more processors are further configured to determine that the step size is equal to the motion vector precision, and in response to determining that the step size is equal to the motion vector precision, terminate the iterative reduction in the step size.

[0215] Clause 3B. The device of clause 1B, wherein to iteratively reduce the initial step size until the final step size is equal to the motion vector precision, the one or more processors are further configured to: search other reference block templates around the initial reference block template using the initial step size to determine a first improved motion vector; iteratively reduce the step size from the initial step size to a high precision step size; identify a new initial reference block template based on the first improved motion vector; and search a second group of other reference block templates around the new initial reference block template using the high precision step size to determine a second improved motion vector.

[0216] Clause 4B. The device of clause 1B, wherein the initial step size is equal to n pels, and the one or more processors are further configured to reduce the step size from n pels to n / 2 pels to iteratively reduce the step size from the initial step size until the step size is set to a final step size equal to the motion vector precision.

[0217] Clause 5B. The device of clause 1B, wherein all values ​​of the step size used to search within the search area are greater than or equal to the motion vector precision.

[0218] Clause 6B. The device of clause 1B, wherein for iteratively reducing the step size, the one or more processors are further configured to reduce the step size by a factor of 1 / 2.

[0219] Clause 7B. The device of clause 1B, wherein to iteratively reduce the initial step size until the final step size is equal to the motion vector accuracy, the one or more processors are further configured to search other reference block templates around the initial reference block template using the initial step size and a first search pattern to determine a first improved motion vector, identify a new initial reference block template based on the first improved motion vector, and search a second group of other reference block templates around the new initial reference block template using the initial step size and a second search pattern to determine a second improved motion vector.

[0220] Clause 8B. The device of clause 1B, wherein the motion vector identifies a top-left sample of a reference block in the reference picture, and the search area is an area within 8 samples in an x-direction of the top-left sample and within 8 samples in a y-direction of the top-left sample.

[0221] Clause 9B. The device of clause 1B, wherein the motion vector precision and final step size are greater than 1 / 8 pel.

[0222] Clause 10B. The device of clause 1B, wherein the inter prediction mode comprises an AMVP mode, and determining the motion vector precision for the current block comprises receiving in the bitstream a syntax element indicating the motion vector precision.

[0223] Clause 11B. The device of clause 1B, wherein the inter prediction mode comprises a merge mode, and determining the motion vector precision for the current block comprises determining the motion vector precision from candidates in a merge list.

[0224] Clause 12B. The device of clause 1B, wherein for outputting the decoded version of the current picture, the one or more processors are further configured to output the decoded version of the current picture for display.

[0225] Clause 13B. The device of clause 1B, wherein the device for decoding is configured to decode a current block of a current picture as part of performing an encoding process for the current picture, and wherein the one or more processors are further configured to store the decoded version of the current picture for use in encoding subsequent blocks of video data, to output a decoded version of the current picture.

[0226] Clause 14B. The device of clause 1B, wherein the device comprises a wireless communication device, further comprising a receiver configured to receive the encoded video data.

[0227] Clause 15B. The device of clause 14B, wherein the wireless communications device comprises a telephone handset, and the receiver is configured to demodulate the signal comprising the encoded video data in accordance with a wireless communications standard.

[0228] Clause 16B. The device of clause 1B, further comprising a display configured to display the decoded video data.

[0229] Clause 17B. The device of clause 1B, wherein the device comprises one or more of a computer, a mobile device, a broadcast receiver device, or a set-top box.

[0230] Clause 18B. The device of clause 1B, wherein the device comprises a camera configured to capture video data.

[0231] Clause 19B. A method for decoding video data, the method comprising: determining that a current block of a current picture is coded in an inter-prediction mode; determining a motion vector for the current block based on the inter-prediction mode; determining a motion vector precision for the motion vector; identifying a current block template in the current picture; searching within a search area for a final reference block template corresponding to the current block template, wherein searching within the search area comprises identifying an initial reference block template based on the motion vector; searching other reference block templates around the initial reference block template using a step size set to the initial step size; and iteratively reducing a step size from the initial step size until the step size is set to a final step size equal to the motion vector precision; determining a predictive block for the current block based on the final reference block template; decoding the current picture based on the determined predictive block; and outputting a decoded version of the current picture.

[0232] Clause 20B. The method of clause 19B, wherein iteratively reducing the step size from an initial step size until the step size is set to a final step size equal to the motion vector precision comprises determining that the step size is equal to the motion vector precision, and terminating the iteratively reducing the step size in response to determining that the step size is equal to the motion vector precision.

[0233] Clause 21B. The method of clause 19B, wherein iteratively reducing the initial step size until the final step size is equal to the motion vector precision comprises searching other reference block templates around the initial reference block template using the initial step size to determine a first improved motion vector, iteratively reducing the step size from the initial step size to a high precision step size, identifying a new initial reference block template based on the first improved motion vector, and searching a second group of other reference block templates around the new initial reference block template using the high precision step size to determine a second improved motion vector.

[0234] Clause 22B. The method of clause 19B, wherein the initial step size is equal to n pels, and wherein iteratively reducing the step size from the initial step size until the step size is set to a final step size equal to the motion vector precision comprises reducing the step size from n pels to n / 2 pels.

[0235] Clause 23B. The method of clause 19B, wherein all values ​​of the step sizes used to search within the search area are greater than or equal to the motion vector precision.

[0236] Clause 24B. The method of clause 19B, wherein iteratively reducing the step size comprises reducing the step size by a factor of 1 / 2.

[0237] Clause 25B. The method of clause 19B, wherein iteratively reducing the initial step size until the final step size is equal to the motion vector precision comprises searching other reference block templates around the initial reference block template using the initial step size and a first search pattern to determine a first improved motion vector, identifying a new initial reference block template based on the first improved motion vector, and searching a second group of other reference block templates around the new initial reference block template using the initial step size and a second search pattern to determine a second improved motion vector.

[0238] Clause 26B. The method of clause 19B, wherein the motion vector identifies a top-left sample of a reference block in the reference picture, and the search area is an area within 8 samples in an x-direction of the top-left sample and within 8 samples in a y-direction of the top-left sample.

[0239] Clause 27B. The method of clause 19B, wherein the motion vector precision and final step size are greater than 1 / 8 pel.

[0240] Clause 28B. The method of clause 19B, wherein the inter prediction mode comprises an AMVP mode, and determining the motion vector precision for the current block comprises receiving in the bitstream a syntax element indicating the motion vector precision.

[0241] Clause 29B. The method of clause 19B, wherein the inter prediction mode comprises a merge mode, and determining the motion vector precision for the current block comprises determining the motion vector precision from candidates in the merge list.

[0242] Clause 30B. The method of clause 19B, wherein outputting the decoded version of the current picture comprises outputting the decoded version of the current picture for display.

[0243] Clause 31B. The method of clause 19B, wherein the decoding method is performed as part of a video encoding process, and wherein outputting the decoded version of the current picture comprises storing the decoded version of the current picture for use in encoding subsequent blocks of video data.

[0244] Clause 32B. A computer-readable storage medium storing instructions, which, when executed by one or more processors, cause the one or more processors to: determine that a current block of a current picture is coded in an inter-prediction mode; determine a motion vector for the current block based on the inter-prediction mode; determine a motion vector accuracy for the motion vector; identify a current block template in the current picture; and search within a search area for a final reference block template corresponding to the current block template, where to search within the search area, the instructions cause the one or more processors to identify an initial reference block template based on the motion vector, search other reference block templates around the initial reference block template using a step size set to an initial step size, and iteratively reduce the step size from the initial step size until the step size is set to a final step size equal to the motion vector accuracy; determine a predictive block for the current block based on the final reference block template; decode the current picture based on the determined predictive block; and output a decoded version of the current picture.

[0245] Clause 33B. The computer-readable storage medium of clause 32B, wherein to iteratively reduce the step size from an initial step size until the step size is set to a final step size equal to the motion vector precision, the one or more processors are further configured to determine that the step size is equal to the motion vector precision, and in response to determining that the step size is equal to the motion vector precision, terminate the iterative reduction in the step size.

[0246] Clause 34B. The computer-readable storage medium of clause 32B, wherein to iteratively reduce the initial step size until the final step size is equal to the motion vector precision, the one or more processors are further configured to: search other reference block templates around the initial reference block template using the initial step size to determine a first improved motion vector; iteratively reduce the step size from the initial step size to a high precision step size; identify a new initial reference block template based on the first improved motion vector; and search a second group of other reference block templates around the new initial reference block template using the high precision step size to determine a second improved motion vector.

[0247] Clause 35B. The computer-readable storage medium of clause 32B, wherein the initial step size is equal to n pels, and the one or more processors are further configured to reduce the step size from n pels to n / 2 pels to iteratively reduce the step size from the initial step size until the step size is set to a final step size equal to the motion vector precision.

[0248] Clause 36B. The computer-readable storage medium of clause 32B, wherein all values ​​of the step size used to search within the search area are greater than or equal to the motion vector precision.

[0249] Clause 37B. The computer-readable storage medium of clause 32B, wherein, for iteratively reducing the step size, the one or more processors are further configured to reduce the step size by a factor of ½.

[0250] Clause 38B. The computer-readable storage medium of clause 32B, wherein to iteratively reduce the initial step size until the final step size is equal to the motion vector accuracy, the one or more processors are further configured to: search other reference block templates around the initial reference block template using the initial step size and a first search pattern to determine a first improved motion vector, identify a new initial reference block template based on the first improved motion vector, and search a second group of other reference block templates around the new initial reference block template using the initial step size and a second search pattern to determine a second improved motion vector.

[0251] Clause 39B. The computer-readable storage medium of clause 32B, wherein the motion vector identifies a top-left sample of a reference block in the reference picture, and the search area is an area within 8 samples in an x-direction of the top-left sample and within 8 samples in a y-direction of the top-left sample.

[0252] Clause 40B. The computer-readable storage medium of clause 32B, wherein the motion vector precision and final step size are greater than 1 / 8 pel.

[0253] Clause 41B. The computer-readable storage medium of clause 32B, wherein the inter prediction mode comprises an AMVP mode, and determining the motion vector precision for the current block comprises receiving in the bitstream a syntax element indicating the motion vector precision.

[0254] Clause 42B. The computer-readable storage medium of clause 32B, wherein the inter prediction mode comprises a merge mode, and determining the motion vector precision for the current block comprises determining the motion vector precision from candidates in a merge list.

[0255] Clause 43B. The computer-readable storage medium of clause 32B, wherein for outputting the decoded version of the current picture, the one or more processors are further configured to output the decoded version of the current picture for display.

[0256] Clause 44B. The computer-readable storage medium of clause 32B, wherein the device for decoding is configured to decode a current block of a current picture as part of performing an encoding process for the current picture, and the one or more processors are further configured to store the decoded version of the current picture for use in encoding subsequent blocks of video data, to output a decoded version of the current picture.

[0257] Clause 45B. A device for decoding video data, the device comprising: means for determining that a current block of a current picture is coded in an inter prediction mode; means for determining a motion vector for the current block based on the inter prediction mode; means for determining a motion vector accuracy for the motion vector; means for identifying a current block template in the current picture; means for searching within a search area for a final reference block template corresponding to the current block template, the means for searching within the search area comprising: means for identifying an initial reference block template based on the motion vector; means for searching other reference block templates around the initial reference block template using a step size set to the initial step size; and means for iteratively reducing the step size from the initial step size until the step size is set to a final step size equal to the motion vector accuracy; means for determining a predictive block for the current block based on the final reference block template; means for decoding the current picture based on the determined predictive block; and means for outputting a decoded version of the current picture.

[0258] Clause 1C. A device for decoding video data, the device comprising: a memory configured to store the video data; and one or more processors implemented in a circuit configuration, the one or more processors configured to: determine that a current block of a current picture is coded in an inter prediction mode; determine a motion vector for the current block based on the inter prediction mode; determine a motion vector accuracy for the motion vector; identify a current block template in the current picture; search within a search area for a final reference block template corresponding to the current block template, wherein to search within the search area, the one or more processors are further configured to identify an initial reference block template based on the motion vector, search other reference block templates around the initial reference block template using a step size set to an initial step size, and iteratively reduce the step size from the initial step size until the step size is set to a final step size equal to the motion vector accuracy; determine a predictive block for the current block based on the final reference block template; decode the current picture based on the determined predictive block; and output a decoded version of the current picture.

[0259] Clause 2C. The device of clause 1C, wherein for iteratively reducing the step size from an initial step size until the step size is set to a final step size equal to the motion vector precision, the one or more processors are further configured to determine that the step size is equal to the motion vector precision, and in response to determining that the step size is equal to the motion vector precision, terminate the iterative reduction in the step size.

[0260] Clause 3C. The device of any of clauses 1C to 2C, wherein, to iteratively reduce the initial step size until the final step size is equal to the motion vector precision, the one or more processors are further configured to: search other reference block templates around the initial reference block template using the initial step size to determine a first improved motion vector; iteratively reduce the step size from the initial step size to a high precision step size; identify a new initial reference block template based on the first improved motion vector; and search a second group of other reference block templates around the new initial reference block template using the high precision step size to determine a second improved motion vector.

[0261] Clause 4C. The device of any of clauses 1C to 3C, wherein the initial step size is equal to n pels, and the one or more processors are further configured to reduce the step size from n pels to n / 2 pels to iteratively reduce the step size from the initial step size until the step size is set to a final step size equal to the motion vector precision.

[0262] Clause 5C. The device of any of clauses 1C to 4C, wherein all values ​​of the step sizes used for searching within the search area are greater than or equal to the motion vector precision.

[0263] Clause 6C. The device of any of clauses 1C-5C, wherein, for iteratively reducing the step size, the one or more processors are further configured to reduce the step size by a factor of ½.

[0264] Clause 7C. The device of any of clauses 1C to 6C, wherein, for iteratively reducing the initial step size until the final step size is equal to the motion vector accuracy, the one or more processors are further configured to: search other reference block templates around the initial reference block template using the initial step size and a first search pattern to determine a first improved motion vector, identify a new initial reference block template based on the first improved motion vector, and search a second group of other reference block templates around the new initial reference block template using the initial step size and a second search pattern to determine a second improved motion vector.

[0265] Clause 8C. The device of any of clauses 1C to 7C, wherein the motion vector identifies a top-left sample of a reference block in the reference picture, and the search area is an area within 8 samples in the x-direction of the top-left sample and within 8 samples in the y-direction of the top-left sample.

[0266] Clause 9C. The device of any of clauses 1C-8C, wherein the motion vector precision and final step size are greater than 1 / 8 pel.

[0267] Clause 10C. The device of any of clauses 1C to 9C, wherein the inter prediction mode comprises an AMVP mode, and determining the motion vector precision for the current block comprises receiving in the bitstream a syntax element indicating the motion vector precision.

[0268] Clause 11C. The device of any of clauses 1C to 10C, wherein the inter prediction mode comprises a merge mode, and determining the motion vector precision for the current block comprises determining the motion vector precision from candidates in a merge list.

[0269] Clause 12C. The device of any of clauses 1C to 11C, wherein for outputting the decoded version of the current picture, the one or more processors are further configured to output the decoded version of the current picture for display.

[0270] Clause 13C. The device of any of clauses 1C to 12C, wherein the device for decoding is configured to decode a current block of a current picture as part of performing an encoding process for the current picture, and wherein the one or more processors are further configured to store the decoded version of the current picture for use in encoding subsequent blocks of video data, to output a decoded version of the current picture.

[0271] Clause 14C. The device of any of clauses 1C to 13C, wherein the device comprises a wireless communication device, further comprising a receiver configured to receive the encoded video data.

[0272] Clause 15C. The device of clause 14C, wherein the wireless communications device comprises a telephone handset, and the receiver is configured to demodulate the signal comprising the encoded video data in accordance with a wireless communications standard.

[0273] Clause 16C. The device of any of clauses 1C to 15C, further comprising a display configured to display the decoded video data.

[0274] Clause 17C. The device of any of clauses 1C to 16C, wherein the device comprises one or more of a computer, a mobile device, a broadcast receiver device, or a set-top box.

[0275] Clause 18C. The device of any of clauses 1C to 17C, wherein the device comprises a camera configured to capture video data.

[0276] Clause 19C. A method for decoding video data, the method comprising: determining that a current block of a current picture is coded in an inter-prediction mode; determining a motion vector for the current block based on the inter-prediction mode; determining a motion vector precision for the motion vector; identifying a current block template in the current picture; searching within a search area for a final reference block template corresponding to the current block template, where searching within the search area comprises identifying an initial reference block template based on the motion vector; searching other reference block templates around the initial reference block template using a step size set to the initial step size; and iteratively reducing the step size from the initial step size until the step size is set to a final step size equal to the motion vector precision; determining a predictive block for the current block based on the final reference block template; decoding the current picture based on the determined predictive block; and outputting a decoded version of the current picture.

[0277] Clause 20C. The method of clause 19C, wherein iteratively reducing the step size from an initial step size until the step size is set to a final step size equal to the motion vector precision comprises determining that the step size is equal to the motion vector precision, and terminating the iteratively reducing the step size in response to determining that the step size is equal to the motion vector precision.

[0278] Clause 21C. The method of any of clauses 19C to 20C, wherein iteratively reducing the initial step size until the final step size is equal to the motion vector precision comprises searching other reference block templates around the initial reference block template using the initial step size to determine a first improved motion vector, iteratively reducing the step size from the initial step size to a high precision step size, identifying a new initial reference block template based on the first improved motion vector, and searching a second group of other reference block templates around the new initial reference block template using the high precision step size to determine a second improved motion vector.

[0279] Clause 22C. The method of any of clauses 19C to 21C, wherein the initial step size is equal to n pels, and wherein iteratively reducing the step size from the initial step size until the step size is set to a final step size equal to the motion vector precision comprises reducing the step size from n pels to n / 2 pels.

[0280] Clause 23C. The method of any of clauses 19C to 22C, wherein all values ​​of the step sizes used for searching within the search area are greater than or equal to the motion vector precision.

[0281] Clause 24C. The method of any of clauses 19C to 23C, wherein iteratively reducing the step size comprises reducing the step size by a factor of 1 / 2.

[0282] Clause 25C. The method of any of clauses 19C to 24C, wherein iteratively reducing the initial step size until the final step size is equal to the motion vector precision comprises searching other reference block templates around the initial reference block template using the initial step size and a first search pattern to determine a first improved motion vector, identifying a new initial reference block template based on the first improved motion vector, and searching a second group of other reference block templates around the new initial reference block template using the initial step size and a second search pattern to determine a second improved motion vector.

[0283] Clause 26C. The method of any of clauses 19C to 25C, wherein the motion vector identifies a top-left sample of a reference block in the reference picture, and the search area is an area within 8 samples in an x-direction of the top-left sample and within 8 samples in a y-direction of the top-left sample.

[0284] Clause 27C. The method of any of clauses 19C to 26C, wherein the motion vector precision and final step size are greater than 1 / 8 pel.

[0285] Clause 28C. Any of the methods of clauses 19C to 27C, wherein the inter prediction mode comprises an AMVP mode, and determining the motion vector precision for the current block comprises receiving in the bitstream a syntax element indicating the motion vector precision.

[0286] Clause 29C. The method of any of clauses 19C to 28C, wherein the inter prediction mode comprises a merge mode, and determining the motion vector precision for the current block comprises determining the motion vector precision from candidates in a merge list.

[0287] Clause 30C. The method of any of clauses 19C to 29C, wherein outputting the decoded version of the current picture comprises outputting the decoded version of the current picture for display.

[0288] Clause 31C. The method of any of clauses 19C to 30C, wherein the decoding method is performed as part of a video encoding process, and wherein outputting the decoded version of the current picture comprises storing the decoded version of the current picture for use in encoding subsequent blocks of video data.

[0289] Clause 32C. A computer-readable storage medium storing instructions, which when executed by one or more processors, cause the one or more processors to: determine that a current block of a current picture is coded in an inter-prediction mode; determine a motion vector for the current block based on the inter-prediction mode; determine a motion vector accuracy for the motion vector; identify a current block template in the current picture; and search within a search area for a final reference block template corresponding to the current block template, where to search within the search area, the instructions cause the one or more processors to identify an initial reference block template based on the motion vector, search other reference block templates around the initial reference block template using a step size set to an initial step size, and iteratively reduce the step size from the initial step size until the step size is set to a final step size equal to the motion vector accuracy; determine a predictive block for the current block based on the final reference block template; decode the current picture based on the determined predictive block; and output a decoded version of the current picture.

[0290] Clause 33C. The computer-readable storage medium of clause 32C, wherein to iteratively reduce the step size from an initial step size until the step size is set to a final step size equal to the motion vector precision, the one or more processors are further configured to determine that the step size is equal to the motion vector precision, and in response to determining that the step size is equal to the motion vector precision, terminate the iterative reduction in the step size.

[0291] Clause 34C. The computer-readable storage medium of any of clauses 32C to 33C, wherein to iteratively reduce the initial step size until the final step size is equal to the motion vector precision, the one or more processors are further configured to: search other reference block templates around the initial reference block template using the initial step size to determine a first improved motion vector; iteratively reduce the step size from the initial step size to a high precision step size; identify a new initial reference block template based on the first improved motion vector; and search a second group of other reference block templates around the new initial reference block template using the high precision step size to determine a second improved motion vector.

[0292] Clause 35C. The computer-readable storage medium of any of clauses 32C to 34C, wherein the initial step size is equal to n pels, and the one or more processors are further configured to reduce the step size from n pels to n / 2 pels to iteratively reduce the step size from the initial step size until the step size is set to a final step size equal to the motion vector precision.

[0293] Clause 36C. The computer-readable storage medium of any of clauses 32C to 35C, wherein all values ​​of the step sizes used to search within the search area are greater than or equal to the motion vector precision.

[0294] Clause 37C. The computer-readable storage medium of any of clauses 32C to 36C, wherein, for iteratively reducing the step size, the one or more processors are further configured to reduce the step size by a factor of ½.

[0295] Clause 38C. The computer-readable storage medium of any of clauses 32C to 37C, wherein, to iteratively reduce the initial step size until the final step size is equal to the motion vector accuracy, the one or more processors are further configured to search other reference block templates around the initial reference block template using the initial step size and a first search pattern to determine a first improved motion vector, identify a new initial reference block template based on the first improved motion vector, and search a second group of other reference block templates around the new initial reference block template using the initial step size and a second search pattern to determine a second improved motion vector.

[0296] Clause 39C. The computer-readable storage medium of any of clauses 32C to 38C, wherein the motion vector identifies a top-left sample of a reference block in the reference picture, and the search area is an area within 8 samples in an x-direction of the top-left sample and within 8 samples in a y-direction of the top-left sample.

[0297] Clause 40C. The computer-readable storage medium of any of clauses 32C to 39C, wherein the motion vector precision and final step size are greater than 1 / 8 pel.

[0298] Clause 41C. The computer-readable storage medium of any of clauses 32C to 40C, wherein the inter prediction mode comprises an AMVP mode, and determining the motion vector precision for the current block comprises receiving in the bitstream a syntax element indicating the motion vector precision.

[0299] Clause 42C. The computer-readable storage medium of any of clauses 32C to 41C, wherein the inter prediction mode comprises a merge mode, and determining the motion vector accuracy for the current block comprises determining the motion vector accuracy from candidates in the merge list.

[0300] Clause 43C. The computer-readable storage medium of any of clauses 32C to 42C, wherein, for outputting the decoded version of the current picture, the one or more processors are further configured to output the decoded version of the current picture for display.

[0301] Clause 44C. The computer-readable storage medium of any of clauses 32C to 43C, wherein the device for decoding is configured to decode a current block of a current picture as part of performing an encoding process for the current picture, and the one or more processors are further configured to store the decoded version of the current picture for use in encoding subsequent blocks of video data, to output a decoded version of the current picture.

[0302] Clause 45C. A device for decoding video data, the device comprising: means for determining that a current block of a current picture is coded in an inter prediction mode; means for determining a motion vector for the current block based on the inter prediction mode; means for determining a motion vector accuracy for the motion vector; means for identifying a current block template in the current picture; means for searching within a search area for a final reference block template corresponding to the current block template, the means for searching within the search area comprising: means for identifying an initial reference block template based on the motion vector; means for searching other reference block templates around the initial reference block template using a step size set to the initial step size; and means for iteratively reducing the step size from the initial step size until the step size is set to a final step size equal to the motion vector accuracy; means for determining a predictive block for the current block based on the final reference block template; means for decoding the current picture based on the determined predictive block; and means for outputting a decoded version of the current picture.

[0303] It should be appreciated that, depending on the example, some acts or events of any of the techniques described herein may be performed in a different sequence, may be added, combined, or may be omitted entirely (e.g., not all acts or events described are necessary to the practice of the techniques). Moreover, in some examples, acts or events may be performed in parallel rather than sequentially, for example, through multi-threaded processing, interrupt processing, or multiple processors.

[0304] In one or more examples, the described functions may be implemented in hardware, software, firmware, or any combination thereof. If implemented in software, the functions may be stored on or transmitted via a computer-readable medium as one or more instructions or code and executed by a hardware-based processing unit. The computer-readable medium may include a computer-readable storage medium, which corresponds to a tangible medium, such as a data storage medium, or a communication medium, which includes any medium that facilitates transfer of a computer program from one place to another, for example according to a communication protocol. In this manner, a computer-readable medium may generally correspond to (1) a tangible computer-readable storage medium that is non-transitory, or (2) a communication medium, such as a signal or carrier wave. A data storage medium may 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 implementation of the techniques described in this disclosure. A computer program product may include a computer-readable medium.

[0305] By way of example and not limitation, such computer-readable storage media may comprise RAM, ROM, EEPROM, CD-ROM or other optical disk storage, magnetic disk storage or other magnetic storage devices, flash memory, or any other medium that may be used to store desired program code in the form of instructions or data structures and that may be accessed by a computer. Also, any connection is properly referred to as a computer-readable medium. For example, if instructions are transmitted from a website, server, or other remote source using coaxial cable, fiber optic cable, twisted pair, digital subscriber line (DSL), or wireless technologies such as infrared, radio, and microwave, the coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave are included within the definition of the medium. However, it should be understood that computer-readable storage media and data storage media do not include connections, carrier waves, signals, or other transitory media, but instead cover non-transitory tangible storage media. As used herein, 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 and discs reproduce data optically using lasers. Combinations of the above should also be included within the scope of computer readable media.

[0306] The instructions may be executed by one or more processors, such as one or more DSPs, general-purpose microprocessors, ASICs, FPGAs, or other equivalent integrated or discrete logic circuitry. Thus, the terms "processor" and "processing circuitry" as used herein may refer to any of the above structures or any other structures suitable for implementing the techniques described herein. In addition, in some aspects, the functionality described herein may be provided within dedicated hardware and / or software modules configured for encoding and decoding, or may be incorporated into a combined codec. Also, the techniques may be fully implemented in one or more circuits or logic elements.

[0307] The techniques of the present disclosure may be implemented in a wide variety of devices or apparatuses, including wireless handsets, integrated circuits (ICs), or sets of ICs (e.g., chipsets). Various components, modules, or units are described in the present disclosure to highlight functional aspects of devices configured to perform the disclosed techniques, but they do not necessarily require realization by different hardware units. Rather, as described above, the various units may be combined in a codec hardware unit or may be provided by a collection of interoperable hardware units including one or more processors as described above in conjunction with suitable software and / or firmware.

[0308] Various examples have been described. These and other examples are within the scope of the following claims. [Explanation of symbols]

[0309] 100 Video Encoding and Decoding System 102 Source Device 104 Video Sources 106 Memory 108 Output Interface 110 Computer-readable medium 112 Storage Devices 114 File Server 116 Destination Device 118 Display Devices 120 Memory 122 Input Interface 130 Quadruple Tree Binary Tree (QTBT) Structure 132 Coding Tree Unit (CTU) Blocks 140, 142, 144 146 Motion Vector Scaling Process 148 Current Templates 150 Current Picture 152 Reference Templates 154 Reference Pictures 156 Current Picture 158, 160 Reference Pictures 162 Current Picture 164, 166 Reference Pictures 170, 172, 174, 176 Samples Blocks 178 and 180 182, 184 points 200 Video Encoder 202 Mode Selection Unit 204 Residual Generation Unit 206 Conversion Processing Unit 208 Quantization Units 210 Inverse Quantization Unit 212 Inverse Transformation Processing Unit 214 Reconstruction Unit 216 Filter unit 218 Decoded Picture Buffer (DPB) 220 Entropy Coding Unit 222 Motion Estimation Unit 224 Motion Compensation Unit 226 intra prediction units 230 Video Data Memory 300 Video Decoder 302 Entropy Decoding Unit 304 Prediction Processing Unit 306 Inverse Quantization Unit 308 Inverse Transformation Processing Unit 310 Reconstruction Unit 312 Filter unit 314 Decoded Picture Buffer (DPB) 316 Motion Compensation Unit 317 DMVR unit 318 Intra Prediction Units 320 Coded Picture Buffer (CPB) Memory

Claims

1. 1. A device for decoding video data, comprising: a memory configured to store the video data; and one or more processors implemented in a circuit configuration, the one or more processors: determining that a current block of a current picture is coded in an inter prediction mode; determining a motion vector for the current block based on the inter prediction mode; determining a motion vector precision for the motion vector; identifying a current block template in the current picture; searching within a search area for a final reference block template corresponding to the current block template, wherein to search within the search area, the one or more processors: identifying an initial reference block template based on the motion vector; Searching other reference block templates around the initial reference block template using a step size set to an initial step size; searching, further configured to iteratively reduce the step size from the initial step size until the step size is set to a final step size equal to the motion vector precision; determining a prediction block for the current block based on the final reference block template; decoding the current picture based on the determined predictive block; and outputting a decoded version of the current picture. device.

2. the one or more processors to iteratively reduce the step size from the initial step size until the step size is set to the final step size equal to the motion vector precision; determining that the step size is equal to the motion vector precision; and further configured, in response to determining that the step size is equal to the motion vector precision, to terminate the iterative reduction of the step size.

2. The device of claim 1.

3. to iteratively reduce the initial step size until the final step size is equal to the motion vector precision, searching the other reference block templates around the initial reference block template using the initial step size to determine a first refined motion vector; Iteratively reducing the step size from the initial step size to a high precision step size; Identifying a new initial reference block template based on the first refined motion vector; and further configured to search a second group of other reference block templates around the new initial reference block template using the high precision step size to determine a second refined motion vector.

2. The device of claim 1.

4. the one or more processors are further configured to reduce the step size from n pels to n / 2 pels to iteratively reduce the step size from the initial step size until the initial step size is equal to n pels and the step size is set to the final step size equal to the motion vector precision. or 2. The device of claim 1, wherein to iteratively reduce the step size, the one or more processors are further configured to reduce the step size by a factor of 1 / 2.

5. The device of claim 1 , wherein all values ​​of the step size used to search within the search area are greater than or equal to the motion vector precision.

6. to iteratively reduce the initial step size until the final step size is equal to the motion vector precision, searching the other reference block templates around the initial reference block template using the initial step size and a first search pattern to determine a first refined motion vector; Identifying a new initial reference block template based on the first refined motion vector; and further configured to search a second group of other reference block templates around the new initial reference block template using the initial step size and a second search pattern to determine a second improved motion vector.

2. The device of claim 1.

7. 2. The device of claim 1, wherein the motion vector identifies a top-left sample of a reference block in a reference picture, and the search area is an area within 8 samples in an x-direction of the top-left sample and within 8 samples in a y-direction of the top-left sample.

8. The device of claim 1 , wherein the motion vector precision and the final step size are greater than 1 / 8 pel.

9. the inter prediction mode comprises an AMVP mode, and determining the motion vector precision for the current block comprises receiving in a bitstream a syntax element indicating the motion vector precision. or 2. The device of claim 1, wherein the inter prediction mode comprises a merge mode, and wherein determining the motion vector accuracy for the current block comprises determining the motion vector accuracy from candidates in a merge list.

10. 10. The device of claim 1, wherein the one or more processors are further configured to: output the decoded version of the current picture for display;

11. 2. The device of claim 1, wherein the device for decoding is configured to decode the current block of the current picture as part of performing an encoding process for the current picture, and wherein the one or more processors are further configured to store the decoded version of the current picture for use in encoding subsequent blocks of the video data to output the decoded version of the current picture.

12. 13. The device of claim 1, further comprising a wireless communication device comprising a receiver configured to receive encoded video data, optionally wherein the wireless communication device comprises a telephone handset, and wherein the receiver is configured to demodulate a signal comprising the encoded video data in accordance with a wireless communication standard.

13. 13. The device of claim 1, further comprising a display configured to display the decoded video data, and further comprising one or more of a computer, a mobile device, a broadcast receiver device, or a set-top box, and / or a camera configured to capture the video data.

14. 1. A method for decoding video data, comprising the steps of: determining that a current block of a current picture is coded in an inter prediction mode; determining a motion vector for the current block based on the inter prediction mode; determining a motion vector precision for the motion vector; identifying a current block template in the current picture; searching within a search area for a final reference block template corresponding to the current block template, the searching within the search area comprising: identifying an initial reference block template based on the motion vector; searching other reference block templates around the initial reference block template using a step size set to an initial step size; and iteratively reducing the step size from the initial step size until the step size is set to a final step size equal to the motion vector precision; determining a prediction block for the current block based on the final reference block template; decoding the current picture based on the determined predictive block; outputting a decoded version of the current picture; A method for providing the above.

15. 15. A computer-readable storage medium storing instructions that, when executed by one or more processors, cause the one or more processors to perform the method of claim 14. A computer-readable storage medium.