Template-based intra mode derivation

Template-based intra mode derivation (TIMD) addresses inefficiencies in video coding standards by deriving intra modes using reference samples and templates, enhancing encoding and decoding efficiency for pixel blocks with varied local motion and texture.

WO2026098593A1PCT designated stage Publication Date: 2026-05-15MEDIATEK 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
2025-11-07
Publication Date
2026-05-15

AI Technical Summary

Technical Problem

Existing video coding standards like HEVC and VVC face challenges in efficiently encoding and decoding pixel blocks due to the complexity of intra-prediction modes, particularly in handling various local motion and texture characteristics, leading to suboptimal compression efficiency.

Method used

The method employs template-based intra mode derivation (TIMD) using reference samples to derive intra modes for pixel blocks, involving the use of a set of reference samples and a template region in the current picture to compute difference values, select transforms, and generate predictors, which can be separable or non-separable, to improve encoding and decoding efficiency.

Benefits of technology

TIMD enhances encoding and decoding efficiency by reducing complexity and improving compression performance through optimized intra-prediction modes, particularly for diverse local motion and texture characteristics.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025133224_15052026_PF_FP_ABST
    Figure CN2025133224_15052026_PF_FP_ABST
Patent Text Reader

Abstract

A video coder identifies a set of reference samples and a template region in a reconstructed portion of the current picture. The video coder computes a difference value between reconstruction samples of the template region and intra prediction samples of the template region that are generated by referring the set of reference samples for each of a set of candidate intra modes. The video coder derives one or more intra modes based on the computed difference values of the set of candidate intra modes. The video coder uses at least one of the derived one or more intra modes to select a transform. The video coder generates a predictor of the current block based on the one or more derived intra modes by referring the set of reference samples. The video coder encodes or decodes the current block by using the computed predictor and the selected transform.
Need to check novelty before this filing date? Find Prior Art

Description

TEMPLATE-BASED INTRA MODE DERIVATIONCROSS 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 / 717,952, filed on 8 November 2024. 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-prediction.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.

[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.SUMMARY

[0009] 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.

[0010] Some embodiments of the disclosure provide methods of using TIMD with reference samples to encode or decode pixel blocks. A video coder identifies a set of reference samples and a template region in a reconstructed portion of the current picture. The video coder computes a difference value between reconstruction samples of the template region and intra prediction samples of the template region that are generated by referring the set of reference samples for each of a set of candidate intra modes. The video coder derives one or more intra modes based on the computed difference values of the set of candidate intra modes. The video coder uses at least one of the derived one or more intra modes to select a transform. The selected transform may be a separable or non-separable primary or secondary transform. The video coder generates a predictor of the current block based on the one or more derived intra modes by referring the set of reference samples. The video coder encodes or decodes the current block by using the computed predictor and the selected transform.

[0011] In some embodiments, the set of reference samples is (in a reference line that is) adjacent to left side and above side of the current block, adjacent to bottom side and left side of a template region above the current block, and adjacent to top side and right side of a template region left of the current block.

[0012] In some embodiments, samples of the set of reference samples and samples of the template region are in a horizontally or vertically mirrored position. The samples of the set of reference samples and the samples of the template region may be stored and retrieved from a buffer in their horizontally or vertically mirrored positions.

[0013] The video coder may store at least one of the derived intra prediction modes to be referenced by subsequent coding blocks. In some embodiments, at least one of the derived intra prediction modes may be added into a list of most probable modes (MPM) for intra prediction. In some embodiments, at least one of the derived intra prediction modes is added into a merge list. In some embodiments, the current block is a luma block and at least one of the derived one or more intra prediction modes is referenced by a collocated chroma block of the current block. In some embodiments, the video coder reverses an intra prediction direction of at least one of the derived one or more intra modes.BRIEF DESCRIPTION OF THE DRAWINGS

[0014] 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.

[0015] FIG. 1 illustrates 67 intra prediction modes, including 65 directional or angular intra prediction modes (from 2 to 66) .

[0016] FIG. 2 illustrates using decoder-side intra mode derivation (DIMD) to implicitly derive an intra prediction mode for a current block.

[0017] FIG. 3 illustrates identifying template-based intra mode derivation (TIMD) for a current block.

[0018] FIG. 4 illustrates derivation of TIMD modes using a set of common reference samples for both the current block and its template.

[0019] FIG. 5 conceptually illustrates derivation of TIMD modes using samples in a common reference line for both the current block and its template.

[0020] FIGS. 6A-6B illustrate using a common reference line neighboring a left template region for TIMD.

[0021] FIGS. 7A-7B illustrate identifying a common reference line neighboring an above template region for TIMD.

[0022] FIG. 8 illustrates an example video encoder that may implement TIMD.

[0023] FIG. 9 illustrates portions of the video encoder that implement TIMD with reference samples.

[0024] FIG. 10 conceptually illustrates a process that uses TIMD with reference samples to encode a pixel block.

[0025] FIG. 11 illustrates an example video decoder that may implement TIMD.

[0026] FIG. 12 illustrates portions of the video decoder that implement TIMD with reference samples.

[0027] FIG. 13 conceptually illustrates a process that uses TIMD with reference samples to decode a pixel block.

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

[0029] 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. Intra Prediction

[0030] A. Intra Prediction Modes and MPMs

[0031] Intra-prediction method exploits one or more reference lines adjacent to the current prediction unit (PU) and one of the intra-prediction modes to generate the predictors for the current PU. The Intra-prediction direction can be chosen among a mode set containing multiple prediction directions, DC mode, and Planar mode. The intra prediction mode may also refer to any intra mode which determines the predictor of the current block using the spatially reconstructed samples. The number of directional intra modes may be 33 or extended to 65 direction modes. By including DC and Planar modes, the number of intra-prediction mode is 35 or extended to 67. FIG. 1 illustrates 67 intra predictions modes, including 65 directional or angular intra prediction modes (from 2 to 66) .

[0032] To keep the complexity of the most probable mode (MPM) list generation low, an intra mode coding method with 6 MPMs (or called primary MPMs) is used by considering two available neighboring intra modes. The following three aspects are considered to construct the MPM list: default intra modes, neighbouring intra modes, and derived intra modes.

[0033] B. Decoder side Intra Mode Derivation (DIMD)

[0034] Decoder-Side Intra Mode Derivation (DIMD) is a technique in which two or more intra prediction modes / angles / directions are derived from the reconstructed neighbor samples (template) of a block, and those two predictors are combined with the planar mode predictor with the weights derived from the gradients. The DIMD mode is used as an alternative prediction mode. To implicitly derive the intra prediction modes of a block, a texture gradient analysis is performed at both encoder and decoder sides. This process starts with an empty Histogram of Gradient (HoG) having 65 entries, corresponding to the 65 angular / directional intra prediction modes. Amplitudes of these entries are determined during the texture gradient analysis.

[0035] A video coder performing DIMD performs the following steps: in a first step, the video coder picks a template of T=3 columns and lines from respectively left and above current block. This area is used as the reference for the gradient based intra prediction modes derivation. In a second step, the horizontal and vertical Sobel filters are applied on all 3×3 window positions, centered on the pixels of the middle line of the template. On each window position, Sobel filters calculate the intensity of pure horizontal and vertical directions as Gx and Gy , respectively. Then, the texture angle of the window is calculated as: angle=arctan (Gx / Gy) ,

[0036] which can be converted into one of the 65 angular intra prediction modes. Once the intra prediction mode index of current window is derived as idx, the amplitude of its entry in the HoG [idx] is updated by addition of amplitude = |Gx|+|Gy|

[0037] FIG. 2 illustrates using decoder-side intra mode derivation (DIMD) to implicitly derive an intra prediction mode for a current block. The figure shows an example Histogram of Gradient (HoG) 210 that is calculated after applying the above operations on all pixel positions in a template 215 that includes neighboring lines of pixel samples around a current block 200. Once the HoG is computed, the indices of the two or more (e.g., five) tallest histogram bars are selected as the implicitly derived intra prediction modes (IPMs, including M1 and M2) for the block. The predictions of the two or more selected intra prediction modes are blended with the prediction of the planar mode to generate the final DIMD prediction of the current block.

[0038] C. Template-based Intra mode Derivation (TIMD)

[0039] For mode selection, template matching method can be applied by computing the cost between reconstructed samples and predicted samples. One of the examples is template-based intra mode derivation (TIMD) . TIMD is a coding method in which the intra prediction mode of a CU is implicitly derived by using a neighboring template at both encoder and decoder, instead of the encoder signaling the exact intra prediction mode to the decoder.

[0040] In some embodiments, for each intra prediction mode in MPMs, as well as the wide-angle modes if the above-right and / or bottom-left reference samples are available, the sum of absolute transformed differences (SATD) between the prediction and reconstruction samples of the template is calculated. The calculated SATDs are used to identify a set of intra prediction modes for TIMD.

[0041] FIG. 3 illustrates identifying TIMD intra prediction modes for a current block 300. As illustrated, for a current block 300, the prediction samples of its template 310 are generated using the reference samples of the template 310 for each candidate intra prediction mode. The predictors on the templates 310 are generated based on a reference line 320 that is adjacent to the template 310 (also referred to as the reference line of the template) .

[0042] For each candidate intra prediction mode, the SATD between the prediction samples and reconstruction samples of the template 310 are calculated. The two intra prediction modes with the lowest SATD costs and one non-angular intra prediction mode (i.e. DC or Planar) with the lowest SATD cost are selected as the three TIMD modes. In some embodiments, (the three predictions of the current block generated by using) these three TIMD modes are fused using weights after applying position dependent intra prediction combination (PDPC) process, and such weighted intra prediction is used to code the current CU 300.

[0043] In some embodiments, the conditions below are checked to determine whether the non-angular intra prediction mode is used in fusion: - the non-angular intra prediction mode is different from the two selected intra prediction modes. - costMode3 < 1.5*costMode1, where the costMode3 is the SATD cost of the non-angular intra prediction mode and costMode1 is the SATD cost of the first intra prediction mode.

[0044] If both of the conditions are true, three intra prediction modes are used to generate the prediction. And the weights of each intra prediction mode are computed from SATD cost:

[0045] Otherwise, the non-angular intra prediction mode is not used in prediction. And the costs of the two selected modes are compared with a threshold, in the test, the cost factor of 2 is applied as follows: costMode2 < 2*costMode1.

[0046] If this condition is true, the fusion is applied, otherwise the only mode1 is used. Weights of the modes are computed from their SATD costs as follows: weight1 = costMode2  /  (costMode1+ costMode2) weight2 = 1 -weight1

[0047] The division operations are conducted using a lookup table (LUT) based integerization scheme.

[0048] D. TIMD mode from Common Reference Samples

[0049] In JVET-AJ0152, an alternative TIMD mode from common reference samples (TIMD-CRS) is added as a sub-mode of TIMD, where the derivation of TIMD modes uses the same reference samples (e.g., in a same reference line) as when the current block is predicted. In TIMD-CRS, the reference line for generating predictors for the template is the same as the reference line for generating predictors for the current block.

[0050] FIG. 4 illustrates derivation of TIMD modes using a set of common reference samples for both the current block and its template. As illustrated, a current block 400 has its neighboring top template region and left template regions as its template 410. A same set of samples (e.g., a set of one or more reference lines) 420 is used to generate a predictor for the current block 400 and a predictor for the template 410 for TIMD.

[0051] FIG. 5 conceptually illustrates derivation of TIMD modes using samples in a common reference line for both the current block and its template. The figure illustrates an 8x8 block with an 8x4 above template region 511, a 4x8 left template region 512, and “line0” as the common reference line 520 providing the common reference samples for the current block and / or the template for the current block, “line0” being the reference line immediately adjacent to the current block at its left and above sides.

[0052] The template 510 for the current block 500 may include the above template region 511 and / or the left template region 512. The template 510 is used to derive the selected candidate modes (such as DC, planar, and / or angular modes) according to the TIMD process as described above in Section I. C above.

[0053] Following the flow associated with TIMD, several candidate modes (for example, horizontal, vertical, diagonal, …) are determined to be available for the current block. For each candidate mode, a cost is determined based on the template for the current block as follows. A candidate mode calculates its cost as the distortion between the prediction (using the candidate mode and a reference line) of the template 510 and the reconstruction of the template 510. One or more candidate modes (which have the smallest costs) are determined as the selected candidate modes to generate the prediction of the current block. The selected candidate modes and the reference line are then employed to generate the prediction of the current block 500. In some embodiments, the reference line for the template is the same as the reference line for the current block. For example, the reference line 520 adjacent to the current block ( “line0” ) may be used to provide the shared reference samples for both the template and the current block.

[0054] In some embodiments, the shared reference samples for TIMD-CRS are chosen to include the reconstructed samples adjacent to the current block 500 (i.e., “line0” ) , which means that the shared reference samples are located in a reference line at the left and bottom sides of the above template region 511, and at the right and the top sides of the left template region 512. To use such a shared reference line for the template regions requires an intra prediction process that is different from the conventional intra prediction flow, which uses the L-shape reference samples located at the left side and the above side to the to-be-predicted region. Specifically, for some angular modes and some templates, the prediction direction is reversed to point to the reference lines. The remaining mode derivation processes (SATD-based cost evaluation, mode sorting, fusion rules) are the same as TIMD.

[0055] In some embodiments, when the shared reference line is located adjacent to the current block, the TIMD process is performed with samples of the reference line and the template region in their TIMD-CRS positions (as shown in FIG. 5) to derive intra-prediction modes that may be reversed intra prediction direction. This is referred to “method 1” for some embodiments of the disclosure. In some embodiments, when the shared reference samples are located adjacent to the current block, the TIMD process is performed with samples of the reference line and the template region in up-down or left-right reversed configuration positions to derive intra-prediction modes that have conventional intra prediction directions (because the reference samples are now at top and left of the template region) . This is referred to as “method 2” for some embodiments of the disclosure.

[0056] FIGS. 6A-6B illustrate using common reference samples neighboring the left template region for TIMD, using “method 1” and “method 2” . FIGS. 6A illustrate the left template region 512 using samples in reference line located at the template region’s right side and above side (at TIMD-CRS positions shown in FIG. 5) as reference samples for TIMD, i.e., “method 1” . When generating predictions for the candidate modes, the directions of some candidate modes are left-right reversed (e.g., intra mode 18 becomes horizontal mode referencing the right rather than the left, intra mode 34 becomes diagonal mode referencing top-right instead of top-left, etc. )

[0057] FIG. 6B illustrates the left template region 512 using samples in reference line located at its left and above side as reference samples for TIMD, i.e., “method 2” such that all directional intra modes are conventionally defined as in FIG. 1. When generating the prediction on the left template region 512, samples of the reference line and of the left template region 512 may be reversely stored into a buffer (in a reverse configuration) , and the intra prediction are generated using samples stored in the buffer for each candidate mode to obtain the corresponding costs.

[0058] In FIG. 6A, the above-left, above-right, bottom-left, and bottom-right samples for the left template 512 are denoted as t (0, 0) , t (3, 0) , t (0, 7) , and t (3, 7) , respectively. In FIG. 6B, with samples in reverse configuration positions based on horizontal-mirroring, for the reference line, r0 is at the left-above location (originally, right-above location) , h1 to h4 …are located from left to right (originally, right to left) , and v1 to v8 …are left of the left template 512 (originally, right of the left template) ; for the left template, the same way is used to do mirroring, so the original rightmost line associated with the left template 512 is mirrored to the leftmost line associated with the left template. Using the proposed reversed buffer, the candidate mode can generate the intra prediction on the left template 512 as the conventional intra prediction flow. The above-left, above-right, bottom-left, and bottom-right samples for the reversed left template are denoted as t (3, 0) , t (0, 0) , t (3, 7) , and t (0, 7) , respectively.

[0059] FIGS. 7A-7B illustrate using common reference samples neighboring the above template region for TIMD, using “method 1” and “method 2” . FIGS. 7A illustrates the top template region 511 using samples in reference line located at its left side and bottom side (at their TIMD-CRS positions as shown in FIG. 5) as reference samples for TIMD, i.e., “method 1” . When generating predictions for the candidate modes, the directions of some candidate modes are up-down reversed (e.g., intra mode 50 becomes vertical mode referencing the bottom rather than the top, intra mode 34 becomes diagonal mode referencing down-left instead of up-left, etc. )

[0060] FIG. 7B illustrates the above template region 511 using samples in reference line located at its left and above side as reference samples for TIMD, i.e., “method 2” such that all directional intra modes are conventionally defined as in FIG. 1. When generating the prediction on the above template region 511, the samples of the reference line (Line0) and the samples of the above template region 511 may be reversely stored into a buffer (in a reverse configuration) , and the intra prediction are generated using samples stored in the buffer for each candidate mode to obtain the corresponding costs.

[0061] In FIG. 7A, the above-left, above-right, bottom-left, and bottom-right samples for the above template 511 are denoted as t (0, 0) , t (7, 0) , t (0, 3) , and t (7, 3) , respectively. In FIG. 7B, with samples in reverse configuration positions based on vertical-mirroring, for the reference line, r0 is at the left-above location (originally, left-bottom location) , v1 to v4 …are located from above to bottom (originally, bottom to above) , and h1 to h8 …are above to the above template (originally, bottom to the above template) ; for the above template, the same way is used to do mirroring, so the original bottommost line associated with the above template is mirrored to the topmost line associated with the above template. By using the reverse buffer, the candidate mode can generate the intra prediction on the above template as the conventional intra prediction flow. The above-left, above-right, bottom-left, and bottom-right samples for the reversed above template are denoted as t (0, 3) , t (7, 3) , t (0, 0) , and t(7, 0) , respectively.

[0062] As mentioned, in some embodiments, when a predefined reference line (e.g., “line0” ) is used to provide the reference samples for generating the prediction of a template region for deriving the selected candidate modes for TIMD, the video coder may reverse the direction of some selected candidate modes when generating the prediction of the current block (with some selected candidate modes staying in their original directions without reversing) . The pre-defined reference line (for example, “line0” , or a line same as the reference line for generating prediction on the template) and the selected candidate modes with or without reversing direction may be used to generate predicted samples for the current block. For the example after using the top and left template regions 511 and 512 of FIG. 5 as method 1 to identify the TIMD intra modes based on “line0” as the reference line, when generating the prediction for the current block 500 based on the identified TIMD intra modes, the original (selected) candidate modes are used to generate the predictors for the current block. For the example after using the top and left template regions 511 and 512 as method 2 to identify the TIMD intra modes, when generating the prediction for the current block 500 based on the identified TIMD intra modes, intra mode 18 (horizontal mode pointing left) and intra mode 34 (diagonal mode pointing top-left) may reverse left-right direction (so horizontal mode 18 point right and diagonal mode 34 point up-right) . For another example, when generating the prediction for the current block 500, intra mode 50 (vertical mode pointing up) and intra mode 34 (diagonal mode pointing top-left) may reverse up-down direction (so vertical mode 50 point down and diagonal mode 34 point down-left) .

[0063] The above two examples are not a limitation to the proposed methods. The proposed methods can be applied as any combinations, such as: generating prediction for the current block using original (selected) candidate modes when method 1 is applied to generating prediction on the template; generating prediction for the current block using original (selected) candidate modes when method 2 is applied to generating prediction on the template; generating prediction for the current block with some candidate modes reversed when method 1 is applied to generating prediction on the template; or generating prediction for the current block with some candidate modes reversed when method 2 is applied to generating prediction on the template.

[0064] In some embodiments, since the template region and the reference samples may be positionally reversed (left-right or up-down) during the prediction generation on the template (i.e., “method 2” ) , some angular modes associated with the selected candidate modes for the current block may need to reverse accordingly.

[0065] The TIMD candidate modes may be selected by applying “method 1” or “method 2” to the left template region 512 and the reference line “line0” as described by FIGS. 6A-6B. Thus, some candidate modes may be reversed, such as mode 18′ (reversed horizontal) and mode 34′(reversed diagonal) . If some candidate modes with reversed versions are not available for the current block, those candidate modes are not allowed or not reversed. For the current block, the horizontal mode (18) may not be available after reversing.

[0066] The TIMD candidate modes may be selected by applying “method 1” or “method 2” to the above template region 511 and the reference line “line0” as described by FIGS. 7A-7B. Thus, some candidate modes may be reversed, such as mode 50′ (reversed vertical) and mode 34′ (reversed diagonal) . If some candidate modes with reversed versions are not available for the current block, those candidate modes are not allowed or not reversed. For the current block, the vertical mode (50) may be not available after reversing.

[0067] In some embodiments, the method of reversing some selected candidate modes is adaptive. For example, in some embodiments, the adaptive rule may depend on the positions of to-be-predicted samples. When the position of to-be-predicted sample is near the above template, the TIMD mode being applied is selected and reversed based on the above template. When the position of to-be-predicted sample is near the left template, the TIMD mode being applied is selected and reversed based on the left template.

[0068] In some embodiments, method 1 and / or method 2 for the prediction generation for the template, and / or reversing angles for the current block can be implicitly applied when the current block is determined as a TIMD-coded block. In some embodiments, method 1 and / or method 2 for the prediction generation for the template, and / or reversing angles for the current block can be an alternative option when the current block is determined as a TIMD-coded block. That is, an explicit syntax is signaled to indicate (1) the original method is used for TIMD or (2) the proposed method is used for TIMD.

[0069] In some embodiments, the selected candidate modes of TIMD are used to generate the intra prediction of the current block and / or can be treated as a derived intra prediction mode. In some embodiments, at least one of the derived intra prediction mode (s) can be used for the transform selection for the current block. For example, the transform may refer to any separable or non-separable primary transform, or any separable or non-separable secondary transform.

[0070] In some embodiments, the derived intra prediction mode can be stored for the current block and / or can be referenced by the subsequent coding blocks. For example, the derived intra prediction mode can be added into the intra MPM list or any merge list associated with intra prediction modes for the subsequent coding block during the list construction for the subsequent coding block. For example, the derived intra prediction mode can be referenced by chroma blocks if the current block is the collocated luma block of the chroma blocks.

[0071] The proposed methods in this invention can be enabled and / or disabled according to implicit rules (e.g. block width, height, or area) or according to explicit rules (e.g. syntax on block, tile, slice, picture, SPS, or PPS level) . For example, the proposed method is applied when the block area is smaller / larger than a threshold. The term “block” in this invention can refer to TU / TB, CU / CB, PU / PB, pre-defined region, or CTU / CTB.

[0072] Any combination of the proposed methods in this invention can be applied. The proposed methods in this invention can be applied to any template-based intra mode derivation tools such as any TIMD variations.

[0073] 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 intra / prediction / transform module of an encoder, and / or an intra / prediction / transform module of a decoder. Alternatively, any of the proposed methods can be implemented as a circuit coupled to the intra / prediction / transform module of the encoder and / or the intra / prediction / transform module of the decoder, so as to provide the information needed by the intra / prediction / transform module. II. Example Video Encoder

[0074] FIG. 8 illustrates an example video encoder 800 that may implement TIMD. As illustrated, the video encoder 800 receives input video signal from a video source 805 and encodes the signal into bitstream 895. The video encoder 800 has several components or modules for encoding the signal from the video source 805, at least including some components selected from a transform module 810, a quantization module 811, an inverse quantization module 814, an inverse transform module 815, an intra-picture estimation module 824, an intra-prediction module 825, a motion compensation module 830, a motion estimation module 835, an in-loop filter 845, a reconstructed picture buffer 850, a MV buffer 865, and a MV prediction module 875, and an entropy encoder 890. The motion compensation module 830 and the motion estimation module 835 are part of an inter-prediction module 840. The intra-prediction module 825 and the intra-prediction estimation module 824 are part of a current picture prediction module 820, which uses current picture reconstructed samples as reference samples for prediction of the current block.

[0075] In some embodiments, the modules 810 –890 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 810 –890 are modules of hardware circuits implemented by one or more integrated circuits (ICs) of an electronic apparatus. Though the modules 810 –890 are illustrated as being separate modules, some of the modules can be combined into a single module.

[0076] The video source 805 provides a raw video signal that presents pixel data of each video frame without compression. A subtractor 808 computes the difference between the raw video pixel data of the video source 805 and the predicted pixel data 813 from the motion compensation module 830 or intra-prediction module 825 as prediction residual 809. The transform module 810 converts the difference (or the residual pixel data or residual signal 808) into transform coefficients (e.g., by performing Discrete Cosine Transform, or DCT) . The quantization module 811 quantizes the transform coefficients into quantized data (or quantized coefficients) 812, which is encoded into the bitstream 895 by the entropy encoder 890.

[0077] The inverse quantization module 814 de-quantizes the quantized data (or quantized coefficients) 812 to obtain transform coefficients 818, and the inverse transform module 815 performs inverse transform on the transform coefficients 818 to produce reconstructed residual 819. The reconstructed residual 819 is added with the predicted pixel data 813 to produce reconstructed pixel data 817. In some embodiments, the reconstructed pixel data 817 is temporarily stored in a line buffer 827 (or intra prediction buffer) for intra-picture prediction and spatial MV prediction. The reconstructed pixels are filtered by the in-loop filter 845 and stored in the reconstructed picture buffer 850. In some embodiments, the reconstructed picture buffer 850 is a storage external to the video encoder 800. In some embodiments, the reconstructed picture buffer 850 is a storage internal to the video encoder 800.

[0078] The intra-picture estimation module 824 performs intra-prediction based on the reconstructed pixel data 817 to produce intra prediction data. The intra-prediction data is provided to the entropy encoder 890 to be encoded into bitstream 895. The intra-prediction data is also used by the intra-prediction module 825 to produce the predicted pixel data 813.

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

[0080] Instead of encoding the complete actual MVs in the bitstream, the video encoder 800 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 895.

[0081] The MV prediction module 875 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 875 retrieves reference MVs from previous video frames from the MV buffer 865. The video encoder 800 stores the MVs generated for the current video frame in the MV buffer 865 as reference MVs for generating predicted MVs.

[0082] The MV prediction module 875 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 895 by the entropy encoder 890.

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

[0084] The in-loop filter 845 performs filtering or smoothing operations on the reconstructed pixel data 817 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 845 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.

[0085] FIG. 9 illustrates portions of the video encoder 800 that implement TIMD with common reference samples. Specifically, the figure illustrates the components of the current picture prediction module 820 of the video encoder 800. As illustrated, the current picture prediction module 820 includes a template predictor generator 910, a TIMD process module 920, and the intra prediction module 825.

[0086] For each template region (e.g., above template 511 or left template 512 of the current block 500) , the template predictor generator 910 generates a template predictor for each of the candidate intra prediction modes for TIMD. The candidate intra prediction modes may include some or all 67 intra prediction modes, including DC mode, planar mode, and some or all of the angular intra modes (2 to 66) . The generated template predictors 915 for the template region (s) are provided to the TIMD process module 920 for the different candidate intra modes.

[0087] The template predictor generator 910 retrieves the reconstructed samples 905 as reference samples from the reconstructed picture buffer 850. In some embodiments, the template predictor generator 910 uses reference samples that are adjacent to the current block at its above side and at its left side for predicting the template region, as these reference samples are common for predicting the template region and for predicting the current block (as shown in FIG. 5, e.g., reference line 520, or “Line0” ) .

[0088] The TIMD process module 920 uses the generated template predictors 915 for the different candidate intra modes to select one or more TIMD intra modes 925. For each candidate intra mode, the TIMD process module 920 computes a difference value (e.g., SATD) between the corresponding template predictor with the template’s reconstructed samples (retrieved from the reconstructed picture buffer 850 and the line buffer 827) . The selection of the TIMD intra modes is made based on the computed difference values for the different candidate intra modes. One or more of the selected TIMD intra modes is / are provided to the intra prediction module 825, which may generate a predictor 930 of the current block based on the selected TIMD intra modes. The generated predictor may then be used as the predicted pixel data 813.

[0089] The selected one or more TIMD intra modes 925 may be stored for use for coding a subsequent block. One or more of the selected TIMD intra modes 925 may be provided to a transform selection module 940, which specifies which primary and / or secondary transforms is to be used by the transform module 810 and the inverse transform module 815 for the current block. In some embodiments, the TIMD intra mode used by the intra prediction module 825 and the TIMD intra mode used by the transform selection module 940 may not or may be the same.

[0090] In some embodiments, if the TIMD intra mode 925 identified by TIMD process module 920 falls within certain angular range, the intra-prediction direction is not reversed when used by the intra prediction module 825 or the TIMD intra mode 925 identified by TIMD process module 920 is used in the transform selection 940 to select primary and / or secondary transform. (This is referred to as “method 1” , which is described by reference to FIG. 6A and FIG. 7A above. )

[0091] In some embodiments, the TIMD process module 920 horizontally or vertically mirrors the positions of the reference samples and of the template samples when computing the difference values for certain angular ranges. The TIMD process module 920 may reversely store and / or retrieve the reconstructed samples (from the reconstructed picture buffer 850) and the predicted samples (from the template predictor generator 910) in a buffer. If the TIMD intra mode 925 identified by TIMD process module 920 falls within certain angular range, the intra-prediction direction is reversed when used by the intra prediction module 825 or the TIMD intra mode 925 identified by TIMD process module 920 is used in the transform selection 940. (This is referred to as “method 2” , which is described by reference to FIG. 6B and FIG. 7B above. )

[0092] FIG. 10 conceptually illustrates a process 1000 that uses TIMD with common reference samples to encode a pixel block. In some embodiments, one or more processing units (e.g., a processor) of a computing device implementing the encoder 800 performs the process 1000 by executing instructions stored in a computer readable medium. In some embodiments, an electronic apparatus implementing the encoder 800 performs the process 1000.

[0093] The encoder receives (at block 1010) data to be encoded as a current block of pixels in a current picture of a video. The encoder identifies (at block 1020) a set of reference samples and a template region in a reconstructed portion of the current picture. In some embodiments, the set of reference samples is (in a reference line that is) adjacent to left side and above side of the current block, adjacent to bottom side and left side of a template region above the current block (e.g., above template 511) , and adjacent to top side and right side of a template region left of the current block (e.g., left template 512) .

[0094] The encoder computes (at block 1030) a difference value (e.g., SATD, SAD) between reconstruction samples of the template region and intra prediction samples of the template region that are generated by referring the set of reference samples for each candidate intra mode in a set of candidate intra modes. In some embodiments, samples of the set of reference samples and samples of the template region are in a horizontally or vertically mirrored position ( “method 2” ) . The samples of the the set of reference samples and the samples of the template region may be stored and retrieved from a buffer in their horizontally or vertically mirrored positions.

[0095] The encoder derives (at block 1040) one or more intra modes based on the computed difference values of the set of candidate intra modes. The encoder may store at least one of the derived intra prediction modes to be referenced by subsequent coding blocks. In some embodiments, at least one of the derived intra prediction modes may be added into a list of most probable modes (MPM) for intra prediction. In some embodiments, at least one of the derived intra prediction modes is added into a merge list. In some embodiments, the current block is a luma block and at least one of the derived one or more intra prediction modes is referenced by a collocated chroma block of the current block. In some embodiments, the encoder reverses an intra prediction direction of at least one of the derived one or more intra modes.

[0096] The encoder uses (at block 1050) at least one of the derived one or more intra modes to select a transform. The selected transform may be a separable or non-separable primary transform. The selected transform may be a separable or non-separable secondary transform. The encoder generates (at block 1060) a predictor of the current block based on the one or more derived intra modes by referring the set of reference samples. The encoder encodes (at block 1070) the current block by using the computed predictor and the selected transform. III. Example Video Decoder

[0097] 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.

[0098] FIG. 11 illustrates an example video decoder 1100 that may implement TIMD. As illustrated, the video decoder 1100 is an image-decoding or video-decoding circuit that receives a bitstream 1195 and decodes the content of the bitstream into pixel data of video frames for display. The video decoder 1100 has several components or modules for decoding the bitstream 1195, including some components selected from an inverse quantization module 1114, an inverse transform module 1115, an intra-prediction module 1125, a motion compensation module 1130, an in-loop filter 1145, a decoded picture buffer 1150, a MV buffer 1165, a MV prediction module 1175, and a parser 1190. The motion compensation module 1130 is part of an inter-prediction module 1140. The intra-prediction module 1125 is part of a current picture prediction module 1120, which uses current picture reconstructed samples as reference samples for prediction of the current block.

[0099] In some embodiments, the modules 1114 –1190 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 1114 –1190 are modules of hardware circuits implemented by one or more ICs of an electronic apparatus. Though the modules 1114 –1190 are illustrated as being separate modules, some of the modules can be combined into a single module.

[0100] The parser 1190 (or entropy decoder) receives the bitstream 1195 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) 1112. The parser 1190 parses out the various syntax elements by using entropy-coding techniques such as context-adaptive binary arithmetic coding (CABAC) or Huffman encoding.

[0101] The inverse quantization module 1114 de-quantizes the quantized data (or quantized coefficients) 1112 to obtain transform coefficients, and the inverse transform module 1115 performs inverse transform on the transform coefficients 1118 to produce reconstructed residual signal 1119. The reconstructed residual signal 1119 is added with predicted pixel data 1113 from the intra-prediction module 1125 or the motion compensation module 1130 to produce decoded pixel data 1117. The decoded pixels data are filtered by the in-loop filter 1145 and stored in the decoded picture buffer 1150. In some embodiments, the decoded picture buffer 1150 is a storage external to the video decoder 1100. In some embodiments, the decoded picture buffer 1150 is a storage internal to the video decoder 1100.

[0102] The intra-prediction module 1125 receives intra-prediction data from bitstream 1195 and according to which, produces the predicted pixel data 1113 from the decoded pixel data 1117 stored in the decoded picture buffer 1150. In some embodiments, the decoded pixel data 1117 is also stored in a line buffer 1127 (or intra prediction buffer) for intra-picture prediction and spatial MV prediction.

[0103] In some embodiments, the content of the decoded picture buffer 1150 is used for display. A display device 1105 either retrieves the content of the decoded picture buffer 1150 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 1150 through a pixel transport.

[0104] The motion compensation module 1130 produces predicted pixel data 1113 from the decoded pixel data 1117 stored in the decoded picture buffer 1150 according to motion compensation MVs (MC MVs) . These motion compensation MVs are decoded by adding the residual motion data received from the bitstream 1195 with predicted MVs received from the MV prediction module 1175.

[0105] The MV prediction module 1175 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 1175 retrieves the reference MVs of previous video frames from the MV buffer 1165. The video decoder 1100 stores the motion compensation MVs generated for decoding the current video frame in the MV buffer 1165 as reference MVs for producing predicted MVs.

[0106] The in-loop filter 1145 performs filtering or smoothing operations on the decoded pixel data 1117 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 1145 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.

[0107] FIG. 12 illustrates portions of the video decoder 1100 that implement TIMD with common reference samples. Specifically, the figure illustrates the components of the current picture prediction module 1120 of the video decoder 1100. As illustrated, the current picture prediction module 1120 includes a template predictor generator 1210, a TIMD process module 1220, and the intra prediction module 1125.

[0108] For each template region (e.g., above template 511 or left template 512 of the current block 500) , the template predictor generator 1210 generates a template predictor for each of the candidate intra prediction modes for TIMD. The candidate intra prediction modes may include some or all 67 intra prediction modes, including DC mode, planar mode, and some or all of the angular intra modes (2 to 66) . The generated template predictors 1215 for the template region (s) are provided to the TIMD process module 1220 for the different candidate intra modes.

[0109] The template predictor generator 1210 retrieves the reconstructed samples 1205 as reference samples from the decoded picture buffer 1150. In some embodiments, the template predictor generator 1210 uses reference samples that are adjacent to the current block at its above side and at its left side for predicting the template region, as these reference samples are common for predicting the template region and for predicting the current block (as shown in FIG. 5, e.g., reference line 520, or “Line0” ) .

[0110] The TIMD process module 1220 uses the generated template predictors 1215 for the different candidate intra modes to select one or more TIMD intra modes 1225. For each candidate intra mode, the TIMD process module 1220 computes a difference value (e.g., SATD) between the corresponding template predictor with the template’s reconstructed samples (retrieved from the decoded picture buffer 1150 and the line buffer 1127) . The selection of the TIMD intra modes is made based on the computed difference values for the different candidate intra modes. One or more of the selected TIMD intra modes is / are provided to the intra prediction module 1125, which may generate a predictor 1230 of the current block based on the selected TIMD intra modes. The generated predictor may then be used as the predicted pixel data 1113.

[0111] The selected one or more TIMD intra modes 1225 may be stored for use for coding a subsequent block. One or more of the selected TIMD intra modes 1225 may be provided to a transform selection module 1240, which specifies which primary and / or secondary transforms is to be used by the inverse transform module 1115 for the current block. In some embodiments, the TIMD intra mode used by the intra prediction module 1125 and the TIMD intra mode used by the transform selection module 1240 may not or may be the same.

[0112] In some embodiments, if the TIMD intra mode 1225 identified by TIMD process module 1220 falls within certain angular range, the intra-prediction direction is not reversed when used by the intra prediction module 1125 or the TIMD intra mode 1225 identified by TIMD process module 1220 is used in the transform selection 1240 to select primary and / or secondary transform. (This is referred to as “method 1” , which is described by reference to FIG. 6A and FIG. 7A above. )

[0113] In some embodiments, the TIMD process module 1220 horizontally or vertically mirrors the positions of the reference samples and of the template samples when computing the difference values for certain angular ranges. The TIMD process module 1220 may reversely store and / or retrieve the reconstructed samples (from the decoded picture buffer 1150) and the predicted samples (from the template predictor generator 1210) in a buffer. If the TIMD intra mode 1225 identified by TIMD process module 1220 falls within certain angular range, the intra-prediction direction is reversed when used by the intra prediction module 1125 or the TIMD intra mode 1225 identified by TIMD process module 1220 is used in the transform selection 1240. (This is referred to as “method 2” , which is described by reference to FIG. 6B and FIG. 7B above. )

[0114] FIG. 13 conceptually illustrates a process 1300 that uses TIMD with common reference samples to decode a pixel block. In some embodiments, one or more processing units (e.g., a processor) of a computing device implementing the decoder 1100 performs the process 1300 by executing instructions stored in a computer readable medium. In some embodiments, an electronic apparatus implementing the decoder 1100 performs the process 1300.

[0115] The decoder receives (at block 1310) data to be decoded as a current block of pixels in a current picture of a video. The decoder identifies (at block 1320) a set of reference samples and a template region in a reconstructed portion of the current picture. In some embodiments, the set of reference samples is (in a reference line that is) adjacent to left side and above side of the current block, adjacent to bottom side and left side of a template region above the current block (e.g., above template 511) , and adjacent to top side and right side of a template region left of the current block (e.g., left template 512) .

[0116] The decoder computes (at block 1330) a difference value (e.g., SATD, SAD) between reconstruction samples of the template region and intra prediction samples of the template region that are generated by referring the set of reference samples for each candidate intra mode in a set of candidate intra modes. In some embodiments, samples of the set of reference samples and samples of the template region are in a horizontally or vertically mirrored position ( “method 2” ) . The samples of the the set of reference samples and the samples of the template region may be stored and retrieved from a buffer in their horizontally or vertically mirrored positions.

[0117] The decoder derives (at block 1340) one or more intra modes based on the computed difference values of the set of candidate intra modes. The decoder may store at least one of the derived intra prediction modes to be referenced by subsequent coding blocks. In some embodiments, at least one of the derived intra prediction modes may be added into a list of most probable modes (MPM) for intra prediction. In some embodiments, at least one of the derived intra prediction modes is added into a merge list. In some embodiments, the current block is a luma block and at least one of the derived one or more intra prediction modes is referenced by a collocated chroma block of the current block. In some embodiments, the decoder reverses an intra prediction direction of at least one of the derived one or more intra modes.

[0118] The decoder uses (at block 1350) at least one of the derived one or more intra modes to select a transform. The selected transform may be a separable or non-separable primary transform. The selected transform may be a separable or non-separable secondary transform.

[0119] The decoder generates (at block 1360) a predictor of the current block based on the one or more derived intra modes by referring the set of reference samples. The decoder reconstructs (at block 1370) the current block by using the computed predictor and the selected transform. The decoder may then provide the reconstructed current block for display or output as part of the reconstructed current picture. IV. Example Electronic System

[0120] 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.

[0121] 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.

[0122] FIG. 14 conceptually illustrates an electronic system 1400 with which some embodiments of the present disclosure are implemented. The electronic system 1400 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 1400 includes a bus 1405, processing unit (s) 1410, a graphics-processing unit (GPU) 1415, a system memory 1420, a network 1425, a read-only memory 1430, a permanent storage device 1435, input devices 1440, and output devices 1445.

[0123] The bus 1405 collectively represents all system, peripheral, and chipset buses that communicatively connect the numerous internal devices of the electronic system 1400. For instance, the bus 1405 communicatively connects the processing unit (s) 1410 with the GPU 1415, the read-only memory 1430, the system memory 1420, and the permanent storage device 1435.

[0124] From these various memory units, the processing unit (s) 1410 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 1415. The GPU 1415 can offload various computations or complement the image processing provided by the processing unit (s) 1410.

[0125] The read-only-memory (ROM) 1430 stores static data and instructions that are used by the processing unit (s) 1410 and other modules of the electronic system. The permanent storage device 1435, 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 1400 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 1435.

[0126] 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 1435, the system memory 1420 is a read-and-write memory device. However, unlike storage device 1435, the system memory 1420 is a volatile read-and-write memory, such a random access memory. The system memory 1420 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 1420, the permanent storage device 1435, and / or the read-only memory 1430. 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) 1410 retrieves instructions to execute and data to process in order to execute the processes of some embodiments.

[0127] The bus 1405 also connects to the input and output devices 1440 and 1445. The input devices 1440 enable the user to communicate information and select commands to the electronic system. The input devices 1440 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 1445 display images generated by the electronic system or otherwise output data. The output devices 1445 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.

[0128] Finally, as shown in FIG. 14, bus 1405 also couples electronic system 1400 to a network 1425 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 1400 may be used in conjunction with the present disclosure.

[0129] 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.

[0130] 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.

[0131] 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.

[0132] 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. 10 and FIG. 13) 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

[0133] 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.

[0134] 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.

[0135] 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., “a system 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., “a system 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. ”

[0136] 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;identifying a set of reference samples and a template region in a reconstructed portion of the current picture;computing a difference value between reconstruction samples of the template region and intra prediction samples of the template region that are generated by referring the set of reference samples for each candidate intra mode in a set of candidate intra modes;deriving one or more intra modes based on the computed difference values of the set of candidate intra modes;using at least one of the derived one or more intra modes to select a transform;generating a predictor of the current block based on the one or more derived intra modes by referring the set of reference samples; andencoding or decoding the current block by using the computed predictor and the selected transform.2.The video coding method of claim 1, wherein the selected transform is a primary transform.3.The video coding method of claim 1, wherein the selected transform is a secondary transform.4.The video coding method of claim 1, wherein at least one of the derived intra prediction modes is stored to be referenced by subsequent coding blocks.5.The video coding method of claim 1, wherein at least one of the derived intra prediction modes is added into a list of most probable modes (MPM) for intra prediction.6.The video coding method of claim 1, wherein at least one of the derived intra prediction modes is added into a merge list.7.The video coding method of claim 1, wherein the current block is a luma block and at least one of the derived one or more intra prediction modes are referenced by a collocated chroma block of the current block.8.The video coding method of claim 1, wherein the set of reference samples are adjacent to left side and above side of the current block.9.The video coding method of claim 1, wherein the set of reference samples are adjacent to bottom side and left side of a template region above the current block.10.The video coding method of claim 1, wherein the set of reference samples are adjacent to top side and right side of a template region left of the current block.11.The video coding method of claim 1, wherein an intra prediction direction of at least one of the derived one or more intra modes is reversed when used to generate the predictor of the current block.12.The video coding method of claim 1, wherein samples of the set of reference samples and samples of the template region are in a horizontally or vertically mirrored position.13.The video coding method of claim 12, wherein the samples of the the set of reference samples and the samples of the template region are stored and retrieved from a buffer in their horizontally or vertically mirrored positions.14.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;identifying a set of reference samples and a template region in a reconstructed portion of the current picture;computing a difference value between reconstruction samples of the template region and intra prediction samples of the template region that are generated by referring the set of reference samples for each candidate intra mode in a set of candidate intra modes;deriving one or more intra modes based on the computed difference values of the set of candidate intra modes;using at least one of the derived one or more intra modes to select a transform;generating a predictor of the current block based on the one or more derived intra modes by referring the set of reference samples; andencoding or decoding the current block by using the computed predictor and the selected transform.15.A video decoding method comprising:receiving data to be decoded as a current block of pixels of a current picture of a video;identifying a set of reference samples and a template region in a reconstructed portion of the current picture;computing a difference value between reconstruction samples of the template region and intra prediction samples of the template region that are generated by referring the set of reference samples for each candidate intra mode in a set of candidate intra modes;deriving one or more intra modes based on the computed difference values of the set of candidate intra modes;using at least one of the derived one or more intra modes to select a transform;generating a predictor of the current block based on the one or more derived intra modes by referring the set of reference samples; andreconstructing the current block by using the computed predictor and the selected transform.16.A video encoding method comprising:receiving data to be encoded as a current block of pixels of a current picture of a video;identifying a set of reference samples and a template region in a reconstructed portion of the current picture;computing a difference value between reconstruction samples of the template region and intra prediction samples of the template region that are generated by referring the set of reference samples for each candidate intra mode in a set of candidate intra modes;deriving one or more intra modes based on the computed difference values of the set of candidate intra modes;using at least one of the derived one or more intra modes to select a transform;generating a predictor of the current block based on the one or more derived intra modes by referring the set of reference samples; andencoding the current block by using the computed predictor and the selected transform.