Template-based intra coding

Adaptive determination of candidate list lengths and entropy coding schemes for intra template matching prediction in video coding standards address inefficiencies, improving encoding and decoding efficiency and compression performance.

WO2026153481A1PCT designated stage Publication Date: 2026-07-23MEDIATEK INC
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
MEDIATEK INC
Filing Date
2026-01-16
Publication Date
2026-07-23

AI Technical Summary

Technical Problem

Existing video coding standards like HEVC and VVC face challenges in efficiently encoding and decoding intra prediction modes, particularly in determining the length of candidate lists for reference blocks in intra template matching prediction, which affects compression efficiency and bitstream parsing throughput.

Method used

Adaptive determination of the length of candidate lists for reference blocks based on coded contextual information and current coding conditions, using truncated unary and binary codes, and concatenated codeword schemes to entropy encode the index for selecting a reference block in intra template matching prediction.

Benefits of technology

Improves encoding and decoding efficiency by optimizing the length of candidate lists and reducing bitstream complexity, enhancing compression efficiency and bitstream parsing throughput.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2026073052_23072026_PF_FP_ABST
    Figure CN2026073052_23072026_PF_FP_ABST
Patent Text Reader

Abstract

A method for entropy coding an index for selecting a reference block from a list of candidates for intra template matching prediction (IntraTMP) is provided. A video coder receives data to be encoded or decoded as a current block of pixels of a current picture of a video. The video coder constructs a candidate list by searching the current picture to locate one or more reference blocks based on template matching with the current block. A length of the candidate list is adaptively determined for the current block. The video coder selects a reference block from the candidate list of reference blocks and signals or receives an index that indicates the selected reference block in the candidate list. The video coder generates a predictor of the current block based on the selected reference block. The video coder encodes or decodes the current block by using the generated predictor.
Need to check novelty before this filing date? Find Prior Art

Description

TEMPLATE-BASED INTRA CODINGCROSS REFERENCE TO RELATED PATENT APPLICATION (S)

[0001] The present disclosure is part of a non-provisional application that claims the priority benefit of U.S. Provisional Patent Application No. 63 / 745,846, filed on 16 January 2025. Content of above-listed application is herein incorporated by reference.TECHNICAL FIELD

[0002] The present disclosure relates generally to video coding. In particular, the present disclosure relates to methods of coding pixel blocks by intra template matching prediction (IntraTMP) and signaling of related syntax elements.BACKGROUND

[0003] Unless otherwise indicated herein, approaches described in this section are not prior art to the claims listed below and are not admitted as prior art by inclusion in this section.

[0004] High-Efficiency Video Coding (HEVC) is an international video coding standard developed by the Joint Collaborative Team on Video Coding (JCT-VC) . HEVC is based on the hybrid block-based motion-compensated DCT-like transform coding architecture. The basic unit for compression, termed coding unit (CU) , is a 2Nx2N square block of pixels, and each CU can be recursively split into four smaller CUs until the predefined minimum size is reached. Each CU contains one or multiple prediction units (PUs) .

[0005] Versatile video coding (VVC) is the latest international video coding standard developed by the Joint Video Expert Team (JVET) of ITU-T SG16 WP3 and ISO / IEC JTC1 / SC29 / WG11. The input video signal is predicted from the reconstructed signal, which is derived from the coded picture regions. The prediction residual signal is processed by a block transform. The transform coefficients are quantized and entropy coded together with other side information in the bitstream. The reconstructed signal is generated from the prediction signal and the reconstructed residual signal after inverse transform on the de-quantized transform coefficients. The reconstructed signal is further processed by in-loop filtering for removing coding artifacts. The decoded pictures are stored in the frame buffer for predicting the future pictures in the input video signal.

[0006] In VVC, a coded picture is partitioned into non-overlapped square block regions represented by the associated coding tree units (CTUs) . The leaf nodes of a coding tree correspond to the coding units (CUs) . A coded picture can be represented by a collection of slices, each comprising an integer number of CTUs. The individual CTUs in a slice are processed in raster-scan order. A bi-predictive (B) slice may be decoded using intra prediction or inter prediction with at most two motion vectors (MVs) and reference indices to predict the sample values of each block. A predictive (P) slice is decoded using intra prediction or inter prediction with at most one motion vector and reference index to predict the sample values of each block. An intra (I) slice is decoded using intra prediction only.

[0007] A CTU can be partitioned into one or multiple non-overlapped coding units (CUs) using the quadtree (QT) with nested multi-type-tree (MTT) structure to adapt to various local motion and texture characteristics. A CU can be further split into smaller CUs using one of several split types: quad-tree partitioning, vertical binary tree partitioning, horizontal binary tree partitioning, vertical center-side triple-tree partitioning, horizontal center-side triple-tree partitioning.

[0008] Each CU contains one or more prediction units (PUs) . The prediction unit, together with the associated CU syntax, works as a basic unit for signaling the predictor information. The specified prediction process is employed to predict the values of the associated pixel samples inside the PU. Each CU may contain one or more transform units (TUs) for representing the prediction residual blocks. A transform unit (TU) is comprised of a transform block (TB) of luma samples and two corresponding transform blocks of chroma samples and each TB correspond to one residual block of samples from one color component. An integer transform is applied to a transform block. The level values of quantized coefficients together with other side information are entropy coded in the bitstream. The terms coding tree block (CTB) , coding block (CB) , prediction block (PB) , and transform block (TB) are defined to specify the 2-D sample array of one-color component associated with CTU, CU, PU, and TU, respectively. Thus, a CTU consists of one luma CTB, two chroma CTBs, and associated syntax elements. A similar relationship is valid for CU, PU, and TU.

[0009] In VVC, an intra dual tree mode can be employed for coding intra slices. When the intra dual tree mode is applied, the luma CTB is partitioned into CUs by one coding tree structure, and the two chroma CTBs are partitioned into chroma CUs by another coding tree structure. There are two coding tree syntax structures thus signaled for luma and chroma, respectively, in a CTU. As a result, each CU consists of either one coding block from the luma component or two coding blocks, respectively from the two chroma components, when the intra dual tree mode is applied.

[0010] For achieving high compression efficiency, the context-based adaptive binary arithmetic coding (CABAC) mode, or known as regular mode, is employed for entropy coding the values of the syntax elements in VVC. As the arithmetic coder in the CABAC engine can only encode the binary symbol values, the CABAC operation first needs to convert the value of a syntax element into a binary string, the process commonly referred to as binarization. During the coding process, the probability models are gradually built up from the coded symbols for the different contexts. The selection of the modeling context for coding the next binary symbol can be determined by the coded information. Symbols can be coded without the context modeling stage and assume a predetermined probability distribution, commonly referred to as the bypass mode, for improving bitstream parsing throughput rate.SUMMARY

[0011] The following summary is illustrative only and is not intended to be limiting in any way. That is, the following summary is provided to introduce concepts, highlights, benefits and advantages of the novel and non-obvious techniques described herein. Select and not all implementations are further described below in the detailed description. Thus, the following summary is not intended to identify essential features of the claimed subject matter, nor is it intended for use in determining the scope of the claimed subject matter.

[0012] Some embodiments of the disclosure provide a method for entropy coding an index for selecting a reference block from a list of candidates for intra template matching prediction (IntraTMP) is provided. A video coder receives data to be encoded or decoded as a current block of pixels of a current picture of a video. The video coder constructs a candidate list by searching the current picture to locate one or more reference blocks based on template matching with the current block. A length of the candidate list is adaptively determined for the current block. The video coder selects a reference block from the candidate list of reference blocks and signals or receives an index that indicates the selected reference block in the candidate list. The video coder generates a predictor of the current block based on the selected reference block. The video coder encodes or decodes the current block by using the generated predictor.

[0013] In some embodiments, the length of the candidate list (or the number of reference blocks) is determined based on coded contextual information and current coding condition associated with the current block. In some embodiments, the length of the candidate list is determined based on at least one of a quantization parameter, a residual information, and a block size of the current block. In some embodiments, the length of the candidate list is determined for the current block by selecting from a pre-defined set of candidate list lengths. In some embodiments, one or more syntax elements to indicate the number of reference blocks in the candidate list are signaled in e.g., a sequence parameter set (SPS) , a picture parameter set (PPS) , picture header (PH) , or a slice header (SH) .

[0014] The signaled index may be entropy coded. In some embodiments, different codeword schemes are used to entropy code the index for candidate lists of different lengths. For example, when the length of the candidate list is 11, the maximum number of bins in a codeword used to code the index is 6. For example, when the length of the candidate list is 7, the maximum number of bins in a codeword used to code the index is 5. For example, when the length of the candidate list is 15, the number of bins in a codeword used to code the index is 6 if the index is in a range from 3 to 6, and 7 if the index in a range from 7 to 14.

[0015] In some embodiments, the index is entropy coded or binarized by a first codeword scheme when the length of the candidate list is less than or equal to a threshold value (e.g., threshold value = 2) and by a second codeword scheme when the length of the candidate list is greater than the threshold value. In some embodiments, the index is entropy coded (or binarized) by a concatenated codeword set, by which a first codeword scheme is used when the index is less than or equal to a threshold codeword value and a second codeword scheme is used when the index is greater than the threshold codeword value, with the first codeword scheme being truncated unary code and the second codeword scheme being truncated Rice code or truncated binary code.BRIEF DESCRIPTION OF THE DRAWINGS

[0016] The accompanying drawings are included to provide a further understanding of the present disclosure, and are incorporated in and constitute a part of the present disclosure. The drawings illustrate implementations of the present disclosure and, together with the description, serve to explain the principles of the present disclosure. It is appreciable that the drawings are not necessarily in scale as some components may be shown to be out of proportion than the size in actual implementation in order to clearly illustrate the concept of the present disclosure.

[0017] FIG. 1 conceptually illustrates using search regions for reference blocks for a current block coded by Intra Template Matching Prediction (IntraTMP) .

[0018] FIG. 2 illustrates an example video encoder that may implement IntraTMP prediction.

[0019] FIG. 3 illustrates portions of the video encoder that perform IntraTMP prediction for the current block.

[0020] FIG. 4 illustrates portions of the video encoder that entropy encodes an index for selecting a reference block from a list of candidates.

[0021] FIG. 5 conceptually illustrates a process that signals a selection of a IntraTMP reference block when encoding a pixel block.

[0022] FIG. 6 illustrates an example video decoder that may implement IntraTMP prediction.

[0023] FIG. 7 illustrates portions of the video decoder that perform IntraTMP prediction for the current block.

[0024] FIG. 8 illustrates portions of the video decoder that entropy decodes an index for selecting a reference block from a list of candidates.

[0025] FIG. 9 conceptually illustrates a process that signals a selection of a IntraTMP reference block when decoding a pixel block.

[0026] FIG. 10 conceptually illustrates an electronic system with which some embodiments of the present disclosure are implemented.DETAILED DESCRIPTION

[0027] In the following detailed description, numerous specific details are set forth by way of examples in order to provide a thorough understanding of the relevant teachings. Any variations, derivatives and / or extensions based on teachings described herein are within the protective scope of the present disclosure. In some instances, well-known methods, procedures, components, and / or circuitry pertaining to one or more example implementations disclosed herein may be described at a relatively high level without detail, in order to avoid unnecessarily obscuring aspects of teachings of the present disclosure. I. Candidate List for Reference Blocks of IntraTMP

[0028] Intra template matching prediction (IntraTMP) is a special intra prediction mode that utilizes one or more reference blocks from the reconstructed part of the current frame for predicting a current block. A list of candidate reference blocks is determined based on template matching costs, wherein a template-matching cost between a reference block and a current block corresponds to the sum of absolute transformed differences (SATD) or the sum of absolute differences (SAD) between the reconstructed samples in a L-shaped template region around the reference block and the reconstructed samples in a L-shaped template region around the current block. FIG. 1 conceptually illustrates using search regions (R1-R6) for reference blocks for a current block 110 coded by IntraTMP. A video encoder and a video decoder correspondingly search for the most similar reference template to the current template in a predefined search area of the current frame or picture to construct the list of candidate reference blocks. The index of the selected reference block in the candidate list is coded in the bitstream. II. Codeword Schemes for IntraTMP Reference Block Selection

[0029] In some embodiments, the list of candidate reference blocks for IntraTMP has 19 candidates. The selected candidate index is coded according to a codeword set (also termed codeword scheme) shown in Table 1 below.

[0030] Table 1: Codewords for selected index for IntraTMP

[0031] According to this codeword set or codeword scheme, 7 bins are needed to entropy code a candidate index from 3 to 18. In some embodiments, instead of using a fixed length of the candidate list (e.g., 19) , a video coder may determine the number of reference blocks in the candidate list adaptively, for coding a current block in intraTMP mode. In this way, a video coder may entropy encode or decode the current block in intraTMP mode more efficiently on different coding conditions.

[0032] In some embodiments, a video coder may encode or decode a current block in intraTMP mode, with one or more reference blocks from the reconstructed regions of the current frame being utilized for predicting a current block. The video coder further constructs a list of candidate reference blocks for predicting the current block. The number of reference blocks in the candidate list may be determined adaptively for the current block, and the list of candidate reference blocks may be derived based on template matching costs.

[0033] The video coder also performs entropy coding on the index of the selected reference block in the candidate list for predicting the current block. In some embodiments, a video coder may represent the index of a selected reference block in the candidate list by the truncated Rice (TR) code, the truncated binary (TB) code, the k-th order Exp-Golomb (EGk) code, the fixed-length code (FL) , or Huffman code.

[0034] In some embodiments, a video coder may determine the number of reference blocks in the candidate list adaptively for coding a current block in intraTMP mode based on the coded contextual information and current coding condition associated with the current block. In some embodiments, a video coder may determine the number of reference blocks in the candidate list for a current block based on quantization parameter, residual information, and / or block size of the current block.

[0035] In some embodiments, a video coder may signal one or more syntax elements to indicate the number of reference blocks in the candidate list in intraTMP mode. In some embodiments, a video coder may further signal one or more syntax elements in one or more high-level syntax sets to indicate the length of the candidate list for intraTMP mode for respective data units, the one or more high-level syntax sets being SPS, PPS, PH, SH or a combination thereof.

[0036] In some embodiments, a video coder may employ different codeword sets for different candidate list lengths for intraTMP mode. In some embodiments, when a current candidate list length N0 is less than a pre-defined threshold T0, a video coder may adopt a truncated unary code (TR with a Rice parameter equal to 0) with a maximum codeword value equal to (N0 –1 ) to signal the selected candidate index. In some embodiments, when a current candidate list length N1 is greater than another pre-defined threshold T1, a video coder may adopt a truncated binary code with a maximum codeword value equal to (N1 –1 ) as the codeword set to signal the selected candidate index. In some embodiments, a video coder may employ a concatenation of the truncated unary code and the truncated binary code as a concatenated codeword set (or codeword scheme) to represent a selected candidate index, indicated by intraTmpIdx, for intraTMP mode with a candidate list length N. The concatenated codeword set is used as follows: when the codeword value of intraTmpIdx is less than or equal to a threshold T2, the codeword value is binarize by the truncated unary code with an allowed maximum codeword value equal to T2. When the codeword value of intraTmpIdx is greater than T2, (intraTmpIdx –T2 > 0) , the codeword value is binarized by a truncated binary code. The allowed maximum codeword value is (N –1 ) . The control parameters T0, T1, and T2 can be pre-defined or signaled in the bitstream.

[0037] In some embodiments, the selected index can be represented by a concatenated codeword set of the truncated unary code with the truncated Rice code or the fixed-length code. In some embodiments, a video coder may represent a selected index by a concatenated codeword set of the truncated unary code with the fixed-length code. In some embodiments, a video coder may represent a selected index by a concatenated codeword set of the truncated unary code and the truncated Rice code.

[0038] In some embodiments, a video coder may use a pre-defined set of candidate list lengths for intraTMP mode and the video coder may determine the candidate list length for coding a current block in intraTMP mode from the pre-defined set of candidate list lengths. For example, a pre-defined set of candidate list lengths may comprise the candidate list lengths 1, 2, 3, 4, 7, 8, 11, 15, 19, 35 or a combination thereof. (Thus, when the selected candidate list length for intraTMP is equal to 1 for a current block, the selected candidate index (for the selected reference block) can be inferred to be equal to 0 without explicitly signaling for the current block. For another example, a pre-defined set of candidate list lengths may comprise a set of the candidate list lengths in form of N = N0 + i *2k, where N0, i and k are integers.

[0039] In some embodiements, when the selected candidate list length for intraTMP is equal to 11, the selected candidate index for the selected reference block is coded according to a codeword set shown in Table 2.

[0040] Table 2: Codewords for a selected index with candidate list length 11

[0041] In some embodiements, when the selected candidate list length for intraTMP is equal to 7, the selected candidate index for the selected reference block is coded according to a codeword set shown in Table 3.

[0042] Table 3: Codewords for a selected index with candidate list length 7

[0043] In some embodiements, when the selected candidate list length for intraTMP is equal to 15, the selected candidate index for the selected reference block is coded according to a codeword set shown in Table 4.

[0044] Table 4: Codewords for a selected index with candidate list length 15

[0045] In some embodiements, when the selected candidate list length for intraTMP is equal to 19, the selected candidate index for the selected reference block is coded according to a codeword set shown in Table 5.

[0046] Table 5: Codewords for a selected index with a candidate list length 19

[0047] In some embodiments, the video coder signals one or more syntax elements in one or more high-level syntax sets to indicate whether any of the proposed methods is enabled or disable in a current video data unit, the one or more high-level syntax sets may comprise sequence parameter set (SPS) , picture parameter set (PPS) , picture header (PH) , slice header (SH) , or a combination thereof.

[0048] Any of the foregoing proposed methods can be implemented in encoders and / or decoders. For example, any of the proposed methods can be implemented in an entropy coding module of an encoder, and / or an entropy coding module of a decoder. Alternatively, any of the proposed methods can be implemented as a circuit integrated to the entropy coding module of the encoder and / or the entropy coding module of the decoder. The proposed aspects, methods and related embodiments can be implemented individually or jointly in an image and video coding system. III. Example Video Encoder

[0049] FIG. 2 illustrates an example video encoder 200 that may implement IntraTMP prediction. As illustrated, the video encoder 200 receives input video signal from a video source 205 and encodes the signal into bitstream 295. The video encoder 200 has several components or modules for encoding the signal from the video source 205, at least including some components selected from a transform module 210, a quantization module 211, an inverse quantization module 214, an inverse transform module 215, an intra estimation module 224, an intra prediction module 225, a motion compensation module 230, a motion estimation module 235, an in-loop filter 245, a reconstructed picture buffer 250, a MV buffer 265, and a MV prediction module 275, and an entropy encoder 290. The motion compensation module 230 and the motion estimation module 235 are part of an inter-prediction module 240. The intra-prediction module 225 and the intra-estimation module 224 are part of a current picture prediction module 220, which uses current picture reconstructed samples as reference samples for prediction of the current block.

[0050] In some embodiments, the modules 210 –290 are modules of software instructions being executed by one or more processing units (e.g., a processor) of a computing device or electronic apparatus. In some embodiments, the modules 210 –290 are modules of hardware circuits implemented by one or more integrated circuits (ICs) of an electronic apparatus. Though the modules 210 –290 are illustrated as being separate modules, some of the modules can be combined into a single module.

[0051] The video source 205 provides a raw video signal that presents pixel data of each video frame without compression. A subtractor 208 computes the difference between the raw video pixel data of the video source 205 and the predicted pixel data 213 from the motion compensation module 230 or intra-prediction module 225 as prediction residual 209. The transform module 210 converts the difference (or the residual pixel data or residual signal 209) into transform coefficients (e.g., by performing Discrete Cosine Transform, or DCT) . The quantization module 211 quantizes the transform coefficients into quantized data (or quantized coefficients) 212, which is encoded into the bitstream 295 by the entropy encoder 290.

[0052] The inverse quantization module 214 de-quantizes the quantized data (or quantized coefficients) 212 to obtain transform coefficients 218, and the inverse transform module 215 performs inverse transform on the transform coefficients 218 to produce reconstructed residual 219. The reconstructed residual 219 is added with the predicted pixel data 213 to produce reconstructed pixel data 217. In some embodiments, the reconstructed pixel data 217 is temporarily stored in a line buffer 227 (or intra prediction buffer) for intra-picture prediction and spatial MV prediction. The reconstructed pixels are filtered by the in-loop filter 245 and stored in the reconstructed picture buffer 250. In some embodiments, the reconstructed picture buffer 250 is a storage external to the video encoder 200. In some embodiments, the reconstructed picture buffer 250 is a storage internal to the video encoder 200.

[0053] The intra estimation module 224 derives intra-prediction data (e.g., intra prediction modes) based on the reconstructed pixel data 217 (stored in the line buffer 227) . The intra-prediction data is provided to the entropy encoder 290 to be encoded into bitstream 295. The intra-prediction data is also used by the intra-prediction module 225 to produce the predicted pixel data 213.

[0054] The motion estimation module 235 performs inter-prediction by producing MVs to reference pixel data of previously decoded frames stored in the reconstructed picture buffer 250. These MVs are provided to the motion compensation module 230 to produce predicted pixel data.

[0055] Instead of encoding the complete actual MVs in the bitstream, the video encoder 200 uses MV prediction to generate predicted MVs, and the difference between the MVs used for motion compensation and the predicted MVs is encoded as residual motion data and stored in the bitstream 295.

[0056] The MV prediction module 275 generates the predicted MVs based on reference MVs that were generated for encoding previously video frames, i.e., the motion compensation MVs that were used to perform motion compensation. The MV prediction module 275 retrieves reference MVs from previous video frames from the MV buffer 265. The video encoder 200 stores the MVs generated for the current video frame in the MV buffer 265 as reference MVs for generating predicted MVs.

[0057] The MV prediction module 275 uses the reference MVs to create the predicted MVs. The predicted MVs can be computed by spatial MV prediction or temporal MV prediction. The difference between the predicted MVs and the motion compensation MVs (MC MVs) of the current frame (residual motion data) are encoded into the bitstream 295 by the entropy encoder 290.

[0058] The entropy encoder 290 encodes various parameters and data into the bitstream 295 by using entropy-coding techniques such as context-adaptive binary arithmetic coding (CABAC) or Huffman encoding. The entropy encoder 290 encodes various header elements, flags, along with the quantized transform coefficients 212, and the residual motion data as syntax elements into the bitstream 295. The bitstream 295 is in turn stored in a storage device or transmitted to a decoder over a communications medium such as a network.

[0059] The in-loop filter 245 performs filtering or smoothing operations on the reconstructed pixel data 217 to reduce the artifacts of coding, particularly at boundaries of pixel blocks. In some embodiments, the filtering or smoothing operations performed by the in-loop filter 245 include deblock filter (DBF) , sample adaptive offset (SAO) , and / or adaptive loop filter (ALF) . In some embodiments, luma mapping chroma scaling (LMCS) is performed before the loop filters.

[0060] FIG. 3 illustrates portions the video encoder 200 that perform IntraTMP prediction for the current block. As illustrated, an IntraTMP module 310 searches the content of the reconstructed picture buffer 250 and the line buffer 227 for reference areas or blocks in the current picture based on template matching with the current block. One or more block vectors (BVs) for locating the best matching reference blocks are stored in a storage 320. In some embodiments, the best matching reference block (s) is / are located based on the respective template cost (s) calculated for the reference blocks.

[0061] A candidate list 335 for the IntraTMP reference blocks is produced for the current block by a candidate list construction module 330. The length of the candidate list 335 is specified by an adaptive list length module 340, which may determine the candidate list length 345 (i.e., the number of reference blocks) based on the coded contextual information and current coding condition associated with the current block. In some embodiments, the adaptive list length module 340 may determine the candidate list length for the current block based on quantization parameter, residual information, and / or block size of the current block. The candidate list length 345 is also provided to the entropy encoder 290 for selecting a codeword scheme.

[0062] A candidate selection module 350 may select one or more of the candidate IntraTMP reference blocks from the candidate list 335 by providing a candidate selection index 355. The selected reference block (s) is provided to a prediction generation module 360, which fetches samples from the reconstructed picture buffer 250 to generate a predictor for the current block as the predicted pixel data 213. The candidate selection index 355 is also provided to the entropy encoder 290 to be entropy coded and signaled.

[0063] FIG. 4 illustrates portions of the video encoder 200 that entropy encodes an index for selecting a reference block from a list of candidates. Specifically, the figure illustrates the components of the entropy encoder 290 when entropy encoding syntax elements of the current block. As illustrated, the entropy encoder 290 includes a syntax element selection module 410, a context selection module 420, a context models storage 430, a binarization module 440, a bypass encoding engine 445, a bin encoding engine 450, and a context model update module 460.

[0064] The syntax element selection module 410 selects data to be encoded as syntax elements in the bitstream 295 from various sources of the video encoder 200, including quantized coefficients 212 and the candidate selection index 355.

[0065] The data selected as syntax element is passed to the binarization module 440, which convert the selected data into bins for syntax elements in regular mode. The conversion of the selected data into bins may use different codeword sets or schemes for different syntax elements under different conditions. For example, different codeword sets may be used by the binarization module 440 for binarizing the candidate selection index 355 based on the candidate list length 345. Some examples of the different codeword schemes for candidate lists of different lengths are provided by Tables 1 through 5 in Section II above.

[0066] The bin encoding engine 450 in turn performs binary arithmetic coding to convert the bins into binary arithmetic codes to be included in the bitstream 295. The binary arithmetic coding operation relies on context modeling, which provides context models based on probabilities specific to the type of syntax element being coded. Syntax elements in bypass mode are sent to the bypass encoding engine 445 to be directly entropy coded into the bitstream 295 without context modeling.

[0067] The different context models of the different types of syntax elements are stored at the context models storage 430. The context model update module 460 updates the probabilities of the various context models based on the bin values that are processed at the bin encoding engine 450. The context models (or context variables 432) being used by the bin encoding engine 450 are retrieved from the context models storage 430 based on a context index 425 provided by the context selection module 420.

[0068] FIG. 5 conceptually illustrates a process 500 that signals a selection of a IntraTMP reference block when encoding a pixel block. In some embodiments, one or more processing units (e.g., a processor) of a computing device implementing the encoder 200 performs the process 500 by executing instructions stored in a computer readable medium. In some embodiments, an electronic apparatus implementing the encoder 200 performs the process 500.

[0069] The encoder receives (at block 510) data to be encoded as a current block of pixels in a current picture.

[0070] The encoder constructs (at block 520) a candidate list by searching the current picture (by performing IntraTMP process) to locate one or more reference blocks based on template matching with the current block (e.g., the reference blocks having template regions that best match a neighboring region of the current block based on template matching costs. ) A length of the candidate list (or a number of reference blocks included in the candidate list) is adaptively determined for the current block. In some embodiments, the length of the candidate list (or the number of reference blocks) is determined based on coded contextual information and current coding condition associated with the current block. In some embodiments, the length of the candidate list is determined based on at least one of a quantization parameter, a residual information, and a block size of the current block. In some embodiments, the length of the candidate list is determined for the current block by selecting from a pre-defined set of candidate list lengths. In some embodiments, one or more syntax elements to indicate the number of reference blocks in the candidate list are signaled in e.g., a sequence parameter set (SPS) , a picture parameter set (PPS) , picture header (PH) , or a slice header (SH) .

[0071] The encoder selects (at block 530) a reference block from the candidate list of reference blocks. The encoder signals (at block 535) an index that indicates the selected reference block in the candidate list. The signaled index may be entropy coded. In some embodiments, different codeword schemes are used to entropy code the index for candidate lists of different lengths. For example, when the length of the candidate list is 11, the maximum number of bins in a codeword used to code the index is 6. For example, when the length of the candidate list is 7, the maximum number of bins in a codeword used to code the index is 5. For example, when the length of the candidate list is 15, the number of bins in a codeword used to code the index is 6 for when the index is in a range from 3 to 6, and 7 for when the index in a range from 7 to 14.

[0072] In some embodiments, the index is entropy coded or binarized by a first codeword scheme when the length of the candidate list is less than or equal to a threshold value (e.g., threshold value = 2) and by a second codeword scheme when the length of the candidate list is greater than the threshold value. In some embodiments, the index is entropy coded (or binarized) by a concatenated codeword set, by which a first codeword scheme is used when the index is less than or equal to a threshold codeword value and a second codeword scheme is used when the index is greater than the threshold codeword value, with the first codeword scheme being truncated unary code and the second codeword scheme being truncated Rice code or truncated binary code.

[0073] The encoder generates (at block 540) a predictor of the current block based on the selected reference block. The encoder encodes (at block 550) the current block by using the generated predictor to produce prediction residuals. IV. Example Video Decoder

[0074] In some embodiments, an encoder may signal (or generate) one or more syntax element in a bitstream, such that a decoder may parse said one or more syntax element from the bitstream.

[0075] FIG. 6 illustrates an example video decoder 600 that may implement IntraTMP prediction. As illustrated, the video decoder 600 is an image-decoding or video-decoding circuit that receives a bitstream 695 and decodes the content of the bitstream into pixel data of video frames for display. The video decoder 600 has several components or modules for decoding the bitstream 695, including some components selected from an inverse quantization module 614, an inverse transform module 615, an intra-prediction module 625, a motion compensation module 630, an in-loop filter 645, a decoded picture buffer 650, a MV buffer 665, a MV prediction module 675, and a parser 690. The motion compensation module 630 is part of an inter-prediction module 640. The intra-prediction module 625 is part of a current picture prediction module 620, which uses current picture reconstructed samples as reference samples for prediction of the current block.

[0076] In some embodiments, the modules 614 –690 are modules of software instructions being executed by one or more processing units (e.g., a processor) of a computing device. In some embodiments, the modules 614 –690 are modules of hardware circuits implemented by one or more ICs of an electronic apparatus. Though the modules 614 –690 are illustrated as being separate modules, some of the modules can be combined into a single module.

[0077] The parser 690 (or entropy decoder) receives the bitstream 695 and performs initial parsing according to the syntax defined by a video-coding or image-coding standard. The parsed syntax element includes various header elements, flags, as well as quantized data (or quantized coefficients) 612. The parser 690 parses out the various syntax elements by using entropy-coding techniques such as context-adaptive binary arithmetic coding (CABAC) or Huffman encoding.

[0078] The inverse quantization module 614 de-quantizes the quantized data (or quantized coefficients) 612 to obtain transform coefficients, and the inverse transform module 615 performs inverse transform on the transform coefficients 618 to produce reconstructed residual signal 619. The reconstructed residual signal 619 is added with predicted pixel data 613 from the intra-prediction module 625 or the motion compensation module 630 to produce decoded pixel data 617. The decoded pixels data are filtered by the in-loop filter 645 and stored in the decoded picture buffer 650. In some embodiments, the decoded picture buffer 650 is a storage external to the video decoder 600. In some embodiments, the decoded picture buffer 650 is a storage internal to the video decoder 600.

[0079] The intra-prediction module 625 receives intra-prediction data from bitstream 695 and according to which, produces the predicted pixel data 613 from the decoded pixel data 617 stored in the decoded picture buffer 650. In some embodiments, the decoded pixel data 617 is also stored in a line buffer 627 (or intra prediction buffer) for intra-picture prediction and spatial MV prediction.

[0080] In some embodiments, the content of the decoded picture buffer 650 is used for display. A display device 605 either retrieves the content of the decoded picture buffer 650 for display directly, or retrieves the content of the decoded picture buffer to a display buffer. In some embodiments, the display device receives pixel values from the decoded picture buffer 650 through a pixel transport.

[0081] The motion compensation module 630 produces predicted pixel data 613 from the decoded pixel data 617 stored in the decoded picture buffer 650 according to motion compensation MVs (MC MVs) . These motion compensation MVs are decoded by adding the residual motion data received from the bitstream 695 with predicted MVs received from the MV prediction module 675.

[0082] The MV prediction module 675 generates the predicted MVs based on reference MVs that were generated for decoding previous video frames, e.g., the motion compensation MVs that were used to perform motion compensation. The MV prediction module 675 retrieves the reference MVs of previous video frames from the MV buffer 665. The video decoder 600 stores the motion compensation MVs generated for decoding the current video frame in the MV buffer 665 as reference MVs for producing predicted MVs.

[0083] The in-loop filter 645 performs filtering or smoothing operations on the decoded pixel data 617 to reduce the artifacts of coding, particularly at boundaries of pixel blocks. In some embodiments, the filtering or smoothing operations performed by the in-loop filter 645 include deblock filter (DBF) , sample adaptive offset (SAO) , and / or adaptive loop filter (ALF) . In some embodiments, luma mapping chroma scaling (LMCS) is performed before the loop filters.

[0084] FIG. 7 illustrates portions the video decoder 600 that perform IntraTMP prediction for the current block. As illustrated, an IntraTMP module 710 searches the content of the decoded picture buffer 650 and the line buffer 627 for reference areas or blocks in the current picture based on template matching with the current block. One or more block vectors (BVs) for locating the best matching reference blocks are stored in a storage 720.

[0085] A candidate list 735 for the IntraTMP reference blocks is constructed for the current block by a candidate list construction module 730. The length of the candidate list 735 is specified by an adaptive list length module 740, which may determine the candidate list length 745 (i.e., the number of reference blocks) based on the coded contextual information and current coding condition associated with the current block. In some embodiments, the adaptive list length module 740 may determine the candidate list length for the current block based on quantization parameter, residual information, and / or block size of the current block. The candidate list length 745 is also provided to the entropy decoder 690 for selecting a codeword scheme.

[0086] A candidate selection module 750 may select one or more of the candidate IntraTMP reference blocks from the candidate list 735 based on a candidate selection index 755 that is received from the entropy decoder, which parses the bitstream for syntax element that represents the selection index 755. The selected reference block (s) is provided to a prediction generation module 760, which fetches samples from the decoded picture buffer 650 to generate a predictor for the current block as the predicted pixel data 613.

[0087] FIG. 8 illustrates portions of the video decoder 600 that entropy decodes an index for selecting a reference block from a list of candidates. Specifically, the figure illustrates the components of the entropy decoder 690 when entropy decoding syntax elements of the current block. As illustrated, the entropy decoder 690 includes a syntax element distribution module 810, a context selection module 820, a context models storage 830, a de-binarization module 840, a bypass decoding engine 845, a bin decoding engine 850, and a context model update module 860.

[0088] Bits from the bitstream 695 in bypass mode are sent to the bypass decoding engine 845 to be directly entropy decoded and used as syntax elements without context modeling. Bits from the bitstream in regular mode are sent to the bin decoding engine 850. The bin decoding engine 850 receives bits in regular mode and performs binary arithmetic coding to convert the received bits into bins. The binary arithmetic coding operation relies on context modeling, which provides context models based on probabilities specific to the type of syntax element being coded. The context models (or context variables 832) being used by the bin decoding engine 850 is retrieved from the context models storage 830 based on context index 825 provided by the context selection module 820. The different context models of the different types of syntax elements are stored at the context models storage 830. The context model update module 860 updates the probabilities of the various context models based on the bin values that are processed at the bin decoding engine 850.

[0089] The de-binarization module 840 converts the bins from the bin decoding engine 850 into syntax elements. The conversion of the bins into syntax elements may use different codeword sets or schemes for different syntax elements under different conditions. For example, different codeword sets may be used by the de-binarization module 840 for de-binarizing the bins for the candidate selection index 755 based on the candidate list length 745. Some examples of the different codeword schemes for candidate lists of different lengths are provided by Tables 1 through 5 in Section II above.

[0090] The decoded syntax elements are in turn distributed to various destinations in the video decoder 600 by the syntax element distribution module 810. As illustrated, decoded syntax elements such as quantized coefficients 612 and candidate selection index 755 are distributed to various destination of the video decoder 600.

[0091] FIG. 9 conceptually illustrates a process 900 that signals a selection of a IntraTMP reference block when decoding a pixel block. In some embodiments, one or more processing units (e.g., a processor) of a computing device implementing the decoder 600 performs the process 900 by executing instructions stored in a computer readable medium. In some embodiments, an electronic apparatus implementing the decoder 600 performs the process 900.

[0092] The decoder receives (at block 910) data to be decoded as a current block of pixels in a current picture.

[0093] The decoder constructs (at block 920) a candidate list by searching the current picture (by performing IntraTMP process) to locate one or more reference blocks based on template matching with the current block (e.g., reference blocks having template regions that best match a neighboring region of the current block based on template matching costs. ) A length of the candidate list (or a number of reference blocks included in the candidate list) is adaptively determined for the current block. In some embodiments, the length of the candidate list (or the number of reference blocks) is determined based on coded contextual information and current coding condition associated with the current block. In some embodiments, the length of the candidate list is determined based on at least one of a quantization parameter, a residual information, and a block size of the current block. In some embodiments, the length of the candidate list is determined for the current block by selecting from a pre-defined set of candidate list lengths. In some embodiments, one or more syntax elements to indicate the number of reference blocks in the candidate list are signaled in e.g., a sequence parameter set (SPS) , a picture parameter set (PPS) , picture header (PH) , or a slice header (SH) .

[0094] The decoder receives (at block 925) an index that indicates the selected reference block in the candidate list. The signaled index may be entropy coded. In some embodiments, different codeword schemes are used to entropy code the index for candidate lists of different lengths. For example, when the length of the candidate list is 11, the maximum number of bins in a codeword used to code the index is 6. For example, when the length of the candidate list is 7, the maximum number of bins in a codeword used to code the index is 5. For example, when the length of the candidate list is 15, the number of bins in a codeword used to code the index is 6 for when the index is in a range from 3 to 6, and 7 for when the index in a range from 7 to 14.

[0095] In some embodiments, the index is entropy coded or binarized by a first codeword scheme when the length of the candidate list is less than or equal to a threshold value (e.g., threshold value = 2) and by a second codeword scheme when the length of the candidate list is greater than the threshold value. In some embodiments, the index is entropy coded (or binarized) by a concatenated codeword set, by which a first codeword scheme is used when the index is less than or equal to a threshold codeword value and a second codeword scheme is used when the index is greater than the threshold codeword value, with the first codeword scheme being truncated unary code and the second codeword scheme being truncated Rice code or truncated binary code.

[0096] The decoder selects (at block 930) a reference block from the candidate list of reference blocks based on the received index. The decoder generates (at block 940) a predictor of the current block based on the selected reference block. The decoder reconstructs (at block 950) the current block by using the generated predictor to combine with prediction residuals. The decoder may then provide the reconstructed current block for display or output as part of the reconstructed current picture. V. Example Electronic System

[0097] Many of the above-described features and applications are implemented as software processes that are specified as a set of instructions recorded on a computer readable storage medium (also referred to as computer readable medium) . When these instructions are executed by one or more computational or processing unit (s) (e.g., one or more processors, cores of processors, or other processing units) , they cause the processing unit (s) to perform the actions indicated in the instructions. Examples of computer readable media include, but are not limited to, CD-ROMs, flash drives, random-access memory (RAM) chips, hard drives, erasable programmable read only memories (EPROMs) , electrically erasable programmable read-only memories (EEPROMs) , etc. The computer readable media does not include carrier waves and electronic signals passing wirelessly or over wired connections.

[0098] In this specification, the term “software” is meant to include firmware residing in read-only memory or applications stored in magnetic storage which can be read into memory for processing by a processor. Also, in some embodiments, multiple software inventions can be implemented as sub-parts of a larger program while remaining distinct software inventions. In some embodiments, multiple software inventions can also be implemented as separate programs. Finally, any combination of separate programs that together implement a software invention described here is within the scope of the present disclosure. In some embodiments, the software programs, when installed to operate on one or more electronic systems, define one or more specific machine implementations that execute and perform the operations of the software programs.

[0099] FIG. 10 conceptually illustrates an electronic system 1000 with which some embodiments of the present disclosure are implemented. The electronic system 1000 may be a computer (e.g., a desktop computer, personal computer, tablet computer, etc. ) , phone, PDA, or any other sort of electronic device. Such an electronic system includes various types of computer readable media and interfaces for various other types of computer readable media. Electronic system 1000 includes a bus 1005, processing unit (s) 1010, a graphics-processing unit (GPU) 1015, a system memory 1020, a network 1025, a read-only memory 1030, a permanent storage device 1035, input devices 1040, and output devices 1045.

[0100] The bus 1005 collectively represents all system, peripheral, and chipset buses that communicatively connect the numerous internal devices of the electronic system 1000. For instance, the bus 1005 communicatively connects the processing unit (s) 1010 with the GPU 1015, the read-only memory 1030, the system memory 1020, and the permanent storage device 1035.

[0101] From these various memory units, the processing unit (s) 1010 retrieves instructions to execute and data to process in order to execute the processes of the present disclosure. The processing unit (s) may be a single processor or a multi-core processor in different embodiments. Some instructions are passed to and executed by the GPU 1015. The GPU 1015 can offload various computations or complement the image processing provided by the processing unit (s) 1010.

[0102] The read-only-memory (ROM) 1030 stores static data and instructions that are used by the processing unit (s) 1010 and other modules of the electronic system. The permanent storage device 1035, on the other hand, is a read-and-write memory device. This device is a non-volatile memory unit that stores instructions and data even when the electronic system 1000 is off. Some embodiments of the present disclosure use a mass-storage device (such as a magnetic or optical disk and its corresponding disk drive) as the permanent storage device 1035.

[0103] Other embodiments use a removable storage device (such as a floppy disk, flash memory device, etc., and its corresponding disk drive) as the permanent storage device. Like the permanent storage device 1035, the system memory 1020 is a read-and-write memory device. However, unlike storage device 1035, the system memory 1020 is a volatile read-and-write memory, such a random access memory. The system memory 1020 stores some of the instructions and data that the processor uses at runtime. In some embodiments, processes in accordance with the present disclosure are stored in the system memory 1020, the permanent storage device 1035, and / or the read-only memory 1030. For example, the various memory units include instructions for processing multimedia clips in accordance with some embodiments. From these various memory units, the processing unit (s) 1010 retrieves instructions to execute and data to process in order to execute the processes of some embodiments.

[0104] The bus 1005 also connects to the input and output devices 1040 and 1045. The input devices 1040 enable the user to communicate information and select commands to the electronic system. The input devices 1040 include alphanumeric keyboards and pointing devices (also called “cursor control devices” ) , cameras (e.g., webcams) , microphones or similar devices for receiving voice commands, etc. The output devices 1045 display images generated by the electronic system or otherwise output data. The output devices 1045 include printers and display devices, such as cathode ray tubes (CRT) or liquid crystal displays (LCD) , as well as speakers or similar audio output devices. Some embodiments include devices such as a touchscreen that function as both input and output devices.

[0105] Finally, as shown in FIG. 10, bus 1005 also couples electronic system 1000 to a network 1025 through a network adapter (not shown) . In this manner, the computer can be a part of a network of computers (such as a local area network ( “LAN” ) , a wide area network ( “WAN” ) , or an Intranet, or a network of networks, such as the Internet. Any or all components of electronic system 1000 may be used in conjunction with the present disclosure.

[0106] Some embodiments include electronic components, such as microprocessors, storage and memory that store computer program instructions in a machine-readable or computer-readable medium (alternatively referred to as computer-readable storage media, machine-readable media, or machine-readable storage media) . Some examples of such computer-readable media include RAM, ROM, read-only compact discs (CD-ROM) , recordable compact discs (CD-R) , rewritable compact discs (CD-RW) , read-only digital versatile discs (e.g., DVD-ROM, dual-layer DVD-ROM) , a variety of recordable / rewritable DVDs (e.g., DVD-RAM, DVD-RW, DVD+RW, etc. ) , flash memory (e.g., SD cards, mini-SD cards, micro-SD cards, etc. ) , magnetic and / or solid state hard drives, read-only and recordable  discs, ultra-density optical discs, any other optical or magnetic media, and floppy disks. The computer-readable media may store a computer program that is executable by at least one processing unit and includes sets of instructions for performing various operations. Examples of computer programs or computer code include machine code, such as is produced by a compiler, and files including higher-level code that are executed by a computer, an electronic component, or a microprocessor using an interpreter.

[0107] While the above discussion primarily refers to microprocessor or multi-core processors that execute software, many of the above-described features and applications are performed by one or more integrated circuits, such as application specific integrated circuits (ASICs) or field programmable gate arrays (FPGAs) . In some embodiments, such integrated circuits execute instructions that are stored on the circuit itself. In addition, some embodiments execute software stored in programmable logic devices (PLDs) , ROM, or RAM devices.

[0108] As used in this specification and any claims of this application, the terms “computer” , “server” , “processor” , and “memory” all refer to electronic or other technological devices. These terms exclude people or groups of people. For the purposes of the specification, the terms display or displaying means displaying on an electronic device. As used in this specification and any claims of this application, the terms “computer readable medium, ” “computer readable media, ” and “machine readable medium” are entirely restricted to tangible, physical objects that store information in a form that is readable by a computer. These terms exclude any wireless signals, wired download signals, and any other ephemeral signals.

[0109] While the present disclosure has been described with reference to numerous specific details, one of ordinary skill in the art will recognize that the present disclosure can be embodied in other specific forms without departing from the spirit of the present disclosure. In addition, a number of the figures (including FIG. 5 and FIG. 9) conceptually illustrate processes. The specific operations of these processes may not be performed in the exact order shown and described. The specific operations may not be performed in one continuous series of operations, and different specific operations may be performed in different embodiments. Furthermore, the process could be implemented using several sub-processes, or as part of a larger macro process. Thus, one of ordinary skill in the art would understand that the present disclosure is not to be limited by the foregoing illustrative details, but rather is to be defined by the appended claims. Additional Notes

[0110] The herein-described subject matter sometimes illustrates different components contained within, or connected with, different other components. It is to be understood that such depicted architectures are merely examples, and that in fact many other architectures can be implemented which achieve the same functionality. In a conceptual sense, any arrangement of components to achieve the same functionality is effectively "associated" such that the desired functionality is achieved. Hence, any two components herein combined to achieve a particular functionality can be seen as "associated with" each other such that the desired functionality is achieved, irrespective of architectures or intermediate components. Likewise, any two components so associated can also be viewed as being "operably connected" , or "operably coupled" , to each other to achieve the desired functionality, and any two components capable of being so associated can also be viewed as being "operably couplable" , to each other to achieve the desired functionality. Specific examples of operably couplable include but are not limited to physically mateable and / or physically interacting components and / or wirelessly interactable and / or wirelessly interacting components and / or logically interacting and / or logically interactable components.

[0111] Further, with respect to the use of substantially any plural and / or singular terms herein, those having skill in the art can translate from the plural to the singular and / or from the singular to the plural as is appropriate to the context and / or application. The various singular / plural permutations may be expressly set forth herein for sake of clarity.

[0112] Moreover, it will be understood by those skilled in the art that, in general, terms used herein, and especially in the appended claims, e.g., bodies of the appended claims, are generally intended as “open” terms, e.g., the term “including” should be interpreted as “including but not limited to, ” the term “having” should be interpreted as “having at least, ” the term “includes” should be interpreted as “includes but is not limited to, ” etc. It will be further understood by those within the art that if a specific number of an introduced claim recitation is intended, such an intent will be explicitly recited in the claim, and in the absence of such recitation no such intent is present. For example, as an aid to understanding, the following appended claims may contain usage of the introductory phrases "at least one" and "one or more" to introduce claim recitations. However, the use of such phrases should not be construed to imply that the introduction of a claim recitation by the indefinite articles "a" or "an" limits any particular claim containing such introduced claim recitation to implementations containing only one such recitation, even when the same claim includes the introductory phrases "one or more" or "at least one" and indefinite articles such as "a" or "an, " e.g., “a”and / or “an” should be interpreted to mean “at least one” or “one or more; ” the same holds true for the use of definite articles used to introduce claim recitations. In addition, even if a specific number of an introduced claim recitation is explicitly recited, those skilled in the art will recognize that such recitation should be interpreted to mean at least the recited number, e.g., the bare recitation of "two recitations, " without other modifiers, means at least two recitations, or two or more recitations. Furthermore, in those instances where a convention analogous to “at least one of A, B, and C, etc. ” is used, in general such a construction is intended in the sense one having skill in the art would understand the convention, e.g., “asystem having at least one of A, B, and C” would include but not be limited to systems that have A alone, B alone, C alone, A and B together, A and C together, B and C together, and / or A, B, and C together, etc. In those instances where a convention analogous to “at least one of A, B, or C, etc. ” is used, in general such a construction is intended in the sense one having skill in the art would understand the convention, e.g., “asystem having at least one of A, B, or C” would include but not be limited to systems that have A alone, B alone, C alone, A and B together, A and C together, B and C together, and / or A, B, and C together, etc. It will be further understood by those within the art that virtually any disjunctive word and / or phrase presenting two or more alternative terms, whether in the description, claims, or drawings, should be understood to contemplate the possibilities of including one of the terms, either of the terms, or both terms. For example, the phrase “A or B” will be understood to include the possibilities of “A” or “B” or “A and B. ”

[0113] From the foregoing, it will be appreciated that various implementations of the present disclosure have been described herein for purposes of illustration, and that various modifications may be made without departing from the scope and spirit of the present disclosure. Accordingly, the various implementations disclosed herein are not intended to be limiting, with the true scope and spirit being indicated by the following claims.

Claims

1.A video coding method comprising:receiving data to be encoded or decoded as a current block of pixels of a current picture of a video;constructing a candidate list by searching the current picture to locate one or more reference blocks based on template matching with the current block, wherein a length of the candidate list is adaptively determined for the current block;selecting a reference block from the candidate list of reference blocks;signaling or receiving an index that indicates the selected reference block in the candidate list;generating a predictor of the current block based on the selected reference block; andencoding or decoding the current block by using the generated predictor.2.The video coding method of claim 1, wherein the length of the candidate list is determined based on coded contextual information and current coding condition associated with the current block.3.The video coding method of claim 1, wherein the length of the candidate list is determined based on at least one of a quantization parameter, a residual information, and a block size of the current block.4.The video coding method of claim 1, wherein the length of the candidate list is determined for the current block by selecting from a pre-defined set of candidate list lengths.5.The video coding method of claim 1, further comprising signaling or receiving one or more syntax elements to indicate the number of reference blocks in the candidate list.6.The video coding method of claim 5, wherein the one or more syntax elements are signaled in at least one of a sequence parameter set (SPS) , a picture parameter set (PPS) , picture header (PH) , and a slice header (SH) .7.The video coding method of claim 1, wherein the index indicating the selected reference block in the candidate list is entropy coded.8.The video coding method of claim 7, wherein different codeword schemes are used to entropy code the index for candidate lists of different lengths.9.The video coding method of claim 8, wherein the index is entropy coded by a first codeword scheme when the length of the candidate list is less than or equal to a threshold value and by a second codeword scheme when the length of the candidate list is greater than the threshold value.10.The video coding method of claim 7, wherein the index is entropy coded by a concatenated codeword set, wherein a first codeword scheme is used when the index is less than or equal to a threshold codeword value and a second codeword scheme is used when the index is greater than the threshold codeword value.11.The video coding method of claim 10, wherein the first codeword scheme is truncated unary code and the second codeword scheme is truncated Rice code or truncated binary code.12.The video coding method of claim 10, wherein the threshold codeword value is 2.13.The video coding method of claim 1, wherein when the length of the candidate list is 11, the maximum number of bins in a codeword used to code the index is 6.14.The video coding method of claim 1, wherein when the length of the candidate list is 7, the maximum number of bins in a codeword used to code the index is 5.15.The video coding method of claim 1, wherein when the length of the candidate list is 15, the number of bins in a codeword used to code the index is 6 if the index is in a range from 3 to 6, 7 if the index in a range from 7 to 14.16.An electronic apparatus comprising:a video coder circuit configured to perform operations comprising:receiving data to be encoded or decoded as a current block of pixels of a current picture of a video;constructing a candidate list by searching the current picture to locate one or more reference blocks based on template matching with the current block, wherein a length of the candidate list is adaptively determined for the current block;selecting a reference block from the candidate list of reference blocks;signaling or receiving an index that indicates the selected reference block in the candidate list;generating a predictor of the current block based on the selected reference block; andencoding or decoding the current block by using the generated predictor.17.A video decoding method comprising:receiving data to be decoded as a current block of pixels of a current picture of a video;constructing a candidate list by searching the current picture to locate one or more reference blocks based on template matching with the current block, wherein a length of the candidate list is adaptively determined for the current block;receiving an index that indicates a selected reference block in the candidate list;generating a predictor of the current block based on the selected reference block; andreconstructing the current block by using the generated predictor.18.A video encoding method comprising:receiving data to be encoded as a current block of pixels of a current picture of a video;constructing a candidate list by searching the current picture to locate one or more reference blocks based on template matching with the current block, wherein a length of the candidate list is adaptively determined for the current block;selecting a reference block from the candidate list of reference blocks;signaling an index that indicates the selected reference block in the candidate list;generating a predictor of the current block based on the selected reference block; andencoding the current block by using the generated predictor.