Encoding method and decoding method, encoder and decoder, and storage medium

By dynamically selecting filter sets for video coding based on indication information, the method enhances coding efficiency and improves compression performance.

WO2026153110A1PCT designated stage Publication Date: 2026-07-23GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
Filing Date
2025-12-29
Publication Date
2026-07-23

AI Technical Summary

Technical Problem

Current video coding techniques using fixed filters in template matching processes lower coding efficiency.

Method used

Implementing a method and apparatus for encoding and decoding that allow for determining and using multiple filter sets based on indication information for deriving reference samples, enhancing the coding process.

Benefits of technology

Improves coding efficiency by optimizing the selection of filter sets for video coding, leading to enhanced compression performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025146797_23072026_PF_FP_ABST
    Figure CN2025146797_23072026_PF_FP_ABST
Patent Text Reader

Abstract

According to one aspect of the present disclosure, a method of decoding is provided. The method may include decoding, by a processor, indication information associated with a process of deriving a reference sample for a block. The method may include determining, by the processor, at least one filter set from among a plurality of filter sets for use in the process of deriving the reference sample for the block based on the indication information. The method may include decoding, by the processor, a bitstream based on the process of deriving the reference sample for the block using the at least one filter set.
Need to check novelty before this filing date? Find Prior Art

Description

ENCODING METHOD AND DECODING METHOD, ENCODER AND DECODER, AND STORAGE MEDIUMCROSS-REFERENCE TO RELATED APPLICATIONS

[0001] This application claims the benefit of priority to U.S. Provisional Application No. 63 / 746,187, filed January 16, 2025, entitled “ENCODING METHOD AND DECODING METHOD, ENCODER AND DECODER, AND STORAGE MEDIUM, ” which is incorporated by reference herein in its entirety.BACKGROUND

[0002] Embodiments of the present disclosure relate to video coding.

[0003] Digital video has become mainstream and is being used in a wide range of applications including digital television, video telephony, and teleconferencing. These digital video applications are feasible because of the advances in computing and communication technologies as well as efficient video coding techniques. Various video coding techniques may be used to compress video data, such that coding on the video data may be performed using one or more video coding standards. Exemplary video coding standards may include, but not limited to, versatile video coding (H. 266 / VVC) , high-efficiency video coding (H. 265 / HEVC) , advanced video coding (H. 264 / AVC) , moving picture expert group (MPEG) coding, enhanced video coding model (ECM) , to name a few.SUMMARY

[0004] According to one aspect of the present disclosure, a method of decoding is provided. The method may include decoding, by a processor, indication information associated with a process of deriving a reference sample for a block. The method may include determining, by the processor, at least one filter set from among a plurality of filter sets for use in the process of deriving the reference sample for the block based on the indication information. The method may include decoding, by the processor, a bitstream based on the process of deriving the reference sample for the block using the at least one filter set.

[0005] According to another aspect of the present disclosure, a decoder is provided. The decoder may include a processor and memory storing instructions. The memory storing instructions, which when executed by the processor, may cause the processor to decode indication information associated with a process of deriving a reference sample for a block. The memory storing instructions, which when executed by the processor, may cause the processor to determine at least one filter set from among a plurality of filter sets for use in the process of deriving the reference sample for the block based on the indication information. The memory storing instructions, which when executed by the processor, may cause the processor to decode a bitstream based on the process of deriving the reference sample for the block using the at least one filter set.

[0006] According to a further aspect of the present disclosure, an apparatus for decoding is provided. The apparatus for decoding may include a processor and memory storing instructions. The memory storing instructions, which when executed by the processor, may cause the processor to decode indication information associated with a process of deriving a reference sample for a block. The memory storing instructions, which when executed by the processor, may cause the processor to determine at least one filter set from among a plurality of filter sets for use in the process of deriving the reference sample for the block based on the indication information. The memory storing instructions, which when executed by the processor, may cause the processor to decode a bitstream based on the process of deriving the reference sample for the block using the at least one filter set.

[0007] According to still another aspect of the present disclosure, a non-transitory computer-readable medium storing instructions for a processor of a decoder is provided. The instructions, which when executed by the processor of the decoder, may cause the processor of the decoder to decode indication information associated with a process of deriving a reference sample for a block. The instructions, which when executed by the processor of the decoder, may cause the processor of the decoder to determine at least one filter set from among a plurality of filter sets for use in the process of deriving the reference sample for the block based on the indication information. The instructions, which when executed by the processor of the decoder, may cause the processor of the decoder to decode a bitstream based on the process of deriving the reference sample for the block using the at least one filter set.

[0008] According to one aspect of the present disclosure, a method of encoding is provided. The method may include encoding, by a processor, indication information associated with a process of deriving a reference sample for a block. The method may include determining, by the processor, at least one filter set from among a plurality of filter sets for use in the process of deriving the reference sample for the block based on the indication information. The method may include encoding, by the processor, a bitstream based on the process of deriving the reference sample for the block using the at least one filter set.

[0009] According to another aspect of the present disclosure, an encoder is provided. The encoder may include a processor and memory storing instructions. The memory storing instructions, which when executed by the processor, may cause the processor to encode indication information associated with a process of deriving a reference sample for a block. The memory storing instructions, which when executed by the processor, may cause the processor to determine at least one filter set from among a plurality of filter sets for use in the process of deriving the reference sample for the block based on the indication information. The memory storing instructions, which when executed by the processor, may cause the processor to encode a bitstream based on the process of deriving the reference sample for the block using the at least one filter set.

[0010] According to a further aspect of the present disclosure, an apparatus for encoding is provided. The apparatus for encoding may include a processor and memory storing instructions. The memory storing instructions, which when executed by the processor, may cause the processor to encode indication information associated with a process of deriving a reference sample for a block. The memory storing instructions, which when executed by the processor, may cause the processor to determine at least one filter set from among a plurality of filter sets for use in the process of deriving the reference sample for the block based on the indication information. The memory storing instructions, which when executed by the processor, may cause the processor to encode a bitstream based on the process of deriving the reference sample for the block using the at least one filter set.

[0011] According to still another aspect of the present disclosure, a non-transitory computer-readable medium storing instructions for a processor of an encoder is provided. The instructions, which when executed by the processor of the encoder, may cause the processor of the encoder to encode indication information associated with a process of deriving a reference sample for a block. The instructions, which when executed by the processor of the encoder, may cause the processor of the encoder to determine at least one filter set from among a plurality of filter sets for use in the process of deriving the reference sample for the block based on the indication information. The instructions, which when executed by the processor of the encoder, may cause the processor of the encoder to encode a bitstream based on the process of deriving the reference sample for the block using the at least one filter set.

[0012] According to a further aspect of the present disclosure, a method of transmitting a bitstream is provided. The method may include executing the encoding method described herein to generate a bitstream. The method may include transmitting the bitstream.

[0013] According to still another aspect of the present disclosure, a non-transitory computer-readable storage medium, having a computer program and a bitstream stored thereon is provided. The computer program, when executed by a processor, enables the processor to perform the operations of the encoding method described herein to generate the bitstream.

[0014] These illustrative embodiments are mentioned not to limit or define the present disclosure, but to provide examples to aid understanding thereof. Additional embodiments are described in the Detailed Description, and further description is provided there.BRIEF DESCRIPTION OF THE DRAWINGS

[0015] The accompanying drawings, which are incorporated herein and form a part of the specification, illustrate embodiments of the present disclosure and, together with the description, further serve to explain the principles of the present disclosure and to enable a person skilled in the pertinent art to make and use the present disclosure.

[0016] FIG. 1A illustrates a block diagram of an exemplary encoding system, according to some embodiments of the present disclosure.

[0017] FIG. 1B illustrates a block diagram of an exemplary decoding system, according to some embodiments of the present disclosure.

[0018] FIG. 2 illustrates a block diagram of an exemplary encoder, according to some embodiments of the present disclosure.

[0019] FIG. 3A illustrates an exemplary technique of quadtree splitting of a coding unit, according to some embodiments of the present disclosure.

[0020] FIG. 3B illustrates an exemplary technique of binary splitting and ternary splitting of a coding unit, according to some embodiments of the present disclosure.

[0021] FIG. 3C illustrates an exemplary technique of splitting of a coding unit into various split types, according to some embodiments of the present disclosure.

[0022] FIG. 4 illustrates an exemplary technique of inter prediction based on template matching, according to some embodiments of the present disclosure.

[0023] FIG. 5A illustrates first exemplary templates used in template matching, according to some embodiments of the present disclosure.

[0024] FIG. 5B illustrates second exemplary templates used in template matching, according to some embodiments of the present disclosure.

[0025] FIG. 5C illustrates third exemplary templates used in template matching, according to some embodiments of the present disclosure.

[0026] FIG. 6 illustrates an exemplary technique of intra prediction based on template matching, according to some embodiments of the present disclosure.

[0027] FIGs. 7A-7E illustrate example syntax elements for signaling controlling parameters for template based prediction modes, according to some embodiments of the present disclosure.

[0028] FIGs. 8A-8G illustrate example syntax elements for signaling controlling parameters for template based prediction modes, according to some embodiments of the present disclosure.

[0029] FIGs. 9A-9E illustrate example syntax elements for signaling controlling parameters for template based prediction modes, according to some embodiments of the present disclosure.

[0030] FIG. 10 illustrates an example implementation of decoder, according to some embodiments of the present disclosure.

[0031] FIG. 11 illustrates an example of source device, according to some embodiments of the present disclosure.

[0032] FIG. 12 illustrates an example of receiving device, according to some embodiments of the present disclosure.

[0033] FIG. 13 illustrates an example of communication system, according to some embodiments of the present disclosure.

[0034] FIG. 14 illustrates an example of video codec system, according to some embodiments of the present disclosure.

[0035] FIG. 15 illustrates an example of communication system, according to some embodiments of the present disclosure.

[0036] FIG. 16 illustrates an example of current block and reference sample, according to some embodiments of the present disclosure.

[0037] FIG. 17 illustrates a diagram of non-adjacent spatial neighboring candidates for occurrence-based intra coding (OBIC) mode, according to some embodiments of the present disclosure.

[0038] FIG. 18 illustrates an example of the histogram-of-occurrences (HoC) of intra prediction mode, according to some embodiments of the present disclosure.

[0039] FIG. 19 illustrates an example of region transform of current block, according to some embodiments of the present disclosure.

[0040] FIG. 20A illustrates a first example of region transform of current block, according to some embodiments of the present disclosure.

[0041] FIG. 20B illustrates a second example of region transform of current block, according to some embodiments of the present disclosure.

[0042] FIG. 21 illustrates an example of region transform of current block, according to some embodiments of the present disclosure.

[0043] FIG. 22 illustrates an example of adjacent blocks of a current block, according to some embodiments of the present disclosure.

[0044] FIG. 23 illustrates a first example of an adjacent block of block vector (BV) -based prediction mode, according to some embodiments of the present disclosure.

[0045] FIG. 24 illustrates a second example of an adjacent block of BV-based prediction mode, according to some embodiments of the present disclosure.

[0046] FIG. 25 is a flowchart of an example method of predicting a current block using a BV-based technique, according to some embodiments of the present disclosure.

[0047] FIG. 26 illustrates an example of spatial merge candidates of a current block, according to some embodiments of the present disclosure.

[0048] FIG. 27 illustrates an example of block vector (BV) refinement, according to some embodiments of the present disclosure.

[0049] FIG. 28A illustrates a first example of BV flip, according to some embodiments of the present disclosure.

[0050] FIG. 28B illustrates a second example of BV flip, according to some embodiments of the present disclosure.

[0051] FIG. 29 illustrates an example of NN-based intra prediction, according to some embodiments of the present disclosure.

[0052] FIG. 30 illustrates an example of a block and its reference samples for cross-component prediction, according to some embodiments of the present disclosure.

[0053] FIG. 31A illustrates an example of a block that is partitioned into sub-blocks in cross-component prediction, according to some embodiments of the present disclosure.

[0054] FIG. 31B illustrates a first example of a block that is partitioned into sub-blocks in cross-component prediction that may be performed based on a block vector (BV) , according to some embodiments of the present disclosure.

[0055] FIG. 31C illustrates a second example of a block that is partitioned into sub-blocks in cross-component prediction that may be performed based on a BV, according to some embodiments of the present disclosure.

[0056] FIG. 31D illustrates a third example of a block that is partitioned into sub-blocks in cross-component prediction that may be performed based on a BV, according to some embodiments of the present disclosure.

[0057] FIG. 32A illustrates a first example Sobel filter, according to some embodiments of the present disclosure.

[0058] FIG. 32B illustrates a second example Sobel filter, according to some embodiments of the present disclosure.

[0059] FIG. 32C illustrates a first example Edge filter, according to some embodiments of the present disclosure.

[0060] FIG. 32D illustrates a second example Edge filter, according to some embodiments of the present disclosure.

[0061] FIG. 33 illustrates a flowchart of an example method of decoding, according to some embodiments of the present disclosure.

[0062] FIG. 34 illustrates a flowchart of an example method of encoding, according to some embodiments of the present disclosure.

[0063] Embodiments of the present disclosure may be described with reference to the accompanying drawings.DETAILED DESCRIPTION

[0064] Although some configurations and arrangements are discussed, it should be understood that this is done for illustrative purposes only. A person skilled in the pertinent art will recognize that other configurations and arrangements may be used without departing from the spirit and scope of the present disclosure. It may be apparent to a person skilled in the pertinent art that the present disclosure can also be employed in a variety of other applications.

[0065] It is noted that references in the specification to “one embodiment, ” “an embodiment, ” “an example embodiment, ” “some embodiments, ” “certain embodiments, ” etc., indicate that the embodiment described may include a particular feature, structure, or characteristic, but every embodiment may not necessarily include the particular feature, structure, or characteristic. Moreover, such phrases do not necessarily refer to the same embodiment. Further, when a particular feature, structure, or characteristic is described in connection with an embodiment, it would be within the knowledge of a person skilled in the pertinent art to effect such feature, structure, or characteristic in connection with other embodiments whether or not explicitly described.

[0066] In general, terminology may be understood at least in part from usage in context. For example, the term “one or more” as used herein, depending at least in part upon context, may be used to describe any feature, structure, or characteristic in a singular sense or may be used to describe combinations of features, structures or characteristics in a plural sense. Similarly, terms, such as “a, ” “an, ” or “the, ” again, may be understood to convey a singular usage or to convey a plural usage, depending at least in part upon context. In addition, the term “based on” may be understood as not necessarily intended to convey an exclusive set of factors and may, instead, allow for existence of additional factors not necessarily expressly described, again, depending at least in part on context.

[0067] Various aspects of point cloud coding systems will now be described with reference to various apparatus and methods. These apparatus and methods may be described in the following detailed description and illustrated in the accompanying drawings by various modules, components, circuits, steps, operations, processes, algorithms, etc. (collectively referred to as “elements” ) . These elements may be implemented using electronic hardware, firmware, computer software, or any combination thereof. Whether such elements are implemented as hardware, firmware, or software depends upon the particular application and design constraints imposed on the overall system. The techniques described herein may be used for various point cloud coding applications. As described herein, point cloud coding includes both encoding and decoding a point cloud.

[0068] In August 2020, ITU-T finalized a standardization project namely H. 266 / VVC (Versatile Video Coding) and published the first version of the ITU-T H. 266 standard. Then, the standardization committee started exploration work aiming at achieve a performance superior to the latest H. 266 / VVC standard in coding high quality video with one or more features of high resolution, high frame rate, high bit depth, high dynamic range, wide color gamut and omnidirectional video. JVET (Joint Video Expert Group of ITU-T SG 16 WP 3 and ISO / IEC JTC 1 / SC 29) is in charge of this exploration work. Various prediction and transform modes have been verified to achieve high compression efficiency in coding high quality video and thus adopted in a software platform for this exploration work.

[0069] Currently, a fixed filter is used a template matching searching process, which lowers the coding efficiency.

[0070] FIG. 1A illustrates a block diagram of an exemplary encoding system 100, according to some embodiments of the present disclosure. FIG. 1B illustrates a block diagram of an exemplary decoding system 150, according to some embodiments of the present disclosure. Each system 100 or 150 may be applied or integrated into various systems and apparatuses capable of data processing, such as computers and wireless communication devices. For example, system 100 or 150 may be the entirety or part of a mobile phone, a desktop computer, a laptop computer, a tablet, a vehicle computer, a gaming console, a printer, a positioning device, a wearable electronic device, a smart sensor, a virtual reality (VR) device, an argument reality (AR) device, or any other suitable electronic devices having data processing capability. As shown in FIGs. 1A and 1B, system 100 or 150 may include a processor 102, a memory 104, and an interface 106. These components are shown as connected one to another by a bus, but other connection types are also permitted. It is understood that system 100 or 150 may include any other suitable components for performing functions described here.

[0071] Processor 102 may include microprocessors, such as graphic processing unit (GPU) , image signal processor (ISP) , central processing unit (CPU) , digital signal processor (DSP) , tensor processing unit (TPU) , vision processing unit (VPU) , neural processing unit (NPU) , synergistic processing unit (SPU) , or physics processing unit (PPU) , microcontroller units (MCUs) , application-specific integrated circuits (ASICs) , field-programmable gate arrays (FPGAs) , programmable logic devices (PLDs) , state machines, gated logic, discrete hardware circuits, and other suitable hardware configured to perform the various functions described throughout the present disclosure. Although only one processor is shown in FIGs. 1A and 1B, it is understood that multiple processors may be included. Processor 102 may be a hardware device having one or more processing cores. Processor 102 may execute software. Software shall be construed broadly to mean instructions, instruction sets, code, code segments, program code, programs, subprograms, software modules, applications, software applications, software packages, routines, subroutines, objects, executables, threads of execution, procedures, functions, etc., whether referred to as software, firmware, middleware, microcode, hardware description language, or otherwise. Software can include computer instructions written in an interpreted language, a compiled language, or machine code. Other techniques for instructing hardware are also permitted under the broad category of software.

[0072] Memory 104 can broadly include both memory (a.k.a, primary / system memory) and storage (a.k.a. secondary memory) . For example, memory 104 may include random-access memory (RAM) , read-only memory (ROM) , static RAM (SRAM) , dynamic RAM (DRAM) , ferro-electric RAM (FRAM) , electrically erasable programmable ROM (EEPROM) , compact disc read-only memory (CD-ROM) or other optical disk storage, hard disk drive (HDD) , such as magnetic disk storage or other magnetic storage devices, Flash drive, solid-state drive (SSD) , or any other medium that may be used to carry or store desired program code in the form of instructions that may be accessed and executed by processor 102. Broadly, memory 104 may be embodied by any computer-readable medium, such as a non-transitory computer-readable medium. Although only one memory is shown in FIGs. 1A and 1B, it is understood that multiple memories may be included.

[0073] Interface 106 can broadly include a data interface and a communication interface that is configured to receive and transmit a signal in a process of receiving and transmitting information with other external network elements. For example, interface 106 may include input / output (I / O) devices and wired or wireless transceivers. Although only one memory is shown in FIGs. 1A and 1B, it is understood that multiple interfaces may be included.

[0074] Processor 102, memory 104, and interface 106 may be implemented in various forms in system 100 or 150 for performing point cloud coding functions. In some embodiments, processor 102, memory 104, and interface 106 of system 100 or 150 are implemented (e.g., integrated) on one or more system-on-chips (SoCs) . In one example, processor 102, memory 104, and interface 106 may be integrated on an application processor (AP) SoC that handles application processing in an operating system (OS) environment, including running point cloud encoding and decoding applications. In another example, processor 102, memory 104, and interface 106 may be integrated on a specialized processor chip for point cloud coding, such as a GPU or ISP chip dedicated to graphic processing in a real-time operating system (RTOS) .

[0075] As shown in FIG. 1A, in encoding system 100, processor 102 may include one or more modules, such as an encoder 101. Although FIG. 1A shows that encoder 101 is within one processor 102, it is understood that encoder 101 may include one or more sub-modules that may be implemented on different processors located closely or remotely with each other. Encoder 101 (and any corresponding sub-modules or sub-units) may be hardware units (e.g., portions of an integrated circuit) of processor 102 designed for use with other components or software units implemented by processor 102 through executing at least part of a program, i.e., instructions. The instructions of the program may be stored on a computer-readable medium, such as memory 104, and when executed by processor 102, it may perform a process having one or more functions related to point cloud encoding, such as voxelization, transformation, quantization, arithmetic encoding, etc., as described below in detail.

[0076] Similarly, as shown in FIG. 1B, in decoding system 150, processor 102 may include one or more modules, such as a decoder 120. Although FIG. 2 shows that decoder 120 is within one processor 102, it is understood that decoder 120 may include one or more sub-modules that may be implemented on different processors located closely or remotely with each other. Decoder 120 (and any corresponding sub-modules or sub-units) may be hardware units (e.g., portions of an integrated circuit) of processor 102 designed for use with other components or software units implemented by processor 102 through executing at least part of a program, i.e., instructions. The instructions of the program may be stored on a computer-readable medium, such as memory 104, and when executed by processor 102, it may perform a process having one or more functions related to point cloud decoding, such as arithmetic decoding, dequantization, inverse transformation, reconstruction, synthesis, as described below in detail.

[0077] FIG. 2 illustrates a block diagram of an exemplary encoder 200, according to some embodiments of the present disclosure. As shown, the input to the encoder 200 may be a video including a sequence of pictures or a still picture, while the output of the encoder 200 may be a bitstream representing a compressed version of the input video. As also shown, encoder 200 may include, e.g., a partition unit 201, a prediction unit 202, a block partition unit 203, an inter prediction unit 204, an intra prediction unit 205, a first adder 206, a transform unit 207, a quantization unit 208, an inverse quantization unit 209, an inverse transform unit 210, a second adder 211, a filtering unit 212, and a decoded picture buffer (DPB) 213. The various operations of encoder 200 will now be described.

[0078] For example, referring to FIG. 2, partition unit 201 divides a picture in an input video into one or more coding tree units (CTUs) . Partition unit 201 divides the picture into tiles, and optionally may further divide a tile into one or more bricks. A tile or a brick may contain one or more integral and / or partial CTUs. Partition unit 201 forms one or more slices, where a slice may contain one or more tiles in a raster order of tiles in the picture, or one or more tiles covering a rectangular region in the picture. Partition unit 201 may also form one or more sub-pictures, which may contain one or more slices, tiles, or bricks.

[0079] During the encoding process, partition unit 201 passes CTUs to prediction unit 202. Generally, prediction unit 202 is composed of block partition unit 203, inter prediction unit 204, and intra prediction unit 205. Block partition unit 203 further divides an input CTU into smaller coding units (CUs) using various split or partition types, such as quadtree split, binary split, and ternary split iteratively. Examples of quadtree split, binary split, and ternary split of a CU or a coding block are described below in connection with FIGs. 3A, 3B, and 3C.

[0080] FIG. 3A illustrates an exemplary technique of quadtree splitting 300 of a coding unit, according to some embodiments of the present disclosure. As shown in FIG. 3A, quadtree split is applied to CU or coding block 301. Blocks 3010, 3011, 3012 and 3013, as CU, can also be further partitioned iteratively using various split or partition types, such as quadtree split, binary split, ternary split, etc. The processing order of the four CUs obtained by partitioning coding block 301 is 3010, 3011, 3012, and 3013.

[0081] FIG. 3B illustrates an exemplary technique of binary splitting and ternary splitting 325 of a coding unit, according to some embodiments of the present disclosure. As shown in FIG. 3B, various examples of binary splitting and / or ternary splitting is applied to a CU are depicted. For instance, CU 302 is partitioned using vertical binary split. Blocks 3020 and 3021, as CU, can also be further partitioned iteratively using various split or partition types, such as quadtree split, binary split, ternary split, etc. CU 303 is partitioned using horizontal binary split. Blocks 3030 and 3031, as CU, can also be further partitioned iteratively using various split or partition types, such as quadtree split, binary split, ternary split, etc. CU 304 is partitioned using vertical ternary split. Blocks 3040, 3041, and 3042, as CU, can also be further partitioned iteratively using various split or partition types, such as quadtree split, binary split, ternary split, etc. CU 305 is partitioned using horizontal ternary split. Blocks 3003, 3051, and 3052, as CU, can also be further partitioned iteratively using various split or partition types, such as quadtree split, binary split, ternary split, etc.

[0082] FIG. 3C illustrates an exemplary technique of splitting 350 of a coding unit into various split types, according to some embodiments of the present disclosure. As shown in FIG. 3C, an example of partitioning or splitting a CU 306 iteratively using various split or partition types, e.g., such as quadtree split, binary split, ternary split, etc. is depicted.

[0083] Referring again to FIG. 2, prediction unit 202 may derive inter prediction block of a CU using inter prediction unit 204, and may derive intra prediction block of a CU using intra prediction unit 205. In an example, prediction unit 202 may use a rate-distortion mode decision process to determine a prediction mode of a CU.

[0084] Generally, inter prediction unit 204 performs motion estimation to derive motion parameters of a CU. The motion parameters include motion vector (MV) and reference index (refIdx) . MV indicates a relative location of a matching block in a reference picture indicated by refIdx in a specific reference list (e.g., list 0 and list 1) . Generally, list 0 mainly includes reference pictures that is ahead of the current picture in an output order or a displaying order, while list 1 mainly includes reference pictures that is behind the current picture in an output order or a displaying order. Inter prediction unit 204 may derive the MV of the CU using the samples in the CU and find the block in the reference with least cost according to a rate-distortion motion estimation method. Inter prediction unit 204 may derive motion parameters and / or prediction samples using an NN-based method or process. Inter prediction unit 204 may derive the MV of the CU using spatial reference samples of the CU.

[0085] FIG. 4 illustrates an exemplary technique of inter prediction 400 based on template matching, according to some embodiments of the present disclosure.

[0086] As shown in FIG. 4, CU 403 is the current CU in the current picture 401. A reference picture of the current CU 403 is a reconstructed or decoded reference picture 402. Template 404 includes the above neighboring samples and / or left samples. Instead of deriving a matching block of the current CU 403 in a search range in a reference picture 402, inter prediction unit 204 may derive a matching template 405 of template 404 in reference picture 402. An initial MV is derived based on the displacement between template 404 and matching template 405. In an example, the block 406 in a same size of the current block 403 may be used as an inter prediction block of the current CU 403. FIGs. 5A-5C shows examples of templates.

[0087] FIG. 5A illustrates first exemplary templates 500 used in template matching, according to some embodiments of the present disclosure. Referring to FIG. 5A, examples of candidate templates using neighboring samples of the current CU (Curr CU) are depicted. As an example, a template of the current CU may be one of AboveLeft, Above, AboveRight, Left and BottomLeft. As another example, a template of the current CU may be a region of a combination of two or more of AboveLeft, Above, AboveRight, Left and BottomLeft. Take template 404 for example. Template 404 in FIG. 4 is a combination of Above and Left templates in FIG. 5A.

[0088] FIG. 5B illustrates second exemplary templates 525 used in template matching, according to some embodiments of the present disclosure. As shown in FIG. 5B, examples of candidate templates using samples that are not directly neighboring the current CU (Curr CU) are depicted. As an example, a template of the current CU may be one of AboveLeft, Above-Left, Above, AboveRight, Left-Above, Left and BottomLeft. As another example, a template of the current CU may be a region of a combination of two or more of AboveLeft, Above-Left, Above, AboveRight, Left-Above, Left and BottomLeft. As another example, a template of the current CU may be a combination of two or more of the example candidate templates in FIGs. 5A and 5B.

[0089] FIG. 5C illustrates third exemplary templates 550 used in template matching, according to some embodiments of the present disclosure. As shown in FIG. 5C examples of templates from the candidate templates in FIG. 5A are shown. In some other implementations, templates using non-neighboring samples may be derived in a similar way in FIG. 5C using examples of candidate templates in FIG. 5B.

[0090] Referring again to FIG. 2, inter prediction unit 204 may refine an existing MV based on a displacement between a template of a current block and a matching block. Additionally and / or alternatively, inter prediction unit 204 may refine an existing MV based on a displacement between two template blocks. In some embodiments, inter prediction unit 204 may also use the matching template to derive certain compensation to the current block.

[0091] Generally, inter prediction unit 204 may determine a template shape. Then, inter prediction unit 204 may calculate a cost between various reference templates and the template. Finally, inter prediction unit 204 may determine a reference template that results in an optimal cost function as a matching template of the template.

[0092] A cost between two templates may be represented as an error between a template and a reference template. As an example, the cost may be a Sum of Absolute Differences (SAD) calculated according to equation (1) shown below. where Ti, m and Tm are samples in two templates, respectively; and M is a number of samples in a template.

[0093] As an example, the cost may be a Sum of Absolute Transformed Differences (SATD) calculated according to equation (2) shown below. where X represents a matrix of a difference between two template samples, M is the size of the matrix, and H is a normalized MxM Hadamard matrix.

[0094] As an example, the cost may be a Mean Reduced Sum of Absolute Differences (MR-SAD) calculated according to equation (3) shown below. where Ti, m and Tm are samples in two templates, respectively; M is the number of samples in a template; Avgi is the average value of a first template containing Ti, m; and Avg is the average of a second template containing Tm.

[0095] In some implementations, other cost measures that may be used by inter prediction unit 204 may include one or more of, e.g., Mean Squared Error (MSE) , Sum of Squared Differences (SSD) , Mean Absolute Difference (MAD) , Mean Squared Difference (MSD) , Normalized Cross-Correlation (NCC) , Structural Similarity Index Measure (SSIM) , or Multi-Scale Structural Similarity Index Measure (MS-SSIM) , just to name a few.

[0096] Still referring to FIG. 2, besides directly using the matching block 406 as a prediction of the current CU 403, inter prediction unit 204 may be enabled with a number of prediction modes that utilizes template matching to derive a matching template. Table 1 below shows example prediction modes, which may be carried out by the inter prediction unit 204, with default cost functions of the modes. As one example, the intra block copying (IBC) mode may be carried out by inter prediction unit 204 by setting available reconstructed area of the current picture as “reference picture” to derive a matching block of the current block. Table 1: Example Prediction Modes for Inter Prediction

[0097] Inter prediction unit 204 may determine a cost different from the default cost for one or more prediction modes in Table 1. That is, inter prediction unit 204 may choose a cost function from several candidate cost functions. In some implementations, inter prediction unit 204 may determine whether default costs are used for one or more of the inter prediction modes. In some implementations, inter prediction unit 204 can determine that for an inter prediction mode that utilizes template matching, a first cost function (e.g., SAD) may be used for coding all pictures in a video sequence, and / or pictures within a certain period in a video sequence, and / or a picture, and / or a tile, and / or a slice, and / or a CTU, and / or a CU. In an embodiment, inter prediction unit 204 may use a unified cost function for a same or similar process using a template. For example, for “reordering” functions as listed in Table 1, inter prediction unit 204 can use SATD for one, multiple but not all, or all of the prediction modes having “reordering” of candidates in a candidate list. For example, for “reordering” functions as listed in Table 1, inter prediction unit 204 can use SAD or any one of the abovementioned cost function for one, multiple but not all, or all of the prediction modes having “reordering” of candidates in a candidate list. In an embodiment, inter prediction unit 204 can use a single cost function for all prediction modes.

[0098] In some implementations, prediction unit 202 may use an interpolation filter to generate the fractional samples in template matching process. In one example, prediction unit 202 may use a fixed set of filters to generate fractional samples in both intra and inter template matching. In one example, the fixed set of filters ( “Filter set A” ) may include the coefficients for 2-tap filters shown below in Table 2. Table 2: “Filter set A”

[0099] In some implementations, the fixed set of filters ( “Filter set B” ) may include coefficients for 4-tap filters shown below in Table 3. Table 3: “Filter set B”

[0100] In one example, the fixed set of filters ( “Filter set C” ) may include coefficients for 4-tap filters shown below in Table 4. Table 4: “Filter set C”

[0101] In some implementations, prediction unit 202 may determine which filer set for template matching will be used in encoding a video sequence, a picture, a region of a picture (e.g., a sub-picture, a slice, a tile, and / or other region in a picture) , and / or a coding block. Take the abovementioned example filter sets shown in Tables 2-4, prediction unit 202 may use a rate-distortion optimization (RDO) process to determine which filter set will be used in encoding. Prediction unit 202 may determine indication information or an indication parameter corresponding to the one or more filter sets used in encoding, which it sends the indication parameter to the entropy coding unit 214.

[0102] In some implementations, the indication information may indicate which one or more filter sets are used in encoding a video, and the entropy coding unit 214 may signal the indication information in a sequence-level data unit in a bitstream, e.g., such as in video parameter set, sequence parameter set, picture parameter set, adaption parameter set, and / or a picture header.

[0103] In some implementations, the indication information may indicate which one or more filter sets are used in encoding a picture, and the entropy coding unit 214 may signal the indication information in a picture-level data unit in a bitstream, e.g., such as in picture parameter set, adaption parameter set, a picture header, and / or a slice header.

[0104] In some implementations, the indication information may indicate which one or more filter sets are used in encoding a region in a picture, and the entropy coding unit 214 may signal the indication information in a picture-region-level data unit in a bitstream, e.g., such as in adaption parameter set and / or a slice header.

[0105] In some implementations, the indication information may indicate which one or more filter sets are used in encoding a block in a picture, and the entropy coding unit 214 may signal the indication information in a block-level data unit in a bitstream, e.g., such as in a coding tree unit, a coding unit, a prediction unit and / or a transform unit.

[0106] In some implementations, the indication information or indication parameter may be one or more indices corresponding to the one or more filter sets used in template matching in encoding.

[0107] Generally, intra prediction unit 205 may derive an intra prediction block of a CU using various intra prediction modes including, e.g., direct copying (DC) mode, planar mode, angular prediction mode, Matrix-based Intra Prediction (MIP) mode, cross-component prediction (CCP) mode (e.g., cross-component linear model intra prediction (CCLM) mode, cross-component convolutional model (CCCM) intra prediction mode, etc. ) , intra block copying (IBC) mode, intra template matching prediction (IntraTMP) mode, NN-based intra prediction mode, etc. In an example, rate-distortion optimized motion estimation may be invoked by intra prediction unit 205 to derive the intra prediction mode for a current block; and according to the intra prediction mode, intra prediction unit 205 determines the intra prediction block for the current block.

[0108] FIG. 30 illustrates an example of a block and its reference samples for cross-component prediction 3000, according to some embodiments of the present disclosure.

[0109] Block 3001 is a current block, and reference area 3002 includes reference samples for deriving prediction parameters. Intra prediction unit 205 can derive CCP model parameter using one or more reference samples in the reference area 3002.

[0110] The CCP model can map a value of a sample of a first picture component to a value of a sample of a second picture component, where a picture component may be one of a component of a color space used in representing a picture or video, and the first picture component is different from the second picture component. For example, a picture component may be one of luma component and a chroma component (e.g., Cb component or Cr component) ; in one example, a picture component may be one of red component, green component, and blue component; in one example, a picture component may be one of X component, Y component and Z component.

[0111] The CCP model may be based on a linear model. For example, in CCLM mode, the CCP model may be implemented as: derivedSamples [x] [y] = Clip1 ( ( (pDsY [x] [y] *a ) >> k ) + b)where derivedSamples [x] [y] is a second picture component value at sample position (x, y) in the current block, and pDsY is a reference value of a first picture component for sample position (x, y) in the current block, a, k and b are model parameters, and Clip1 is a function defined as follows: Clip1 (x) = Clip3 (0, (1 << BitDepth ) -1, x) where BitDepth is a value of bit depth representing a picture component, and Clip3 is a function defined as follows:

[0112] For example, in CCCM mode, the CCP model may be implemented as: derivedSamples [x] [y] = c0 x C + c1 x N + c2 x S + c3 x E + c4 x W + c5 x P + c6 x B where derivedSamples [x] [y] is a second picture component value at sample position (x, y) in the current block, c0, c1, c2, c3, c4, c5 and c6 are model parameters, and C, N, S, E, W, P and B are reference values of a first picture component for sample position (x, y) in the current block.

[0113] In one example, intra prediction unit 205 may use the derivedSamples [x] [y] as a prediction of the second picture component of the current block 3001. In this case, reference values are from reconstructed samples of a first picture component block corresponding to the current block.

[0114] For example, the first picture component is luma component, and the second picture component is a chroma component. The current block 3001 is a chroma block, and the intra prediction unit 205 may derive reference values of luma component from one or more luma reconstructed samples in the collocated luma block of the current block 3001.

[0115] In one example, intra prediction unit 205 may derive model parameters of CCP using one or more samples in reference region 3002. Reference region 3002 includes one or more neighboring samples of the current block 3001.

[0116] FIG. 31A illustrates an example of a block that is partitioned into sub-blocks in cross-component prediction 3100, according to some embodiments of the present disclosure.

[0117] Referring to FIG. 31A, in one example, intra prediction unit 205 may divide the current block 3101 into more than one sub-blocks. Intra prediction unit 205 respectively may derive CCP models for the sub-blocks based on different reference samples. As in the non-limiting example depicted in FIG. 31A, intra prediction unit 205 divides the current block 3101 into two sub-blocks 3111 and 3112. Intra prediction unit 205 may derive CCP model parameters for sub-block 3111 using one or more reference samples from a reference area (e.g., one or more areas of 3221, 3222, and 3223) for sub-block 3111; and intra prediction unit 205 may derive CCP model parameters for sub-block 3112 using one or more reference samples from a reference area (e.g., one or more areas of 3221, 3222, and 3223) for sub-block 3112. In some implementations, the reference area for sub-block 3111 and the reference area for sub-block 3112 may not be the same. In some implementations, the reference samples from the reference area for sub-block 3111 and the reference samples from the reference area for sub-block 3112 may not fully the same.

[0118] FIG. 31B illustrates a first example of a block that is partitioned into sub-blocks in cross-component prediction 3125 that may be performed based on a BV, according to some embodiments of the present disclosure.

[0119] Referring to FIG. 31B, in one example, intra prediction unit 205 may divide the current block 3101 into more than one sub-block. Intra prediction unit 205 respectively may derive CCP models for the sub-blocks with different reference samples. As in an example shown in FIG. 31B, intra prediction unit 205 may divides the current block 3101 into two sub-blocks 3111 and 3112. Intra prediction unit 205 may derive CCP model parameters for sub-block 3111 using one or more reference samples from a reference block 3131 indicated by block vector 1 (BV1) of sub-block 3111. Intra prediction unit 205 may derive CCP model parameters for sub-block 3112 using one or more reference samples from a reference area for sub-block 3112, that is, from one or more areas of 3221, 3222 and 3223. In one example, intra prediction unit 205 may derive BV1 from block matching and send BV1 to entropy coding unit 214 to signal in a bitstream. In one example, intra prediction unit 205 may derive BV1 from neighboring blocks of sub-block 3111 or block 3101. In one example, intra prediction unit 205 may derive BV1 using template matching with a template containing one or more neighboring reference samples of sub-block 3111 or block 3101. In one example, intra prediction unit 205 may derive BV1 from an BV candidate list and send corresponding index of BV1 in the BV candidate list to entropy coding unit 214 to signal in a bitstream.

[0120] FIG. 31C illustrates a second example of a block that is partitioned into sub-blocks in cross-component prediction 3150 that may be performed based on a BV, according to some embodiments of the present disclosure.

[0121] Referring to FIG. 31C, in one example, intra prediction unit 205 may divide the current block 3101 into more than one sub-blocks. Intra prediction unit 205 respectively may derive CCP models for the sub-blocks with different reference samples. As in an example shown in FIG. 31C, intra prediction unit 205 divides the current block 3101 into two sub-blocks 3111 and 3112. Intra prediction unit 205 may derive CCP model parameters for sub-block 3112 using one or more reference samples from a reference block 3132 indicated by block vector 2 (BV2) of sub-block 3112. Intra prediction unit 205 may derive CCP model parameters for sub-block 3111 using one or more reference samples from a reference area for sub-block 3111, that is, from one or more areas of 3221, 3222 and 3223. In one example, intra prediction unit 205 may derive BV2 from block matching and send BV1 to entropy coding unit 214 to signal in a bitstream. In one example, intra prediction unit 205 may derive BV2 from neighboring blocks of sub-block 3112 or block 3101. In one example, intra prediction unit 205 may derive BV2 using template matching with a template containing one or more neighboring reference samples of sub-block 3112 or block 3101. In one example, intra prediction unit 205 may derive BV2 from an BV candidate list and send corresponding index of BV2 in the BV candidate list to entropy coding unit 214 to signal in a bitstream.

[0122] FIG. 31D illustrates a third example of a block that is partitioned into sub-blocks in cross-component prediction 3175 that may be performed based on a BV, according to some embodiments of the present disclosure.

[0123] Referring to FIG. 31D, in one example, intra prediction unit 205 may divide the current block 3101 into more than one sub-blocks. Intra prediction unit 205 respectively may derive CCP models for the sub-blocks with different reference samples. As in an example shown in FIG. 31D, intra prediction unit 205 divides the current block 3101 into two sub-blocks 3111 and 3112. Intra prediction unit 205 divides the current block 3101 into two sub-blocks 3111 and 3112. Intra prediction unit 205 may derive CCP model parameters for sub-block 3111 using one or more reference samples from a reference block 3131 indicated by block vector 1 (BV1) of sub-block 3111. Intra prediction unit 205 may derive CCP model parameters for sub-block 3112 using one or more reference samples from a reference block 3132 indicated by block vector 1 (BV2) of sub-block 3112. In one example, intra prediction unit 205 may derive BV1 from block matching and send BV1 to entropy coding unit 214 to signal in a bitstream. In one example, intra prediction unit 205 may derive BV1 from neighboring blocks of sub-block 3111 or block 3101. In one example, intra prediction unit 205 may derive BV1 using template matching with a template containing one or more neighboring reference samples of sub-block 3111 or block 3101. In one example, intra prediction unit 205 may derive BV1 from an BV candidate list and send corresponding index of BV1 in the BV candidate list to entropy coding unit 214 to signal in a bitstream. In one example, Intra prediction unit 205 may derive BV2 from block matching and send BV1 to entropy coding unit 214 to signal in a bitstream. In one example, intra prediction unit 205 may derive BV2 from neighboring blocks of sub-block 3112 or block 3101. In one example, intra prediction unit 205 may derive BV2 using template matching with a template containing one or more neighboring reference samples of sub-block 3112 or block 3101. In one example, intra prediction unit 205 may derive BV2 from an BV candidate list and send corresponding index of BV2 in the BV candidate list to entropy coding unit 214 to signal in a bitstream.

[0124] In this way, intra prediction unit 205 may be implemented using parallel processing to simultaneously derive model parameters of sub-block 3111 and sub-block 3112.

[0125] In one example, sub-block 3111 and sub-block 3112 are of an equal size. In another example, sub-block 3111 and sub-block 3112 are of different sizes; that is, one sub-block will include more samples than another sub-block.

[0126] In one example, intra prediction unit 205 may divide the current block into more than 2 sub-blocks. An example of 4 sub-blocks is shown in Table 8 below, where cuBlkSize is a size (measured as a number of samples in a block) of a current block, Partitions is a number of sub-blocks in the current block, BlkW and BlkH is a width and height of the current block respectively, and SubW and SubH are a width and height of a sub-block. Note that in this example, intra prediction unit 205 divides the current block into sub-blocks of an equal size. In another example, intra prediction unit 205 divides the current block into sub-blocks of non-equal sizes. Table 8: Sub-block sizes

[0127] In one example, intra prediction unit 205 may determine one mode for sub-block 3111 and 3112. For example, intra prediction unit 205 uses CCLM mode for sub-block 3111 and sub-block 3112. For example, intra prediction unit 205 uses CCCP mode for sub-block 3111 and sub-block 3112. Note that although intra prediction unit 205 may use the same mode for sub-block 3111 and sub-block 3112, model parameters could be different for sub-block 3111 and sub-block 3112, as corresponding reference samples for the two sub-blocks are different.

[0128] In one example, intra prediction unit 205 may determine different CCP modes for sub-block 3111 and 3112. In some examples, intra prediction unit 205 uses CCLM mode for sub-block 3111 and uses CCCM mode for sub-block 3112. In some examples, intra prediction unit 205 uses CCCM mode for sub-block 3111 and uses CCLM mode for sub-block 3112.

[0129] In one example, intra prediction unit 205 may also determine whether the above described CCP using sub-block will be used, for example, using rate-distortion optimization (RDO) . Intra prediction unit 205 may set an indication parameter for the current block 3101 to indicate whether the above described CCP using sub-block will be used to decode the current block 3101 (or the above described CCP using sub-block is used to encode the current block 3101) . Intra prediction unit 205 may pass this indication parameter to the entropy coding unit 214, and the entropy coding unit 214 may signal this indication parameter for the current block in a bitstream.

[0130] In an example, when the size of the current block meets a threshold condition, intra prediction unit 205 may determine whether the above described CCP using sub-block will be used for the current block 3101. For example, the threshold condition may be whether a number of samples in the current block is greater than or equal to a predetermined value (e.g., 256 samples) . For example, the threshold condition may be whether a number of samples in the current block is less than or equal to another predetermined value (for example, 128x128 samples) . For example, the threshold condition may be whether a number of samples in the current block is within a range (e.g., greater than or equal to 128 samples and less than or equal to 128x128 samples) . When the size of the current block meets the threshold condition, intra prediction unit 205 may determine the said indication parameter, and correspondingly, entropy coding unit 214 may signal this indication parameter for the current block in a bitstream.

[0131] FIG. 6 illustrates an exemplary technique of intra prediction 600 based on template matching, according to some embodiments of the present disclosure.

[0132] Referring to FIG. 6, an example of IntraTMP mode is shown. Picture 601 is a current picture, and block 603 is current block or current CU. Region 602 in picture 601 is an already reconstructed area. Current block 603 is within region 608, which is an area to be reconstructed or encoded. Intra prediction unit 205 first determines a template of the current block 603, where a template may be one of the template types as shown in one or more of FIGs. 5A-5C. In the non-limiting example shown in FIG. 6, intra prediction unit 205 uses a template that is a combination of Above and Left neighboring samples of the current block 603. Intra prediction unit 205 may then search in a search range within region 602 to find a matching template that results in an optimal cost as a matching template of the template.

[0133] The cost between two templates may be represented as an error between a template and a reference template. As an example, the cost may be the SAD calculated according to equation (1) , shown above. As another example, the cost may be an SATD calculated according to equation (2) , shown above. As a further example, the cost may be a MR-SAD calculated according to equation (3) shown above. In some implementations, other cost measures that may be used by intra prediction unit 205 may include one or more of, e.g., MSE, SSD, MAD, MSD, NCC, SSIM, or MS-SSIM, just to name a few.

[0134] By way of example and not limitation, intra prediction unit 205 may use the SAD function to determine a matching reference template 605 for the template 604. The reference sample 607, which may be in a same size as that of the current block 603, is used by the intra prediction unit 205 to derive a prediction of the current block 603. A block vector (BV) 606 represents a displacement between the template 604 and its matching reference template 605, and / or represents a displacement between the current block 603 and the reference sample 607.

[0135] In some non-limiting examples, referring to FIGs. 2 and 6, intra prediction unit 205 can use the reference sample 607 as the prediction of the current block 603. In some non-limiting examples, intra prediction unit 205 can use a result of filtering the reference sample 607 to be the prediction of the current block 603. In some non-limiting examples, intra prediction unit 205 can use a result of the reference sample 607 adjusted with weighting factor to be the prediction of the current block 603.

[0136] Still referring to FIGs. 2 and 6, intra prediction unit 205 can derive more than one reference sample, in some implementations. For example, an optimal matching block and a sub-optimal matching block may be derived by the intra prediction unit 205, and two reference samples may be available. Intra prediction unit 205 may perform a fusion operation on the multiple reference samples derived in template matching process to derive a prediction of the current block 603. An example fusion operation is a weighted combination of the multiple reference samples, where the weights may be determined based on a matching error between the two reference templates and the template 604.

[0137] Still referring to FIGs. 2 and 6, in one example, besides deriving the prediction of the current block, intra prediction unit 205 may also derive coding parameters for the current block based on the reference template 605. In one embodiment, intra prediction unit 205 may derive model parameters for performing cross-component prediction on the current block 603 based on one or more reference templates 605.

[0138] Table 6 shows example prediction modes, which may be carried out by the intra prediction unit 205, with default cost functions of the modes. In some implementations, the intra block copying (IBC) mode may be carried out by intra prediction unit 205 as the prediction block is derived only based on the samples in the current picture and no temporal reference picture or inter-layer reference picture is used. Table 6: Example Prediction Modes for Intra Prediction

[0139] Referring to FIG. 2, intra prediction unit 205 can determine a cost different from the default cost for one or more prediction modes in Table 6. That is, intra prediction unit 205 can choose a cost function from several candidate cost functions. In some implementations, intra prediction unit 205 can determine whether default costs are used for one or more of the intra prediction modes. In some implementations, intra prediction unit 205 can determine that for an intra prediction mode that utilizes template matching, a first cost function (e.g., SAD) may be used for coding all pictures in a video sequence, and / or pictures within a certain period in a video sequence, and / or a picture, and / or a tile, and / or a slice, and / or a CTU, and / or a CU. In some implementations, intra prediction unit 205 may use a unified cost function for a same or similar process using a template. For example, for “reordering” functions as listed in Table 6, intra prediction unit 205 may use SATD for one, multiple but not all, or all of the prediction modes having “reordering” of candidates in a candidate list. For example, for “reordering” functions as listed in Table 6, intra prediction unit 205 can use SAD, or any one of the abovementioned cost functions for one, multiple but not all, or all of the prediction modes having “reordering” of candidates in a candidate list. In some implementations, intra prediction unit 205 can use a single cost function for all prediction modes.

[0140] In some implementations, according to an indication parameter or indication information received from parsing unit 1001, prediction unit 1002 may use an interpolation filter to generate the fractional samples in template matching process. In one example, prediction unit 1002 may use a fixed set of filters to generate fractional samples in both intra and inter template matching. In one example, the fixed set of filters ( “Filter set A” ) may include the coefficients for 2-tap filters shown below in Table 2. Table 2: “Filter set A”

[0141] In some implementations, the fixed set of filters ( “Filter set B” ) may include coefficients for 4-tap filters shown below in Table 3. Table 3: “Filter set B”

[0142] In one example, the fixed set of filters ( “Filter set C” ) may include coefficients for 4-tap filters shown below in Table 4. Table 4: “Filter set C”

[0143] In some implementations, prediction unit 1002 may determine which filer set for template matching will be used in decoding a video sequence, a picture, a region of a picture (e.g., a sub-picture, a slice, a tile, and / or other region in a picture) , and / or a coding block. Take the abovementioned example filter sets shown in Tables 2-4, prediction unit 1002 may determine which filter set will be used in decoding based on the indication information or an indication parameter received from the parsing unit 1001.

[0144] In some implementations, the parsing unit 1001 may provide the prediction unit 1002 with the indication information which indicates one or more filter sets are used in decoding a video. Parsing unit 1001 may obtain the indication information (or indication parameter) from a sequence-level data unit in a bitstream, e.g., such as in video parameter set, sequence parameter set, picture parameter set, adaption parameter set, and / or a picture header.

[0145] In some implementations, the parsing unit 1001 may provide the prediction unit 1002 with the indication information which indicates one or more filter sets are used in decoding a picture. Parsing unit 1001 may obtain the indication information from a picture-level data unit in a bitstream, e.g., such as in picture parameter set, adaption parameter set, a picture header, and / or a slice header.

[0146] In some implementations, the parsing unit 1001 may provide the prediction unit 1002 with the indication information which indicates one or more filter sets are used in decoding a region in a picture. Parsing unit 1001 may obtain the indication information in a picture-region-level data unit in a bitstream, e.g., such as in adaption parameter set and / or a slice header.

[0147] In some implementations, the parsing unit 1001 may provide the prediction unit 1002 with the indication information which indicates one or more filter sets are used in decoding a block in a picture. Parsing unit 1001 may obtain the indication information from a block-level data unit in a bitstream, e.g., such as in a coding tree unit, a coding unit, a prediction unit and / or a transform unit.

[0148] In some implementations, the indication information or indication parameter may be one or more indices corresponding to the one or more filter sets used in template matching in decoding.

[0149] As mentioned above, FIG. 30 illustrates an example of a block and its reference samples for cross-component prediction 3000, according to some embodiments of the present disclosure.

[0150] Block 3001 is a current block, and reference area 3002 includes reference samples for deriving prediction parameters. Intra prediction unit 1004 can derive CCP model parameter using one or more reference samples in the reference area 3002.

[0151] The CCP model can map a value of a sample of a first picture component to a value of a sample of a second picture component, where a picture component may be one of a component of a color space used in representing a picture or video, and the first picture component is different from the second picture component. For example, a picture component may be one of luma component and a chroma component (e.g., Cb component or Cr component) ; in one example, a picture component may be one of red component, green component, and blue component; in one example, a picture component may be one of X component, Y component and Z component.

[0152] The CCP model may be based on a linear model. For example, in CCLM mode, the CCP model may be implemented as: derivedSamples [x] [y] = Clip1 ( ( (pDsY [x] [y] *a ) >> k ) + b)where derivedSamples [x] [y] is a second picture component value at sample position (x, y) in the current block, and pDsY is a reference value of a first picture component for sample position (x, y) in the current block, a, k and b are model parameters, and Clip1 is a function defined as follows: Clip1 (x) = Clip3 (0, (1 << BitDepth ) -1, x) where BitDepth is a value of bit depth representing a picture component, and Clip3 is a function defined as follows:

[0153] For example, in CCCM mode, the CCP model may be implemented as: derivedSamples [x] [y] = c0 x C + c1 x N + c2 x S + c3 x E + c4 x W + c5 x P + c6 x B where derivedSamples [x] [y] is a second picture component value at sample position (x, y) in the current block, c0, c1, c2, c3, c4, c5 and c6 are model parameters, and C, N, S, E, W, P and B are reference values of a first picture component for sample position (x, y) in the current block.

[0154] In one example, intra prediction unit 1004 may use the derivedSamples [x] [y] as a prediction of the second picture component of the current block 3001. In this case, reference values are from reconstructed samples of a first picture component block corresponding to the current block.

[0155] For example, the first picture component is luma component, and the second picture component is a chroma component. The current block 3001 is a chroma block, and the intra prediction unit 1004 may derive reference values of luma component from one or more luma reconstructed samples in the collocated luma block of the current block 3001.

[0156] In one example, intra prediction unit 1004 may derive model parameters of CCP using one or more samples in reference region 3002. Reference region 3002 includes one or more neighboring samples of the current block 3001.

[0157] As mentioned above, FIG. 31A illustrates an example of a block that is partitioned into sub-blocks in cross-component prediction 3100, according to some embodiments of the present disclosure.

[0158] Referring to FIG. 31A, in one example, intra prediction unit 1004 may divide the current block 3101 into more than one sub-blocks. Intra prediction unit 1004 respectively may derive CCP models for the sub-blocks based on different reference samples. As in the non-limiting example depicted in FIG. 31A, intra prediction unit 1004 divides the current block 3101 into two sub-blocks 3111 and 3112. Intra prediction unit 1004 may derive CCP model parameters for sub-block 3111 using one or more reference samples from a reference area (e.g., one or more areas of 3221, 3222, and 3223) for sub-block 3111; and intra prediction unit 1004 may derive CCP model parameters for sub-block 3112 using one or more reference samples from a reference area (e.g., one or more areas of 3221, 3222, and 3223) for sub-block 3112. In some implementations, the reference area for sub-block 3111 and the reference area for sub-block 3112 may not be the same. In some implementations, the reference samples from the reference area for sub-block 3111 and the reference samples from the reference area for sub-block 3112 may not fully the same.

[0159] As mentioned above, FIG. 31B illustrates a first example of a block that is partitioned into sub-blocks in cross-component prediction 3125 that may be performed based on a BV, according to some embodiments of the present disclosure.

[0160] Referring to FIG. 31B, in one example, intra prediction unit 1004 may derive a prediction of the current block 3101 by deriving predictions of more than one sub-blocks in the current block 3101. Intra prediction unit 1004 respectively may derive CCP models for the sub-blocks with different reference samples. As in an example shown in FIG. 31B, intra prediction unit 1004 predicts two sub-blocks 3111 and 3112 in the current block 3101. Intra prediction unit 1004 may derive CCP model parameters for sub-block 3111 using one or more reference samples from a reference block 3131 indicated by block vector 1 (BV1) of sub-block 3111. Intra prediction unit 1004 may derive CCP model parameters for sub-block 3112 using one or more reference samples from a reference area for sub-block 3112, that is, from one or more areas of 3221, 3222 and 3223. In one example, intra prediction unit 1004 may obtain BV1 from parsing unit 1001. In one example, intra prediction unit 1004 may derive BV1 from neighboring blocks of sub-block 3111 or block 3101. In one example, intra prediction unit 1004 may derive BV1 using template matching with a template containing one or more neighboring reference samples of sub-block 3111 or block 3101. In one example, intra prediction unit 1004 may derive BV1 from an BV candidate index from parsing unit 1001.

[0161] As mentioned above, FIG. 31C illustrates a second example of a block that is partitioned into sub-blocks in cross-component prediction 3150 that may be performed based on a BV, according to some embodiments of the present disclosure.

[0162] Referring to FIG. 31C, in one example, intra prediction unit 1004 may derive a prediction of the current block 3101 by deriving predictions of more than one sub-blocks in the current block 3101. Intra prediction unit 1004 respectively may derive CCP models for the sub-blocks with different reference samples. As in an example shown in FIG. 31C, intra prediction unit 1004 may predict two sub-blocks 3111 and 3112 in the current block 3101. Intra prediction unit 1004 may derive CCP model parameters for sub-block 3112 using one or more reference samples from a reference block 3132 indicated by block vector 2 (BV2) of sub-block 3112. Intra prediction unit 1004 may derive CCP model parameters for sub-block 3111 using one or more reference samples from a reference area for sub-block 3111, that is, from one or more areas of 3221, 3222 and 3223. In one example, intra prediction unit 1004 may obtain BV2 from parsing unit 1001. In one example, intra prediction unit 1004 may derive BV2 from neighboring blocks of sub-block 3112 or block 3101. In one example, intra prediction unit 1004 may derive BV2 using template matching with a template containing one or more neighboring reference samples of sub-block 3112 or block 3101. In one example, intra prediction unit 1004 may derive BV2 from an BV candidate index from parsing unit 1001.

[0163] As mentioned above, FIG. 31D illustrates a third example of a block that is partitioned into sub-blocks in cross-component prediction 3175 that may be performed based on a BV, according to some embodiments of the present disclosure.

[0164] Referring to FIG. 31D, in one example, intra prediction unit 1004 may derive a prediction of the current block 3101 by deriving predictions of more than one sub-blocks in the current block 3101. Intra prediction unit 1004 respectively may derive CCP models for the sub-blocks with different reference samples. As in an example shown in FIG. 31D, intra prediction unit 1004 may predict two sub-blocks 3111 and 3112 in the current block 3101. Intra prediction unit 1004 may derive CCP model parameters for sub-block 3111 using one or more reference samples from a reference block 3131 indicated by block vector 1 (BV1) of sub-block 3111. Intra prediction unit 1004 may derive CCP model parameters for sub-block 3112 using one or more reference samples from a reference block 3132 indicated by block vector 2 (BV2) of sub-block 3112. In one example, Intra prediction unit 1004 may obtain BV1 from parsing unit 1001. In one example, intra prediction unit 1004 may derive BV1 from neighboring blocks of sub-block 3111 or block 3101. In one example, intra prediction unit 1004 may derive BV1 using template matching with a template containing one or more neighboring reference samples of sub-block 3111 or block 3101. In one example, intra prediction unit 1004 may derive BV1 from an BV candidate index from parsing unit 1001. In one example, intra prediction unit 1004 may obtain BV2 from parsing unit 1001. In one example, intra prediction unit 1004 may derive BV2 from neighboring blocks of sub-block 3112 or block 3101. In one example, intra prediction unit 1004 may derive BV2 using template matching with a template containing one or more neighboring reference samples of sub-block 3112 or block 3101. In one example, intra prediction unit 1004 may derive BV2 from an BV candidate index from parsing unit 1001.

[0165] In this way, intra prediction unit 1004 may be implemented using parallel processing to simultaneously derive model parameters of sub-block 3111 and sub-block 3112.

[0166] In one example, sub-block 3111 and sub-block 3112 are of an equal size. In another example, sub-block 3111 and sub-block 3112 are of different sizes; that is, one sub-block will include more samples than another sub-block.

[0167] In one example, intra prediction unit 1004 may divide the current block into more than 2 sub-blocks. An example of 4 sub-blocks is shown in Table 8 above. Note that in this example, intra prediction unit 1004 divides the current block into sub-blocks of an equal size. In another example, intra prediction unit 1004 divides the current block into sub-blocks of non-equal sizes.

[0168] In one example, intra prediction unit 1004 may determine one mode for sub-block 3111 and 3112. For example, intra prediction unit 1004 uses CCLM mode for sub-block 3111 and sub-block 3112. For example, intra prediction unit 1004 uses CCCP mode for sub-block 3111 and sub-block 3112. Note that although intra prediction unit 1004 may use the same mode for sub-block 3111 and sub-block 3112, model parameters could be different for sub-block 3111 and sub-block 3112, as corresponding reference samples for the two sub-blocks are different. In one example, intra prediction unit 1004 may determine one mode for sub-block 3111 and 3112 according to the parameters from the parsing unit 1001.

[0169] In one example, intra prediction unit 1004 may determine different CCP modes for sub-block 3111 and 3112. In some examples, intra prediction unit 1004 uses CCLM mode for sub-block 3111 and uses CCCM mode for sub-block 3112. In some examples, intra prediction unit 1004 uses CCCM mode for sub-block 3111 and uses CCLM mode for sub-block 3112 according to the parameters from the parsing unit 1001.

[0170] In one example, intra prediction unit 1004 may also determine whether the above described CCP using sub-block will be used, for example, according to the parameters from the parsing unit 1001. Intra prediction unit 1004 may determine an indication parameter for the current block 3101 which indicates whether the above described CCP using sub-block will be used to decode the current block 3101.

[0171] In an example, when the size of the current block meets a threshold condition, intra prediction unit 1004 may determine whether the above described CCP using sub-block will be used for the current block 3101. For example, the threshold condition may be whether a number of samples in the current block is greater than or equal to a predetermined value (e.g., 256 samples) . For example, the threshold condition may be whether a number of samples in the current block is less than or equal to another predetermined value (for example, 128x128 samples) . For example, the threshold condition may be whether a number of samples in the current block is within a range (e.g., greater than or equal to 128 samples and less than or equal to 128x128 samples) . When the size of the current block meets the threshold condition, intra prediction unit 1004 may determine the indication parameter.

[0172] In an example, when the size of the current block meets a threshold condition, parsing unit 1001 may determine an indication parameter indicating whether the above described CCP using sub-block will be used for the current block 3101 according the bitstream. For example, the threshold condition can be whether a number of samples in the current block is greater than or equal to a predetermined value (for example, 256 samples) . For example, the threshold condition may be whether a number of samples in the current block is less than or equal to another predetermined value (e.g., 128x128 samples) . For example, the threshold condition can be whether a number of samples in the current block is within a range (e.g., greater than or equal to 128 samples, and less than or equal to 128x128 samples) . When the size of the current block meets the threshold condition, parsing unit 1001 may determine the indication parameter according to the bitstream.

[0173] When the indication parameter is absent from the bitstream, the sub-block CCP mode may be inferred to be disabled.

[0174] Prediction unit 202 may also derive intra prediction mode or angular prediction direction of the current CU based on one or more reference samples, as described below in connection with FIG. 16.

[0175] FIG. 16 illustrates an example visualization 1600 of a current block 1601 and reference samples 1602, 1603, according to some embodiments of the present disclosure.

[0176] Referring to FIG. 16, the reference sample 1602, 1603, which are marked as black dot outside the current block 1601, may be one or more samples in a template ( “L-shape” template consisting of the black dots in FIG. 16) as shown in FIGs. 5A-5C. For example, a gradient of reference sample 1602, 1603 may be derived by applying one or more filters to process one or more samples in a template as shown in FIGs. 5A-5C. Prediction unit 202 first may derive a gradient of a reference sample using an operator. Generally, the operator may be used to detect an edge or a gradient in a picture. The operator may be a 2-dimentional (2D) M x N filter, where M and N are positive integers, and M may be equal to or different from N.

[0177] One example of the operator is a Sobel filter. A first example of a 3x3 Sobel filter 3200 is depicted in FIG. 32A, and a second example of a 3x3 Sobel filter 3225 is depicted in FIG. 32B.

[0178] Another example of the operator is an Edge filter. A first example of an Edge filter 3250 is depicted in FIG. 32C, and a second example of an Edge filter 3275 is depicted in FIG. 32D.

[0179] In some implementations, prediction unit 202 can choose different operators according to a width and / or a height of the current block. For example, prediction unit 202 uses smaller operator for smaller block, and uses larger operator for larger block. One example would be that prediction unit 202 uses the abovementioned Edge filter when a size (e.g., width x height) of the current block is 4x4, 4x8 or 8x4, and uses the abovementioned Sobel filter for other sizes of the current block.

[0180] Prediction unit 202 may derive a Histogram of Gradients (HoG) by analyzing one or more reference samples 1602, 1603 marked in black dots in FIG. 16. The template in FIG. 16 may include three reference sample lines above and three reference sample columns on the left of the current block 1601. The HoG is derived by accumulating the magnitudes of one or more gradients at one or more given directions, for one, a part of, or all of the reference samples 1602, 1603 as shown in FIG. 16. One or more directions indicated by the gradients with the highest or higher cumulative magnitudes may be identified as the angular prediction direction or intra prediction mode of the current block 1601.

[0181] As an example, when prediction unit 202 uses one reference sample (e.g., any black dot above and / or to the left of the current block 1601) as shown in FIG. 16 to derive a direction, the prediction unit 202 can determine the direction as the one indicated by a gradient derived at this reference sample.

[0182] As an example, when prediction unit 202 uses a part of reference samples (e.g., one or more of the black dots above and / or to the left of the current block 1601) as shown in FIG. 16 to derive directions, prediction unit 202 can choose a preset number of samples from the reference samples. For example, prediction unit 202 choose J reference samples above the current block and K reference samples left to the current block, wherein J and K are integers greater than or equal to 0.For example, both J and K are equal to 2, J equal to 4 and K equal to 8, or J plus K equal to 4. Prediction unit 202 may derive the gradients at the selected reference samples using the operator and may derive the HoG. One or more directions indicated by the gradients with highest or higher cumulative magnitudes may be identified as the angular prediction direction or intra prediction mode of the current block 1601.

[0183] As an example, prediction unit 202 can adaptively determine one or more reference samples used for deriving a HoG. Prediction unit 202 uses a preset scanning order of the reference samples. When scanning a reference sample, prediction unit 202 may derive a gradient at this reference sample, and updates the accumulation of the magnitudes according to this gradient at one or more given directions in the HoG. When prediction unit 202 determines that the total cumulative amplitude is greater or equal than a given threshold, prediction unit 202 will stop scanning the remaining reference sample and deriving new gradient. The resulting HoG at the termination of scanning by prediction unit 202 is determined as the HoG, which may be used to derive intra prediction mode or angular prediction direction.

[0184] Examples of the abovementioned preset scanning order of the reference samples may be the following.

[0185] For example, a scanning order (A) may be scanning the left column of reference samples as shown in FIG. 16 from bottom to top; a scanning order (B) may be scanning the left column of reference samples as shown in FIG. 16 from top to bottom; a scanning order (C) may be scanning the above line of reference samples as shown in FIG. 16 from left to right; a scanning order (D) may be scanning the above line of reference samples as shown in FIG. 16 from right to left.

[0186] An example of the preset scanning order may be one or more of “first order (A) then order (C) , ” “first order (A) then order (D) , ” “first order (B) then order (C) , ” “first order (B) then order (D) , ” “first order (C) then order (A) , ” “first order (D) then order (A) , ” “first order (C) then order (B) , ” and / or “first order (D) then order (B) . ”

[0187] In some implementations, the preset scanning order may be performed in an interleaving manner. In one example, one or multiple reference samples may be scanned from the left column and then one or multiple second reference samples from the above line and then one or multiple third reference sample from left column. In another example, one or multiple reference samples may be scanned from the above line and then one or multiple second reference samples from the left column and then one or multiple third reference sample from above line. Additionally, as an example, the scanning order of samples in the left column may be one or more of order (A) and (B) , and the scanning order of samples in the above line may be one or more of order (C) and (D) .

[0188] Prediction unit 202 may use the derived one or more intra prediction modes or one or more angular prediction directions (intra prediction mode or angular prediction direction also may be called as “intra prediction direction” ) to derive a prediction of the current block. For example, prediction unit 202 may pass the derived one or more intra prediction modes or one or more angular prediction directions to intra prediction unit 205. In some implementations, intra prediction unit 205 may derive a prediction of the current block by fusing one or more predictions corresponding to the derived intra prediction modes. In one embodiment, Intra prediction unit 205 may derive a prediction of the current block by fusing one or more predictions corresponding to the derived intra prediction modes. In one embodiment, Intra prediction unit 205 may derive a prediction of the current block by fusing one or more predictions determined according to the derived intra prediction modes and one or more predictions determined according to one or more preset mode (e.g., Planar mode, DC mode and cross-component prediction mode and etc. ) .

[0189] Prediction unit 202 may use Occurrence-based intra coding (OBIC) to derive the intra prediction modes of the current block based on the sample-wise occurrence of the intra modes in the spatial neighborhood of the block. For this, adjacent and non-adjacent spatial neighboring blocks are checked, and the intra prediction modes of the blocks are collected into an occurrence histogram. Instead of Histogram of Gradient (HoG) as in DIMD, the OBIC method uses the Histogram of occurrence (HoC) , which consists of the intra modes and their sample-wise occurrences. The occurrence values are calculated based on the number of samples that are coded in a certain intra prediction mode in that neighborhood. For example, if a uiWidth × uiHeight block is coded with an IPM mode, the occurrence of the mode in that particular block is calculated as: HoC [IPM] += uiWidth *uiHeight, where uiWidth and uiHeight are the width and height of a spatial neighboring block.

[0190] The occurrences of the existing modes from the spatial neighborhood blocks are accumulated into the histogram, adjacent and non-adjacent spatial neighboring blocks are checked, and the intra prediction modes of the blocks are collected into an occurrence histogram. Instead of Histogram of Gradient (HoG) as in DIMD, the OBIC method uses the Histogram of occurrence (HoC) , which consists of the intra modes and their sample-wise occurrences. The occurrence values are calculated based on the number of samples that are coded in a certain intra prediction mode in that neighborhood. For example, if a uiWidth × uiHeight block is coded with an Intra Predication Mode (IPM) mode, the occurrence of the mode in that particular block is calculated as: HoC [IPM] += uiWidth *uiHeight, where uiWidth and uiHeight are the width and height of a spatial neighboring block.

[0191] The occurrences of the existing modes from the spatial neighborhood blocks are accumulated into the histogram.

[0192] FIG. 17 illustrates a diagram of non-adjacent spatial neighboring candidates 1700 for occurrence-based intra coding (OBIC) mode, according to some embodiments of the present disclosure.

[0193] Referring to FIG. 17, one or multiple (e.g., up to five angular modes) with the highest occurrence along with the planar mode or block vector based prediction (same as in DIMD) are selected from the HoC and used for final prediction by blending the prediction of the selected modes.

[0194] Some blocks, mentioned below, use more than one intra mode for prediction. In such cases, all the intra modes of such blocks are selected and used when creating the OBIC histogram. For example, DIMD may use up to 5 angular modes, TIMD may use up to 2 modes, SGPM may use up to 2 modes, and OBIC may use up to 5 angular modes.

[0195] Moreover, the virtual intra prediction modes (VIPMs) of the following blocks are considered only in inter slices when creating the histogram of OBIC mode: MIP block, IntraTMP block, IBC block, and EIP block.

[0196] The blending weights are calculated similarly to the DIMD mode, but instead of using gradient values from the template, the occurrence values are used for OBIC. Moreover, the planar mode’s weight is also decided similarly to the DIMD mode.

[0197] FIG. 18 illustrates an example of the histogram-of-occurrences (HoC) 1800 of intra prediction mode, according to some embodiments of the present disclosure.

[0198] Referring to FIG. 18, in an embodiment, in order to decrease the buffer memory, the OBIC method may use non-sample-wise occurrences, such as block-wise occurrences. For example, if a uiWidth× uiHeight block is coded with an IPM mode, the block-wise occurrence of the mode in that particular block is calculated as: HoC [IPM] += (uiWidth>>shift1) *(uiHeight>>shift2) , where the variable shift1 and shift2 are both positive integers greater than or equal to 1. When the variable shift1 and shift2 are set to 1, the occurrence type 2×2 block-wise occurrence is used. The variable shift 1 or shift 2 can also be set to 2, 3, 4, 5, and so on. It is not limited that the shift1 is equal to shift2.

[0199] In an embodiment, the shift1 or shift 2 may be determined according to the size (width or height) of the current block. For example, if the size of the current block is 4×4, the 2×2 block-wise occurrence may be used.

[0200] In an embodiment, the shift1 or shift2 may be determined by using the flag sps_log2_min_luma_coding_block_size_minus2. For example, parse a bitstream and obtain the value of sps_log2_min_luma_coding_block_size_minus2. If the value of sps_log2_min_luma_coding_block_size_minus2 is equal to 2, the size of the current block is determined to 4×4. Then the occurrence type may be obtained through the determined size of the current block.

[0201] In an embodiment, the block-wise occurrence may be determined through a look-up table. Tables 7A-7E illustrate various non-limiting examples of look-up tables that correlate CU size to occurrence type. Table 7A: First Example Occurrence-Type Look-up Table Table 7B: Second Example Occurrence-Type Look-up Table Table 7C: Third Example Occurrence-Type Look-up Table Table 7D: Fourth Example Occurrence-Type Look-up Table Table 7E: Fifth Example Occurrence-Type Look-up Table

[0202] In an embodiment, a confidence level can also be used to calculate the occurrence. If there is a very large size block neighboring a small size block, the IPM of the large size block is considered as a low confidence level block and the large size block is not used to calculate the occurrence of the current block. For example, if a 64×64 block neighbors a 2×2 block, the 64×64 block may not be used to calculate the occurrence of the 2×2 block for the reason that the 2×2 block is too small than the 64×64 block. If the 64×64 block is used to calculate, it will negatively interfere with the histogram statistics. The size of current block is a factor the determined the confidence level of a neighbor block.

[0203] In an embodiment, the OBIC mode may be used to luma blocks.

[0204] In an embodiment, the OBIC mode may be used to chroma blocks.

[0205] FIG. 22 illustrates an example of adjacent blocks 2200 of current block 2201, according to some embodiments of the present disclosure. The numbers on adjacent reference samples shows an example of scanning order of the adjacent blocks by prediction unit 202. In one example, intra prediction unit 205 scans prediction modes of the adjacent reference samples to derive one or more MPM. If the mode of an adjacent block is not a BV based intra prediction mode (e.g., planar mode, DC mode, angular prediction mode, etc. ) , intra prediction unit 205 may include this intra mode as a candidate mode in MPM list. In an example, spatial reference samples can also be one or more non-adjacent blocks shown in FIG. 17.

[0206] FIG. 23 illustrates a first example of an adjacent block of a BV-based prediction mode, according to some embodiments of the present disclosure. In FIG. 23, 2300 is a current picture 2300 and 2301 is a current block 2301.

[0207] For example, current block 2301 is a block in an intra coded slice. For example, current block 2301 is a block in an intra coded picture (e.g., a picture that may be employed as an access point, such as Instantaneous Decoding Refresh picture, Clean Random Access picture, Broken Link Access picture, etc. ) .

[0208] Block 2302 is an adjacent block of current block 2301, and block 2302 is coded using a BV based coding mode, e.g., IBC or IntraTMP. BV (2302) is a BV of block 2302 and indicates a reference block 2303. If block 2303 is an intra coded block which only references to reconstructed samples in the current picture 2300 and block 2303 is not using a BV based coding mode, for example, block 2303 is of an angular mode, DC mode or planar mode, the width and / or height of block 2303 may be used to derive an HoC of the current block 2301. As block 2302 is of a same size as that of 2303, equivalently, the width and / or height of block 2302 may be used to derive an HoC of the current block 2301. In one example, coding information of the block 2303 may be used to derive an HoC of the current block 2301. In one example, the coding information of the block 2303 may include one or more of the width of block 2303, the height of block 2303, or the coding mode of block 2303. In one example, the width and / or height of block 2303 as well as the coding mode of block 2303 may be used to derive an HoC of the current block 2301.

[0209] If block 2303 is also coded using a BV based coding mode, prediction unit 202 will check a coding mode of block 2304, which is indicated by BV (2303) of block 2303. If block 2304 is an intra coded block which only references to reconstructed samples in the current picture 2300 and block 2304 is not using a BV based coding mode, for example, block 2304 is of an angular mode, DC mode or planar mode, the width and / or height of block 2304 may be used to derive an HoC of the current block 2301. As block 2302 is of a same size as that of 2303 and 2304, equivalently, the width and / or height of block 2302 may be used to derive an HoC of the current block 2301. In one example, coding information of the block 2304 may be used to derive an HoC of the current block 2301. In one example, the coding information of the block 2304 may include one or more of the width of block 2304, the height of block 2304, or the coding mode of block 2304. In one example, the width and / or height of block 2304 as well as the coding mode of block 2304 may be used to derive an HoC of the current block 2301.

[0210] Optionally, if prediction unit 202 cannot determine an intra coding mode that is not BV based mode after recursively searching using “BV links, ” for example using N linked BVs, prediction unit 202 will stopped and does not use any information from block 2302 to derive HoC of the current block 2301. As an example, N is a non-negative integer. When N is equal to 0, only block 2302 is checked by prediction unit 202. As an example, when N is equal to 1, block 2302 and block 2303 may be checked if block 2302 is coded using BV-based intra mode. As an example, when N is equal to 2, blocks 2302, 2303 and 2304 may be checked by prediction unit 202 if blocks 2302 and 2303 is coded using BV-based intra mode.

[0211] FIG. 24 illustrates a second example of an adjacent block of BV-based prediction mode, according to some embodiments of the present disclosure. For example, current block 2401 may be a block in an intra coded slice. For example, current block 2401 is a block in an intra coded picture (e.g., a picture that may be employed as an access point, such as Instantaneous Decoding Refresh picture, Clean Random Access picture, Broken Link Access picture, etc. ) .

[0212] Block 2402 is an adjacent block of current block 2401, and block 2402 is coded using a BV based coding mode, e.g. IBC or IntraTMP. BV (2402) is a BV of block 2402. Block 2403 is a block which contains a reference sample indicated by BV (2402) . In an example, (x0, y0) denotes a sample in current block 2401, and the reference sample is derived as (x0 + x (2402) , y0 + y (2402) ) , wherein BV (2402) has a horizontal component equal to x (2402) and a vertical component equal to y (2402) . For example, (x0, y0) may be a top-left sample in the current block 2401. For example, (x0, y0) may be a sample located at any corner of the current block 2401. For example, (x0, y0) may be a sample at a middle bottom-right position (e.g., (width (2401)  / 2, height (2401)  / 2) ) in the current block 2401. For example, (x0, y0) may be a sample at a middle top-right position (e.g., (width (2401)  / 2, height (2401)  / 2 - 1) ) in the current block 2401. For example, (x0, y0) may be a sample at a middle bottom-left position (e.g., (width (2401)  / 2 - 1, height (2401)  / 2) ) in the current block 2401. For example, (x0, y0) may be a sample at a middle top-left position (i.e. (width (2401)  / 2 - 1, height (2401)  / 2 - 1) ) in the current block 2401. width (2401) and height (2401) are width and height, respectively, of the current block 2401.

[0213] If block 2403 is an intra coded block which only references to reconstructed samples in the current picture 2400 and block 2403 is not using a BV based coding mode, for example, block 2403 is of an angular mode, DC mode or planar mode, in one example, the width and / or height of block 2403 may be used to derive a HoC of the current block 2401. In one example, width and / or height of block 2402 may be used to derive a HoC of the current block 2401. In one example, width and / or height of block 2401 may be used to derive a HoC of the current block 2401.

[0214] In one example, coding information of the block 2403 may be used to derive a HoC of the current block 2401. In one example, the coding information of the block 2403 may include one or more of the width of block 2403, the height of block 2403, or the coding mode of block 2403. In one example, coding information of the block 2403 and one of coding information of the block 2402, coding information of the current block 2401 may be used to derive a HoC of the current block 2401. In one example, the width and / or height of block 2403 as well as the coding mode of block 2403 may be used to derive a HoC of the current block 2401. In one example, width and / or height of block 2402 as well as the coding mode of block 2403 may be used to derive a HoC of the current block 2401. In one example, width and / or height of block 2401 as well as the coding mode of block 2403 may be used to derive a HoC of the current block 2401.

[0215] If block 2403 is also coded using a BV based coding mode, prediction unit 202 will check a coding mode of block 2404, which is indicated by BV (2403) of block 2403. In one example, Block 2404 is a block which contains another reference sample indicated further by BV (2403) . In one example, (x0, y0) denotes a sample in current block 2401, and the another reference sample is derived as (x0 + x (2402) + x (2403) , y0 + y (2402) + x (2403) ) , wherein BV (2402) has a horizontal component equal to x (2402) and a vertical component equal to y (2402) , and BV (2403) has a horizontal component equal to x (2403) and a vertical component equal to y (2403) . For example, (x0, y0) may be a top-left sample in the current block 2401. For example, (x0, y0) may be a sample located at any corner of the current block 2401. For example, (x0, y0) may be a sample at a middle bottom-right position (i.e. (width (2401)  / 2, height (2401)  / 2) ) in the current block 2401. For example, (x0, y0) may be a sample at a middle top-right position (i.e. (width (2401)  / 2, height (2401)  / 2 - 1) ) in the current block 2401. For example, (x0, y0) may be a sample at a middle bottom-left position (i.e. (width (2401)  / 2 - 1, height (2401)  / 2) ) in the current block 2401. For example, (x0, y0) may be a sample at a middle top-left position (i.e. (width (2401)  / 2 - 1, height (2401)  / 2 - 1) ) in the current block 2401. width (2401) and height (2401) are width and height, respectively, of the current block 2401.

[0216] If block 2404 is an intra coded block which only references to reconstructed samples in the current picture 2400 and block 2404 is not using a BV based coding mode, for example, block 2404 is of an angular mode, DC mode or planar mode, in one example, the width and / or height of block 2404 may be used to derive a HoC of the current block 2401. In one example, width and / or height of block 2403 may be used to derive a HoC of the current block 2401. In one example, width and / or height of block 2402 may be used to derive a HoC of the current block 2401. In one example, width and / or height of block 2401 may be used to derive a HoC of the current block 2401.

[0217] In one example, coding information of the block 2404 may be used to derive a HoC of the current block 2401. In one example, the coding information of the block 2404 may include one or more of the width of block 2404, the height of block 2404, or the coding mode of block 2404. In one example, coding information of the block 2404 and one of coding information of the block 2403, coding information of the block 2402, or coding information of the current block 2401 may be used to derive a HoC of the current block 2401. In one example, the width and / or height of block 2404 as well as the coding mode of block 2404 may be used to derive a HoC of the current block 2401. In one example, width and / or height of block 2403 as well as the coding mode of block 2404 may be used to derive a HoC of the current block 2401. In one example, width and / or height of block 2402 as well as the coding mode of block 2404 may be used to derive a HoC of the current block 2401. In one example, width and / or height of block 2401 as well as the coding mode of block 2404 may be used to derive a HoC of the current block 2401.

[0218] Optionally, if prediction unit 202 cannot determine an intra coding mode that is not BV based mode after recursively searching using “BV links, ” for example using N linked BVs, prediction unit 202 will stopped and does not use any information from block 2402 to derive HoC of the current block 2401. As an example, N is a non-negative integer. When N is equal to 0, only block 2402 is checked by prediction unit 202. As an example, when N is equal to 1, block 2402 and block 2403 may be checked if block 2402 is coded using BV-based intra mode. As an example, when N is equal to 2, blocks 2402, 2403 and 2404 may be checked by prediction unit 202 if blocks 2402 and 2403 is coded using BV-based intra mode.

[0219] FIG. 25 illustrates a flowchart of an example method 2500 of predicting a current block using a BV-based prediction technique, according to some implementations. The BV-based prediction technique may be used in intra prediction unit 205 and inter prediction unit 204. For example, BV-based intra prediction technology may include intra template matching prediction (IntraTMP) , intra block copy (IBC) , spatial geometric partitioning mode (SGPM) , and so on. Additionally, the BV-based prediction technique may be used in inter prediction technology, e.g., such as the Geometric partitioning mode (GPM) . It should be noted that the following BV-based prediction may be applied to either intra or inter prediction.

[0220] Referring to FIG. 25, at block 2502, a block vector of a current block may be determined as follows.

[0221] Methods for determining the BV of the current block include, but are not limited to, 1) performing motion search in the reconstructed area of the current picture to obtain the best BV for the current block and 2) constructing a BV Merge list for the current block by using the BV of the reconstructed block in the spatial and temporal domains. In general, BV has two precision options: integer-pel precision and sub-pel precision. The sub-pel precision may include 1 / 2-pel precision, 1 / 4-pel precision, or 1 / 16-pel precision, etc.

[0222] In some implementations, the BV of the current block may be determined based on a motion search. To perform a motion search, one type of template shown in FIGs. 5A-5C may be determined for the current block. Then, a search may be performed to identify a matching template with the smallest matching cost with the template of the current block in the reconstructed area of the current picture. An area with the same size as the current block corresponding to the matching template may be determined as the reference block. The BV of the current block may be determined based on the current block and the reference block.

[0223] In some implementations, the BV of the current block may be determined based on a BV merge list. The BV merge list may include at least one of spatial merge candidate, temporal merge candidate, history-based merge candidate, pairwise average merge candidate, and default merge candidate.

[0224] In some implementations, the BV merge list may be constructed based on spatial merge candidates. As shown in FIG. 26, the spatial merge candidates 2600 include merge candidates A1, B1, B0, A0, and B2. Spatial merge candidates A1, B1, B0, A0, and B2 are sequentially checked. If one of the spatial merge candidates A1, B1, B0, A0 and B2 is available and the available spatial merge candidate applies a BV-based prediction mode, then the BV of that spatial merge candidate may be added to the BV merge list. If the number of BV merge candidates added in the BV merge list is smaller than the allowable maximum value of the BV merge list after checking the spatial merge candidates, then one or more temporal merge candidates may be checked. One or more collocated positions in the collocated picture may be determined and temporal merge candidates corresponding to the collocated positions may be checked. If a temporal merge candidate is available and applies BV-based prediction mode, then the BV of the temporal merge candidate may be added to the BV merge list. If the number of BV merge candidates added in the BV merge list is smaller than the allowable maximum value of the BV merge list after checking the temporal merge candidates, the history-based merge candidates, pairwise average merge candidate, or default merge candidate may be checked. The BV for the current block may be determined from the BV merge list based on corresponding cost values. In some cases, the BV merge list may be reordered, and the BV for the current block may be determined based on cost values after the reordering.

[0225] It should be noted that, at operation 2502, other methods may be used to determine the BV for the current block. The following embodiments may be applied as long as a BV is used in the process of prediction, regardless of how the BV is obtained. In some cases, the BV may be determined having a integer-pel precision.

[0226] In some cases, BV may be determined having a sub-pel precision, including 1 / 2-pel precision, 1 / 4-pel precision, or 1 / 16-pel precision, etc. A BV with a sub-pel precision means the BV may refer to a fractional-pel position of the reconstruction area of the current picture. A BV with an integer-pel precision means the BV may refer to an integer-pel position of the reconstruction area of the current picture.

[0227] If an integer-pel precision BV is determined, to improve the precision of the BV, or considering the unity of BV precision, the integer-pel precision BV may be converted to sub-pel precision. In one example, the integer-pel precision BV may be converted to the sub-pel precision BV according to the following functions: xfrac=xint<< (FRAC_BITS-INT_BITS) , and yfrac=yint<< (FRAC_BITS-INT_BITS) .

[0228] The sub-pel precision BV is represented by (xfrac, yfrac) , and integer-pel precision BV is represented by (xint, yint) , where xfrac or xint indicates a horizontal value of the BV and yfrac or yint indicates a vertical value of the BV.

[0229] The sub-pel precision may be represented by FRAC_BITS and the integer-pel precision may be represented by INT_BITS. INT_BITS indicates a number of bits representing a BV with integer-pel precision, and FRAC_BITS indicates a number of bits representing a BV with sub-pel precision. In an example, the value of INT_BITS is equal to 2. The value of FRAC_BITS of 1 / 2-pel precision is equal to 3. The value of FRAC_BITS of 1 / 4-pel precision is equal to 4. The value of FRAC_BITS of 1 / 16-pel precision is equal to 6. Of course, the values of INT_BITS and values of FRAC_BITS of different sub-pel precisions may be determined as different preset values; or the values of INT_BITS and values of FRAC_BITS of different sub-pel precisions may be determined adaptively based on the network conditions.

[0230] At operation 2504, the block vector of the current block may be adjusted.

[0231] Different prediction modes may utilize BVs with different pel precisions. Therefore, for the BV of the current block, an adjustment of the BV may be determined based on the prediction mode.

[0232] In some implementations, if the determined BV of the current block has a sub-pel precision and prediction mode utilizes a BV with integer-pel precision, a rounding operation may be performed on the determined BV of the current block to obtain an adjusted BV with integer-pel precision. The rounding operation may include, but is not limited to, rounding, rounding up and rounding down.

[0233] In one example, a rounding process may be performed on the determined BV (xfrac, yfrac) of the current block to determine an adjusted BV. An adjusted sub-pel precision BV (xint, yint) of the current block may be determined according to the following function (s) : If xfrac≥0, xint=(xfrac+nOffset-1)>>rightShift; If xfrac<0, xint=(xfrac+nOffset)>>rightShift; If yfrac≥0, yint=(yfrac+nOffset-1)>>rightShift; and If yfrac<0, yint=(yfrac+nOffset)>>rightShift, where rightShift and nOffset may be determined as follows: rightShift=FRAC_BITS-INT_BITS; and nOffset=1<< (rightShift-1) .

[0234] If BV (xfrac, yfrac) has a 1 / 2-pel precision, FRAC_BITS is equal to 3, and INT_BITS is equal to 2; thus, rightShift=1 and nOffset=1. If BV (xfrac, yfrac) has a 1 / 4-pel precision, FRAC_BITS is equal to 4, and INT_BITS is equal to 2; thus, rightShift=2 and nOffset=2. If BV (xfrac, yfrac) has a 1 / 16-pel precision, FRAC_BITS is equal to 6, and INT_BITS is equal to 2; thus, rightShift=4 and nOffset=8.

[0235] In one example, a rounding down process may be performed on the determined BV (xfrac, yfrav) to determine an adjusted BV (xint, yint) of the current block using the following functions: xint=xfrac>> (FRAC_BITS-INT_BITS) , and yint=yfrac>> (FRAC_BITS-INT_BITS) .

[0236] In one example, a rounding up process may be performed on the determined BV (xfrac, yfrac) to determine an adjusted BV (xint, yint) of the current block using the following functions: xtemp= (xfrac>> (FRAC_BITS-INT_BITS) ) << (FRAC_BITS-INT_BITS) ; ytemp= (yfrac>> (FRAC_BITS-INT_BITS) ) << (FRAC_BITS-INT_BITS) ; If xfrac=xtemp, xint=xfrac>> (FRAC_BITS-INT_BITS) ; If xfrac≠xtemp, xint=xfrac>> (FRAC_BITS-INT_BITS) +1; If yfrac=ytemp, yint=yfrac>> (FRAC_BITS-INT_BITS) ; and If yfrac≠ytemp, yint=yfrac>> (FRAC_BITS-INT_BITS) +1.

[0237] If a sub-pel precision BV is obtained for the current block, the sub-pel precision BV may be converted to an integer-pel precision BV for use in predicting the current block. In this way, a reference block may be determined in the reference area based on the integer-pel precision BV with no sample interpolation, thereby improving coding efficiency.

[0238] In some implementations, the BV of the current block may be adjusted based on refinement. In one example, if the determined BV of the current block has a sub-pel precision, the determined BV may be adjusted based on a rounding operation to obtain an integer-pel precision BV, and the integer-pel precision BV may be further refined. The rounding operation may include, but is not limited to, rounding, rounding up, or rounding down. Using a refined BV for the prediction process may improve prediction accuracy.

[0239] FIG. 27 illustrates example sub-pel and integer-pel positions 2700, according to some implementations. Sub-pel positions include 1 / 4-pel positions, 1 / 2-pel positions and 3 / 4-pel positions. The sub-pel position may be represented by FracPre. The sub-pel direction may include eight directions: left (LEFT_POS) , above left (ABOVE_LEFT_POS) , left bottom (LEFT_BOTTOM_POS) , right (RIGHT_POS) , above right (ABOVE_RIGHT_POS) , right bottom (RIGHT_BOTTOM_POS) , above (ABOVE_POS) and bottom (BOTTOM_POS) . The sub-pel direction may be represented by FracDir. The sub-pel position may also be referred to as “fractional-pel position” or “fractional sample position. ” The integer-pel position may also be referred to as “integer sample position. ”

[0240] An integer-pel precision BV may be adjusted to a sub-pel precision BV. For example, a sub-pel precision BV, BV′int (x′int, y′int) , may be determined based on an integer-pel precision BV, BVint (xint, yint) , according to the following functions: x′int=xint<< (FRAC_BITS-INT_BITS) , and y′int=yint<< (FRAC_BITS-INT_BITS) .

[0241] A sub-pel precision BV (arefined BV) , BVfrac, may be determined based on the sub-pel precision BV, BV′int, the FracPre (e.g., sub-pel position) , and FracDir (e.g., the sub-pel direction) .

[0242] A sub-pel step absDistance may be determined based on sub-pel position FracPre. The sub-pel step absDistance may also be referred to as “fractional sub step absDistance” or “fractional sample step absDistance. ”

[0243] If FracPre is 1 / 4-pel position, absDistance= (1<< (FRAC_BITS-INT_BITS) ) >>2.

[0244] If FracPre is 1 / 2-pel position, absDistance= (1<< (FRAC_BITS-INT_BITS) ) >>1.

[0245] If FracPre is 3 / 4-pel position, absDistance= (1<< (FRAC_BITS-INT_BITS) ) >>2×3.

[0246] For example, if sub-pel precision is 1 / 16-pel precision, FRAC_BITS is equal to 6 and INT_BITS is equal to 2. If FracPre is 1 / 4-pel position, sub-pel step absDistance is equal to 4. If FracPre is 1 / 2-pel position, sub-pel step absDistance is equal to 8. If FracPre is 3 / 4-pel position, sub-pel step absDistance is equal to 12.

[0247] A horizontal offset xDistance and a vertical offset yDistance may be determined based on the sub-pel step absDistance and sub-pel direction FracDir.

[0248] If the FracDir is LEFT_POS, ABOVE_LEFT_POS, or LEFT_BOTTOM_POS, xDistance=-absDistance.

[0249] If FracDir is RIGHT_POS, ABOVE_RIGHT_POS, or RIGHT_BOTTOM_POS, xDistance=absDistance.

[0250] If FracDir is ABOVE_POS, ABOVE_LEFT_POS or ABOVE_RIGHT_POS, yDistance=-absDistance.

[0251] If FracDir is BOTTOM_POS, LEFT_BOTTOM_POS or RIGHT_BOTTOM_POS, yDistance=absDistance.

[0252] A refined BV, BVfrac (xfrac, yfrac) , may be determined based on the sub-pel precision BV, BV′int (x′int, y′int) , the horizontal offset xDistance, and the vertical offset yDistance, where xfrac=x′int+xDistance and yfrac=y′int+yDistance.

[0253] As shown in FIG. 27, for example, assuming BV (2701) is the sub-pel precision BV, BV′int (x′int, y′int) , BV (2702) is a 1 / 4-pel position, absDistance=4, FracDir is ABOVE_LEFT_POS, xDistance=-4, and yDistance=-4, the refined BV, BVfrac (xfrac, yfrac) , may be determined as: xfrac=x′int-4 and yfrac=y′int-4.

[0254] In another example, assuming BV (2701) is the sub-pel precision BV, BV′int (x′int, y′int) , BV (2703) is a 1 / 2-pel position, absDistance=8, FracDir is ABOV_RIGHT_POS, xDistance=8, and yDistance=-8, the refined BV, BVfrac (xfrac, yfrac) , may be determined as: xfrac=x′int+8 and yfrac=y′int-8.

[0255] In a further example, assuming BV (2701) is the sub-pel precision BV, BV′int (x′int, y′int) , BV (2704) is a 3 / 4-pel position, absDistance=12, FracDir is LEFT_BOTTOM_POS, xDistance=-12, and yDistance=12, the refined BV, BVfrac (xfrac, yfrac) , may be determined as: xfrac=x′iny-12 and yfrac=y′inct+12.

[0256] All or a preset number of sub-pel positions may be traversed in the reconstructed area of the current frame based on template matching cost to determine a refined BV of the current block. For example, the matching cost of each sub-pel precision BV, BVfrac, may be computed, and the matching cost of the sub-pel precision BV, BV′int , corresponding to integer-pel precision BV, BVint, may be determined, and determine a BVfrac with the smallest matching cost in the reconstructed area may be used as the refined BV used for predicting the current block. The type of template may be determined based on the availability of neighboring reference samples.

[0257] Referring to FIG. 5C, when the above left, above and left reference samples are all available, the template shape may be the template shown in (a) , e.g., refTemplateType=1.

[0258] When only the left reference samples are available, the template shape may be the template shown in (b) , e.g., refTemplateType=2.

[0259] When only the above reference samples are available, the template shape may be the template shown in (c) , e.g., refTemplateType=3.

[0260] When the left and above left reference samples are available, the template shape may be the template shown in (d) , e.g., refTemplateType=4.

[0261] When the left and left bottom reference samples are available, the template shape may be the template shown in (e) , e.g., refTemplateType=5.

[0262] When the above and above right reference samples are available, the template shape may be the template shown in (f) , e.g., refTemplateType=6.

[0263] When the above and above left reference samples are available, the template shape may be the template shown in (g) , e.g., refTemplateType=7.

[0264] When the above and left reference samples are available, the template shape may be the template shown in (h) , e.g., refTemplateType=8.

[0265] A cost between two templates may be represented as an error between a template and a reference template. As an example, the cost may be a SAD, which may be calculated using equation (1) , shown above. In another example, the cost may be a SATD, which may be calculated according to equation (2) , shown above. Coding accuracy may be improved using BV refinement.

[0266] In another embodiment, predicting current block may consider BV information of a neighboring reconstructed block. Additional information corresponding to the adjacent block is comprehensively considered and may improve the prediction accuracy. In this process, a BV flip operation 2800, 2801 may be applied, as shown in FIGs. 28A and 28B.

[0267] In some implementations, BV of current block may be determined based on a neighboring reconstructed block. The determined BV of the neighboring reconstructed block may be represented by,  and the flip indication, which indicates whether the BV flip operation is a horizontal flip (see FIG. 28A) or a vertical flip (see FIG. 28B) , may be represented by, rribcFlipTypenbr. The adjusted BV determined based on the flip operation may be represented by,  and the flip indication may be represented by, rribcFlipTypecur.

[0268] If rribcFlipTypenbr is equal to 0, no flip may be performed. In this example,  and rribcFlipTypecur=rribcFlipTypenbr=0.

[0269] If rribcFlipTypenbr is equal to 1, a horizontal flip (see FIG. 28A) may be performed. In this example,  and rribcFlipTypecur=rribcFlipTypenbr=1.

[0270] A schematic diagram of the horizontal flip operation 2800 is illustrated in FIG. 28A. Assume the current block is a chroma block and xnbr is the X coordinate of the center position of the adjacent reconstructed block. If the current BV information is determined based on the luma block, then xcur is the X coordinate of the center position of the co-located luma block of the current block. If the current BV information is determined based on the chroma block, then xcur is the X coordinate of the center position of the current block. Assuming the current block is a luma block, the method may be the same.

[0271] If rribcFlipTypenbr is equal to 2, a vertical flip may be performed. In this example,  and rribcFlipTypecur=rribcFlipTypenbr=2.

[0272] A schematic diagram of the vertical flip operation 2801 is illustrated in FIG. 28B. Assume the current block is a chroma block and ynbr is the Y coordinate of the center position of the adjacent reconstructed block. If the current BV information is determined based on the luma block, then ycur is the Y coordinate of the center position of the co-located luma block of the current block. If the current BV information is determined based on the chroma block, then ycur is the Y coordinate of the center position of the current block. Assuming the current block is a luma block, the method may be the same.

[0273] Referring again to FIG. 25, at operation 2506, the current block may be predicted based on the adjusted BV.

[0274] A reference block in the current frame may be determined based on the adjusted BV, and a prediction of the current block may be determined based on the reference block.

[0275] The BV used for predicting current block may be stored for use in the prediction of a subsequent block. The BV may be stored in sub-pel precision.

[0276] In one example, the BV may be stored in 1 / 2-pel precision. In one example, the BV may be stored in 1 / 4-pel precision. In one example, the BV may be stored in 1 / 16-pel precision. In one example, the BV may be stored in at least two kinds of sub-pel precisions of 1 / 2-pel precision, 1 / 4-pel precision, and / or 1 / 16-pel precision. In one example, the encoder and decoder may use a unified default sub-pel precision. In one example, the encoder may determine one or more sub-pel precision and signal a precision indication in the bitstream. The decoder may determine to store the BV with a precision based on the precision indication. The precision indication may be sequence level, picture level, slice level and block level. The precision indication may be associated with prediction mode.

[0277] It is possible to store both the integer-pel precision BV and the sub-pel precision BV of the current block. In some cases, integer-pel precision BV may be derived based on the sub-pel precision BV. However, storing both integer-pel precision BV and sub-pel precision BV consumes more memory than only storing one of them. Thus, to reduce memory consumption sub-pel precision BV rather than integer-pel precision BV may be stored. This improves memory usage efficiency.

[0278] In one example, intra prediction unit 205 may use an NN-based intra prediction mode to derive a prediction of the current block. FIG. 29 illustrates an example of NN-based intra prediction 2900, according to some embodiments.

[0279] Block 2901 (block Y) is a current block having w×h samples. The samples 2902 adjacent to block 2901 are reference samples. Let “X” be an input of the NN-based intra prediction process. In one example, “X” may be one or more samples among the samples 2902. In one example, “X” may be derived by filtering one or more samples among the samples 2902. Block 2903 is an output of the NN-based intra prediction process. In one example, block 2903 is an intra prediction of block 2901.

[0280] In one example, inter prediction unit 204 may also derive motion parameters and / or prediction samples using an NN-based method or process.

[0281] Prediction unit 202 may pass the derived one or more intra prediction modes or one or more angular prediction directions (intra prediction mode or angular prediction direction also may be called as “intra prediction direction” ) to transform unit 207. In one embodiment, transform unit 207 may use such information to determine transform kernel or a set of transform kernels in the primary transform and / or secondary transform.

[0282] Transform unit 207 performs a first transform, for example, integer transform which is originally designed based on discrete cosine transform (DCT) , on the residual block. Transform unit 207 determines whether a secondary transform is enabled to be applied on a block or not. When enabled, transform unit 207 further determines whether to apply the secondary transform to the coefficients obtained after performing the first transform. Transform unit 207 may generate transform coefficients by applying a transform technique to the residual signal, which is derived by the adder 206 as a difference between the original samples of the current block and the prediction of the current block. For example, the transform technique may include at least one of a discrete cosine transform (DCT) , a discrete sine transform (DST) , a karhunen-loève transform (KLT) , a graph-based transform (GBT) , or a conditionally non-linear transform (CNT) . Here, the GBT means transform obtained from a graph when relationship information between pixels is represented by the graph. The CNT refers to transform generated based on a prediction signal generated using all previously reconstructed pixels. In addition, the transform process may be applied to square pixel blocks having the same size or may be applied to blocks having a variable size rather than square.

[0283] Transform unit 207 in encoder 200 may determine a region or a sub-block in a current block and performs transform on the samples in this region or sub-block. FIG. 19 demonstrates an example of region transform of a current block 1900. The current block 1900 may be a coding block, a coding unit, a transform unit or a sub-block. Region 1901 is a region in the current block 1900. Transform unit 207 will perform a transform on the samples in region 1901, and set a value of a sample in the remaining region 1902 in the current block 1900 to be equal to 0.The sample in region 1901 may be residual sample of the current block, or original sample of the current block. Transform unit 207 may determine a region parameter indicating the region 1901 including at least one of the following: [Parameter 1] : position of region 1901 and / or [Parameter 2] : size of region 1901.

[0284] As an option, transform unit 207 can also determine that more than one region in a current block may be transformed. FIG. 19 also shows an example in which two regions are in a current block. Transform unit 207 will perform transform on samples in regions 1911 and 1913 in a current block 1910, and set a value of a sample in the remaining region 1912 in the current block 1910 to be equal to 0. The said sample in regions 1911 and 1913 may be residual sample of the current block or the original sample of the current block. Transform unit 207 may determine one or more region parameters indicating region 1911 and 1913 including one or both of [Parameter 1]and [Parameter 2] .

[0285] In the following descriptions, current block 1900 may be taken as an example. The implementation with multiple regions containing non-zero samples (e.g., current block 1911) is carried out using similar method to indicate the regions.

[0286] FIGs. 20A and 20B demonstrates examples 2000, 2001 of region transform. Transform unit 207 performs transform on a sample in a gray region in a current block and sets a value of a sample in the remaining region in a current block to be equal to 0, wherein the sample may be a residual sample after prediction or an original sample. The “arrays” of each gray region demonstrates the transform directions and transform kernel of each direction.

[0287] The gray region in FIGs. 20A and 20B is at a pre-defined position with pre-defined size. For example in FIGs. 20A and 20B, [Parameter 2] may be one or more parameters indicating a split type of a current block (e.g., quad, triple, horizontal or vertical) , and [Parameter 1] may be one or more parameters indicating which one of the regions according to the split type of a current block as indicated by [Parameter 2] is the region on a sample of which transform unit 207 performs a transform. Transform unit 207 may derive a width and a height (e.g., a size) of a gray region according to the abovementioned parameters. For example, given that a size (e.g., width x height) of the current block is 4Wx4H. The size (e.g., represented width x height of a region in the current block) and position (e.g., represented by a location of top-left sample of a region in the current block) of a gray region in FIGs. 20A and 20B are shown below in Tables 8A and 8B. Table 8A: Example sizes of gray region in FIG. 20A Table 8B: Example sizes of gray region in FIG. 20B

[0288] In addition to the abovementioned examples, [Parameter 1] may also include one or more offset parameters (e.g., dx and / or dy in the following examples) , and for each example of a gray region in FIG. 20A, a position of a gray region is shown in Tables 8C and 8D. Table 8C: Example positions of gray region in FIG. 20A Table 8D: Example positions of gray region in FIG. 20B

[0289] FIG. 21 illustrates examples of region transform. Transform unit 207 performs transform on a sample in a gray region in a current block and sets a value of a sample in the remaining region in a current block to be equal to 0, wherein the sample may be a residual sample after prediction or an original sample. The “arrays” of each gray region demonstrates the transform directions and transform kernel of each direction.

[0290] Referring to FIG. 21, a size of a gray region 2101, 2111 or 2121 may be represented as gW x gH, wherein gW is a width of the gray region, and gH is a height of the gray region, and a position of a gray region may be represented by a location of a top-left sample in the gray region in the current block, e.g., (dx, dy) .

[0291] Transform unit 207 may determine values of dx and dy of [Parameter 1] , and gW and gH of [Parameter 2] .

[0292] Optionally, transform unit 207 may first determine a split type of a gray region. For example, a split type of gray region 2101 is “arbitrary type, ” which indicates that gW and gH are smaller than a with and a height of the current block 2100, respectively. In this case, transform unit 207 determines values of dx and dy of [Parameter 1] , and gW and gH of [Parameter 2] for gray region 2101. For example, a split type of gray region 2111 is “vertical type, ” transform unit 207 determines values of dx of [Parameter 1] , and gW of [Parameter 2] for gray region 2111, as dy may be inferred to be 0 and gH may be inferred to be equal to the height of the current block 2110. For example, a split type of gray region 2121 is “horizontal type, ” transform unit 207 determines values of dy of [Parameter 1] , and gH of [Parameter 2] for gray region 2121, as dx may be inferred to be 0 and gW may be inferred to be equal to the width of the current block 2120.

[0293] Transform unit 207 may select an optimal region transform for a current block, and passes the parameters indicating “gray region” of such optimal region transform to entropy coding unit 214 for a signaling in output bitstream of encoder 200.

[0294] In an example, dx and dy are represented in a precision of integral sample in a bitstream.

[0295] In another example, dx and dy are represented in a precision of multiple samples. For example, dx is represented as dx>>shift in a bitstream, wherein shift is an non-negative integer, and “dx>>shift” is arithmetic right shift of a two’s complement integer representation of dx by shift binary digits. “shift” may be a fixed value, for example 1, 2, 3, 4, …, Log2 (MaxCuSize) - 1, wherein MaxCuSize is the maximum value of a width or height of a coding unit and Log2 (MaxCuSize ) is a base-2 logarithm of MaxCuSize. Examples of a representation of dy in a bitstream is the same as those of dx.

[0296] Quantization unit 208 quantizes the coefficients from the transform unit 207.

[0297] Inverse quantization unit 209 performs scaling operations on the quantized coefficients to output reconstructed coefficients. Inverse transform unit 210 performs one or more inverse transforms corresponding to the transforms in transform unit 207 and output reconstructed residual.

[0298] When transform unit 207 uses region transform to code the current block, inverse transform unit 210 gets parameters indicating a position and size of a region in the current block, and performs inverse transform to obtain the reconstructed samples in the region. The reconstructed samples are residual samples. The inverse transform unit 210 sets a value of a sample in the remaining region of the current block to be equal to 0, wherein the said sample is a residual sample.

[0299] Adder 211 calculates reconstructed CU by adding the reconstructed residual and the prediction block of the CU from prediction unit 202. Adder 211 also forwards its output to prediction unit 202 to be used as intra prediction reference. After all the CUs in a picture or a sub-picture have been reconstructed, filtering unit 212 performs in-loop filtering on the reconstructed picture or sub-picture. Filtering unit 212 contains one or more filters, for example, deblocking filter, sample adaptive offset (SAO) filter, adaptive loop filter (ALF) , luma mapping with chroma scaling (LMCS) filter and neural network based filters. Alternatively, when filtering unit 212 determines that the CU is not used as reference for encoding other CUs, filtering unit 212 performs in-loop filtering on one or more target samples in the CU.

[0300] In one embodiment, filtering unit 212 would process filtering on the reconstructed samples of one or more color components of the current block (e.g., a CU) . The encoder 200 stores the filtered reconstructed samples of one or more color components of the current block in a picture buffer for a picture in which the current block locates. Thus, the prediction unit 202 can use the filtered samples of the current block in encoding the succeeding block of the current block in encoding order. For example, the prediction unit 202 can use the filtered samples of the current block to derive a prediction of succeeding block of the current block in encoding order. For example, the prediction unit 202 as well as other units in encoder 200, would include the filtered samples of the current block in a template and derive of a prediction, reordering candidate modes or parameters, and / or coding parameters using template matching approach. Since the filtering unit 212 suppresses reconstruction distortion of the current block introduced by the lossy source coding, when the filtered sample of the current block is used to encode the succeeding block, the prediction efficiency of the succeeding coding block has been improved, and thus the coding performance of encoder 200 is greatly improved.

[0301] In one embodiment, the filtering unit 212 uses one or more fixed 1D or 2D filters to process the reconstruct sample of the current block. For example, the 1D filter may be a symmetry filter. For example, the 1D filter may be an asymmetry filter. For example, the 2D filter may be a symmetry filter. For example, the 2D filter may be an asymmetry filter. For example, the 2D filter may be a separable filter. For example, the 2D filter may be a non-separable filter.

[0302] In one embodiment, the filtering unit 212 uses one or more adaptive 1D or 2D filters to process the reconstruct sample of the current block. For example, the 1D filter may be a symmetry filter. For example, the 1D filter may be an asymmetry filter. For example, the 2D filter may be a symmetry filter. For example, the 2D filter may be an asymmetry filter. For example, the 2D filter may be a separable filter. For example, the 2D filter may be a non-separable filter.

[0303] In one embodiment, the filtering unit 212 uses one or more neural-network (NN) based filters to process the reconstruct sample of the current block.

[0304] In one embodiment, the filtering unit 212 can use one or more filters of the spatial and / or temporal neighboring blocks of the current block. In one example, the filters from neighboring blocks may include the filter used to filter reconstructed sample of the neighboring blocks before filtering which is invoked after reconstructing a picture where the neighboring block locates. In one example, the filters from neighboring blocks may include the filter used to filter reconstructed sample of the neighboring blocks after reconstructing a picture where the neighboring block locates. One example is that filtering unit 212 may use the adaptive loop filter (ALF) which is used to filter a temporal neighboring block of the current block. In one example, the filtering unit 212 may select one or more existing filters which are available before filtering the current block. One example is that the filters with parameters are signaled at block layer (e.g., coding tree unit or coding unit) or a layer higher than a block layer of the current block (e.g., video parameter set, sequence parameter set, picture parameter set, adaption parameter set, picture header and / or slice header) . In one example, filtering unit 212 adaptively may derive parameter of one or more filters to process the sample in the current block using spatial and / or temporal samples in one or more templates. In one example, filtering unit 212 adaptively may derive parameter of one or more filters to process the sample in the current block based on the reconstructed samples and the original samples, and filtering unit 212 will pass the filter parameters to entropy coding unit 214 to signal the filter parameters in the bitstream.

[0305] In one embodiment, filtering unit 212 may derive an indication parameter to indicate whether the reconstructed sample in the current block is needed to be filtered or not. For example, the indication parameter may be a 1 bit flag. For example, the indication parameter may be a variable with a number of values indicating not only whether the reconstruct sample is needed to be filtered but also which filter is used. When the variable is equal to 0, the reconstructed sample of the current block will not be filtered; otherwise, the reconstructed sample of the current block is filtered with a filter with an index equal to the value of this variable. Filter unit 212 will pass this indication parameter to entropy coding unit 214 to signal the parameter value in the bitstream.

[0306] In one embodiment, filtering unit 212 may also set indication parameter to indicate which color component may be filtered. Filtering unit 212 can choose to filter one or more of the luma and two chroma components. Filter unit 212 may pass this indication parameter to entropy coding unit 214 to signal the parameter value in the bitstream.

[0307] Output of filtering unit 212 is a decoded picture or sub-picture, which is forwarded to DPB (decoded picture buffer) 213. DPB 213 outputs decoded pictures according to timing and controlling information. Pictures stored in DPB 213 may also be employed as reference for performing inter or intra prediction by prediction unit 202.

[0308] Entropy coding unit 214 converts parameters from units in encoder 200 that are necessary for deriving decoded picture as well as control parameters and supplemental information into binary representations, and writes such binary representations according to syntax structure of each data unit into a generated video bitstream.

[0309] Generally, an NN-based process consume more computational resources or use a dedicated hardware module to support calculations in an NN structure, as compared to a non-NN-based process. For example, one NN-based process may request Neural Processing Unit (NPU) , Graphics Processing Unit (GPU) , and / or any other modules that support the NN-based process may be support an implementation of a NN-based process (e.g., one or more of NN-based inter prediction, NN-based intra prediction, NN-based filtering, etc. ) . In one example, when an encoder determines that NN-based process are used to decode a bitstream generated by the encoder, the encoder signals an indication of this ability in the bitstream for a receiving device or decoder. In one example, when an encoder or sending device has an ability to perform an NN process (e.g., the encoder or sending device is integrated dedicated module, such as NPU, GPU or other modules or chips, to conduct NN process) , the encoder or sending device may signal this to a receiving device or a decoder during session negotiation process.

[0310] To signal the ability of performing NN-based process, in one example, the encoder 200 may signal a Profile in the bitstream, where the Profile specifies that an NN-based process may be used in decoding the bitstream. The Profile may be signaled in a data unit containing Profile data. The data unit may be within one or more parameter sets, e.g., decoder parameter set, video parameter set, sequence parameter set, adaption parameter set, etc. In one example, the data unit may also be within a packet of session unit data, e.g., a payload of session negotiation packet. The Profile may specify whether an NN-based process may be used in decoding a bitstream. The Profile may further specify a quantization-error bounds for performing the NN-based process.

[0311] In one example, the encoder 200 can signal a Level in the bitstream, where the Level specifies that an NN-based process may be used in decoding the bitstream. The Level may be signaled in a data unit containing Level data. The data unit may be within one or more parameter sets, e.g., decoder parameter set, video parameter set, sequence parameter set, adaption parameter set, etc. In one example, the data unit may also be within a packet of session unit data, e.g., a payload of session negotiation packet. The Level may specify whether an NN-based process may be used in decoding a bitstream. The Level may further specify a quantization-error bounds for performing the NN-based process.

[0312] In one example, the encoder 200 can signal a Tier in the bitstream, where the Tier specifies that an NN-based process may be used in decoding the bitstream. The Tier may be signaled in a data unit containing Tier data. The data unit may be within one or more parameter sets, e.g. decoder parameter set, video parameter set, sequence parameter set, adaption parameter set, etc. In one example, the data unit may also be within a packet of session unit data, e.g., a payload of session negotiation packet. The Tier may specify whether an NN-based process may be used in decoding a bitstream. The Tier may further specify a quantization-error bounds for performing the NN-based process.

[0313] In one example, the encoder 200 can signal a General Constraints Information (GCI) in the bitstream, where the GCI specifies that an NN-based process may be used in decoding the bitstream. The GCI may be signaled in a data unit containing GCI data. The data unit may be within one or more parameter sets, e.g., decoder parameter set, video parameter set, sequence parameter set, adaption parameter set, etc. In one example, the data unit may also be within a packet of session unit data, e.g., a payload of session negotiation packet. The GCI may specify whether NN-based process may be used in decoding a bitstream. The GCI may further specify a quantization-error bounds for performing the NN-based process.

[0314] Encoder 200 may provide controlling parameters to prediction unit 202 to instruct inter prediction unit 204 and intra prediction unit 205 whether one or more template based prediction modes are enabled in the encoding process, or equivalently whether one or more template based prediction modes are disabled in the encoding process. In this disclosure, the embodiments are describes from an aspect way of “enabling” a template based prediction mode. The embodiments from an aspect way of “disabling” a template based prediction mode may be directly derived based on the following descriptions.

[0315] In one example implementation, encoder 200 may perform pre-analysis process on the input video or picture to identify whether template based prediction modes would bring benefit to the coding efficiency, especially perceptual quality. For example, template based prediction modes would hurt the perceptual quality of a picture or video containing complex texture and / or motion. One example of such picture or video would be waterfront with random waves, and the reflection on the surface of the waterfront is random because of the small waves. In this case, encoder 200 will determine to disable all template based prediction modes or enable only one or several template based prediction modes in the encoding process. In one embodiment, encoder 200 can use rate-distortion based method to make such decisions. In one embodiment, encoder 200 can use multi-pass encoding method to make such decisions, wherein encoder 200 codes the input video or picture will all or several template based prediction modes enabled, and then determines which of the template based prediction modes are used in the second pass encoding.

[0316] In one embodiment, the controlling parameters are obtained from configurations for encoder 200. For example, such controlling parameters are set in an encoder configuration file according to a pre-analysis on the input video or picture. For example, controlling parameters are set in an encoder configuration file according to complexity restrictions on encoder 200 and / or a decoder. For example, controlling parameters are set according to conformance indications, such as indications by one or more of Profile, Tier and Level. One example implementation would be a Profile may specify that all of or several of template based prediction modes are enabled or disabled.

[0317] Encoder 200 passes such controlling parameters to the entropy coding unit 214. Entropy coding unit 214 performs entropy coding on the value of such controlling parameters, and then writes the coding bits in to the output bitstream. To avoid any doubt, another implementation is that if the controlling parameters are set according to conformance indications, such as indications by one or more of Profile, Tier and Level, encoder 200 has one option of not passing such controlling parameters to the entropy coding unit 214 to write such controlling parameters into the output bitstream, as the entropy coding unit 214 has written the conformance indications such as Profile, Tier and Level into the output bitstream.

[0318] FIGs. 7A-7E, 8A-8G, and 9A-9E depict examples of the syntax elements for signaling the controlling parameters for template based prediction modes.

[0319] FIGs. 7A-7E illustrate example syntax elements of “high level” or “collective” indications. Entropy coding unit 214 can write the example syntax elements into the output bitstream.

[0320] In one embodiment as shown in FIG. 7A, encoder 200 can set an indication information by syntax element “tm_prediction_enable_flag” to indicate whether template based prediction modes may be used for inter and intra predictions (as shown as example in Table 1 and Table 6) . When tm_prediction_enable_flag is equal to 1, prediction unit 202 may use the template based prediction modes in encoding one or more blocks in the input video or picture. Otherwise, when tm_prediction_enable_flag is equal to 0, prediction unit 202 will not use the template based prediction modes in encoding one or more blocks in the input video or picture.

[0321] In one embodiment as shown in FIG. 7B, encoder 200 can set an indication information for inter prediction. As shown in FIG. 7B, the indication information may be syntax element “tm_prediction_enable_for_inter_flag” to indicate whether template based prediction modes may be used for inter predictions. When tm_prediction_enable_for_inter_flag is equal to 1, inter prediction unit 204 within prediction unit 202 may use the template based inter prediction modes (as shown as example in Table 1) in encoding one or more blocks in the input video or picture. Otherwise, when tm_prediction_enable_for_inter_flag is equal to 0, inter prediction unit 204 within prediction unit 202 will not use the template based inter prediction modes (as shown as example in Table 1) in encoding one or more blocks in the input video or picture.

[0322] In one embodiment as shown in FIG. 7C, encoder 200 can set an indication information for intra prediction. As shown in FIG. 7C, the indication information may be syntax element “tm_prediction_enable_for_intra_flag” to indicate whether template based prediction modes may be used for intra predictions. When tm_prediction_enable_for_intra_flag is equal to 1, intra prediction unit 205 within prediction unit 202 may use the template based intra prediction modes (as shown as example in Table 6) in encoding one or more blocks in the input video or picture. Otherwise, when tm_prediction_enable_for_intra_flag is equal to 0, intra prediction unit 205 within prediction unit 202 will not use the template based intra prediction modes (as shown as example in Table 6) in encoding one or more blocks in the input video or picture.

[0323] In one embodiment as shown in FIG. 7D, encoder 200 can set an indication information for a set of prediction modes. As shown in FIG. 7D, the indication information may be syntax element “tm_mode_setA_enable_flag” to indicate whether several template based prediction modes may be used for intra and / or inter predictions. The said several template based prediction modes may be viewed or classified as “setA. ” “setA” can contains one or more prediction modes. One example would be that IntraTMP and DMVR are within “setA. ” When tm_mode_setA_enable_flag is equal to 1, intra prediction unit 205 within prediction unit 202 may use the template based intra prediction modes in “setA” (e.g., IntraTMP in this example) , and inter prediction unit 204 within prediction unit 202 may use the template based inter prediction modes in “setA” (e.g., DMVR in this example) in encoding one or more blocks in the input video or picture. Otherwise, when tm_mode_setA_enable_flag is equal to 0, intra prediction unit 205 within prediction unit 202 will not use the template based intra prediction modes in “setA” (e.g., IntraTMP in this example) and inter prediction unit 204 within prediction unit 202 will not use the template based inter prediction modes in “setA” (e.g., DMVR in this example) in encoding one or more blocks in the input video or picture. One example would be that IntraTMP and TIMD (that is, two intra prediction modes) are within “setA. ” When tm_mode_setA_enable_flag is equal to 1, intra prediction unit 205 within prediction unit 202 may use the template based intra prediction modes in “setA” (e.g., IntraTMP and TIMD in the above example) . Otherwise, when tm_mode_setA_enable_flag is equal to 0, intra prediction unit 205 within prediction unit 202 will not use the template based intra prediction modes in “setA” (e.g., IntraTMP and TIMD in the above example) . One example would be that DMVR and BDOF (that is, two inter prediction modes) are within “setA. ” When tm_mode_setA_enable_flag is equal to 1, inter prediction unit 204 within prediction unit 202 may use the template based intra prediction modes in “setA” (e.g., DMVR and BDOF in the above example) . Otherwise, when tm_mode_setA_enable_flag is equal to 0, inter prediction unit 204 within prediction unit 202 will not use the template based intra prediction modes in “setA” (e.g., DMVR and BDOF in the above example) .

[0324] In one embodiment as shown in FIG. 7E, encoder 200 can set an indication information for one prediction mode in Table 1 and / or Table 6 (e.g., referred to as “modeA” in this description) . As shown in FIG. 7D, the indication information may be syntax element “tm_modeA_enable_flag” to indicate whether the template based prediction mode ( “modeA” ) may be used for intra and / or inter predictions. When tm_modeA_enable_flag is equal to 1, prediction unit 202 may use the template based prediction mode ( “modeA” ) in encoding one or more blocks in the input video or picture. Otherwise, when tm_modeA_enable_flag is equal to 0, prediction unit 202 will not use the template based prediction mode ( “modeA” ) in encoding one or more blocks in the input video or picture.

[0325] FIGs. 8A-8G illustrate example syntax elements, which may be implemented as a combination of the example syntax elements shown in FIGs. 7A-7E to enable sophisticated controlling options. Entropy coding unit 214 can write the example syntax elements into the output bitstream.

[0326] In one embodiment as shown in FIG. 8A, encoder 200 has already set an indication information by syntax element “tm_prediction_enable_flag” to indicate whether template based prediction modes may be used for inter and intra predictions (as shown as example in Table 1 and Table 6) . When tm_prediction_enable_flag is equal to 1, encoder 200 can further set separate indications for one or more template based prediction modes. FIG. 8A provides an adaption of different template based prediction modes based on characteristics of input video or picture. The controlling or indication by the example syntax elements are identical or similar to those in FIG. 7A and FIG. 7E.

[0327] In one embodiment as shown in FIG. 8B, encoder 200 has already set an indication information by syntax element “tm_prediction_enable_for_inter_flag” to indicate whether template based prediction modes may be used for inter predictions (as shown as example in Table 1) .When tm_prediction_enable_for_inter_flag is equal to 1, encoder 200 can further set separate indications for one or more template based inter prediction modes. FIG. 8B provides an adaption of different template based inter prediction modes based on characteristics of input video or picture. The controlling or indication by the example syntax elements are identical or similar to those in FIG. 7B and FIG. 7E.

[0328] In one embodiment as shown in FIG. 8C, encoder 200 has already set an indication information by syntax element “tm_prediction_enable_for_intra_flag” to indicate whether template based prediction modes may be used for intra predictions (as shown as example in Table 6) .When tm_prediction_enable_for_intra_flag is equal to 1, encoder 200 can further set separate indications for one or more template based intra prediction modes. FIG. 8C provides an adaption of different template based intra prediction modes based on characteristics of input video or picture. The controlling or indication by the example syntax elements are identical or similar to those in FIG. 7C and FIG. 7E.

[0329] In one embodiment as shown in FIG. 8D, encoder 200 has already set an indication information by syntax element “tm_mode_setA_enable_flag” to indicate whether template based prediction modes may be used for inter and / or intra predictions in “setA. ” When tm_mode_setA_enable_flag is equal to 1, encoder 200 can further set separate indications for one or more template based inter and / or intra prediction modes in “setA. ” FIG. 8D provides an adaption of different template based inter and / or intra prediction modes in “setA” based on characteristics of input video or picture. The controlling or indication by the example syntax elements are identical or similar to those in FIG. 7D and FIG. 7E.

[0330] In one embodiment as shown in FIG. 8E, encoder 200 has already set an indication information by syntax element “tm_prediction_enable_flag” to indicate whether template based prediction modes may be used for inter and intra predictions (as shown as example in Table 1 and Table 6) . When tm_prediction_enable_flag is equal to 1, encoder 200 can further set separate indications for template based inter prediction modes and template based intra prediction modes. FIG. 8E provides an adaption of different template based prediction modes based on characteristics of input video or picture. The controlling or indication by the example syntax elements are identical or similar to those in FIG. 7A, FIG. 7B and FIG. 7C.

[0331] In one embodiment as shown in FIG. 8F, encoder 200 has already set an indication information by syntax element “tm_prediction_enable_flag” to indicate whether template based prediction modes may be used for inter and intra predictions (as shown as example in Table 1 and Table 6) . When tm_prediction_enable_flag is equal to 1, encoder 200 can further set separate indications for template based inter prediction modes using “tm_prediction_enable_for_inter_flag” and several template based prediction modes in “setA. ” For example, as template based inter prediction mode may be collectively controlled or indicated by “tm_prediction_enable_for_inter_flag, ” “setA” may contain one or more template based intra prediction modes. FIG. 8E provides an adaption of different template based prediction modes based on characteristics of input video or picture. The controlling or indication by the example syntax elements are identical or similar to those in FIG. 7A, FIG. 7B and FIG. 7E.

[0332] In one embodiment as shown in FIG. 8G, encoder 200 has already set an indication information by syntax element “tm_prediction_enable_flag” to indicate whether template based prediction modes may be used for inter and intra predictions (as shown as example in Table 1 and Table 6) . When tm_prediction_enable_flag is equal to 1, encoder 200 can further set separate indications for template based intra prediction modes using “tm_prediction_enable_for_intra_flag” and several template based prediction modes in “setA. ” For example, as template based intra prediction mode may be collectively controlled or indicated by “tm_prediction_enable_for_intra_flag, ” “setA” may contain one or more template based inter prediction modes. FIG. 8F provides an adaption of different template based prediction modes based on characteristics of input video or picture. The controlling or indication by the example syntax elements are identical or similar to those in FIG. 7A, FIG. 7B and FIG. 7E.

[0333] FIGs. 9A-9E illustrate example syntax elements, which may be implemented as a combination of the example syntax elements shown in FIGs. 7A-7E and / or FIG. 8A-8G to enable sophisticated controlling options. Entropy coding unit 214 can write the example syntax elements into the output bitstream.

[0334] In one embodiment as shown in FIG. 9A, encoder 200 has already set an indication information by syntax element “tm_prediction_enable_flag” to indicate whether template based prediction modes may be used for inter and intra predictions (as shown as example in Table 1 and Table 6) as in FIG. 7A. When tm_prediction_enable_flag is equal to 1, encoder 200 may use a combination of FIG. 7E for one template based prediction mode (with the single mode being represented as “modeC” ) , FIG. 7D for one or more template based prediction modes in “setA, ” and FIG. 8D for separate controlling or indication for the one or more template based prediction modes in “set A. ” FIG. 9A provides an adaption of different template based prediction modes based on characteristics of input video or picture.

[0335] In one embodiment as shown in FIG. 9B, encoder 200 has already set an indication information by syntax element “tm_prediction_enable_for_inter_flag” to indicate whether template based inter prediction modes may be used for inter predictions (as shown as example in Table 1) as in FIG. 7B. When tm_prediction_enable_for_inter_flag is equal to 1, encoder 200 may use a combination of FIG. 7E for one template based inter prediction mode (with the single mode being represented as “modeC” ) , FIG. 7D for one or more template based inter prediction modes in “setA, ” and FIG. 8D for separate controlling or indication for the one or more template based inter prediction modes in “set A. ” FIG. 9B provides an adaption of different template based prediction modes based on characteristics of input video or picture.

[0336] In one embodiment as shown in FIG. 9C, encoder 200 has already set an indication information by syntax element “tm_prediction_enable_for_intra_flag” to indicate whether template based intra prediction modes may be used for intra predictions (as shown as example in Table 6) as in FIG. 7C. When tm_prediction_enable_for_intra_flag is equal to 1, encoder 200 may use a combination of FIG. 7E for one template based intra prediction mode (with the single mode being represented as “modeC” ) , FIG. 7D for one or more template based intra prediction modes in “setA, ” and FIG. 8D for separate controlling or indication for the one or more template based intra prediction modes in “set A. ” FIG. 9C provides an adaption of different template based prediction modes based on characteristics of input video or picture.

[0337] In one embodiment as shown in FIG. 9D, encoder 200 has already set an indication information by syntax element “tm_prediction_enable_flag” to indicate whether template based prediction modes may be used for inter and intra predictions (as shown as example in Table 1 and Table 6) as in FIG. 7A. When tm_prediction_enable_flag is equal to 1, encoder 200 may use a combination of FIG. 7B for template based inter prediction modes, and as template based inter prediction modes may be collectively controlled or indicated by “tm_prediction_enable_for_inter_flag, ” FIG. 7D for one or more template based intra prediction modes in “setA, ” FIG. 8D for separate controlling or indication for the one or more template based intra prediction modes in “set A, ” and FIG. 7E for one template based intra prediction mode (with the single mode being represented as “modeC” ) .

[0338] In one embodiment as shown in FIG. 9E, encoder 200 has already set an indication information by syntax element “tm_prediction_enable_flag” to indicate whether template based prediction modes may be used for inter and intra predictions (as shown as example in Table 1 and Table 6) as in FIG. 7A. When tm_prediction_enable_flag is equal to 1, encoder 200 may use a combination of FIG. 7B for template based intra prediction modes, and as template based intra prediction modes may be collectively controlled or indicated by “tm_prediction_enable_for_intra_flag, ” FIG. 7D for one or more template based inter prediction modes in “setA, ” FIG. 8D for separate controlling or indication for the one or more template based inter prediction modes in “set A, ” and FIG. 7E for one template based inter prediction mode (with the single mode being represented as “modeC” ) .

[0339] In FIGs. 7A-7E, FIGS. 8A-8G and FIG. 9, the descriptor refers to an entropy coding method for the corresponding syntax element. The definition and algorithms of u (1) , u (n) , ue (v) and ae (v) are the same as those in the H. 265 / HEVC standard.

[0340] In an embodiment, entropy coding unit 214 in encoder 200 writes the example syntax elements in FIGs. 7A-7E, FIGs. 8A-8G and / or FIGs. 9A-9E in one or more of the following data units in the output bitstream. In one embodiment, an order of the levels from high to low is sequence level, picture level, slice level and block level. The indications or controlling parameters in lower levels may overwrite or override the counterparts in higher levels. Prediction unit 202 in encoder 200 will follow the final valid instruction or controlling parameters in deriving the prediction of the current coding block using the template based prediction modes.

[0341] A sequence-level data unit which is valid for all pictures in a coded video sequence. An example of sequence-level data unit may be one or more of video parameter set (VPS) , sequence parameter set (SPS) , picture parameter set (PPS) with consistent parameters for all pictures in a coded video sequence, adaptation parameter set (APS) with consistent parameters for all pictures in a coded video sequence, picture header with consistent parameters for all pictures in a coded video sequence, supplemental enhancement information (SEI) with consistent parameters for all pictures in a coded video sequence. Entropy coding unit 214 may write the example syntax elements in FIGs. 7A-7E, FIGs. 8A-8G and / or FIGs. 9A-9E in one or more sequence-level data units. For example, entropy coding unit 214 may write the example syntax elements in FIGs. 7A-7E, FIGs. 8A-8G and / or FIGs. 9A-9E in the same one sequence-level data unit. For example, entropy coding unit 214 writes FIGs. 7A-7E syntax elements in SPS, and FIGs. 8A-8G and / or FIGs. 9A-9E syntax elements in PPS and / or APS directly or indirectly referring to the said SPS.

[0342] A picture-level data unit which is valid for one picture. An example of picture-level data unit may be one or more of picture parameter set (PPS) , adaptation parameter set (APS) with consistent parameters for one picture, picture header, slice header (s) of one picture with consistent parameters, supplemental enhancement information (SEI) with consistent parameters for one picture. Entropy coding unit 214 may write the example syntax elements in FIGs. 7A-7E, FIGs. 8A-8G and / or FIGs. 9A-9E in one or more picture-level data units, for example, in picture header, PPS and / or APS. For example, entropy coding unit 214 may write the example syntax elements in FIGs. 7A-7E, FIGs. 8A-8G and / or FIGs. 9A-9E in the same one picture-level data units. For example, entropy coding unit 214 writes FIGS. 7A-7E syntax elements in PPS, and FIGS. 8A-8G and / or FIGS. 9A-9E syntax elements in picture header, slice header, and / or APS directly or indirectly referring to the said PPS. For example, entropy coding unit 214 writes FIGS. 7A-7E syntax elements in picture header, and FIGS. 8A-8G and / or FIGS. 9A-9E syntax elements in slice header, and / or APS directly or indirectly referred to by the said picture header. For example, entropy coding unit 214 writes FIGS. 7A-7E syntax elements in APS, and FIGS. 8A-8G and / or FIGS. 9A-9E syntax elements in picture header and / or slice header directly or indirectly referring to the said APS.

[0343] Slice level data unit which is valid for one slice. An example of slice level data unit may be one or more of slice header, adaptation parameter set (APS) , supplemental enhancement information (SEI) for a slice. Entropy coding unit 214 may write the example syntax elements in FIGs. 7A-7E, FIGs. 8A-8G and / or FIGs. 9A-9E in one or more slice level data units. For example, entropy coding unit 214 may write the example syntax elements in FIGs. 7A-7E, FIGs. 8A-8G and / or FIGs. 9A-9E in the same one slice level data units. For example, entropy coding unit 214 writes FIGs. 7A-7E syntax elements in slice header, and FIGs. 8A-8G and / or FIGS. 9A-9E syntax elements in APS directly or indirectly referred to by the said slice header. For example, entropy coding unit 214 writes FIGs. 7A-7E syntax elements in slice header, and FIGs. 8A-8G and / or FIGs. 9A-9E syntax elements in slice header directly or indirectly referring to the said APS.

[0344] Block-level data unit, which is valid for one or more of CTU, CU, coding block, transform block. Entropy coding unit 214 may write the example syntax elements in FIGs. 7A-7E, FIGs. 8A-8G and / or FIGs. 9A-9E in one or more block-level data units. For example, entropy coding unit 214 may write the example syntax elements in FIGs. 7A-7E, FIGs. 8A-8G and / or FIGs. 9A-9E in the same one block-level data units. For example, entropy coding unit 214 writes FIGs. 7A-7E syntax elements in CTU, and FIGs. 8A-8G and / or FIGs. 9A-9E syntax elements in CU that is within the said CTU. For example, entropy coding unit 214 writes FIGs. 7A-7E syntax elements in a first CU, and FIGs. 8A-8G and / or FIGs. 9A-9E syntax elements in the CU that is within the said first CU.

[0345] Encoder 200 could be a computing device with a processor and a storage medium recording an encoding program. When the processor reads and executes the encoding program, the encoder 200 reads an input video and generates corresponding video bitstream.

[0346] Encoder 200 could be a computing device with one or more chips. The units, implemented as integrated circuits, on the chip are of similar functionalities with similar connections as well as data exchangings as the corresponding ones in FIG. 2.

[0347] FIG. 10 illustrates an example of an example implementation of a decoder 1000. Input of the decoder 1000 a bitstream representing a compressed version of a video or a still picture. Output of the decoder 1000 may be a decoded video consisting of a sequence of pictures or a decoded still picture.

[0348] Input bitstream of a decoder 1000 may be a bitstream generated by the encoder 200. Parsing unit 1001 parses the input bitstream and obtains values of syntax elements from the input bitstream. Parsing unit 1001 converts binary representations of syntax elements to numerical values and forwards the numerical values to the units in the decoder 1000 to derive one or more decoded pictures. Parsing unit 1001 may also parse one or more syntax elements from the input bitstream for rendering the decoded pictures.

[0349] Generally, an NN-based process consume more computational resources or use a dedicated hardware module to support calculations in an NN structure, as compared to a non-NN-based process. For example, one NN-based process may request Neural Processing Unit (NPU) , Graphics Processing Unit (GPU) , and / or any other modules that support the NN-based process may be support an implementation of a NN-based process (e.g., one or more of NN-based inter prediction, NN-based intra prediction, NN-based filtering, etc. ) . In one example, when an encoder determines that NN-based process are used to decode a bitstream generated by the encoder, the encoder signals an indication of this ability in the bitstream for a receiving device or decoder. In one example, when an encoder or sending device has an ability to perform an NN process (e.g., the encoder or sending device is integrated dedicated module, such as NPU, GPU or other modules or chips, to conduct NN process) , the encoder or sending device may signal this to a receiving device or a decoder during session negotiation process.

[0350] To signal the ability of performing NN-based process, in one example, the decoder 1000 may signal a Profile in the bitstream, where the Profile specifies that an NN-based process may be used in decoding the bitstream. The Profile may be signaled in a data unit containing Profile data. The data unit may be within one or more parameter sets, e.g., decoder parameter set, video parameter set, sequence parameter set, adaption parameter set, etc. In one example, the data unit may also be within a packet of session unit data, e.g., a payload of session negotiation packet. The Profile may specify whether an NN-based process may be used in decoding a bitstream. The Profile may further specify a quantization-error bounds for performing the NN-based process.

[0351] In one example, the decoder 1000 can signal a Level in the bitstream, where the Level specifies that an NN-based process may be used in decoding the bitstream. The Level may be signaled in a data unit containing Level data. The data unit may be within one or more parameter sets, e.g., decoder parameter set, video parameter set, sequence parameter set, adaption parameter set, etc. In one example, the data unit may also be within a packet of session unit data, e.g., a payload of session negotiation packet. The Level may specify whether an NN-based process may be used in decoding a bitstream. The Level may further specify a quantization-error bounds for performing the NN-based process.

[0352] In one example, the decoder 1000 can signal a Tier in the bitstream, where the Tier specifies that an NN-based process may be used in decoding the bitstream. The Tier may be signaled in a data unit containing Tier data. The data unit may be within one or more parameter sets, e.g. decoder parameter set, video parameter set, sequence parameter set, adaption parameter set, etc. In one example, the data unit may also be within a packet of session unit data, e.g., a payload of session negotiation packet. The Tier may specify whether an NN-based process may be used in decoding a bitstream. The Tier may further specify a quantization-error bounds for performing the NN-based process.

[0353] In one example, the decoder 1000 can signal a General Constraints Information (GCI) in the bitstream, where the GCI specifies that an NN-based process may be used in decoding the bitstream. The GCI may be signaled in a data unit containing GCI data. The data unit may be within one or more parameter sets, e.g., decoder parameter set, video parameter set, sequence parameter set, adaption parameter set, etc. In one example, the data unit may also be within a packet of session unit data, e.g., a payload of session negotiation packet. The GCI may specify whether NN-based process may be used in decoding a bitstream. The GCI may further specify a quantization-error bounds for performing the NN-based process.

[0354] As mentioned above, FIGs. 7A-7E illustrate example syntax elements of “high level” or “collective” indications. Parsing unit 1001 can process the example syntax elements in the bitstream to determine corresponding values of such syntax elements.

[0355] In an embodiment, parsing unit 1001 can process the bitstream containing one or more of the syntax elements as show in FIG. 7A. Parsing unit 1001 uses one of the entropy decoding methods in the “descriptor” to get a value of syntax element “tm_prediction_enable_flag” which indicates whether template based prediction modes may be used for inter and intra predictions (as shown as example in Table 1 and Table 6) . When tm_prediction_enable_flag is equal to 1, prediction unit 1002 may use the template based prediction modes in decoding one or more blocks in the video or picture bitstream. Otherwise, when tm_prediction_enable_flag is equal to 0, prediction unit 1002 will not use the template based prediction modes in decoding one or more blocks in the video or picture bitstream.

[0356] In an embodiment, parsing unit 1001 can process the bitstream containing one or more of the syntax elements as shown in FIG. 7B. Parsing unit 1001 uses one of the entropy decoding methods in the “descriptor” to get a value of syntax element “tm_prediction_enable_for_inter_flag” which indicates whether template based prediction modes may be used for inter predictions. When tm_prediction_enable_for_inter_flag is equal to 1, inter prediction unit 1003 within prediction unit 1002 may use the template based inter prediction modes (as shown as example in Table 1) in decoding one or more blocks in the video or picture bitstream. Otherwise, when tm_prediction_enable_for_inter_flag is equal to 0, inter prediction unit 1003 within prediction unit 1002 will not use the template based inter prediction modes (as shown as example in Table 1) in decoding one or more blocks in the video or picture bitstream.

[0357] In an embodiment, parsing unit 1001 can process the bitstream containing one or more of the syntax elements as shown in FIG. 7C. Parsing unit 1001 uses one of the entropy decoding methods in the “descriptor” to get a value of syntax element “tm_prediction_enable_for_intra_flag” which indicates whether template based prediction modes may be used for intra predictions. When tm_prediction_enable_for_intra_flag is equal to 1, intra prediction unit 1004 within prediction unit 1002 may use the template based intra prediction modes (as shown as example in Table 6) in decoding one or more blocks in the video or picture bitstream. Otherwise, when tm_prediction_enable_for_intra_flag is equal to 0, intra prediction unit 1004 within prediction unit 1002 will not use the template based intra prediction modes (as shown as example in Table 6) in decoding one or more blocks in the video or picture bitstream.

[0358] In an embodiment, parsing unit 1001 can process the bitstream containing one or more of the syntax elements as shown in FIG. 7D. Parsing unit 1001 uses one of the entropy decoding methods in the “descriptor” to get a value of syntax element “tm_mode_setA_enable_flag” which indicates whether several template based prediction modes may be used for intra and / or inter predictions. The said several template based prediction modes may be viewed or classified as “setA” . “setA” can contains one or more prediction modes. One example would be that IntraTMP and DMVR are within “setA” . When tm_mode_setA_enable_flag is equal to 1, intra prediction unit 1004 within prediction unit 1002 may use the template based intra prediction modes in “setA” (e.g., IntraTMP in this example) , and inter prediction unit 1003 within prediction unit 1002 may use the template based inter prediction modes in “setA” (e.g., DMVR in this example) in decoding one or more blocks in the video or picture bitstream. Otherwise, when tm_mode_setA_enable_flag is equal to 0, intra prediction unit 1004 within prediction unit 1002 will not use the template based intra prediction modes in “setA” (e.g., IntraTMP in this example) and inter prediction unit 1003 within prediction unit 1002 will not use the template based inter prediction modes in “setA” (e.g., DMVR in this example) in decoding one or more blocks in the video or picture bitstream. One example would be that IntraTMP and TIMD (that is, two intra prediction modes) are within “setA” . When tm_mode_setA_enable_flag is equal to 1, intra prediction unit 1004 within prediction unit 1002 may use the template based intra prediction modes in “setA” (e.g., IntraTMP and TIMD in the above example) . Otherwise, when tm_mode_setA_enable_flag is equal to 0, intra prediction unit 1004 within prediction unit 1002 will not use the template based intra prediction modes in “setA” (e.g., IntraTMP and TIMD in the above example) . One example would be that DMVR and BDOF (that is, two inter prediction modes) are within “setA” . When tm_mode_setA_enable_flag is equal to 1, inter prediction unit 1003 within prediction unit 1002 may use the template based intra prediction modes in “setA” (e.g., DMVR and BDOF in the above example) . Otherwise, when tm_mode_setA_enable_flag is equal to 0, inter prediction unit 1003 within prediction unit 1002 will not use the template based intra prediction modes in “setA” (e.g., DMVR and BDOF in the above example) .

[0359] In an embodiment, parsing unit 1001 can process the bitstream containing one or more of the syntax elements as shown in FIG. 7E. Parsing unit 1001 uses one of the entropy decoding methods in the “descriptor” to get a value of syntax element “tm_modeA_enable_flag” which indicates whether the template based prediction mode ( “modeA” ) may be used for intra and / or inter predictions. When tm_modeA_enable_flag is equal to 1, prediction unit 1002 may use the template based prediction mode ( “modeA” ) in decoding one or more blocks in the video or picture bitstream. Otherwise, when tm_modeA_enable_flag is equal to 0, prediction unit 1002 will not use the template based prediction mode ( “modeA” ) in decoding one or more blocks in the video or picture bitstream.

[0360] FIGs. 8A-8G illustrate example syntax elements, which may be implemented as a combination of the example syntax elements shown in FIGs. 7A-7E to enable sophisticated controlling options. Parsing unit 1001 can process the example syntax elements in the bitstream to determine corresponding values of such syntax elements.

[0361] In an embodiment, parsing unit 1001 can process the bitstream containing one or more of the syntax elements as shown in FIG. 8A. Parsing unit 1001 uses one of the entropy decoding methods in the “descriptor” to get a value of syntax element “tm_prediction_enable_flag” which indicates whether template based prediction modes may be used for inter and intra predictions (as shown as example in Table 1 and Table 6) . When tm_prediction_enable_flag is equal to 1, parsing unit 1001 may further determine separate indications for one or more template based prediction modes according to the additional syntax elements in the bitstream. Parsing unit 1001 determines further the controlling or indication by the example syntax elements in identical or similar way to those in FIG. 7A and FIG. 7E.

[0362] In an embodiment, parsing unit 1001 can process the bitstream containing one or more of the syntax elements as shown in FIG. 8B. Parsing unit 1001 uses one of the entropy decoding methods in the “descriptor” to get a value of syntax element “tm_prediction_enable_for_inter_flag” which indicates whether template based prediction modes may be used for inter predictions (as shown as example in Table 1) . When tm_prediction_enable_for_inter_flag is equal to 1, parsing unit 1001 may further determine separate indications for one or more template based inter prediction modes according to the additional syntax elements in the bitstream. Parsing unit 1001 determines further the controlling or indication by the example syntax elements are identical or similar to those in FIG. 7B and FIG. 7E.

[0363] In an embodiment, parsing unit 1001 can process the bitstream containing one or more of the syntax elements as shown in FIG. 8C. Parsing unit 1001 uses one of the entropy decoding methods in the “descriptor” to get a value of syntax element “tm_prediction_enable_for_intra_flag” which indicates whether template based prediction modes may be used for intra predictions (as shown as example in Table 6) . When tm_prediction_enable_for_intra_flag is equal to 1, parsing unit 1001 may further determine separate indications for one or more template based intra prediction modes according to the additional syntax elements in the bitstream. Parsing unit 1001 determines further the controlling or indication by the example syntax elements are identical or similar to those in FIG. 7C and FIG. 7E.

[0364] In an embodiment, parsing unit 1001 can process the bitstream containing one or more of the syntax elements as shown in FIG. 8D. Parsing unit 1001 uses one of the entropy decoding methods in the “descriptor” to get a value of syntax element “tm_mode_setA_enable_flag” which indicates whether template based prediction modes may be used for inter and / or intra predictions in “setA” . When tm_mode_setA_enable_flag is equal to 1, parsing unit 1001 may further determine separate indications for one or more template based inter and / or intra prediction modes in “setA” according to the additional syntax elements in the bitstream. Parsing unit 1001 determines further the controlling or indication by the example syntax elements are identical or similar to those in FIG. 7D and FIG. 7E.

[0365] In an embodiment, parsing unit 1001 can process the bitstream containing one or more of the syntax elements as shown in FIG. 8E. Parsing unit 1001 uses one of the entropy decoding methods in the “descriptor” to get a value of syntax element “tm_prediction_enable_flag” which indicates whether template based prediction modes may be used for inter and intra predictions (as shown as example in Table 1 and Table 6) . When tm_prediction_enable_flag is equal to 1, parsing unit 1001 may further determine separate indications for template based inter prediction modes and template based intra prediction modes according to the additional syntax elements in the bitstream. Parsing unit 1001 determines further the controlling or indication by the example syntax elements are identical or similar to those in FIG. 7A, FIG. 7B, and FIG. 7C.

[0366] In an embodiment, parsing unit 1001 can process the bitstream containing one or more of the syntax elements as shown in FIG. 8F. Parsing unit 1001 uses one of the entropy decoding methods in the “descriptor” to get a value of syntax element “tm_prediction_enable_flag” which indicates whether template based prediction modes may be used for inter and intra predictions (as shown as example in Table 1 and Table 6) . When tm_prediction_enable_flag is equal to 1, parsing unit 1001 may further determine separate indications for template based inter prediction modes using “tm_prediction_enable_for_inter_flag” and several template based prediction modes in “setA” according to the additional syntax elements in the bitstream. For example, as template based inter prediction mode may be collectively controlled or indicated by “tm_prediction_enable_for_inter_flag, ” “setA” may contain one or more template based intra prediction modes. Parsing unit 1001 determines further the controlling or indication by the example syntax elements are identical or similar to those in FIG. 7A, FIG. 7B and FIG. 7D.

[0367] In an embodiment, parsing unit 1001 can process the bitstream containing one or more of the syntax elements as shown in FIG. 8G. Parsing unit 1001 uses one of the entropy decoding methods in the “descriptor” to get a value of syntax element “tm_prediction_enable_flag” which indicates whether template based prediction modes may be used for inter and intra predictions (as shown as example in Table 1 and Table 6) . When tm_prediction_enable_flag is equal to 1, parsing unit 1001 may further determine separate indications for template based intra prediction modes using “tm_prediction_enable_for_intra_flag” and several template based prediction modes in “setA” according to the additional syntax elements in the bitstream. For example, as template based intra prediction modes may be collectively controlled or indicated by “tm_prediction_enable_for_intra_flag, ” “setA” may contain one or more template based inter prediction modes. Parsing unit 1001 determines further the controlling or indication by the example syntax elements are identical or similar to those in FIG. 7A, FIG. 7B and FIG. 7D.

[0368] FIGs. 9A-9E illustrate example syntax elements, which may be implemented as a combination of the example syntax elements shown in FIG. 7 and / or FIG. 8 to enable sophisticated controlling options. Parsing unit 1001 can process the example syntax elements in the bitstream to determine corresponding values of such syntax elements.

[0369] In an embodiment, parsing unit 1001 can process the bitstream containing one or more of the syntax elements as shown in FIG. 9A. Parsing unit 1001 uses one of the entropy decoding methods in the “descriptor” to get a value of syntax element “tm_prediction_enable_flag” which indicates whether template based prediction modes may be used for inter and intra predictions (as shown as example in Table 1 and Table 6) as in FIG. 7A. When tm_prediction_enable_flag is equal to 1, parsing unit 1001 may, according to a combination of syntax elements in FIG. 7E for one template based prediction mode (with the single mode being represented as “modeC” ) , in FIG. 7D for one or more template based prediction modes in “setA, ” and in FIG. 8D for separate controlling or indication for the one or more template based prediction modes in “set A, ” further determine corresponding indication or controlling parameters.

[0370] In an embodiment, parsing unit 1001 can process the bitstream containing one or more of the syntax elements as shown in FIG. 9B. Parsing unit 1001 uses one of the entropy decoding methods in the “descriptor” to get a value of syntax element “tm_prediction_enable_for_inter_flag” which indicates whether template based inter prediction modes may be used for inter predictions (as shown as example in Table 1) as in FIG. 7B. When tm_prediction_enable_for_inter_flag is equal to 1, parsing unit 1001 may, according to a combination of syntax elements in FIG. 7E for one template based inter prediction mode (with the single mode being represented as “modeC” ) , in FIG. 7D for one or more template based inter prediction modes in “setA, ” and in FIG. 8D for separate controlling or indication for the one or more template based inter prediction modes in “set A, ” further determine corresponding indication or controlling parameters.

[0371] In an embodiment, parsing unit 1001 can process the bitstream containing one or more of the syntax elements as shown in FIG. 9C. Parsing unit 1001 uses one of the entropy decoding methods in the “descriptor” to get a value of syntax element “tm_prediction_enable_for_intra_flag” which indicates whether template based intra prediction modes may be used for intra predictions (as shown as example in Table 6) as in FIG. 7C. When tm_prediction_enable_for_intra_flag is equal to 1, parsing unit 1001 may, according to a combination of syntax elements in FIG. 7E for one template based intra prediction mode (with the single mode being represented as “modeC” ) , in FIG. 7D for one or more template based intra prediction modes in “setA, ” and in FIG. 8D for separate controlling or indication for the one or more template based intra prediction modes in “set A, ” further determine corresponding indication or controlling parameters.

[0372] In an embodiment, parsing unit 1001 can process the bitstream containing one or more of the syntax elements as shown in FIG. 9D. Parsing unit 1001 uses one of the entropy decoding methods in the “descriptor” to get a value of syntax element “tm_prediction_enable_flag” to indicate whether template based prediction modes may be used for inter and intra predictions (as shown as example in Table 1 and Table 6) as in FIG. 7A. When tm_prediction_enable_flag is equal to 1, parsing unit 1001 may, according to a combination of syntax elements in FIG. 7B for template based inter prediction modes, and as template based inter prediction modes may be collectively controlled or indicated by “tm_prediction_enable_for_inter_flag, ” in FIG. 7D for one or more template based intra prediction modes in “setA, ” in FIG. 8D for separate controlling or indication for the one or more template based intra prediction modes in “set A, ” and in FIG. 7E for one template based intra prediction mode (with the single mode being represented as “modeC” ) .

[0373] In an embodiment, parsing unit 1001 can process the bitstream containing one or more of the syntax elements as shown in FIG. 9E. Parsing unit 1001 uses one of the entropy decoding methods in the “descriptor” to get a value of syntax element “tm_prediction_enable_flag” to indicate whether template based prediction modes may be used for inter and intra predictions (as shown as example in Table 1 and Table 6) as in FIG. 7A. When tm_prediction_enable_flag is equal to 1, parsing unit 1001 may, according to a combination of syntax elements in FIG. 7B for template based intra prediction modes, and as template based intra prediction modes may be collectively controlled or indicated by “tm_prediction_enable_for_intra_flag, ” in FIG. 7D for one or more template based inter prediction modes in “setA, ” in FIG. 8D for separate controlling or indication for the one or more template based inter prediction modes in “set A, ” and in FIG. 7E for one template based inter prediction mode (with the single mode being represented as “modeC” ) .

[0374] In FIGs. 7A-7E, FIGs. 8A-8G and FIGs. 9A-9E, the descriptor refers to an entropy decoding method for the corresponding syntax element. The definition and algorithms of u (1) , u (n) , ue (v) and ae (v) are the same as those in the H. 265 / HEVC standard.

[0375] In an embodiment, parsing unit 1001 determines the example syntax elements in FIGs. 7A-7E, FIGs. 8A-8G, and / or FIGs. 9A-9E from one or more of the following data units in the input bitstream. To avoid any doubt, the “parameters” mentioned below refers to the example syntax elements in FIGs. 7A-7E, FIGs. 8A-8G, and / or FIGs. 9A-9E indicating whether one or more template based prediction modes are enabled in decoding one or more blocks in the input bitstream. In one embodiment, an order of the levels from high to low is sequence level, picture level, slice level and block level. The indications or controlling parameters in lower levels may overwrite or override the counterparts in higher levels. Parsing unit 1001 will pass the final valid indication or controlling parameters to prediction unit 1002 in decoder 1000. Prediction unit 1002 will follow the final valid instruction or controlling parameters in deriving the prediction of one or more blocks using the template based prediction modes.

[0376] A sequence-level data unit which is valid for all pictures in a coded video sequence. An example of sequence-level data unit may be one or more of video parameter set (VPS) , sequence parameter set (SPS) , picture parameter set (PPS) with consistent parameters for all pictures in a coded video sequence, adaptation parameter set (APS) with consistent parameters for all pictures in a coded video sequence, picture header with consistent parameters for all pictures in a coded video sequence, supplemental enhancement information (SEI) with consistent parameters for all pictures in a coded video sequence.

[0377] If the parsing unit 1001 determines the instruction or controlling parameters according to syntax elements in a sequence-level data unit, prediction unit 1002 in decoder 1000 may use the template based prediction modes that may be enabled according to the instruction or controlling parameters from the parsing unit 1001 in decoding one or more blocks in this coded video sequence in the input bitstream. In an embodiment, the said instruction or controlling parameters determined by the parsing unit 1001 from a sequence-level data unit can also be overwritten or overridden by the instruction or controlling parameters determined by parsing lower level (e.g., one or more of picture level, slice level and block level) data units.

[0378] A picture-level data unit which is valid for one picture. An example of picture-level data unit may be one or more of picture parameter set (PPS) , adaptation parameter set (APS) with consistent parameters for one picture, picture header, slice header (s) of one picture with consistent parameters, supplemental enhancement information (SEI) with consistent parameters for one picture.

[0379] If the parsing unit 1001 determines the instruction or controlling parameters according to syntax elements in a picture-level data unit, prediction unit 1002 in decoder 1000 may use the template based prediction modes that may be enabled according to the instruction or controlling parameters from the parsing unit 1001 in decoding one or more blocks in this picture in the input bitstream. In an embodiment, the said instruction or controlling parameters determined by the parsing unit 1001 from a picture-level data unit can also be overwritten or overridden by the instruction or controlling parameters determined by parsing lower level (e.g., one or more of slice level and block level) data units. In an embodiment, the instruction or controlling parameters determined by the parsing unit 1001 from a picture-level data unit can also overwrite or override the instruction or controlling parameters determined by parsing higher level (e.g., sequence level) data unit.

[0380] Slice level data unit which is valid for one slice. An example of slice level data unit may be one or more of slice header, adaptation parameter set (APS) , supplemental enhancement information (SEI) for a slice. In a slice level data unit, ae (v) would not be used.

[0381] If the parsing unit 1001 determines the instruction or controlling parameters according to syntax elements in a slice level data unit, prediction unit 1002 in decoder 1000 may use the template based prediction modes that may be enabled according to the instruction or controlling parameters from the parsing unit 1001 in decoding one or more blocks in this slice in the input bitstream. In an embodiment, the said instruction or controlling parameters determined by the parsing unit 1001 from a slice level data unit can also be overwritten or overridden by the cost function determined by parsing lower level (e.g., block level) data units. In an embodiment, the said instruction or controlling parameters determined by the parsing unit 1001 from a picture-level data unit can also overwrite or override the said instruction or controlling parameters determined by parsing higher level (e.g., one or more of sequence level, picture level) data units.

[0382] Block-level data unit, which is valid for one or more of CTU, CU, coding block, transform block. In a block-level data unit, ae (v) would be used.

[0383] If the parsing unit 1001 determines the instruction or controlling parameters according to syntax elements in a block-level data unit, prediction unit 1002 in decoder 1000 may use the template based prediction modes that may be enabled according to the instruction or controlling parameters from the parsing unit 1001 in decoding the block in the bitstream. In an embodiment, the instruction or controlling parameters determined by the parsing unit 1001 from a block-level data unit can also overwrite or override the cost function determined by parsing higher level (e.g., one or more of sequence level, picture level, slice level) data units.

[0384] Parsing unit 1001 forwards the instruction or controlling parameters to indicate template based prediction modes that may be enabled in deriving prediction of a block by the prediction unit 1002, the values of other syntax elements, as well as one or more variables set or determined according the values of syntax elements, for deriving one or more decoded pictures to the units in the decoder 1000. Prediction unit 1002 determines a prediction block of a current decoding block (e.g., a CU) . When it is indicated that an inter prediction mode is used to decoding the current decoding block, prediction unit 1002 passes relative parameters from parsing unit 1001 to inter prediction unit 1003 to derive inter prediction block. When it is indicated that an intra prediction mode is used to decoding the current decoding block, prediction unit 1002 passes relative parameters from parsing unit 1001 to intra prediction unit 1004 to derive intra prediction block.

[0385] In one embodiment, parsing unit 1001 may determine controlling parameters according to conformance indications, such as indications by one or more of Profile, Tier and Level. One example implementation would be a Profile may specify that all of or several of template based prediction modes are enabled or disabled.

[0386] In one embodiment, if a template based inter prediction mode is enabled and used in decoding a block, inter prediction unit 1003 may derive a reference template. One example of deriving the reference template of a current decoding block is the same as that shown in FIG. 4 using the template as an example shown in FIG. 5. In one example, the prediction block of the current decoding block may be derived based on the reference template, for example, in a same way as that described for encoder 200. In an embodiment, inter prediction unit 1003 can use a unified cost function for a same or similar process using a template. For example, for “reordering” functions as listed in Table 1, inter prediction unit 1003 can use SATD for one, multiple but not all, or all of the prediction modes having “reordering” of candidates in a candidate list. For example, for “reordering” functions as listed in Table 1, inter prediction unit 1003 can use SAD or any one of the abovementioned cost function for one, multiple but not all, or all of the prediction modes having “reordering” of candidates in a candidate list. In an embodiment, inter prediction unit 1003 can use a single cost function for all prediction modes.

[0387] In one embodiment, if a template based intra prediction mode is enabled and used in decoding a block, intra prediction unit 1004 may derive a reference template with the determined cost function. One example of deriving the reference template of a current decoding block is the same as that shown in FIG. 6 using the template as an example shown in FIG. 5. In one example, the prediction block of the current decoding block may be derived based on the reference template, for example, in a same way as that described for encoder 200. In an embodiment, intra prediction unit 1004 can use a unified cost function for a same or similar process using a template. For example, for “reordering” functions as listed in Table 6, intra prediction unit 1004 can use SATD for one, multiple but not all, or all of the prediction modes having “reordering” of candidates in a candidate list. For example, for “reordering” functions as listed in Table 1, intra prediction unit 1004 can use SAD, or any one of the abovementioned cost function for one, multiple but not all, or all of the prediction modes having “reordering” of candidates in a candidate list. In an embodiment, intra prediction unit 1004 can use a single cost function for all prediction modes.

[0388] Prediction unit 1002 can also derive intra prediction mode or angular prediction direction of the current CU based on one or more reference samples. This derivation process is identical to the counterpart of Prediction unit 202. FIG. 16 illustrates an example of a current block 1601 and its reference sample 1602, 1603. For example, the reference sample 1602, 1603, which are marked as black dot outside the current block 1601, may be one or more samples in a template ( “L-shape” template consisting of the black dots in FIG. 16) as shown in FIGs. 5A-5C. For example, a gradient of reference sample 1602, 1603 may be derived by applying one or more filters to process one or more samples in a template as shown in FIGs. 5A-5C. Prediction unit 1002 first may derive a gradient of a reference sample using an operator. Generally, the operator may be used to detect an edge or a gradient in a picture. The operator may be a 2-dimentional (2D) M x N filter, wherein M and N are positive integers, and M may be equal to or different from N.

[0389] One example of the operator is a Sobel filter. A first example of a 3x3 Sobel filter 3200 is depicted in FIG. 32A, and a second example of a 3x3 Sobel filter 3225 is depicted in FIG. 32B.

[0390] Another example of the operator is an Edge filter. A first example of an Edge filter 3250 is depicted in FIG. 32C, and a second example of an Edge filter 3275 is depicted in FIG. 32D.

[0391] In an example, prediction unit 1002 can choose different operators according to a width and / or a height of the current block. For example, prediction unit 1002 uses smaller operator for smaller block, and uses larger operator for larger block. One example would be that prediction unit 1002 uses the abovementioned Edge filter when a size (width by height or “width x height” ) of the current block is 4x4, 4x8 or 8x4, and uses the abovementioned Sobel filter for other sizes of the current block.

[0392] Prediction unit 1002 may derive a Histogram of Gradients (HoG) based on analyzing one or more reference sample marked in black dots in FIG. 16. The template in FIG. 16 comprises three reference sample lines above and three reference sample columns on the left of the current block. The HoG is derived by accumulating the magnitudes of one or more gradients at one or more given direction, for one, a part of, or all of the reference samples as shown in FIG. 16. One or more directions indicated by the gradients with highest or higher cumulative magnitudes are to be angular prediction direction or intra prediction mode of the current block.

[0393] As an example, when prediction unit 1002 uses one reference sample as shown in FIG. 16 to derive a direction, the prediction unit 1002 can determine the direction as the one indicated by a gradient derived at this reference sample.

[0394] As an example, when prediction unit 1002 uses a part of reference samples as shown in FIG. 16 to derive directions, prediction unit 1002 can choose to a preset number of samples from the reference samples. For example, prediction unit 1002 choose J reference samples above the current block and K reference samples left to the current block, wherein J and K are integers greater than or equal to 0. For example, both J and K are equal to 2, J equal to 4 and K equal to 8, or J plus K equal to 4. Prediction unit 1002 may derive the gradients at the selected reference samples using the operator, and derive the HoG. One or more directions indicated by the gradients with highest or higher cumulative magnitudes are to be angular prediction direction or intra prediction mode of the current block.

[0395] As an example, prediction unit 1002 can adaptively determine one or more reference samples used for deriving a HoG. Prediction unit 1002 uses a preset scanning order of the reference samples. When scanning a reference sample, prediction unit 1002 may derive a gradient at this reference sample, and updates the accumulation the magnitudes according to this gradient at one or more given direction in HoG. When prediction unit 1002 determines that the total cumulative amplitude is greater or equal than a given threshold, prediction unit 1002 will stop scanning the remaining reference sample and deriving new gradient. The resulted HoG at the termination of prediction unit 1002’s scanning, is determined as the HoG to derive intra prediction mode or angular prediction direction.

[0396] Examples of the abovementioned preset scanning order of the reference samples may be the following.

[0397] For example, a scanning order (A) may be scanning the left column of reference samples as shown in FIG. 16 from bottom to top; a scanning order (B) may be scanning the left column of reference samples as shown in FIG. 16 from top to bottom; a scanning order (C) may be scanning the above line of reference samples as shown in FIG. 16 from left to right; a scanning order (D) may be scanning the above line of reference samples as shown in FIG. 16 from left to right.

[0398] An example of the preset scanning order may be one or more of “first order (A) then order (C) , ” “first order (A) then order (D) , ” “first order (B) then order (C) , ” “first order (B) then order (D) , ” “first order (C) then order (A) , ” “first order (D) then order (A) , ” “first order (C) then order (B) ” and “first order (D) then order (B) ” .

[0399] An example of the preset scanning order may be an interleaving manner. For example, one or multiple reference samples from the left column and then one or multiple second reference samples from the above line and then one or multiple third reference sample from left column. For example, one or multiple reference samples from the above line and then one or multiple second reference samples from the left column and then one or multiple third reference sample from above line. Additionally, as an example, the scanning order of samples in the left column may be one or more of order (A) and (B) , and the scanning order of samples in the left column may be one or more of order (C) and (D) .

[0400] Prediction unit 1002 may use the derived one or more intra prediction modes or one or more angular prediction directions (intra prediction mode or angular prediction direction also may be called as “intra prediction direction” ) to derive a prediction of the current block. For example, prediction unit 1002 may pass the derived one or more intra prediction modes or one or more angular prediction directions to intra prediction unit 205. In one embodiment, Intra prediction unit 1004 may derive a prediction of the current block by fusing one or more predictions corresponding to the derived intra prediction modes. In one embodiment, Intra prediction unit 1004 may derive a prediction of the current block by fusing one or more predictions determined according to the derived intra prediction modes and one or more predictions determined according to one or more preset mode (for example, Planar mode, DC mode and cross-component prediction mode and etc. ) . One example may be decoder side intra mode Mode Derivation (DIMD) .

[0401] In an embodiment, a DIMD_flag may be determined to enable or disable the Mode Derivation (DIMD) .

[0402] If the DIMD_flag is determined to be 1 (enable) , whether to use the Occurrence-based intra coding (OBIC) mode may be determined. For example, an OBIC_flag may be determined to enable or disable the OBIC mode.

[0403] The DIMD_flag may be signaled in the sequence level, picture level, slice level or block level and so on.

[0404] The OBIC_flag may be signaled in the sequence level, picture level, slice level or block level and so on.

[0405] In an embodiment, the OBIC mode may derive the intra prediction modes of the current block based on the sample-wise occurrence of the intra modes in the spatial neighborhood of the block. For this, adjacent and non-adjacent spatial neighboring blocks are checked and the intra prediction modes of the blocks are collected into an occurrence histogram. Instead of Histogram of Gradient (HoG) as in DIMD, the OBIC method uses the Histogram of occurrence (HoC) , which consists of the intra modes and their sample-wise occurrences. The occurrence values are calculated based on the number of samples that are coded in a certain intra prediction mode in that neighborhood. For example, if a uiWidth × uiHeight block is coded with an IPM mode, the occurrence of the mode in that particular block is calculated as: HoC [IPM] += uiWidth *uiHeight, where uiWidth and uiHeight are the width and height of a spatial neighboring block.

[0406] The occurrences of the existing modes from the spatial neighborhood blocks are accumulated into the histogram, adjacent and non-adjacent spatial neighboring blocks are checked and the intra prediction modes of the blocks are collected into an occurrence histogram. Instead of Histogram of Gradient (HoG) as in DIMD, the OBIC method uses the Histogram of occurrence (HoC) , which consists of the intra modes and their sample-wise occurrences. The occurrence values are calculated based on the number of samples that are coded in a certain intra prediction mode in that neighborhood. For example, if a uiWidth × uiHeight block is coded with an Intra Predication Mode (IPM) mode, the occurrence of the mode in that particular block is calculated as: HoC [IPM] += uiWidth *uiHeight, where uiWidth and uiHeight are the width and height of a spatial neighboring block.

[0407] The occurrences of the existing modes from the spatial neighborhood blocks are accumulated into the histogram.

[0408] FIG. 17 shows the non-adjacent spatial neighboring blocks that are used in OBIC mode’s HoC generation.

[0409] One or multiple (e.g., up to five angular modes) with the highest occurrence along with the planar mode or block vector based prediction (same as in DIMD) are selected from the HoC and used for final prediction by blending the prediction of the selected modes.

[0410] Some blocks, mentioned below, use more than one intra mode for prediction. In such cases, all the intra modes of such blocks are selected and used when creating the OBIC histogram: DIMD may use up to up to 5 angular modes, TIMD may use up to up to 2 modes, SGPM may use up to 2 modes, and OBIC may use up to up to 5 angular modes.

[0411] Moreover, the virtual intra prediction modes (VIPMs) of the following blocks are considered only in inter slices when creating the histogram of OBIC mode: MIP block, IntraTMP block, IBC block, and EIP block.

[0412] The blending weights are calculated similarly to the DIMD mode, but instead of using gradient values from the template, the occurrence values are used for OBIC. Moreover, the planar mode’s weight is also decided similarly to the DIMD mode.

[0413] As mentioned above, FIG. 18 shows an example of a histogram of occurrences (HoC) of intra predication modes in the spatial neighborhood of a CU.

[0414] In an embodiment, in order to decrease the buffer memory, the OBIC method may use non-sample-wise occurrences, such as block-wise occurrences. For example, if a uiWidth×uiHeight block is coded with an IPM mode, the block-wise occurrence of the mode in that particular block is calculated as: HoC [IPM] += (uiWidth>>shift1) * (uiHeight>>shift2) , where the variable shift1 and shift2 are both positive integers greater than or equal to 1. When the variable shift1 and shift2 are set to 1, the occurrence type 2×2 block-wise occurrence is used. The variable shift 1 or shift 2 can also be set to 2, 3, 4, 5 and so on. It is not limited that the shift1 is equal to shift2.

[0415] In an embodiment, the shift1 or shift 2 may be determined according to the size (width or height) of the current block. For example, if the size of the current block is 4×4, the 2×2 block-wise occurrence may be used.

[0416] In an embodiment, the shift1 or shift2 may be determined by using the flag sps_log2_min_luma_coding_block_size_minus2. For example, parse a bitstream and obtain the value of sps_log2_min_luma_coding_block_size_minus2. If the value of sps_log2_min_luma_coding_block_size_minus2 is equal to 2, the size of the current block is determined to 4×4. Then the occurrence type may be obtained through the determined size of the current block.

[0417] In an embodiment, the block-wise occurrence may be determined through a look-up table. Some examples of look-up tables are shown in Tables 3A-3E, without limitation.

[0418] In an embodiment, a confidence level can also be used to calculate the occurrence. If there is a very large size block neighboring a small size block, the IPM of the large size block is considered as a low confidence level block and the large size block is not used to calculate the occurrence of the current block. For example, if a 64×64 block neighbors a 2×2 block, the 64×64 block may not be used to calculate the occurrence of the 2×2 block for the reason that the 2×2 block is too small than the 64×64 block. If the 64×64 block is used to calculate, it will negatively interfere with the histogram statistics. The size of current block is a factor the determined the confidence level of a neighbor block.

[0419] In an embodiment, the OBIC mode may be used to luma blocks.

[0420] In an embodiment, the OBIC mode may be used to chroma blocks.

[0421] To determine the intra prediction mode of the current block according to parameter from parsing unit 1001, Intra prediction unit 1004 may derive a most probable mode (MPM) list containing one or more intra prediction modes. If the parameter from parsing unit 1001 indicates that intra prediction mode of the current block is one candidate mode in MPM list, intra prediction unit 1004 may determine the intra prediction mode according to an index from parsing unit 1001 which indicates this intra prediction mode in MPM list. Otherwise, if the parameter from parsing unit 1001 indicates that the intra prediction mode of the current block is not in the MPM list, intra prediction unit 1004 will derive an index or indication parameter of this intra prediction mode according to further parameter from parsing unit 1001.

[0422] As mentioned above, FIG. 22 illustrates examples of adjacent reference samples of the current block 2201. The numbers on adjacent reference samples show an example of scanning order of the adjacent blocks by intra prediction unit 1004. In one example, intra prediction unit 1004 scans prediction mode of the adjacent reference sample to derive one or more MPMs. If the mode of an adjacent block is not a BV based intra prediction mode (e.g., planar mode, DC mode, angular prediction mode, etc. ) , intra prediction unit 1004 may include this intra mode as a candidate mode in MPM list. In an example, spatial reference samples can also be one or more non-adjacent blocks shown in FIG. 17.

[0423] As mentioned above, FIG. 23 illustrates a first example of an adjacent block of a BV-based prediction mode, according to some embodiments of the present disclosure. In FIG. 23, 2300 is a current picture 2300 and 2301 is a current block 2301.

[0424] For example, current block 2301 is a block in an intra coded slice. For example, current block 2301 is a block in an intra coded picture (e.g., a picture that may be employed as an access point, such as Instantaneous Decoding Refresh picture, Clean Random Access picture, Broken Link Access picture, etc. ) .

[0425] Block 2302 is an adjacent block of current block 2301, and block 2302 is coded using a BV based coding mode, e.g., IBC or IntraTMP. BV (2302) is a BV of block 2302 and indicates a reference block 2303. If block 2303 is an intra coded block which only references to reconstructed samples in the current picture 2300 and block 2303 is not using a BV based coding mode, for example, block 2303 is of an angular mode, DC mode or planar mode, the width and / or height of block 2303 may be used to derive an HoC of the current block 2301. As block 2302 is of a same size as that of 2303, equivalently, the width and / or height of block 2302 may be used to derive an HoC of the current block 2301. In one example, coding information of the block 2303 may be used to derive an HoC of the current block 2301. In one example, the coding information of the block 2303 may include one or more of the width of block 2303, the height of block 2303, or the coding mode of block 2303. In one example, the width and / or height of block 2303 as well as the coding mode of block 2303 may be used to derive an HoC of the current block 2301.

[0426] If block 2303 is also coded using a BV based coding mode, prediction unit 1002 will check a coding mode of block 2304, which is indicated by BV (2303) of block 2303. If block 2304 is an intra coded block which only references to reconstructed samples in the current picture 2300 and block 2304 is not using a BV based coding mode, for example, block 2304 is of an angular mode, DC mode or planar mode, the width and / or height of block 2304 may be used to derive an HoC of the current block 2301. As block 2302 is of a same size as that of 2303 and 2304, equivalently, the width and / or height of block 2302 may be used to derive an HoC of the current block 2301. In one example, coding information of the block 2304 may be used to derive an HoC of the current block 2301. In one example, the coding information of the block 2304 may include one or more of the width of block 2304, the height of block 2304, or the coding mode of block 2304. In one example, the width and / or height of block 2304 as well as the coding mode of block 2304 may be used to derive an HoC of the current block 2301.

[0427] Optionally, if prediction unit 1002 cannot determine an intra coding mode that is not BV based mode after recursively searching using “BV links, ” for example using N linked BVs, prediction unit 1002 will stopped and does not use any information from block 2302 to derive HoC of the current block 2301. As an example, N is a non-negative integer. When N is equal to 0, only block 2302 is checked by prediction unit 1002. As an example, when N is equal to 1, block 2302 and block 2303 may be checked if block 2302 is coded using BV-based intra mode. As an example, when N is equal to 2, blocks 2302, 2303 and 2304 may be checked by prediction unit 1002 if blocks 2302 and 2303 is coded using BV-based intra mode.

[0428] As mentioned above, FIG. 24 illustrates a second example of an adjacent block of BV-based prediction mode, according to some embodiments of the present disclosure. For example, current block 2401 may be a block in an intra coded slice. For example, current block 2401 is a block in an intra coded picture (e.g., a picture that may be employed as an access point, such as Instantaneous Decoding Refresh picture, Clean Random Access picture, Broken Link Access picture, etc. ) .

[0429] Block 2402 is an adjacent block of current block 2401, and block 2402 is coded using a BV based coding mode, e.g. IBC or IntraTMP. BV (2402) is a BV of block 2402. Block 2403 is a block which contains a reference sample indicated by BV (2402) . In an example, (x0, y0) denotes a sample in current block 2401, and the reference sample is derived as (x0 + x (2402) , y0 + y (2402) ) , wherein BV (2402) has a horizontal component equal to x (2402) and a vertical component equal to y (2402) . For example, (x0, y0) may be a top-left sample in the current block 2401. For example, (x0, y0) may be a sample located at any corner of the current block 2401. For example, (x0, y0) may be a sample at a middle bottom-right position (e.g., (width (2401)  / 2, height (2401)  / 2) ) in the current block 2401. For example, (x0, y0) may be a sample at a middle top-right position (e.g., (width (2401)  / 2, height (2401)  / 2 - 1) ) in the current block 2401. For example, (x0, y0) may be a sample at a middle bottom-left position (e.g., (width (2401)  / 2 - 1, height (2401)  / 2) ) in the current block 2401. For example, (x0, y0) may be a sample at a middle top-left position (i.e. (width (2401)  / 2 - 1, height (2401)  / 2 - 1) ) in the current block 2401. width (2401) and height (2401) are width and height, respectively, of the current block 2401.

[0430] If block 2403 is an intra coded block which only references to reconstructed samples in the current picture 2400 and block 2403 is not using a BV based coding mode, for example, block 2403 is of an angular mode, DC mode or planar mode, in one example, the width and / or height of block 2403 may be used to derive a HoC of the current block 2401. In one example, width and / or height of block 2402 may be used to derive a HoC of the current block 2401. In one example, width and / or height of block 2401 may be used to derive a HoC of the current block 2401.

[0431] In one example, coding information of the block 2403 may be used to derive a HoC of the current block 2401. In one example, the coding information of the block 2403 may include one or more of the width of block 2403, the height of block 2403, or the coding mode of block 2403. In one example, coding information of the block 2403 and one of coding information of the block 2402, coding information of the current block 2401 may be used to derive a HoC of the current block 2401. In one example, the width and / or height of block 2403 as well as the coding mode of block 2403 may be used to derive a HoC of the current block 2401. In one example, width and / or height of block 2402 as well as the coding mode of block 2403 may be used to derive a HoC of the current block 2401. In one example, width and / or height of block 2401 as well as the coding mode of block 2403 may be used to derive a HoC of the current block 2401.

[0432] If block 2403 is also coded using a BV based coding mode, prediction unit 1002 will check a coding mode of block 2404, which is indicated by BV (2403) of block 2403. In one example, Block 2404 is a block which contains another reference sample indicated further by BV (2403) . In one example, (x0, y0) denotes a sample in current block 2401, and the another reference sample is derived as (x0 + x (2402) + x (2403) , y0 + y (2402) + x (2403) ) , wherein BV (2402) has a horizontal component equal to x (2402) and a vertical component equal to y (2402) , and BV (2403) has a horizontal component equal to x (2403) and a vertical component equal to y (2403) . For example, (x0, y0) may be a top-left sample in the current block 2401. For example, (x0, y0) may be a sample located at any corner of the current block 2401. For example, (x0, y0) may be a sample at a middle bottom-right position (i.e. (width (2401)  / 2, height (2401)  / 2) ) in the current block 2401. For example, (x0, y0) may be a sample at a middle top-right position (i.e. (width (2401)  / 2, height (2401)  / 2 - 1) ) in the current block 2401. For example, (x0, y0) may be a sample at a middle bottom-left position (i.e. (width (2401)  / 2 - 1, height (2401)  / 2) ) in the current block 2401. For example, (x0, y0) may be a sample at a middle top-left position (i.e. (width (2401)  / 2 - 1, height (2401)  / 2 - 1) ) in the current block 2401. width (2401) and height (2401) are width and height, respectively, of the current block 2401.

[0433] If block 2404 is an intra coded block which only references to reconstructed samples in the current picture 2400 and block 2404 is not using a BV based coding mode, for example, block 2404 is of an angular mode, DC mode or planar mode, in one example, the width and / or height of block 2404 may be used to derive a HoC of the current block 2401. In one example, width and / or height of block 2403 may be used to derive a HoC of the current block 2401. In one example, width and / or height of block 2402 may be used to derive a HoC of the current block 2401. In one example, width and / or height of block 2401 may be used to derive a HoC of the current block 2401.

[0434] In one example, coding information of the block 2404 may be used to derive a HoC of the current block 2401. In one example, the coding information of the block 2404 may include one or more of the width of block 2404, the height of block 2404, or the coding mode of block 2404. In one example, coding information of the block 2404 and one of coding information of the block 2403, coding information of the block 2402, or coding information of the current block 2401 may be used to derive a HoC of the current block 2401. In one example, the width and / or height of block 2404 as well as the coding mode of block 2404 may be used to derive a HoC of the current block 2401. In one example, width and / or height of block 2403 as well as the coding mode of block 2404 may be used to derive a HoC of the current block 2401. In one example, width and / or height of block 2402 as well as the coding mode of block 2404 may be used to derive a HoC of the current block 2401. In one example, width and / or height of block 2401 as well as the coding mode of block 2404 may be used to derive a HoC of the current block 2401.

[0435] Optionally, if prediction unit 1002 cannot determine an intra coding mode that is not BV based mode after recursively searching using “BV links, ” for example using N linked BVs, prediction unit 1002 will stopped and does not use any information from block 2402 to derive HoC of the current block 2401. As an example, N is a non-negative integer. When N is equal to 0, only block 2402 is checked by prediction unit 1002. As an example, when N is equal to 1, block 2402 and block 2403 may be checked if block 2402 is coded using BV-based intra mode. As an example, when N is equal to 2, blocks 2402, 2403 and 2404 may be checked by prediction unit 1002 if blocks 2402 and 2403 is coded using BV-based intra mode.

[0436] As mentioned above, FIG. 25 illustrates a flowchart of an example method 2500 of predicting a current block using BV-based technique, according to some implementations. The BV-based technique may be used in intra prediction unit 1004 and inter prediction unit 1003. For example, BV-based intra prediction technology may include intra template matching prediction (IntraTMP) , intra block copy (IBC) , spatial geometric partitioning mode (SGPM) , and so on. Additionally, the BV-based technique may be used in inter prediction technology, e.g., such as the Geometric partitioning mode (GPM) . It should be noted that the following BV-based prediction may be applied to either intra or inter prediction.

[0437] Referring to FIG. 25, at block 2502, a block vector of a current block may be determined as follows.

[0438] Methods for determining the BV of the current block include, but are not limited to, 1) performing motion search in the reconstructed area of the current picture to obtain the best BV for the current block and 2) constructing a BV Merge list for the current block by using the BV of the reconstructed block in the spatial and temporal domains. In general, BV has two precision options: integer-pel precision and sub-pel precision. The sub-pel precision may include 1 / 2-pel precision, 1 / 4-pel precision, or 1 / 16-pel precision, etc.

[0439] In some implementations, the BV of the current block may be determined based on a motion search. To perform a motion search, one type of template shown in FIGs. 5A-5C may be determined for the current block. Then, a search may be performed to identify a matching template with the smallest matching cost with the template of the current block in the reconstructed area of the current picture. An area with the same size as the current block corresponding to the matching template may be determined as the reference block. The BV of the current block may be determined based on the current block and the reference block.

[0440] In some implementations, the BV of the current block may be determined based on a BV merge list. The BV merge list may include at least one of spatial merge candidate, temporal merge candidate, history-based merge candidate, pairwise average merge candidate, and default merge candidate.

[0441] In some implementations, the BV merge list may be constructed based on spatial merge candidates. As shown in FIG. 26, the spatial merge candidates 2600 include merge candidates A1, B1, B0, A0, and B2. Spatial merge candidates A1, B1, B0, A0, and B2 are sequentially checked. If one of the spatial merge candidates A1, B1, B0, A0 and B2 is available and the available spatial merge candidate applies a BV-based prediction mode, then the BV of that spatial merge candidate may be added to the BV merge list. If the number of BV merge candidates added in the BV merge list is smaller than the allowable maximum value of the BV merge list after checking the spatial merge candidates, then one or more temporal merge candidates may be checked. One or more collocated positions in the collocated picture may be determined and temporal merge candidates corresponding to the collocated positions may be checked. If a temporal merge candidate is available and applies BV-based prediction mode, then the BV of the temporal merge candidate may be added to the BV merge list. If the number of BV merge candidates added in the BV merge list is smaller than the allowable maximum value of the BV merge list after checking the temporal merge candidates, the history-based merge candidates, pairwise average merge candidate, or default merge candidate may be checked. The BV for the current block may be determined from the BV merge list based on corresponding cost values. In some cases, the BV merge list may be reordered, and the BV for the current block may be determined based on cost values after the reordering.

[0442] It should be noted that, at operation 2502, other methods may be used to determine the BV for the current block. The following embodiments may be applied as long as a BV is used in the process of prediction, regardless of how the BV is obtained. In some cases, the BV may be determined having a integer-pel precision. In some cases, BV may be determined having a sub-pel precision, including 1 / 2-pel precision, 1 / 4-pel precision, or 1 / 16-pel precision, etc. A BV with a sub-pel precision means the BV may refer to a fractional-pel position of the reconstruction area of the current picture. A BV with an integer-pel precision means the BV may refer to an integer-pel position of the reconstruction area of the current picture.

[0443] If an integer-pel precision BV is determined, to improve the precision of the BV, or considering the unity of BV precision, the integer-pel precision BV may be converted to sub-pel precision. In one example, the integer-pel precision BV may be converted to the sub-pel precision BV according to the following functions: xfrac=xint<< (FRAC_BITS-INT_BITS) , and yfrac=yint<< (FRAC_BITS-INT_BITS) .

[0444] The sub-pel precision BV is represented by (xfrac, yfrac) , and integer-pel precision BV is represented by (xint, yint) , where xfrac or xint indicates a horizontal value of the BV and yfrac or yint indicates a vertical value of the BV.

[0445] The sub-pel precision may be represented by FRAC_BITS and the integer-pel precision may be represented by INT_BITS. INT_BITS indicates a number of bits representing a BV with integer-pel precision, and FRAC_BITS indicates a number of bits representing a BV with sub-pel precision. In an example, the value of INT_BITS is equal to 2. The value of FRAC_BITS of 1 / 2-pel precision is equal to 3. The value of FRAC_BITS of 1 / 4-pel precision is equal to 4. The value of FRAC_BITS of 1 / 16-pel precision is equal to 6. Of course, the values of INT_BITS and values of FRAC_BITS of different sub-pel precisions may be determined as different preset values; or the values of INT_BITS and values of FRAC_BITS of different sub-pel precisions may be determined adaptively based on the network conditions.

[0446] At operation 2504, the block vector of the current block may be adjusted.

[0447] Different prediction modes may utilize BVs with different pel precisions. Therefore, for the BV of the current block, an adjustment of the BV may be determined based on the prediction mode.

[0448] In some implementations, if the determined BV of the current block has a sub-pel precision and prediction mode utilizes a BV with integer-pel precision, a rounding operation may be performed on the determined BV of the current block to obtain an adjusted BV with integer-pel precision. The rounding operation may include, but is not limited to, rounding, rounding up and rounding down.

[0449] In one example, a rounding process may be performed on the determined BV (xfrac, yfrac) of the current block to determine an adjusted BV. An adjusted sub-pel precision BV (xint, yint) of the current block may be determined according to the following function (s) : If xfrac≥0, xint=(xfrac+nOffset-1)>>rightShift; If xfrac<0, xint=(xfrac+nOffset)>>rightShift; If yfrac≥0, yint=(yfrac+nOffset-1)>>rightShift; and If yfrac<0, yint=(yfrac+nOffset)>>rightShift, where rightShift and nOffset may be determined as follows: rightShift=FRAC_BITS-INT_BITS; and nOffset=1<< (rightShift-1) .

[0450] If BV (xfrac, yfrac) has a 1 / 2-pel precision, FRAC_BITS is equal to 3, and INT_BITS is equal to 2; thus, rightShift=1 and nOffset=1. If BV (xfrac, yfrac) has a 1 / 4-pel precision, FRAC_BITS is equal to 4, and INT_BITS is equal to 2; thus, rightShift=2 and nOffset=2. If BV (xfrac, yfrac) has a 1 / 16-pel precision, FRAC_BITS is equal to 6, and INT_BITS is equal to 2; thus, rightShift=4 and nOffset=8.

[0451] In one example, a rounding down process may be performed on the determined BV (xfrac, yfrac) to determine an adjusted BV (xint, yint) of the current block using the following functions: xint=xfrac>> (FRAC_BITS-INT_BITS) , and yint=yfrac>> (FRAC_BITS-INT_BITS) .

[0452] In one example, a rounding up process may be performed on the determined BV (xfrac, yfrac) to determine an adjusted BV (xint, yint) of the current block using the following functions: xtemp[= (xfrac>> (FRAC_BITS-INT_BITS) ) << (FRAC_BITS-INT_BITS) ; ytemp= (yfrac>> (FRAC_BITS-INT_BITS) ) << (FRAC_BITS-INT_BITS) ; If xfrac=xtemp, xint=xfrac>> (FRAC_BITS-INT_BITS) ; If xfrac≠xtemp, xint=xfrac>> (FRAC_BITS-INT_BITS) +1; If yfrac=ytemp, yint=yfrac>> (FRAC_BITS-INT_BITS) ; and If yfrac≠ytemp, yint=yfrac>> (FRAC_BITS-INT_BITS) +1.

[0453] If a sub-pel precision BV is obtained for the current block, the sub-pel precision BV may be converted to an integer-pel precision BV for use in predicting the current block. In this way, a reference block may be determined in the reference area based on the integer-pel precision BV with no sample interpolation, thereby improving coding efficiency.

[0454] In some implementations, the BV of the current block may be adjusted based on refinement. In one example, if the determined BV of the current block has a sub-pel precision, the determined BV may be adjusted based on a rounding operation to obtain an integer-pel precision BV, and the integer-pel precision BV may be further refined. The rounding operation may include, but is not limited to, rounding, rounding up, or rounding down. Using a refined BV for the prediction process may improve prediction accuracy.

[0455] FIG. 27 illustrates example sub-pel and integer-pel positions 2700, according to some implementations. Sub-pel positions include 1 / 4-pel positions, 1 / 2-pel positions and 3 / 4-pel positions. The sub-pel position may be represented by FracPre. The sub-pel direction may include eight directions: left (LEFT_POS) , above left (ABOVE_LEFT_POS) , left bottom (LEFT_BOTTOM_POS) , right (RIGHT_POS) , above right (ABOVE_RIGHT_POS) , right bottom (RIGHT_BOTTOM_POS) , above (ABOVE_POS) and bottom (BOTTOM_POS) . The sub-pel direction may be represented by FracDir. The sub-pel position may also be referred to as “fractional-pel position” or “fractional sample position. ” The integer-pel position may also be referred to as “integer sample position. ”

[0456] An integer-pel precision BV may be adjusted to a sub-pel precision BV. For example, a sub-pel precision BV, BV′int (xint, y′int) , may be determined based on an integer-pel precision BV, BVint (xint, yint) , according to the following functions: x′int=xint<< (FRAC_BITS-INT_BITS) , and y′int=yint<< (FRAC_BITS-INT_BITS) .

[0457] A sub-pel precision BV (arefined BV) , BVfrac, may be determined based on the sub-pel precision BV, BV′int, the FracPre (e.g., sub-pel position) , and FracDir (e.g., the sub-pel direction) .

[0458] A sub-pel step absDistance may be determined based on sub-pel position FracPre. The sub-pel step absDistance may also be referred to as “fractional sub step absDistance” or “fractional sample step absDistance. ”

[0459] If FracPre is 1 / 4-pel position, absDistance= (1<< (FRAC_BITS-INT_BITS) ) >>2.

[0460] If FracPre is 1 / 2-pel position, absDistance= (1<< (FRAC_BITS-INT_BITS) ) >>1.

[0461] If FracPre is 3 / 4-pel position, absDistance= (1<< (FRAC_BITS-INT_BITS) ) >>2×3.

[0462] For example, if sub-pel precision is 1 / 16-pel precision, FRAC_BITS is equal to 6 and INT_BITS is equal to 2. If FracPre is 1 / 4-pel position, sub-pel step absDistance is equal to 4. If FracPre is 1 / 2-pel position, sub-pel step absDistance is equal to 8. If FracPre is 3 / 4-pel position, sub-pel step absDistance is equal to 12.

[0463] A horizontal offset xDistance and a vertical offset yDistance may be determined based on the sub-pel step absDistance and sub-pel direction FracDir.

[0464] If the FracDir is LEFT_POS, ABOVE_LEFT_POS, or LEFT_BOTTOM_POS, xDistance=-absDistance.

[0465] If FracDir is RIGHT_POS, ABOVE_RIGHT_POS, or RIGHT_BOTTOM_POS, xDistance=absDistance.

[0466] If FracDir is ABOVE_POS, ABOVE_LEFT_POS or ABOVE_RIGHT_POS, yDistance=-absDistance.

[0467] If FracDir is BOTTOM_POS, LEFT_BOTTOM_POS or RIGHT_BOTTOM_POS, yDistance=absDistance.

[0468] A refined BV, BVfrac (xfrac, yfrac) , may be determined based on the sub-pel precision BV, BV′int (x′int, y′int) , the horizontal offset xDistance, and the vertical offset yDistance, where xfrac=x′int+xDistance and yfrac=y′int+yDistance.

[0469] As shown in FIG. 27, for example, assuming BV (2701) is the sub-pel precision BV, BV′int (x′int, y′int) , BV (2702) is a 1 / 4-pel position, absDistance=4, FracDir is ABOVE_LEFT_POS, xDistance=-4, and yDistance=-4, the refined BV, BVfrac (xfrac, yfrac) , may be determined as: xfrac=x′int-4 and yfrac=y′int-4.

[0470] In another example, assuming BV (2701) is the sub-pel precision BV, BV′int (x′int, y′int) , BV (2703) is a 1 / 2-pel position, absDistance=8, FracDir is ABOV_RIGHT_POS, xDistance=8, and yDistance=-8, the refined BV, BVfrac (xfrac, yfrac) , may be determined as: xfrac=x′int+8 and yfrac=y′int-8.

[0471] In a further example, assuming BV (2701) is the sub-pel precision BV, BV′int (x′int, y′int) , BV (2704) is a 3 / 4-pel position, absDistance=12, FracDir is LEFT_BOTTOM_POS, xDistance=-12, and yDistance=12, the refined BV, BVfrac (xfrac, yfrac) , may be determined as: xfrac=x′int-12 and yfrac=y′int+12.

[0472] All or a preset number of sub-pel positions may be traversed in the reconstructed area of the current frame based on template matching cost to determine a refined BV of the current block. For example, the matching cost of each sub-pel precision BV, BVfrac, may be computed, and the matching cost of the sub-pel precision BV, BV′int , corresponding to integer-pel precision BV, BVint, may be determined, and determine a BVfrac with the smallest matching cost in the reconstructed area may be used as the refined BV used for predicting the current block. The type of template may be determined based on the availability of neighboring reference samples.

[0473] Referring to FIG. 5C, when the above left, above and left reference samples are all available, the template shape may be the template shown in (a) , e.g., refTemplateType=1.

[0474] When only the left reference samples are available, the template shape may be the template shown in (b) , e.g., refTemplateType=2.

[0475] When only the above reference samples are available, the template shape may be the template shown in (c) , e.g., refTemplateType=3.

[0476] When the left and above left reference samples are available, the template shape may be the template shown in (d) , e.g., refTemplateType=4.

[0477] When the left and left bottom reference samples are available, the template shape may be the template shown in (e) , e.g., refTemplateType=5.

[0478] When the above and above right reference samples are available, the template shape may be the template shown in (f) , e.g., refTemplateType=6.

[0479] When the above and above left reference samples are available, the template shape may be the template shown in (g) , e.g., refTemplateType=7.

[0480] When the above and left reference samples are available, the template shape may be the template shown in (h) , e.g., refTemplateType=8.

[0481] A cost between two templates may be represented as an error between a template and a reference template. As an example, the cost may be a SAD, which may be calculated using equation (1) , shown above. In another example, the cost may be a SATD, which may be calculated according to equation (2) , shown above. Coding accuracy may be improved using BV refinement.

[0482] In another embodiment, predicting current block may consider BV information of a neighboring reconstructed block. Additional information corresponding to the adjacent block is comprehensively considered and may improve the prediction accuracy. In this process, a BV flip operation 2800, 2801 may be applied, as shown in FIGs. 28A and 28B.

[0483] In some implementations, BV of current block may be determined based on a neighboring reconstructed block. The determined BV of the neighboring reconstructed block may be represented by,  and the flip indication, which indicates whether the BV flip operation is a horizontal flip (see FIG. 28A) or a vertical flip (see FIG. 28B) , may be represented by, rribcFlipTypenbr. The adjusted BV determined based on the flip operation may be represented by,  and the flip indication may be represented by, rribcFlipTypecur.

[0484] If rribcFlipTypenbr is equal to 0, no flip may be performed. In this example,  and rribcFlipTypecur=rribcFlipTypenbr=0.

[0485] If rribcFlipTypenbr is equal to 1, a horizontal flip (see FIG. 28A) may be performed. In this example,  and rribcFlipTypecur=rribcFlipTypenbr=1.

[0486] A schematic diagram of the horizontal flip operation 2800 is illustrated in FIG. 28A. Assume the current block is a chroma block and xnbr is the X coordinate of the center position of the adjacent reconstructed block. If the current BV information is determined based on the luma block, then xcur is the X coordinate of the center position of the co-located luma block of the current block. If the current BV information is determined based on the chroma block, then xcur is the X coordinate of the center position of the current block. Assuming the current block is a luma block, the method may be the same.

[0487] If rribcFlipTypenbr is equal to 2, a vertical flip may be performed. In this example,  and rribcFlipTypecur=rribcFlipTypenbr=2.

[0488] A schematic diagram of the vertical flip operation 2801 is illustrated in FIG. 28B. Assume the current block is a chroma block and ynbr is the Y coordinate of the center position of the adjacent reconstructed block. If the current BV information is determined based on the luma block, then ycur is the Y coordinate of the center position of the co-located luma block of the current block. If the current BV information is determined based on the chroma block, then ycur is the Y coordinate of the center position of the current block. Assuming the current block is a luma block, the method may be the same.

[0489] Referring again to FIG. 25, at operation 2506, the current block may be predicted based on the adjusted BV.

[0490] A reference block in the current frame may be determined based on the adjusted BV, and a prediction of the current block may be determined based on the reference block.

[0491] The BV used for predicting current block may be stored for use in the prediction of a subsequent block. The BV may be stored in sub-pel precision.

[0492] In one example, the BV may be stored in 1 / 2-pel precision. In one example, the BV may be stored in 1 / 4-pel precision. In one example, the BV may be stored in 1 / 16-pel precision. In one example, the BV may be stored in at least two kinds of sub-pel precisions of 1 / 2-pel precision, 1 / 4-pel precision, and / or 1 / 16-pel precision. In one example, the encoder and decoder may use a unified default sub-pel precision. In one example, the encoder may determine one or more sub-pel precision and signal a precision indication in the bitstream. The decoder may determine to store the BV with a precision based on the precision indication. The precision indication may be sequence level, picture level, slice level and block level. The precision indication may be associated with prediction mode.

[0493] It is possible to store both the integer-pel precision BV and the sub-pel precision BV of the current block. In some cases, integer-pel precision BV may be derived based on the sub-pel precision BV. However, storing both integer-pel precision BV and sub-pel precision BV consumes more memory than only storing one of them. Thus, to reduce memory consumption sub-pel precision BV rather than integer-pel precision BV may be stored. This improves memory usage efficiency.

[0494] In one example, intra prediction unit 1004 may use an NN-based intra prediction mode to derive a prediction of the current block. FIG. 29 illustrates an example of NN-based intra prediction 2900, according to some embodiments.

[0495] Block 2901 (block Y) is a current block having w×h samples. The samples 2902 adjacent to block 2901 are reference samples. Let “X” be an input of the NN-based intra prediction process. In one example, “X” may be one or more samples among the samples 2902. In one example, “X” may be derived by filtering one or more samples among the samples 2902. Block 2903 is an output of the NN-based intra prediction process. In one example, block 2903 is an intra prediction of block 2901.

[0496] In one example, inter prediction unit 1003 may also derive motion parameters and / or prediction samples using an NN-based method or process.

[0497] Prediction unit 1002 may pass the derived one or more intra prediction modes or one or more angular prediction directions (intra prediction mode or angular prediction direction also may be called as “intra prediction direction” ) to transform unit 1006. In one embodiment, transform unit 1006 may use such information to determine transform kernel or a set of transform kernels in the primary transform and / or secondary transform.

[0498] When parameter from parsing unit 1001 indicates that region transform is applied to decode the current block, transform unit 1006 may derive residual sample of the current block as following. When transform unit 1006 uses region transform to code the current block, transform unit 1006 determines parameters indicating a position and size of a region in the current block, and performs transform to obtain the reconstructed samples in the region. The reconstructed samples are residual samples. The transform unit 1006 sets a value of a sample in the remaining region of the current block to be equal to 0, wherein the said sample is a residual sample.

[0499] Transform unit 1006 in decoder 1000 may determine, according to one or more parameters from parsing unit 1001, that a region or a sub-block in a current block and performs transform on the samples in this region or sub-block. FIG. 19 demonstrates an example of region transform of a current block. The current block 1900 may be a coding block, a coding unit, a transform unit or a sub-block. Region 1901 is the said region in the current block 1900. Transform unit 1006 will perform a transform on the coefficients obtained by parsing unit 1001 in region 1901 to determine a sample in region 1901, and set a value of a sample or coefficient in the remaining region 1902 in the current block 1900 to be equal to 0. The sample in region 1901 may be residual sample of the current block. Transform unit 1006 may obtain a region parameter from parsing unit 1001 indicating the region 1901 including at least one of the following: [Parameter 1] : position of region 1901 and / or [Parameter 2] : size of region 1901.

[0500] As an option, transform unit 1006 may determine, according to the parameter from parsing unit 1001, that more than one region in a current block may be transformed. FIG. 19 also shows an example in which two regions are in a current block. Transform unit 1006 will perform transform on coefficients in regions 1911 and 1913 in a current block 1910, and set a value of a sample or coefficient in the remaining region 1912 in the current block 1910 to be equal to 0. The sample in regions 1911 and 1912 may be residual sample of the current block. Transform unit 1006 may obtain one or more region parameters from parsing unit 1001 indicating region 1911 and 1913 including one or both of [Parameter 1] and [Parameter 2] .

[0501] In the following descriptions, current block 1900 may be taken as an example. The implementation with multiple regions containing coefficients (e.g., current block 1911) is carried out using similar method to indicate the regions.

[0502] As mentioned above, FIGs. 20A and 20B illustrates examples of region transform. Transform unit 1006 performs transform on a coefficient in a gray region in a current block and sets a value of a sample or coefficient in the remaining region in a current block to be equal to 0, wherein the sample may be a residual sample after prediction. The “arrays” of each gray region demonstrates the transform directions and transform kernel of each direction.

[0503] In one example, the gray region in FIGs. 20A and 20B is at a pre-defined position with pre-defined size. For example in FIGs. 20A and 20B, [Parameter 2] may be one or more parameters indicating a split type of a current block (e.g., quad, triple, horizontal or vertical) , and [Parameter 1] may be one or more parameters indicating which one of the regions, according to the split type of a current block as indicated by [Parameter 2] , is the region on a sample of which transform unit 1006 performs a transform. Transform unit 1006 may derive a width and a height (i.e. a size) of a gray region according to the abovementioned parameters obtained from parsing unit 1001. For example, given that a size (e.g., width x height) of the current block is 4Wx4H. The size (e.g., represented width x height of a region in the current block) and position (e.g., represented by a location of top-left sample of a region in the current block) of a gray region in FIGs. 20A and 20B are shown above in Tables 8A-8D.

[0504] As mentioned above, FIG. 21 illustrates examples of region transform. Transform unit 1006 performs transform on a coefficient in a gray region in a current block and sets a value of a sample or coefficient in the remaining region in a current block to be equal to 0, wherein the sample may be a residual sample. The “arrays” of each gray region demonstrates the transform directions and transform kernel of each direction.

[0505] A size of a gray region 2101, 2111 or 2121 may be represented as gW x gH, wherein gW is a width of the gray region, and gH is a height of the gray region, and a position of a gray region may be represented by a location of a top-left sample in the gray region in the current block, e.g., (dx, dy) .

[0506] Transform unit 1006 may determines values of dx and dy of [Parameter 1] , and gW and gH of [Parameter 2] .

[0507] Optionally, transform unit 1006 may first determine a split type of a gray region according to parameter from parsing unit 1001. For example, a split type of gray region 2101 is “arbitrary type, ” which indicates that gW and gH are smaller than a with and a height of the current block 2100, respectively. In this case, transform unit 1006 determines values of dx and dy of [Parameter 1] , and gW and gH of [Parameter 2] for gray region 2101. For example, a split type of gray region 2111 is “vertical type, ” transform unit 207 determines values of dx of [Parameter 1] , and gW of [Parameter 2] for gray region 2111, as dy may be inferred to be 0 and gH may be inferred to be equal to the height of the current block 2110. For example, a split type of gray region 2121 is “horizontal type, ” transform unit 207 determines values of dy of [Parameter 1] , and gH of [Parameter 2] for gray region 2121, as dx may be inferred to be 0 and gW may be inferred to be equal to the width of the current block 2120.

[0508] In an example, dx and dy are represented in a precision of integral sample in a bitstream.

[0509] In another example, dx and dy are represented in a precision of multiple samples. For example, dx is represented as dx>>shift in a bitstream, wherein shift is an non-negative integer, and “dx>>shift” is arithmetic right shift of a two's complement integer representation of dx by shift binary digits. When obtaining a corresponding parameter (e.g. denoted as “Offset” here) from parsing unit 1001, transform unit 1006 sets a value of dx to be equal to Offset<<shift, wherein “Offset<<shift” is arithmetic left shift of a two's complement integer representation of Offset by shift binary digits. “shift” may be a fixed value, for example 1, 2, 3, 4, …, Log2 (MaxCuSize) - 1, wherein MaxCuSize is the maximum value of a width or height of a coding unit and Log2 (MaxCuSize ) is a base-2 logarithm of MaxCuSize. Examples of a representation of dy in a bitstream and a derivation of dy value according to parameter from parsing unit 1001 is the same as that of dx.

[0510] Adder 1007 performs addition operation with its inputs of prediction block from prediction unit 1002 and reconstructed residual from 1006 to get reconstructed block of the current decoding block. The reconstructed block is also sent to prediction unit 1002 to be used as reference for other blocks coded in intra prediction mode.

[0511] In one embodiment, after the CUs in a picture or a sub-picture have been reconstructed, filtering unit 1008 performs in-loop filtering on the reconstructed picture or sub-picture. Filtering unit 1008 contains one or more filters, for example, deblocking filter, sample adaptive offset (SAO) filter, adaptive loop filter (ALF) , luma mapping with chroma scaling (LMCS) filter and neural network based filters. Alternatively, when filtering unit 1008 determines that the reconstructed block is not used as reference for decoding other blocks, filtering unit 1008 performs in-loop filtering on one or more target pixels in the reconstructed block.

[0512] In one embodiment, filtering unit 1008 would process filtering on the reconstructed samples of one or more color components of the current block (e.g., a CU) . The decoder 1000 stores the filtered reconstructed samples of one or more color components of the current block in a picture buffer for a picture in which the current block locates. Thus, the prediction unit 1002 can use the filtered samples of the current block in decoding the succeeding block of the current block in decoding order. For example, the prediction unit 1002 can use the filtered samples of the current block to derive a prediction of succeeding block of the current block in decoding order. For example, the prediction unit 1002 as well as other units in decoder 1000, would include the filtered samples of the current block in a template and derive of a prediction, reordering candidate modes or parameters, and / or decoding parameters using template matching approach. Since the filtering unit 1008 suppresses reconstruction distortion of the current block introduced by the lossy source coding of encoder 200, when the filtered sample of the current block is used to decode the succeeding block, the prediction efficiency of the succeeding block has been improved, and thus the coding efficiency may be greatly improved.

[0513] In one embodiment, the filtering unit 1008 uses one or more fixed 1D or 2D filters to process the reconstruct sample of the current block. For example, the 1D filter may be a symmetry filter. For example, the 1D filter may be an asymmetry filter. For example, the 2D filter may be a symmetry filter. For example, the 2D filter may be an asymmetry filter. For example, the 2D filter may be a separable filter. For example, the 2D filter may be a non-separable filter.

[0514] In one embodiment, the filtering unit 1008 uses one or more adaptive 1D or 2D filters to process the reconstruct sample of the current block. For example, the 1D filter may be a symmetry filter. For example, the 1D filter may be an asymmetry filter. For example, the 2D filter may be a symmetry filter. For example, the 2D filter may be an asymmetry filter. For example, the 2D filter may be a separable filter. For example, the 2D filter may be a non-separable filter.

[0515] In one embodiment, the filtering unit 1008 uses one or more neural-network based filters to process the reconstruct sample of the current block.

[0516] In one embodiment, the filtering unit 1008 can use one or more filters of the spatial and / or temporal neighboring blocks of the current block. In one example, the filters from neighboring blocks may include the filter used to filter reconstructed sample of the neighboring blocks before filtering which is invoked after reconstructing a picture where the neighboring block locates. In one example, the filters from neighboring blocks may include the filter used to filter reconstructed sample of the neighboring blocks after reconstructing a picture where the neighboring block locates. One example is that filtering unit 1008 may use the adaptive loop filter (ALF) which is used to filter a temporal neighboring block of the current block. In one example, the filtering unit 1008 may select one or more existing filters which are available before filtering the current block. One example is that the filters with parameters are obtained, by parsing unit 1001, from block layer (e.g. coding tree unit or coding unit) or a layer higher than a block layer of the current block (e.g. video parameter set, sequence parameter set, picture parameter set, adaption parameter set, picture header and / or slice header) of the bitstream.

[0517] In one embodiment, filtering unit 212 may obtain an indication parameter from parsing unit 1001, which is to indicate whether the reconstructed sample in the current block is needed to be filtered or not. For example, the indication parameter may be a 1 bit flag. For example, the indication parameter may be a variable with a number of values indicating not only whether the reconstruct sample is needed to be filtered but also which filter is used. When the variable is equal to 0, the reconstructed sample of the current block will not be filtered; otherwise, the reconstructed sample of the current block is filtered with a filter with an index equal to the value of this variable.

[0518] In one embodiment, filtering unit 1008 may also obtain indication parameter from parsing unit 1001, which is to indicate which color component may be filtered. Filtering unit 1008 can choose to filter one or more of the luma and two chroma components.

[0519] Output of filtering unit 1008 is a decoded picture or sub-picture, which is forwarded to DPB (decoded picture buffer) 1009. DPB 1009 outputs decoded pictures according to timing and controlling information. Pictures stored in DPB 1009 may also be employed as reference for performing inter or intra prediction by prediction unit 1002.

[0520] Decoder 1000 could be a computing device with a processor and a storage medium recording a decoding program. When the processor reads and executes the decoding program, the decoder 1000 reads an input video bitstream and generates corresponding decoded video.

[0521] Decoder 1000 could be a computing device with one or more chips. The units, implemented as integrated circuits, on the chip are of similar functionalities with similar connections as well as data exchangings as the corresponding ones in FIG. 10.

[0522] FIG. 11 illustrates an example source device 1100. Acquisition unit 1101 acquires a video signal and forwards the video signal to encoder 1102. Acquisition unit 1101 may be a device containing one or more cameras (including depth cameras) . Acquisition unit 1101 may be a device that partially or completely decodes a bitstream to get a video. Acquisition unit 1101 may also contain one or more elements to capture audio signal. An embodiment of encoder 1102 is the encoder 200 that codes the video signal from acquisition unit 1101 as its input video and generates a video bitstream. Encoder 1102 may also contains one or more audio encoder to code the audio signal to generate an audio bitstream. Storage / sending unit 1103 receives the video bitstream from encoder 1102. Storage / sending unit 1103 may also receive the audio bitstream from encoder 1102 and encapsulate the video bitstream together with the audio bitstream to form a media file (e.g. ISO based media file format) or transport stream. Optionally, storage / sending unit 1103 writes the media file or transport stream in a storage unit. e.g. hard disc, DVD disc, cloud, portable memory devices. Optionally, storage / sending unit 1103 sends the bitstream to a transport network, for example, Internet, wireline networks, cellular networks, wireless local area networks, etc.

[0523] FIG. 12 illustrates an example destination device 1200. Receiving unit 1201 receives the media file or transport stream from networks or reads the media file or transport stream from a storage device. Receiving unit 1201 separates the video bitstream and the audio bitstream from the media file or transport stream. Receiving unit 1201 can also generate a new video bitstream by extracting the video bitstream. Receiving unit 1201 may also generate a new audio bitstream by extracting the audio bitstream. Decoder 1202 includes one or more video decoders, e.g. the decoder 1000. Decoder 1202 may also contains one or more audio decoders. Decoder 1202 decodes the video bitstream and the audio bitstream from receiving unit 1201 to get a decoded video and one or more decoded audio corresponding to one or multiple channels. Rendering unit 1203 performs operations on the reconstructed video to make it suitable for displaying. Such operations may include one or more of the following operations to improve perceptual quality: denoising, synthesis, conversion of color space, upsampling, downsampling, etc. Rendering unit 1203 may also performs operations on the decoded audio to improve the perceptual quality of the audio signal for displaying.

[0524] FIG. 13 illustrates a communication system 1300. Source device 1301 is a source device 1100. Output of the storage / sending unit 1103 is processed by storage medium / transport networks 1302 for storage or transport the bitstream. Destination Device 1303 is a destination device 1200. Receiving unit 1201 gets the bitstream from storage medium / transport networks 1302. Receiving unit 1201 may extract a new video bitstream from the media file or transport stream. Receiving unit 1201 may also extract a new audio bitstream from the media file or transport stream.

[0525] In an example of a session negotiation between Source Device 1301 and Destination Device 1303, Source Device 1301 may send its NN-ability information to Destination Device 1303. For example, Source Device 1301 may indicate that it may provide a bitstream that may be decoded using an NN-based decoding process, and it may also provide a bitstream that may be decoded without using an NN-based decoding process. When receiving the NN-ability information of Source Device 1301, Destination Device 1303 will check its own NN-ability information and feedback to Source Device 1301. One example is that Destination Device 1303 informs Source Device 1301 that it supports an NN-based decoding process and a non-NN-based decoding process, and the Source Device 1301 may determine to send Destination Device 1303 either a bitstream that may be decoded using an NN-based decoding process or another bitstream that may be decoded without using an NN-based decoding process. One example is that Destination Device 1303 informs Source Device 1301 that it only supports NN-based decoding process, and the Source Device 1301 may only determine to send Destination Device 1303 a bitstream that may be decoded using an NN-based decoding process. One example is that Destination Device 1303 informs Source Device 1301 that it only supports a non-NN-based decoding process, and the Source Device 1301 can determine to send Destination Device 1303 a bitstream that may be decoded without using an NN-based decoding process. In the above examples, if the NN-ability information further includes a quantization-error bounds for performing NN-based process, Source device 1301 and Destination Device 1303 may also exchange their quantization-error bounds for NN-based process parameters, and if the error-bounded parameters can secure reproducibility or interoperability between Source device 1301 and Destination Device 1303, the Source Device 1301 may determine to send Destination Device 1303 a bitstream that may be decoded using an NN-based decoding process.

[0526] In an example of a session negotiation between Source Device 1301 and Destination Device 1303, Destination Device 1303 may send its NN-ability information to Source Device 1301 to request data or a bitstream from Source Device 1301. For example, Destination Device 1303 may indicate that it can decode a bitstream using an NN-based decoding process, and it can also decode a bitstream independent of an NN-based decoding process. When receiving the NN-ability information of Destination Device 1303, Source Device 1301 may check NN-ability information for decoding a bitstream and feedback to Destination Device 1303. One example is that Destination Device 1303 informs Source Device 1301 that it supports NN-based decoding process and non-NN-based decoding process, and the Source Device 1301 may determine to send Destination Device 1303 either a bitstream that may be decoded using an NN-based decoding process, or another bitstream that may be decoded without using an NN-based decoding process. One example is that Destination Device 1303 informs Source Device 1301 that it only supports NN-based decoding process, and the Source Device 1301 will only determine to send Destination Device 1303 a bitstream that may be decoded using an NN-based decoding process. One example is that Destination Device 1303 informs Source Device 1301 that it only supports non-NN-based decoding process, and the Source Device 1301 can determine to send Destination Device 1303 a bitstream that may be decoded without using an NN-based decoding process. In the above examples, if the NN-ability information further includes a quantization-error bounds for performing NN-based process, Source device 1301 and Destination Device 1303 may also exchange their quantization-error bounds for NN-based process parameters, and if the error-bounded parameters can secure reproducibility or interoperability between Source device 1301 and Destination Device 1303, the Source Device 1301 may determine to send Destination Device 1303 a bitstream that may be decoded using an NN-based decoding process.

[0527] In the above examples, Source Device 1301 may be a device that provides a content bitstream (e.g., one of a content server, a camera, a mobile phone, a tablet, a computer and etc. ) . Destination Device 1301 may be a device that can decodes the content bitstream (e.g., one of a set-top box, an over-the-top box, a TV, a mobile phone, a tablet, a computer, etc. ) .

[0528] FIG. 14 illustrates an example of video codec system 1400, according to some embodiments of the present disclosure.

[0529] The video codec system 1400 according to an embodiment may include an encoding apparatus 1410 and a decoding apparatus 1420. The encoding apparatus 1410 may deliver encoded video and / or image information or data to the decoding apparatus 1420 in the form of a file or streaming via a digital storage medium or network.

[0530] The encoding apparatus 1410 according to an embodiment may include a video source generator 1411, an encoding unit 1412 (which may be encoder 200) and a transmitter 1413. The decoding apparatus 1420 according to an embodiment may include a receiver 1421, a decoding unit 1422 (which may be decoder 1000) and a renderer 1423. The encoding unit 1412 may be called a video / image encoding unit, and the decoding unit 1422 may be called a video / image decoding unit. The transmitter 1413 may be included in the encoding unit 1412. The receiver 1421 may be included in the decoding unit 1422. The renderer 1423 may include a display and the display may be configured as a separate device or an external component.

[0531] The video source generator 1411 may acquire a video / image through a process of capturing, synthesizing or generating the video / image. The video source generator 1411 may include a video / image capture device and / or a video / image generating device. The video / image capture device may include, for example, one or more cameras, video / image archives including previously captured video / images, and the like. The video / image generating device may include, for example, computers, tablets and smartphones, and may (electronically) generate video / images. For example, a virtual video / image may be generated through a computer or the like. In this case, the video / image capturing process may be replaced by a process of generating related data.

[0532] The encoding unit 1412 may encode an input video / image. The encoding unit 1412 may perform a series of procedures such as prediction, transform, and quantization for compression and coding efficiency. The encoding unit 1412 may output encoded data (encoded video / image information) in the form of a bitstream.

[0533] The transmitter 1413 may transmit the encoded video / image information or data output in the form of a bitstream to the receiver 1421 of the decoding apparatus 1420 through a digital storage medium or a network in the form of a file or streaming. The digital storage medium may include various storage mediums such as USB, SD, CD, DVD, Blu-ray, HDD, SSD, and the like. The transmitter 1413 may include an element for generating a media file through a predetermined file format and may include an element for transmission through a broadcast / communication network. The receiver 1421 may extract / receive the bitstream from the storage medium or network and transmit the bitstream to the decoding unit 1422.

[0534] The decoding unit 1422 may decode the video / image by performing a series of procedures such as dequantization, inverse transform, and prediction corresponding to the operation of the encoding unit 1412.

[0535] The renderer 1423 may render the decoded video / image. The rendered video / image may be displayed through the display.

[0536] The embodiments described herein may be implemented and performed on a processor, microprocessor, controller, or chip. For example, the functional units shown in each drawing may be implemented and performed on a computer, processor, microprocessor, controller, or chip. In this case, information for implementation (e.g., information on instructions) or an algorithm may be stored in a digital storage medium.

[0537] In addition, the decoding apparatus and the encoding apparatus to which the present technique (s) are applied may be included in a multimedia broadcasting transceiver, a mobile communication terminal, a home cinema video device, a digital cinema video device, a surveillance camera, a video chat device, and a real time communication device such as video communication, a mobile streaming device, a storage medium, camcorder, a video on demand (VoD) service provider, an over the top video (OTT) device, an internet streaming service provider, a 3D video device, a virtual reality (VR) device, an augment reality (AR) device, an image telephone video device, a vehicle terminal (ex. a vehicle (including an autonomous vehicle) terminal, an airplane terminal, a ship terminal, etc. ) and a medical video device, and the like, and may be used to process an image signal or data. For example, the OTT video device may include a game console, a Blu-ray player, an Internet-connected TV, a home theater system, a smartphone, a tablet PC, a digital video recorder (DVR) , and the like.

[0538] In addition, the processing method to which the present technique (s) is applied may be produced in the form of a program executed by a computer and may be stored in a computer-readable recording medium. Multimedia data having a data structure according to the embodiment (s) of this document may also be stored in the computer-readable recording medium. The computer readable recording medium includes all kinds of storage devices and distributed storage devices in which computer readable data is stored. The computer readable recording medium may be, for example, a Blu-ray disc (BD) , a universal serial bus (USB) , a ROM, a PROM, an EPROM, an EEPROM, a RAM, a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device. The computer-readable recording medium also includes media embodied in the form of a carrier wave (ex. transmission over the Internet) . In addition, a bitstream generated by the encoding method may be stored in the computer-readable recording medium or transmitted through a wired or wireless communication network.

[0539] In addition, the embodiment of the present technique (s) may be embodied as a computer program product based on a program code, and the program code may be executed on a computer by the embodiment (s) of the present technique (s) . The program code may be stored on a carrier readable by a computer.

[0540] FIG. 15 illustrates an example of communication system 1500, according to some embodiments of the present disclosure. Referring to FIG. 15, the communication system 1500 to which the present technique (s) is applied may largely include an encoding server, a streaming server, a web server, a media storage, a user device, and a multimedia input device.

[0541] The encoding server compresses content input from multimedia input devices such as a smartphone, a camera, a camcorder, etc. into digital data to generate a bitstream and transmit the bitstream to the streaming server. As another example, when the multimedia input devices such as smartphones, cameras, camcorders, etc. directly generate a bitstream, the encoding server may be omitted.

[0542] The bitstream may be generated by an encoding method or a bitstream generating method to which the present technique (s) is applied, and the streaming server may temporarily store the bitstream in the process of transmitting or receiving the bitstream.

[0543] The streaming server transmits the multimedia data to the user device based on a user’s request through the web server, and the web server serves as a medium for informing the user of a service. When the user requests a desired service from the web server, the web server delivers it to a streaming server, and the streaming server transmits multimedia data to the user. In this case, the content streaming system may include a separate control server. In this case, the control server serves to control a command / response between devices in the content streaming system.

[0544] The streaming server may receive content from a media storage and / or an encoding server. For example, when the content is received from the encoding server, the content may be received in real time. In this case, in order to provide a smooth streaming service, the streaming server may store the bitstream for a predetermined time.

[0545] Examples of the user device may include a mobile phone, a smartphone, a laptop computer, a digital broadcasting terminal, a personal digital assistant (PDA) , a portable multimedia player (PMP) , navigation, a slate PC, tablet PCs, ultra-books, wearable devices (ex. smartwatches, smart glasses, head mounted displays) , digital TVs, desktops computer, digital signage, and the like.

[0546] Each server in the content streaming system may be operated as a distributed server, in which case data received from each server may be distributed.

[0547] FIG. 33 illustrates a flow chart of an exemplary method 3300 of decoding, according to some embodiments of the present disclosure. Method 3300 may be performed by an apparatus, e.g., decoder 120 of decoding system 150, decoder 1000, prediction unit 1002, inter prediction unit 1003, intra prediction unit 1004, filtering unit 1008, decoding apparatus 1420, decoding unit 1422, or any other suitable decoding systems. Method 3300 may include operations 3302-3306 as described below. It is understood that some of the operations may be optional, and some of the operations may be performed simultaneously, or in a different order than shown in FIG. 33.

[0548] Referring to FIG. 33, at 3302, indication information associated with a process of deriving a reference sample for a block may be decoded.

[0549] In some implementations, the reference sample may be used in deriving a parameter for decoding the block.

[0550] In some implementations, the reference sample may be used in deriving a prediction sample for decoding the block.

[0551] In some implementations, the process of deriving the reference sample for the block may be a template-matching process.

[0552] In some implementations, the decoding the indication information associated with the process of deriving the reference sample for the block may include decoding the indication information from a sequence-level data unit.

[0553] In some implementations, the sequence-level data unit may be included in one or more of a video parameter set, a sequence parameter set, a picture parameter set, an adaption parameter set, or a picture header.

[0554] In some implementations, the decoding the indication information associated with the process of deriving the reference sample for the block may include decoding the indication information from a picture-level data unit.

[0555] In some implementations, the picture-level data unit may be included in one or more of a picture parameter set, an adaption parameter set, a picture header, or a slice header.

[0556] In some implementations, the decoding the indication information associated with the process of deriving the reference sample for the block may include decoding the indication information from a picture-region-level data unit.

[0557] In some implementations, the picture-region-level data unit may be included in one or more of an adaption parameter set or a slice header.

[0558] In some implementations, the decoding the indication information associated with the process of deriving the reference sample for the block may include decoding the indication information from a block-level data unit corresponding to the block.

[0559] In some implementations, the block-level data unit may be included in one or more of a coding tree unit, a coding unit, a prediction unit, or a transform unit.

[0560] In some implementations, the indication information may include at least one index corresponding to the at least one filter set.

[0561] At 3304, at least one filter set from among a plurality of filter sets may be determined for use in the process of deriving the reference sample for the block based on the indication information.

[0562] In some implementations, a first filter set of the plurality of filter sets may include a first plurality of filter coefficients corresponding to a plurality of fractional sample positions. In some implementations, a second filter set of the plurality of filter sets may include a second plurality of filter coefficients different than the first plurality of filter coefficients corresponding to the plurality of fractional sample positions.

[0563] At 3306, a bitstream may be decoded based on the process of deriving the reference sample for the block using the at least one filter set.

[0564] In some implementations, the decoding the bitstream based on the process of deriving the reference sample for the block using the at least one filter set may include decoding the block from a video corresponding to the sequence-level data unit based on the process of deriving the reference sample for the block using the at least one filter set.

[0565] In some implementations, the decoding the bitstream based on the process of deriving the reference sample for the block using the at least one filter set may include decoding the block from a picture corresponding to the picture-level data unit based on the process of deriving the reference sample for the block using the at least one filter set.

[0566] In some implementations, the decoding the bitstream based on the process of deriving the reference sample for the block using the at least one filter set may include decoding the block from a picture region corresponding to the picture-region-level data unit based on the process of deriving the reference sample for the block using the at least one filter set.

[0567] In some implementations, the decoding the bitstream based on the process of deriving the reference sample for the block using the at least one filter set may include decoding the block corresponding to the block-level data unit based on the process of deriving the reference sample for the block using the at least one filter set.

[0568] FIG. 34 illustrates a flow chart of an exemplary method 3400 of encoding, according to some embodiments of the present disclosure. Method 3400 may be performed by an apparatus, e.g., encoder 101 of encoding system 100, encoder 200, prediction unit 202, inter prediction unit 204, intra prediction unit 205, filtering unit 212, encoding apparatus 1410, encoding unit 1412, or any other suitable decoding systems. Method 3400 may include operations 3402-3412 as described below. It is understood that some of the operations may be optional, and some of the operations may be performed simultaneously, or in a different order than shown in FIG. 34.

[0569] Referring to FIG. 34, at 3402, indication information associated with a process of deriving a reference sample for a block may be encoded.

[0570] In some implementations, the reference sample may be used in deriving a parameter for encoding the block.

[0571] In some implementations, the reference sample may be used in deriving a prediction sample for encoding the block.

[0572] In some implementations, the process of deriving the reference sample for the block may be a template-matching process.

[0573] In some implementations, the encoding the indication information associated with the process of deriving the reference sample for the block may include encoding the indication information from a sequence-level data unit.

[0574] In some implementations, the sequence-level data unit may be included in one or more of a video parameter set, a sequence parameter set, a picture parameter set, an adaption parameter set, or a picture header.

[0575] In some implementations, the encoding the indication information associated with the process of deriving the reference sample for the block may include encoding the indication information from a picture-level data unit.

[0576] In some implementations, the picture-level data unit may be included in one or more of a picture parameter set, an adaption parameter set, a picture header, or a slice header.

[0577] In some implementations, the encoding the indication information associated with the process of deriving the reference sample for the block may include encoding the indication information from a picture-region-level data unit.

[0578] In some implementations, the picture-region-level data unit may be included in one or more of an adaption parameter set or a slice header.

[0579] In some implementations, the encoding the indication information associated with the process of deriving the reference sample for the block may include encoding the indication information from a block-level data unit corresponding to the block.

[0580] In some implementations, the block-level data unit may be included in one or more of a coding tree unit, a coding unit, a prediction unit, or a transform unit.

[0581] In some implementations, the indication information may include at least one index corresponding to the at least one filter set.

[0582] At 3404, at least one filter set from among a plurality of filter sets may be determined for use in the process of deriving the reference sample for the block based on the indication information.

[0583] In some implementations, a first filter set of the plurality of filter sets may include a first plurality of filter coefficients corresponding to a plurality of fractional sample positions. In some implementations, a second filter set of the plurality of filter sets may include a second plurality of filter coefficients different than the first plurality of filter coefficients corresponding to the plurality of fractional sample positions.

[0584] At 3406, a bitstream may be encoded based on the process of deriving the reference sample for the block using the at least one filter set.

[0585] In some implementations, the encoding the bitstream based on the process of deriving the reference sample for the block using the at least one filter set may include encoding the block from a video corresponding to the sequence-level data unit based on the process of deriving the reference sample for the block using the at least one filter set.

[0586] In some implementations, the encoding the bitstream based on the process of deriving the reference sample for the block using the at least one filter set may include encoding the block from a picture corresponding to the picture-level data unit based on the process of deriving the reference sample for the block using the at least one filter set.

[0587] In some implementations, the encoding the bitstream based on the process of deriving the reference sample for the block using the at least one filter set may include encoding the block from a picture region corresponding to the picture-region-level data unit based on the process of deriving the reference sample for the block using the at least one filter set.

[0588] In some implementations, the encoding the bitstream based on the process of deriving the reference sample for the block using the at least one filter set may include encoding the block corresponding to the block-level data unit based on the process of deriving the reference sample for the block using the at least one filter set.

[0589] In various aspects of the present disclosure, the functions described herein may be implemented in hardware, software, firmware, or any combination thereof. If implemented in software, the functions may be stored as instructions on a non-transitory computer-readable medium. Computer-readable media includes computer storage media. Storage media may be any available media that may be accessed by a processor, such as processor 102 in FIGs. 1A and 1B. By way of example, and not limitation, such computer-readable media can include RAM, ROM, EEPROM, CD-ROM or other optical disk storage, HDD, such as magnetic disk storage or other magnetic storage devices, Flash drive, SSD, or any other medium that may be used to carry or store desired program code in the form of instructions or data structures and that may be accessed by a processing system, such as a mobile device or a computer. Disk and disc, as used herein, includes CD, laser disc, optical disc, digital video disc (DVD) , and floppy disk where disks usually reproduce data magnetically, while discs reproduce data optically with lasers. Combinations of the above should also be included within the scope of computer-readable media.

[0590] According to one aspect of the present disclosure, a method of decoding is provided. The method may include decoding, by a processor, indication information associated with a process of deriving a reference sample for a block. The method may include determining, by the processor, at least one filter set from among a plurality of filter sets for use in the process of deriving the reference sample for the block based on the indication information. The method may include decoding, by the processor, a bitstream based on the process of deriving the reference sample for the block using the at least one filter set.

[0591] In some implementations, the reference sample may be used in deriving a parameter for decoding the block.

[0592] In some implementations, the reference sample may be used in deriving a prediction sample for decoding the block.

[0593] In some implementations, the process of deriving the reference sample for the block may be a template-matching process.

[0594] In some implementations, a first filter set of the plurality of filter sets may include a first plurality of filter coefficients corresponding to a plurality of fractional sample positions. In some implementations, a second filter set of the plurality of filter sets may include a second plurality of filter coefficients different than the first plurality of filter coefficients corresponding to the plurality of fractional sample positions.

[0595] In some implementations, the decoding, by the processor, the indication information associated with the process of deriving the reference sample for the block may include decoding, by the processor, the indication information from a sequence-level data unit.

[0596] In some implementations, the sequence-level data unit may be included in one or more of a video parameter set, a sequence parameter set, a picture parameter set, an adaption parameter set, or a picture header.

[0597] In some implementations, the decoding, by the processor, the bitstream based on the process of deriving the reference sample for the block using the at least one filter set may include decoding, by the processor, the block from a video corresponding to the sequence-level data unit based on the process of deriving the reference sample for the block using the at least one filter set.

[0598] In some implementations, the decoding, by the processor, the indication information associated with the process of deriving the reference sample for the block may include decoding, by the processor, the indication information from a picture-level data unit.

[0599] In some implementations, the picture-level data unit may be included in one or more of a picture parameter set, an adaption parameter set, a picture header, or a slice header.

[0600] In some implementations, the decoding, by the processor, the bitstream based on the process of deriving the reference sample for the block using the at least one filter set may include decoding, by the processor, the block from a picture corresponding to the picture-level data unit based on the process of deriving the reference sample for the block using the at least one filter set.

[0601] In some implementations, the decoding, by the processor, the indication information associated with the process of deriving the reference sample for the block may include decoding, by the processor, the indication information from a picture-region-level data unit.

[0602] In some implementations, the picture-region-level data unit may be included in one or more of an adaption parameter set or a slice header.

[0603] In some implementations, the decoding, by the processor, the bitstream based on the process of deriving the reference sample for the block using the at least one filter set may include decoding, by the processor, the block from a picture region corresponding to the picture-region-level data unit based on the process of deriving the reference sample for the block using the at least one filter set.

[0604] In some implementations, the decoding, by the processor, the indication information associated with the process of deriving the reference sample for the block may include decoding, by the processor, the indication information from a block-level data unit corresponding to the block.

[0605] In some implementations, the block-level data unit may be included in one or more of a coding tree unit, a coding unit, a prediction unit, or a transform unit.

[0606] In some implementations, the decoding, by the processor, the bitstream based on the process of deriving the reference sample for the block using the at least one filter set may include decoding, by the processor, the block corresponding to the block-level data unit based on the process of deriving the reference sample for the block using the at least one filter set.

[0607] In some implementations, the indication information may include at least one index corresponding to the at least one filter set.

[0608] According to another aspect of the present disclosure, a decoder is provided. The decoder may include a processor and memory storing instructions. The memory storing instructions, which when executed by the processor, may cause the processor to decode indication information associated with a process of deriving a reference sample for a block. The memory storing instructions, which when executed by the processor, may cause the processor to determine at least one filter set from among a plurality of filter sets for use in the process of deriving the reference sample for the block based on the indication information. The memory storing instructions, which when executed by the processor, may cause the processor to decode a bitstream based on the process of deriving the reference sample for the block using the at least one filter set.

[0609] In some implementations, the reference sample may be used in deriving a parameter for decoding the block.

[0610] In some implementations, the reference sample may be used in deriving a prediction sample for decoding the block.

[0611] In some implementations, the process of deriving the reference sample for the block may be a template-matching process.

[0612] In some implementations, a first filter set of the plurality of filter sets may include a first plurality of filter coefficients corresponding to a plurality of fractional sample positions. In some implementations, a second filter set of the plurality of filter sets may include a second plurality of filter coefficients different than the first plurality of filter coefficients corresponding to the plurality of fractional sample positions.

[0613] In some implementations, to decode the indication information associated with the process of deriving the reference sample for the block, the memory storing instructions, which when executed by the processor, may cause the processor to decode the indication information from a sequence-level data unit.

[0614] In some implementations, the sequence-level data unit may be included in one or more of a video parameter set, a sequence parameter set, a picture parameter set, an adaption parameter set, or a picture header.

[0615] In some implementations, to decode the bitstream based on the process of deriving the reference sample for the block using the at least one filter set, the memory storing instructions, which when executed by the processor, may cause the processor to decode the block from a video corresponding to the sequence-level data unit based on the process of deriving the reference sample for the block using the at least one filter set.

[0616] In some implementations, to decode the indication information associated with the process of deriving the reference sample for the block, the memory storing instructions, which when executed by the processor, may cause the processor to decode the indication information from a picture-level data unit.

[0617] In some implementations, the picture-level data unit may be included in one or more of a picture parameter set, an adaption parameter set, a picture header, or a slice header.

[0618] In some implementations, to decode the bitstream based on the process of deriving the reference sample for the block using the at least one filter set, the memory storing instructions, which when executed by the processor, may cause the processor to decode the block from a picture corresponding to the picture-level data unit based on the process of deriving the reference sample for the block using the at least one filter set.

[0619] In some implementations, to decode the indication information associated with the process of deriving the reference sample for the block, the memory storing instructions, which when executed by the processor, may cause the processor to decode the indication information from a picture-region-level data unit.

[0620] In some implementations, the picture-region-level data unit may be included in one or more of an adaption parameter set or a slice header.

[0621] In some implementations, to decode the bitstream based on the process of deriving the reference sample for the block using the at least one filter set, the memory storing instructions, which when executed by the processor, may cause the processor to decode the block from a picture region corresponding to the picture-region-level data unit based on the process of deriving the reference sample for the block using the at least one filter set.

[0622] In some implementations, to decode the indication information associated with the process of deriving the reference sample for the block, the memory storing instructions, which when executed by the processor, may cause the processor to decode the indication information from a block-level data unit corresponding to the block.

[0623] In some implementations, the block-level data unit may be included in one or more of a coding tree unit, a coding unit, a prediction unit, or a transform unit.

[0624] In some implementations, to decode the bitstream based on the process of deriving the reference sample for the block using the at least one filter set, the memory storing instructions, which when executed by the processor, may cause the processor to decode the block corresponding to the block-level data unit based on the process of deriving the reference sample for the block using the at least one filter set.

[0625] In some implementations, the indication information may include at least one index corresponding to the at least one filter set.

[0626] According to a further aspect of the present disclosure, an apparatus for decoding is provided. The apparatus for decoding may include a processor and memory storing instructions. The memory storing instructions, which when executed by the processor, may cause the process...

Claims

1.A method of decoding, comprising:decoding, by a processor, indication information associated with a process of deriving a reference sample for a block;determining, by the processor, at least one filter set from among a plurality of filter sets for use in the process of deriving the reference sample for the block based on the indication information; anddecoding, by the processor, a bitstream based on the process of deriving the reference sample for the block using the at least one filter set.2.The method of claim 1, wherein the reference sample is used in deriving a parameter for decoding the block.3.The method of claim 1, wherein the reference sample is used in deriving a prediction sample for decoding the block.4.The method of claim 1, wherein the process of deriving the reference sample for the block is a template-matching process.5.The method of claim 1, wherein:a first filter set of the plurality of filter sets comprises a first plurality of filter coefficients corresponding to a plurality of fractional sample positions, anda second filter set of the plurality of filter sets comprises a second plurality of filter coefficients different than the first plurality of filter coefficients corresponding to the plurality of fractional sample positions.6.The method of claim 1, wherein the decoding, by the processor, the indication information associated with the process of deriving the reference sample for the block comprises:decoding, by the processor, the indication information from a sequence-level data unit.7.The method of claim 6, wherein the sequence-level data unit is included in one or more of a video parameter set, a sequence parameter set, a picture parameter set, an adaption parameter set, or a picture header.8.The method of claim 6, wherein the decoding, by the processor, the bitstream based on the process of deriving the reference sample for the block using the at least one filter set comprises:decoding, by the processor, the block from a video corresponding to the sequence-level data unit based on the process of deriving the reference sample for the block using the at least one filter set.9.The method of claim 1, wherein the decoding, by the processor, the indication information associated with the process of deriving the reference sample for the block comprises:decoding, by the processor, the indication information from a picture-level data unit.10.The method of claim 9, wherein the picture-level data unit is included in one or more of a picture parameter set, an adaption parameter set, a picture header, or a slice header.11.The method of claim 9, wherein the decoding, by the processor, the bitstream based on the process of deriving the reference sample for the block using the at least one filter set comprises:decoding, by the processor, the block from a picture corresponding to the picture-level data unit based on the process of deriving the reference sample for the block using the at least one filter set.12.The method of claim 1, wherein the decoding, by the processor, the indication information associated with the process of deriving the reference sample for the block comprises:decoding, by the processor, the indication information from a picture-region-level data unit.13.The method of claim 12, wherein the picture-region-level data unit is included in one or more of an adaption parameter set or a slice header.14.The method of claim 12, wherein the decoding, by the processor, the bitstream based on the process of deriving the reference sample for the block using the at least one filter set comprises:decoding, by the processor, the block from a picture region corresponding to the picture-region-level data unit based on the process of deriving the reference sample for the block using the at least one filter set.15.The method of claim 1, wherein the decoding, by the processor, the indication information associated with the process of deriving the reference sample for the block comprises:decoding, by the processor, the indication information from a block-level data unit corresponding to the block.16.The method of claim 15, wherein the block-level data unit is included in one or more of a coding tree unit, a coding unit, a prediction unit, or a transform unit.17.The method of claim 15, wherein the decoding, by the processor, the bitstream based on the process of deriving the reference sample for the block using the at least one filter set comprises:decoding, by the processor, the block corresponding to the block-level data unit based on the process of deriving the reference sample for the block using the at least one filter set.18.The method of claim 1, wherein the indication information comprises at least one index corresponding to the at least one filter set.19.A decoder, comprising:a processor; andmemory storing instructions, which when executed by the processor, cause the processor to:decode indication information associated with a process of deriving a reference sample for a block;determine at least one filter set from among a plurality of filter sets for use in the process of deriving the reference sample for the block based on the indication information; anddecode a bitstream based on the process of deriving the reference sample for the block using the at least one filter set.20.The decoder of claim 19, wherein the reference sample is used in deriving a parameter for decoding the block.21.The decoder of claim 19, wherein the reference sample is used in deriving a prediction sample for decoding the block.22.The decoder of claim 19, wherein the process of deriving the reference sample for the block is a template-matching process.23.The decoder of claim 19, wherein:a first filter set of the plurality of filter sets comprises a first plurality of filter coefficients corresponding to a plurality of fractional sample positions, anda second filter set of the plurality of filter sets comprises a second plurality of filter coefficients different than the first plurality of filter coefficients corresponding to the plurality of fractional sample positions.24.The decoder of claim 19, wherein, to decode the indication information associated with the process of deriving the reference sample for the block, the memory storing instructions, which when executed by the processor, cause the processor to:decode the indication information from a sequence-level data unit.25.The decoder of claim 24, wherein the sequence-level data unit is included in one or more of a video parameter set, a sequence parameter set, a picture parameter set, an adaption parameter set, or a picture header.26.The decoder of claim 24, wherein, to decode the bitstream based on the process of deriving the reference sample for the block using the at least one filter set, the memory storing instructions, which when executed by the processor, cause the processor to:decode the block from a video corresponding to the sequence-level data unit based on the process of deriving the reference sample for the block using the at least one filter set.27.The decoder of claim 19, wherein, to decode the indication information associated with the process of deriving the reference sample for the block, the memory storing instructions, which when executed by the processor, cause the processor to:decode the indication information from a picture-level data unit.28.The decoder of claim 27, wherein the picture-level data unit is included in one or more of a picture parameter set, an adaption parameter set, a picture header, or a slice header.29.The decoder of claim 27, wherein, to decode the bitstream based on the process of deriving the reference sample for the block using the at least one filter set, the memory storing instructions, which when executed by the processor, cause the processor to:decode the block from a picture corresponding to the picture-level data unit based on the process of deriving the reference sample for the block using the at least one filter set.30.The decoder of claim 19, wherein, to decode the indication information associated with the process of deriving the reference sample for the block, the memory storing instructions, which when executed by the processor, cause the processor to:decode the indication information from a picture-region-level data unit.31.The decoder of claim 30, wherein the picture-region-level data unit is included in one or more of an adaption parameter set or a slice header.32.The decoder of claim 30, wherein, to decode the bitstream based on the process of deriving the reference sample for the block using the at least one filter set, the memory storing instructions, which when executed by the processor, cause the processor to:decode the block from a picture region corresponding to the picture-region-level data unit based on the process of deriving the reference sample for the block using the at least one filter set.33.The decoder of claim 19, wherein, to decode the indication information associated with the process of deriving the reference sample for the block, the memory storing instructions, which when executed by the processor, cause the processor to:decode the indication information from a block-level data unit corresponding to the block.34.The decoder of claim 33, wherein the block-level data unit is included in one or more of a coding tree unit, a coding unit, a prediction unit, or a transform unit.35.The decoder of claim 33, wherein, to decode the bitstream based on the process of deriving the reference sample for the block using the at least one filter set, the memory storing instructions, which when executed by the processor, cause the processor to:decode the block corresponding to the block-level data unit based on the process of deriving the reference sample for the block using the at least one filter set.36.The decoder of claim 19, wherein the indication information comprises at least one index corresponding to the at least one filter set.37.An apparatus for decoding, comprising:a processor; andmemory storing instructions, which when executed by the processor, cause the processor to:decode indication information associated with a process of deriving a reference sample for a block;determine at least one filter set from among a plurality of filter sets for use in the process of deriving the reference sample for the block based on the indication information; anddecode a bitstream based on the process of deriving the reference sample for the block using the at least one filter set.38.A non-transitory computer-readable medium storing instructions, which when executed by a processor of a decoder, cause the processor of the decoder to:decode indication information associated with a process of deriving a reference sample for a block;determine at least one filter set from among a plurality of filter sets for use in the process of deriving the reference sample for the block based on the indication information; anddecode a bitstream based on the process of deriving the reference sample for the block using the at least one filter set.39.The non-transitory computer-readable medium of claim 38, wherein the reference sample is used in deriving a parameter for decoding the block.40.The non-transitory computer-readable medium of claim 38, wherein the reference sample is used in deriving a prediction sample for decoding the block.41.The non-transitory computer-readable medium of claim 38, wherein the process of deriving the reference sample for the block is a template-matching process.42.The non-transitory computer-readable medium of claim 38, wherein:a first filter set of the plurality of filter sets comprises a first plurality of filter coefficients corresponding to a plurality of fractional sample positions, anda second filter set of the plurality of filter sets comprises a second plurality of filter coefficients different than the first plurality of filter coefficients corresponding to the plurality of fractional sample positions.43.The non-transitory computer-readable medium of claim 38, wherein, to decode the indication information associated with the process of deriving the reference sample for the block, the instructions, which when executed by the processor of the decoder, cause the processor of the decoder to:decode the indication information from a sequence-level data unit.44.The non-transitory computer-readable medium of claim 43, wherein the sequence-level data unit is included in one or more of a video parameter set, a sequence parameter set, a picture parameter set, an adaption parameter set, or a picture header.45.The non-transitory computer-readable medium of claim 43, wherein, to decode the bitstream based on the process of deriving the reference sample for the block using the at least one filter set, the instructions, which when executed by the processor of the decoder, cause the processor of the decoder to:decode the block from a video corresponding to the sequence-level data unit based on the process of deriving the reference sample for the block using the at least one filter set.46.The non-transitory computer-readable medium of claim 38, wherein, to decode the indication information associated with the process of deriving the reference sample for the block, the instructions, which when executed by the processor of the decoder, cause the processor of the decoder to:decode the indication information from a picture-level data unit.47.The non-transitory computer-readable medium of claim 46, wherein the picture-level data unit is included in one or more of a picture parameter set, an adaption parameter set, a picture header, or a slice header.48.The non-transitory computer-readable medium of claim 46, wherein, to decode the bitstream based on the process of deriving the reference sample for the block using the at least one filter set, the instructions, which when executed by the processor of the decoder, cause the processor of the decoder to:decode the block from a picture corresponding to the picture-level data unit based on the process of deriving the reference sample for the block using the at least one filter set.49.The non-transitory computer-readable medium of claim 38, wherein, to decode the indication information associated with the process of deriving the reference sample for the block, the instructions, which when executed by the processor of the decoder, cause the processor of the decoder to:decode the indication information from a picture-region-level data unit.50.The non-transitory computer-readable medium of claim 49, wherein the picture-region-level data unit is included in one or more of an adaption parameter set or a slice header.51.The non-transitory computer-readable medium of claim 49, wherein, to decode the bitstream based on the process of deriving the reference sample for the block using the at least one filter set, the instructions, which when executed by the processor of the decoder, cause the processor of the decoder to:decode the block from a picture region corresponding to the picture-region-level data unit based on the process of deriving the reference sample for the block using the at least one filter set.52.The non-transitory computer-readable medium of claim 38, wherein, to decode the indication information associated with the process of deriving the reference sample for the block, the instructions, which when executed by the processor of the decoder, cause the processor of the decoder to:decode the indication information from a block-level data unit corresponding to the block.53.The non-transitory computer-readable medium of claim 52, wherein the block-level data unit is included in one or more of a coding tree unit, a coding unit, a prediction unit, or a transform unit.54.The non-transitory computer-readable medium of claim 52, wherein, to decode the bitstream based on the process of deriving the reference sample for the block using the at least one filter set, the instructions, which when executed by the processor of the decoder, cause the processor of the decoder to:decode the block corresponding to the block-level data unit based on the process of deriving the reference sample for the block using the at least one filter set.55.The non-transitory computer-readable medium of claim 38, wherein the indication information comprises at least one index corresponding to the at least one filter set.56.A method of encoding, comprising:encoding, by a processor, indication information associated with a process of deriving a reference sample for a block;determining, by the processor, at least one filter set from among a plurality of filter sets for use in the process of deriving the reference sample for the block based on the indication information; andencoding, by the processor, a bitstream based on the process of deriving the reference sample for the block using the at least one filter set.57.The method of claim 56, wherein the reference sample is used in deriving a parameter for encoding the block.58.The method of claim 56, wherein the reference sample is used in deriving a prediction sample for encoding the block.59.The method of claim 56, wherein the process of deriving the reference sample for the block is a template-matching process.60.The method of claim 56, wherein:a first filter set of the plurality of filter sets comprises a first plurality of filter coefficients corresponding to a plurality of fractional sample positions, anda second filter set of the plurality of filter sets comprises a second plurality of filter coefficients different than the first plurality of filter coefficients corresponding to the plurality of fractional sample positions.61.The method of claim 56, wherein the encoding, by the processor, the indication information associated with the process of deriving the reference sample for the block comprises:encoding, by the processor, the indication information from a sequence-level data unit.62.The method of claim 61, wherein the sequence-level data unit is included in one or more of a video parameter set, a sequence parameter set, a picture parameter set, an adaption parameter set, or a picture header.63.The method of claim 61, wherein the encoding, by the processor, the bitstream based on the process of deriving the reference sample for the block using the at least one filter set comprises:encoding, by the processor, the block from a video corresponding to the sequence-level data unit based on the process of deriving the reference sample for the block using the at least one filter set.64.The method of claim 56, wherein the encoding, by the processor, the indication information associated with the process of deriving the reference sample for the block comprises:encoding, by the processor, the indication information from a picture-level data unit.65.The method of claim 64, wherein the picture-level data unit is included in one or more of a picture parameter set, an adaption parameter set, a picture header, or a slice header.66.The method of claim 64, wherein the encoding, by the processor, the bitstream based on the process of deriving the reference sample for the block using the at least one filter set comprises:encoding, by the processor, the block from a picture corresponding to the picture-level data unit based on the process of deriving the reference sample for the block using the at least one filter set.67.The method of claim 56, wherein the encoding, by the processor, the indication information associated with the process of deriving the reference sample for the block comprises:encoding, by the processor, the indication information from a picture-region-level data unit.68.The method of claim 67, wherein the picture-region-level data unit is included in one or more of an adaption parameter set or a slice header.69.The method of claim 67, wherein the encoding, by the processor, the bitstream based on the process of deriving the reference sample for the block using the at least one filter set comprises:encoding, by the processor, the block from a picture region corresponding to the picture-region-level data unit based on the process of deriving the reference sample for the block using the at least one filter set.70.The method of claim 56, wherein the encoding, by the processor, the indication information associated with the process of deriving the reference sample for the block comprises:encoding, by the processor, the indication information from a block-level data unit corresponding to the block.71.The method of claim 70, wherein the block-level data unit is included in one or more of a coding tree unit, a coding unit, a prediction unit, or a transform unit.72.The method of claim 70, wherein the encoding, by the processor, the bitstream based on the process of deriving the reference sample for the block using the at least one filter set comprises:encoding, by the processor, the block corresponding to the block-level data unit based on the process of deriving the reference sample for the block using the at least one filter set.73.The method of claim 56, wherein the indication information comprises at least one index corresponding to the at least one filter set.74.An encoder, comprising:a processor; andmemory storing instructions, which when executed by the processor, cause the processor to:encode indication information associated with a process of deriving a reference sample for a block;determine at least one filter set from among a plurality of filter sets for use in the process of deriving the reference sample for the block based on the indication information; andencode a bitstream based on the process of deriving the reference sample for the block using the at least one filter set.75.The encoder of claim 74, wherein the reference sample is used in deriving a parameter for encoding the block.76.The encoder of claim 74, wherein the reference sample is used in deriving a prediction sample for encoding the block.77.The encoder of claim 74, wherein the process of deriving the reference sample for the block is a template-matching process.78.The encoder of claim 74, wherein:a first filter set of the plurality of filter sets comprises a first plurality of filter coefficients corresponding to a plurality of fractional sample positions, anda second filter set of the plurality of filter sets comprises a second plurality of filter coefficients different than the first plurality of filter coefficients corresponding to the plurality of fractional sample positions.79.The encoder of claim 74, wherein, to encode the indication information associated with the process of deriving the reference sample for the block, the memory storing instructions, which when executed by the processor, cause the processor to:encode the indication information from a sequence-level data unit.80.The encoder of claim 79, wherein the sequence-level data unit is included in one or more of a video parameter set, a sequence parameter set, a picture parameter set, an adaption parameter set, or a picture header.81.The encoder of claim 79, wherein, to encode the bitstream based on the process of deriving the reference sample for the block using the at least one filter set, the memory storing instructions, which when executed by the processor, cause the processor to:encode the block from a video corresponding to the sequence-level data unit based on the process of deriving the reference sample for the block using the at least one filter set.82.The encoder of claim 74, wherein, to encode the indication information associated with the process of deriving the reference sample for the block, the memory storing instructions, which when executed by the processor, cause the processor to:encode the indication information from a picture-level data unit.83.The encoder of claim 82, wherein the picture-level data unit is included in one or more of a picture parameter set, an adaption parameter set, a picture header, or a slice header.84.The encoder of claim 82, wherein, to encode the bitstream based on the process of deriving the reference sample for the block using the at least one filter set, the memory storing instructions, which when executed by the processor, cause the processor to:encode the block from a picture corresponding to the picture-level data unit based on the process of deriving the reference sample for the block using the at least one filter set.85.The encoder of claim 74, wherein, to encode the indication information associated with the process of deriving the reference sample for the block, the memory storing instructions, which when executed by the processor, cause the processor to:encode the indication information from a picture-region-level data unit.86.The encoder of claim 85, wherein the picture-region-level data unit is included in one or more of an adaption parameter set or a slice header.87.The encoder of claim 85, wherein, to encode the bitstream based on the process of deriving the reference sample for the block using the at least one filter set, the memory storing instructions, which when executed by the processor, cause the processor to:encode the block from a picture region corresponding to the picture-region-level data unit based on the process of deriving the reference sample for the block using the at least one filter set.88.The encoder of claim 74, wherein, to encode the indication information associated with the process of deriving the reference sample for the block, the memory storing instructions, which when executed by the processor, cause the processor to:encode the indication information from a block-level data unit corresponding to the block.89.The encoder of claim 88, wherein the block-level data unit is included in one or more of a coding tree unit, a coding unit, a prediction unit, or a transform unit.90.The encoder of claim 88, wherein, to encode the bitstream based on the process of deriving the reference sample for the block using the at least one filter set, the memory storing instructions, which when executed by the processor, cause the processor to:encode the block corresponding to the block-level data unit based on the process of deriving the reference sample for the block using the at least one filter set.91.The encoder of claim 74, wherein the indication information comprises at least one index corresponding to the at least one filter set.92.An apparatus for encoding, comprising:a processor; andmemory storing instructions, which when executed by the processor, cause the processor to:encode indication information associated with a process of deriving a reference sample for a block;determine at least one filter set from among a plurality of filter sets for use in the process of deriving the reference sample for the block based on the indication information; andencode a bitstream based on the process of deriving the reference sample for the block using the at least one filter set.93.A non-transitory computer-readable medium storing instructions, which when executed by a processor of an encoder, cause the processor of the encoder to:encode indication information associated with a process of deriving a reference sample for a block;determine at least one filter set from among a plurality of filter sets for use in the process of deriving the reference sample for the block based on the indication information; andencode a bitstream based on the process of deriving the reference sample for the block using the at least one filter set.94.The non-transitory computer-readable medium of claim 93, wherein the reference sample is used in deriving a parameter for encoding the block.95.The non-transitory computer-readable medium of claim 93, wherein the reference sample is used in deriving a prediction sample for encoding the block.96.The non-transitory computer-readable medium of claim 93, wherein the process of deriving the reference sample for the block is a template-matching process.97.The non-transitory computer-readable medium of claim 93, wherein:a first filter set of the plurality of filter sets comprises a first plurality of filter coefficients corresponding to a plurality of fractional sample positions, anda second filter set of the plurality of filter sets comprises a second plurality of filter coefficients different than the first plurality of filter coefficients corresponding to the plurality of fractional sample positions.98.The non-transitory computer-readable medium of claim 93, wherein, to encode the indication information associated with the process of deriving the reference sample for the block, the instructions, which when executed by the processor of the encoder, cause the processor of the encoder to:encode the indication information from a sequence-level data unit.99.The non-transitory computer-readable medium of claim 98, wherein the sequence-level data unit is included in one or more of a video parameter set, a sequence parameter set, a picture parameter set, an adaption parameter set, or a picture header.100.The non-transitory computer-readable medium of claim 98, wherein, to encode the bitstream based on the process of deriving the reference sample for the block using the at least one filter set, the instructions, which when executed by the processor of the encoder, cause the processor of the encoder to:encode the block from a video corresponding to the sequence-level data unit based on the process of deriving the reference sample for the block using the at least one filter set.101.The non-transitory computer-readable medium of claim 93, wherein, to encode the indication information associated with the process of deriving the reference sample for the block, the instructions, which when executed by the processor of the encoder, cause the processor of the encoder to:encode the indication information from a picture-level data unit.102.The non-transitory computer-readable medium of claim 101, wherein the picture-level data unit is included in one or more of a picture parameter set, an adaption parameter set, a picture header, or a slice header.103.The non-transitory computer-readable medium of claim 101, wherein, to encode the bitstream based on the process of deriving the reference sample for the block using the at least one filter set, the instructions, which when executed by the processor of the encoder, cause the processor of the encoder to:encode the block from a picture corresponding to the picture-level data unit based on the process of deriving the reference sample for the block using the at least one filter set.104.The non-transitory computer-readable medium of claim 93, wherein, to encode the indication information associated with the process of deriving the reference sample for the block, the instructions, which when executed by the processor of the encoder, cause the processor of the encoder to:encode the indication information from a picture-region-level data unit.105.The non-transitory computer-readable medium of claim 104, wherein the picture-region-level data unit is included in one or more of an adaption parameter set or a slice header.106.The non-transitory computer-readable medium of claim 104, wherein, to encode the bitstream based on the process of deriving the reference sample for the block using the at least one filter set, the instructions, which when executed by the processor of the encoder, cause the processor of the encoder to:encode the block from a picture region corresponding to the picture-region-level data unit based on the process of deriving the reference sample for the block using the at least one filter set.107.The non-transitory computer-readable medium of claim 93, wherein, to encode the indication information associated with the process of deriving the reference sample for the block, the instructions, which when executed by the processor of the encoder, cause the processor of the encoder to:encode the indication information from a block-level data unit corresponding to the block.108.The non-transitory computer-readable medium of claim 107, wherein the block-level data unit is included in one or more of a coding tree unit, a coding unit, a prediction unit, or a transform unit.109.The non-transitory computer-readable medium of claim 107, wherein, to encode the bitstream based on the process of deriving the reference sample for the block using the at least one filter set, the instructions, which when executed by the processor of the encoder, cause the processor of the encoder to:encode the block corresponding to the block-level data unit based on the process of deriving the reference sample for the block using the at least one filter set.110.The non-transitory computer-readable medium of claim 93, wherein the indication information comprises at least one index corresponding to the at least one filter set.111.A method of transmitting a bitstream, comprising:executing the method of encoding of one or more of claims 56-73 to generate a bitstream; andtransmitting the bitstream.112.A non-transitory computer-readable storage medium, having a computer program and a bitstream stored thereon, wherein the computer program, when executed by a processor, enables the processor to perform the method of encoding of one or more of claims 56-73 to generate the bitstream.