Video encoding method and apparatus, video decoding method and apparatus, computer-readable medium and electronic device

By using pixel values ​​within a specified region in the reference frame to determine pixel values ​​within the interpolation extension region during video encoding, the hardware bandwidth overhead problem caused by inter-frame template matching technology is solved, thus improving encoding and decoding efficiency.

WO2025241790A1PCT designated stage Publication Date: 2025-11-27TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2025/089533
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-05-21
Filing Date
2025-04-17
Publication Date
2025-11-27

AI Technical Summary

Technical Problem

Inter-frame template matching introduces significant hardware implementation bandwidth overhead in video coding, limiting the practical application of the coding technology.

Method used

By using pixel values ​​within a defined region in a reference frame to determine pixel values ​​within the interpolation extension region, reads from off-chip memory are reduced, thus lowering bandwidth overhead in the hardware implementation.

Benefits of technology

It improves video encoding and decoding efficiency and reduces the bandwidth overhead of hardware implementation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025089533_27112025_PF_FP_ABST
    Figure CN2025089533_27112025_PF_FP_ABST
Patent Text Reader

Abstract

Provided in the embodiments of the present application are a video encoding method and apparatus, a video decoding method and apparatus, a computer-readable medium and an electronic device. The video decoding method comprises: decoding a video code stream to obtain a candidate motion vector of a current block using an inter-frame template matching mode; according to the candidate motion vector, performing a search in a search area in a reference frame to obtain a matching block of the current block; according to a pixel value in a set area in the reference frame, determining a pixel value in an interpolation extension area for performing interpolation filtering processing; and, on the basis of the interpolation extension area, performing interpolation filtering processing on the matching block.
Need to check novelty before this filing date? Find Prior Art

Description

Video coding method and device, computer readable medium and electronic device

[0001] The present application claims priority to the Chinese patent application No. 2024106502310, filed on May 21, 2024, and entitled "Video coding method and device, computer readable medium and electronic device". TECHNICAL FIELD

[0002] The present application relates to the technical field of video coding, in particular, to a video coding method, device, computer readable medium and electronic device. BACKGROUND

[0003] Inter-template matching (TM) is an important inter-prediction technology in the field of video coding, aiming to further refine the motion vector of the current block based on the template matching technology, so as to obtain a more accurate prediction result of the current block. From the perspective of the decoding end, in order to generate the prediction block of the current block, when using the inter-template matching technology, in addition to obtaining the reference block of the same size as the current block in the reference frame according to the motion vector, it is possible to further perform template matching to search for the area in the reference frame that is most similar to the surrounding reconstructed pixels (template) of the current block, so as to improve the accuracy of motion estimation. In this process, interpolation operation may also be performed to improve the accuracy of template matching. SUMMARY

[0004] Embodiments of the present application provide a video coding method, device, computer readable medium and electronic device.

[0005] The embodiments of the present application provide a video decoding method, comprising: decoding a video bitstream to obtain a candidate motion vector of a current block using an inter-template matching mode; searching in a search area of the candidate motion vector in a reference frame to obtain a matching block of the current block; determining pixel values in an interpolation expansion area used for interpolation filtering processing of the matching block according to pixel values in a set area in the reference frame; and performing interpolation filtering processing on the matching block based on the interpolation expansion area.

[0006] The embodiments of the present application provide a video coding method, comprising: determining a candidate motion vector of a current block using an inter-template matching mode; searching in a search area of the candidate motion vector in a reference frame to obtain a matching block of the current block; determining pixel values in an interpolation expansion area used for interpolation filtering processing of the matching block according to pixel values in a set area in the reference frame; and performing interpolation filtering processing on the matching block based on the interpolation expansion area to code based on the result of the interpolation filtering processing.

[0007] The embodiment of the present application provides a video decoding apparatus, comprising: a decoding unit configured to decode a video code stream to obtain a candidate motion vector of a current block using an inter-frame template matching mode; a searching unit configured to search in a search area in a reference frame according to the candidate motion vector to obtain a matching block of the current block; a determining unit configured to determine pixel values in an interpolation expansion area used for interpolation filtering processing of the matching block according to pixel values in a set area in the reference frame; and a processing unit configured to perform interpolation filtering processing on the matching block based on the interpolation expansion area.

[0008] The embodiment of the present application provides a video encoding apparatus, comprising: a determining unit configured to determine a candidate motion vector of a current block using an inter-frame template matching mode; a searching unit configured to search in a search area in a reference frame according to the candidate motion vector to obtain a matching block of the current block; a determining unit configured to determine pixel values in an interpolation expansion area used for interpolation filtering processing of the matching block according to pixel values in a set area in the reference frame; and a processing unit configured to perform interpolation filtering processing on the matching block based on the interpolation expansion area.

[0009] The embodiment of the present application provides a computer readable medium, which stores a computer program, and the computer program is executed by a processor to implement the video decoding method or the video encoding method in the above embodiment.

[0010] The embodiment of the present application provides an electronic device, comprising: one or more processors; and a storage device configured to store one or more computer programs, and when the one or more computer programs are executed by the one or more processors, the electronic device implements the video decoding method or the video encoding method in the above embodiment.

[0011] The embodiment of the present application provides a computer program product, which comprises a computer program stored in a computer readable storage medium. A processor of an electronic device reads and executes the computer program from the computer readable storage medium, so that the electronic device executes the video decoding method or the video encoding method provided in the various embodiments.

[0012] The embodiment of the present application provides a method for storing or transmitting a video code stream, wherein the video code stream is decoded according to the video decoding method or generated according to the video encoding method.

[0013] In the technical solution provided in some embodiments of the present application, after a candidate motion vector of a current block in an inter-frame template matching mode is obtained by decoding a video code stream, a search is performed in a search region of the candidate motion vector in a reference frame to obtain a matching block of the current block, then pixel values in an interpolation expansion region used for interpolation filtering processing are determined according to pixel values in a set region in the reference frame, and the matching block is subjected to interpolation filtering processing based on the interpolation expansion region. It can be seen that the technical solution of the embodiments of the present application can use the pixel values in the set region in the reference frame to determine the pixel values in the interpolation expansion region, so that the decoding end does not need to read more reference pixel values from an off-chip memory when decoding, but can use the pixel values in the reference block and the search region which have been read and buffered in an on-chip memory to determine the pixel values in the interpolation expansion region, and even does not need to wait for decoding the pixel values in the interpolation expansion region from the code stream, thereby reducing the bandwidth overhead in hardware implementation and facilitating the improvement of the coding efficiency of the video. BRIEF DESCRIPTION OF DRAWINGS

[0014] FIG. 1 shows a schematic diagram of an exemplary system architecture to which the technical solution of the embodiments of the present application can be applied;

[0015] FIG. 2 shows a schematic diagram of the placement of a video encoding device and a video decoding device in a streaming system according to an embodiment of the present application;

[0016] FIG. 3 shows a basic flowchart of a video encoder according to an embodiment of the present application;

[0017] FIG. 4 shows a schematic diagram of an angle prediction direction in an intra-frame prediction mode according to an embodiment of the present application;

[0018] FIG. 5 shows a schematic diagram of intra-frame prediction according to an embodiment of the present application;

[0019] FIG. 6 shows a schematic diagram of an inter-frame prediction process according to an embodiment of the present application;

[0020] FIG. 7 shows a schematic diagram of another inter-frame prediction process according to an embodiment of the present application;

[0021] FIG. 8 shows a schematic diagram of pixel position distribution in sub-pixel accuracy according to an embodiment of the present application;

[0022] FIG. 9 shows a schematic diagram of a template region according to an embodiment of the present application;

[0023] FIG. 10 shows an example diagram of the shape of coarse search and fine search according to an embodiment of the present application;

[0024] FIG. 11 shows a schematic diagram of a search region and an interpolation expansion region according to an embodiment of the present application;

[0025] FIG. 12 shows a flowchart of a video decoding method according to an embodiment of the present application;

[0026] FIG. 13 shows a schematic diagram of a search region according to an embodiment of the present application;

[0027] FIG. 14A and FIG. 14B show schematic diagrams of an interpolation expansion region according to an embodiment of the present application;

[0028] FIG. 15 shows a schematic diagram of pixel value setting in an interpolation expansion region according to an embodiment of the present application;

[0029] FIG. 16 shows a schematic diagram of pixel value setting in an interpolation expansion region according to an embodiment of the present application;

[0030] FIG. 17 shows a schematic diagram of pixel value setting in an interpolation expansion region according to an embodiment of the present application;

[0031] FIG. 18 shows a schematic diagram of pixel value setting in an interpolation expansion region according to an embodiment of the present application;

[0032] FIG. 19 shows a flowchart of a video encoding method according to an embodiment of the present application;

[0033] FIG. 20 shows a block diagram of a video decoding apparatus according to an embodiment of the present application;

[0034] FIG. 21 shows a block diagram of a video encoding apparatus according to an embodiment of the present application;

[0035] FIG. 22 shows a structural schematic diagram of a computer system of an electronic device suitable for implementing embodiments of the present application. DETAILED DESCRIPTION

[0036] Example implementations are now described in greater detail with reference to the figures. However, example implementations can be implemented in various forms and should not be construed as limited to the examples presented; rather, these implementations are provided so that this disclosure will be thorough and complete, and fully convey the scope of the example implementations to those skilled in the art.

[0037] Furthermore, the features, structures, or characteristics described in connection with the present application can be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are recited in order to provide a thorough understanding of the embodiments of the present application. One skilled in the relevant art, however, will recognize that the embodiments of the present application can be practiced without one or more of the specific details, or with other methods, components, materials, and so forth.

[0038] In embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program with a predetermined function, and works together with other related parts to achieve a predetermined target, and can be implemented entirely or partially by using software, hardware (such as a processing circuit or a memory) or a combination thereof. Similarly, one processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be a part of an integral module or unit that includes the functions of the module or unit.

[0039] The block diagrams in the drawings show only the functional entities and do not necessarily have to correspond to physically independent entities. That is, the functional entities can be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.

[0040] The flowcharts shown in the drawings are only exemplary illustrations and do not necessarily have to include all the contents and operations / steps, nor are they necessarily executed in the order described. For example, some operations / steps can be further broken down, and some operations / steps can be combined or partially combined, so the actual execution order can be changed according to the actual situation.

[0041] "Multiple" referred to herein means two or more. "And / or" describes the association relationship of the associated objects, which means that there can be three relationships, for example, A and / or B can represent the three cases of A alone, A and B together, and B alone. The character " / " generally represents that the associated objects before and after are in an "or" relationship.

[0042] FIG. 1 shows a schematic diagram of an exemplary system architecture to which the technical solutions of embodiments of the present application can be applied.

[0043] As shown in FIG. 1, the system architecture 100 includes a plurality of terminal devices that can communicate with each other via, for example, a network 150. For example, the system architecture 100 can include a first terminal device 110 and a second terminal device 120 interconnected via the network 150. In the embodiment of FIG. 1, the first terminal device 110 and the second terminal device 120 perform unidirectional transmission of data.

[0044] For example, the first terminal device 110 can code video data (for example, a stream of video pictures that are captured by the terminal device 110) for transmission to the second terminal device 120 via the network 150, the coded video data being transmitted in the form of one or more coded video bitstreams, the second terminal device 120 can receive the coded video data from the network 150, decode the coded video data to recover the video data, and display video pictures based on the recovered video data.

[0045] In an embodiment of the application, the system architecture 100 can include a third terminal device 130 and a fourth terminal device 140 that perform bidirectional transmission of coded video data that can occur, for example, during videoconferencing. For bidirectional transmission of data, each terminal device of the third and fourth terminal devices 130, 140 can code video data (e.g., of a stream of video pictures that are captured by the terminal device) for transmission to the other terminal device of the third and fourth terminal devices 130, 140 by way of the network 150. Each of the third and fourth terminal devices 130, 140 also can receive the coded video data transmitted by the other terminal device of the third and fourth terminal devices 130, 140, and can decode the coded video data to recover the video pictures and can display video pictures on a display accessible to the terminal device.

[0046] In the example shown in FIG. 1, the first, second, third, and fourth terminal devices 110, 120, 130, 140 can be servers or terminals, although the principles of the present application can not be limited to this.

[0047] The server can be a stand-alone physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud service, cloud database, cloud computing, cloud function, cloud storage, network service, cloud communication, middleware service, domain name service, security service, content delivery network (CDN), and basic cloud computing services such as big data and artificial intelligence platform. The terminal can be a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart speaker, a smart voice interaction device, a smart watch, a smart home appliance, a vehicle-mounted terminal, an aircraft, and the like, but is not limited thereto.

[0048] The network 150 shown in FIG. 1 represents any number of networks that convey coded video data between the first, second, third, and fourth terminal devices 110, 120, 130, 140, including for example wire- and / or wireless communication networks. The communication network 150 can exchange data in circuit-switched and / or packet-switched channels. The network can include telecommunication networks, local area and / or wide area networks, and / or the Internet. For the purposes of the present application, the architecture and topology of the network 150 can be immaterial to the operation of the application unless explained in the following text.

[0049] FIG. 2 illustrates the placement of video encoding and video decoding devices in a streaming environment according to an embodiment of the present disclosure. The disclosed subject matter can be equally applicable to other video enabled applications including, for example, video conferencing, digital television (TV), storing of compressed video on digital media including CD, DVD, memory stick and the like, and so on.

[0050] The streaming system can include a capture subsystem 213 that can include a video source 201, for example a digital camera, that creates an uncompressed video picture stream 202. In an embodiment, the video picture stream 202 includes samples as they are captured by the digital camera. In contrast to encoded video data 204 (or encoded video bitstreams 204), the video picture stream 202 is depicted as a bold line to emphasize the high data volume of the video picture stream 202 that can be processed by the electronic device 220 that includes a video encoding device 203 coupled to the video source 201. The video encoding device 203 can include hardware, software, or a combination thereof to enable or implement aspects of the disclosed subject matter as described in greater detail below. In contrast to the video picture stream 202, the encoded video data 204 (or encoded video bitstream 204) is depicted as a thin line to emphasize the relatively lower data volume of the encoded video data 204 (or encoded video bitstream 204) that can be stored on a streaming server 205 for future use. One or more streaming client subsystems, such as client subsystem 206 and client subsystem 208 in FIG. 2, can access the streaming server 205 to retrieve copies 207 and 209 of the encoded video data 204. The client subsystem 206 can include a video decoding device 210, for example, in the electronic device 230. The video decoding device 210 decodes the incoming copy 207 of encoded video data and creates an outgoing video picture stream 211 that can be rendered on a display 212, such as a display screen, or other rendering device. In some streaming systems, the encoded video data 204, 207 and 209 (e.g., video bitstreams) can be encoded according to certain video encoding / compression standards.

[0051] It is noted that the electronic devices 220 and 230 can include other components not shown in the figures. For example, the electronic device 220 can include a video decoding device and the electronic device 230 can also include a video encoding device.

[0052] In some embodiments of the present application, taking the High Efficiency Video Coding (HEVC) in the international video coding standard, Versatile Video Coding (VVC), and the Chinese national video coding standard AVS as examples, when an input video frame image is input, the video frame image is divided into a plurality of non-overlapping processing units according to a block size, and each processing unit will perform similar compression operations. This processing unit is called a Coding Tree Unit (CTU), or referred to as a Largest Coding Unit (LCU). The CTU can be further divided into one or more basic Coding Units (CUs) for more detailed division. The CU is the most basic element in the coding link.

[0053] In other embodiments, the processing unit can also be a coding tile, which is a rectangular area of a multimedia data frame that can be independently decoded and coded. In the Alliance for Open Media Video 1 (AV1) standard formulated by the Open Media Alliance, the coding tile can be further divided into one or more maximum coding blocks (for example, Superblock, abbreviated as SB) for more detailed division. Then the maximum coding block is further divided into one or more blocks. Each block is the most basic element in the coding link. A SB can contain a plurality of blocks.

[0054] The above division method of the video frame image can be referred to as a block partition structure. Some concepts in the coding process are introduced as follows:

[0055] Predictive coding (Predictive Coding): Predictive coding includes intra prediction and inter prediction. After the original video signal is predicted by the selected reconstructed video signal, a predicted video signal is obtained, and then a residual video signal is obtained. The encoding end decides which prediction coding mode to select for the current coding unit (or coding block) and informs the decoding end. Intra prediction refers to that the signal used to predict the current coding unit comes from the already coded and reconstructed region in the same image as the current coding unit. Inter prediction refers to that the signal used to predict the current coding unit comes from other images (referred to as reference images or reference frames) that have been coded and are different from the current image (current frame) where the current coding unit is located.

[0056] Transform & Quantization: After the residual video signal is transformed by Discrete Fourier Transform (DFT), Discrete Cosine Transform (DCT) or other transform operations, it is converted into the transform domain and a transform domain signal, called transform coefficients, is obtained. The transform coefficients are further subjected to a lossy quantization operation, which loses some information, so that the quantized signal is conducive to compressed expression. In some video coding standards, more than one transform method can be selected, so the encoding end can select one of them for the current coding unit (or coding block) and inform the decoding end. The degree of quantization precision is usually determined by the quantization parameter (QP). A larger QP value means that coefficients with a larger value range will be quantized to the same output, so it usually brings greater distortion and lower code rate; on the contrary, a smaller QP value means that coefficients with a smaller value range will be quantized to the same output, so it usually brings smaller distortion and higher code rate.

[0057] Entropy Coding or Statistical Coding: According to the frequency of the occurrence of each value in the quantized transform domain signal, the quantized transform domain signal is statistically compressed and coded, and finally a binary (0 or 1) compressed code stream is output. At the same time, other information generated by encoding, such as the selected encoding mode, motion vector data, etc., also needs to be entropy coded to reduce the code rate. Statistical coding is a lossless coding method that can effectively reduce the code rate required to express the same signal. Common statistical coding methods include variable length coding (VLC) or context-based binary arithmetic coding (CABAC).

[0058] The CABAC process mainly includes three steps: binarization, context modeling and binary arithmetic coding. After the binarization of the input syntax elements, the binary data can be encoded by regular coding mode and bypass coding mode. The bypass coding mode does not need to assign a specific probability model for each binary bit, and the input binary bit bin value is directly encoded by a simple bypass encoder to speed up the entire encoding and decoding speed. Generally, different syntax elements are not completely independent, and the same syntax element also has certain memory. Therefore, according to the conditional entropy theory, the use of other coded syntax elements for conditional coding can further improve the coding performance compared with independent coding or non-memory coding. These coded symbol information used as conditions are called contexts. In the regular coding mode, the binary bits of the syntax elements enter the context modeler in order. The encoder assigns an appropriate probability model for each input binary bit according to the value of the previously coded syntax element or binary bit, which is the context modeling process. The context index increment (ctxIdxInc) and the context index Start (ctxIdxStart) can be used to locate the context model corresponding to the syntax element. After the bin value and the assigned probability model are sent to the binary arithmetic encoder for coding, the context model is updated according to the bin value, which is the adaptive process in coding.

[0059] Loop filtering: the signal after transformation and quantization will obtain the reconstructed image through the operation of inverse quantization, inverse transformation and prediction compensation. Compared with the original image, the reconstructed image will have some differences due to the influence of quantization, that is, the reconstructed image will have distortion. Therefore, the reconstructed image can be filtered. For example, the deblocking filter (DB), the sample adaptive offset (SAO) or the adaptive loop filter (ALF) can effectively reduce the distortion degree caused by quantization. Since these filtered reconstructed images will be used as references for subsequent encoded images to predict future image signals, the above filtering operation is also called loop filtering, that is, the filtering operation within the coding loop.

[0060] FIG. 3 shows a basic flowchart of a video encoder according to an embodiment of the present application, in which the intra prediction is taken as an example for illustration. In the flowchart, the original image signal s k[x, y] and the prediction image signal Difference operation is performed to obtain the residual signal u k [x, y]. The residual signal u k [x, y] is transformed and quantized to obtain the quantized coefficients. The quantized coefficients are encoded into the bitstream by entropy coding, and are also used to reconstruct the residual signal u' by inverse quantization and inverse transformation k [x, y]. The prediction image signal and the reconstructed residual signal u' k [x, y] to generate the image signal The image signal On one hand, it is input to the intra mode decision module and the intra prediction module for intra prediction processing, and on the other hand, it is output as the reconstructed image signal s' by loop filtering k [x, y]. The reconstructed image signal s' k [x, y] can be used as the reference image of the next frame for motion estimation and motion compensation prediction. Then, based on the result s' of the motion compensation prediction r [x + m x , y + m y ] and the intra prediction result to obtain the prediction image signal of the next frame and the above process is repeated until the encoding is completed.

[0061] Based on the above encoding process, at the decoding end, for each coding unit (or coding block), after the compressed code stream (i.e. the bitstream) is obtained, entropy decoding is performed to obtain various mode information and quantized coefficients. Then, the quantized coefficients are inverse quantized and inverse transformed to obtain the residual signal. On the other hand, according to the known encoding mode information, the prediction signal corresponding to the coding unit (or coding block) can be obtained. Then, the residual signal and the prediction signal are added to obtain the reconstructed signal, and the reconstructed signal is subjected to loop filtering and other operations to generate the final output signal. In this series of encoding processes, the encoding framework mainly makes decisions based on rate-distortion optimization (RDO) to select the optimal encoding parameters.

[0062] In the field of coding technology, intra prediction is a commonly used prediction coding technology. Intra prediction is based on the correlation of pixels in a video image in the spatial domain, and derives the prediction value of the current coding block from the neighboring coded areas of the current coding block. The AVS3 second stage adopts the extended intra angular prediction mode (EIPM). In the AVS2 of the previous generation of AVS3, there are 33 intra prediction modes in total, including 30 angular prediction modes and 3 special prediction modes (Plane prediction mode, DC prediction mode and Bilinear prediction mode). Among the 33 intra prediction modes, 2 most probable prediction modes (MPM) are used, and the remaining modes are coded using 5-bit fixed-length coding. To support more precise angular prediction, the angular prediction mode is extended to 62 in AVS3. FIG. 4 shows an angular prediction direction diagram in the intra prediction mode according to an embodiment of the present application. As shown in FIG. 4, the newly added angular prediction mode numbers are 34 to 65.

[0063] When the angular prediction mode is used, for a pixel point (pixel position) in the current prediction block, according to the angle direction of the angular prediction mode, the reference pixel value at the corresponding position in the reference pixel row or column is found as the prediction value of the pixel point. FIG. 5 shows a schematic diagram of intra prediction according to an embodiment of the present application. As shown in FIG. 5, for a pixel point P in the current prediction block, first, according to the prediction angle (as indicated by the arrow) in the figure, the position of the reference pixel in the pixel row above the current prediction block that has been coded is determined, and then the reference pixel value at the position is used as the prediction value of the pixel point P. Since not all pixel points in the current prediction block point to the reference pixel position according to the angular prediction mode, such as the reference pixel position of the pixel point P in FIG. 5 is a certain sub-pixel position between pixels B and C, the prediction value of the pixel point P needs to be obtained by interpolation using the surrounding pixels. In order to improve the efficiency of intra prediction, on-chip memory is usually used to store the reference pixel values of intra prediction.

[0064] FIG. 6 shows a schematic diagram of an inter prediction process according to an embodiment of the present application. As shown in FIG. 6, inter prediction uses the correlation in the video time domain to predict the pixels of the current image (current frame) using the pixels of the adjacent coded image (reference frame), in order to effectively remove the video temporal redundancy and effectively save the bits of the residual data coding. Among them, P represents the current frame, Pr represents the reference frame, B represents the current coding block, and Br represents the reference block of B. The coordinates of B' in the reference frame Pr are the same as the coordinate position of B in the current frame P, and the coordinates of Br are (x r ,y r), the coordinates of B' are (x, y). The displacement between the current coding block and its reference block is called the motion vector (MV), where MV = (x r -x, y r -y). In other words, inter prediction refers to a process of searching for a reference block from a neighboring coded image (i.e., a reference frame) according to a current block to be coded in a current frame, with the purpose of removing the temporal redundancy of a video signal. As shown in FIG. 7, for a current block to be coded in a current frame, a best matching block is searched in a certain range (e.g., in a search region formed by a search box) in a reference frame according to a block matching criterion. The block matching criterion is a measurement criterion between the current block and the matching block. Commonly used block matching criteria in video coding can include a minimum mean square error (MSE), a sum of absolute difference (SAD), and the like. Using the matching criterion, the best matching block with the minimum SAD or MSE between the current block is searched in the search region of the reference frame by adjusting the motion vector, and thus the motion vector corresponding to the best matching block is obtained. The process of obtaining the motion vector is motion estimation.

[0065] Since inter prediction can obtain the predicted value of a pixel point in a current block in a reference frame using a motion vector (this process is called motion compensation), in actual situations, the movement of objects between adjacent image frames is not necessarily based on an integer pixel as a basic unit, and thus it is necessary to improve the accuracy of motion estimation to a sub-pixel level, i.e., to interpolate the reference image to improve the accuracy of motion compensation, and thus to improve the coding efficiency.

[0066] FIG. 8 shows a pixel position distribution diagram of sub-pixel accuracy according to an embodiment of the present application. In FIG. 8, black squares represent integer pixel positions, and gray circles represent 1 / 4 sub-pixel positions. The resolution of all integer pixels in a frame is equal to the video resolution. In AVS3, the common inter prediction mode supports five motion vector precisions of 1 / 4 pixel, 1 / 2 pixel, 1 pixel, 2 pixels, and 4 pixels. When the MV precision is 1 / 4 pixel or 1 / 2 pixel, an 8-tap interpolation filter can be used to interpolate the luminance prediction value, and a 4-tap interpolation filter can be used to interpolate the chrominance prediction value. When interpolating the boundary sub-pixels of a current prediction block, it is often necessary to additionally read pixels outside the current prediction block for 8-tap or 4-tap interpolation calculation, i.e., the total number of pixels required for the interpolation process is often greater than the total number of pixels of the current prediction block.

[0067] Inter template matching is an important inter prediction technique in video coding field, aiming to further refine the motion vector of the current block based on template matching technique, so as to obtain more accurate prediction result. Inter template matching finds a motion vector, so that the matching error (cost) between the template of the current block and the template of the reference block is minimized. For example, first, M prediction motion vectors (Motion Vector Prediction, MVP) are obtained from the Advanced Motion Vector Prediction (AMVP), Skip or Direct mode in the inter prediction process as the candidate MVPs of the current block to be predicted. Then, a template region is constructed based on the surrounding reconstructed pixels of the current block to be predicted, for example, the template region has a width of N pixels, and N is a positive integer. FIG. 9 shows a schematic diagram of a template region according to an embodiment of the present application. As shown in FIG. 9, the template region is an L-shaped region covering the top and left side of the current block to be predicted, with a width of N pixels. Then, template matching search is performed for each available direction of the candidate MVP to determine the best matching block.

[0068] Inter template matching usually adopts the mode of coarse search first and then fine search. In the process of coarse search, first, in the reference frame corresponding to each candidate MVP, the candidate MVP is used as the starting point (as the initial MVP) of the search, a certain shape of search mode is used to constantly update the initial MVP, and the cost between the template region in the reference frame corresponding to the updated MVP and the template region of the current block to be predicted is calculated at each search time. If the template region in the reference frame is a fractional pixel precision region, i.e. needs to be interpolated to generate, then the template region in the reference frame is generated by using bilinear interpolation, interpolation filter, etc. and then the cost is calculated. The point with the minimum template cost in each search is used as the center point of the next search. If the center point is optimal, the current search is terminated. After the optimal coarse search MV is obtained, fine search is performed based on a certain shape to obtain the best MV. FIG. 10 shows an example of the shape of coarse search and fine search according to an embodiment of the present application. One of the differences between coarse search and fine search is that the step length of the search is different. After the best MV is obtained, the interpolation filter method introduced in the above embodiments can be used to generate the best matching block corresponding to the current block.

[0069] Therefore, in order to successfully generate the best matching block of the current block, in addition to the reference block of the current block, the inter-frame template matching can also need to obtain the pixels (e.g., search region pixels) within a certain range for template matching, and the additional pixels (pixels in the interpolation expansion region) that can be needed in the final interpolation process. As shown in FIG. 11, in some embodiments, the search region is a first set size region surrounding the reference block, and the interpolation expansion region is a second set size region outside the search region. The search region size is the same at the encoding end and the decoding end, and the interpolation expansion region size is also the same. The first set size and the second set size can be the same or different. In all embodiments of the present application, the interpolation expansion region is a region in the reference frame that is expanded based on the search region, and the pixel values therein are used for performing interpolation filtering on the matching block obtained through template matching.

[0070] From the perspective of the decoding end, in order to generate the prediction block of the current block, when using the ordinary inter-frame prediction technology, it can be only necessary to read the reference block in the reference frame having the same pixel size as the current block and determined according to the motion vector from the off-chip memory (or off-chip buffer). When using the inter-frame template matching technology, it is also necessary to additionally read the search region pixels and the interpolation expansion region pixels from the off-chip memory. It can be seen that the inter-frame template matching technology introduces a large bandwidth overhead in hardware implementation, and the excessive hardware overhead limits the practical application of the encoding technology.

[0071] Based on this, the embodiments of the present application propose a new video coding technology applied to inter-frame template matching, which can use the pixel values in a set region in the reference frame to determine the pixel values in the interpolation expansion region, so that when the decoding end performs decoding, it does not need to read more reference pixel values from the off-chip memory, but can use the pixel values in the reference block and the search region that have been read and buffered in the on-chip memory to determine the pixel values in the interpolation expansion region, and even does not need to decode the pixel values in the interpolation expansion region from the code stream, thereby reducing the bandwidth overhead in hardware implementation and being beneficial to improving the coding efficiency of the video.

[0072] FIG. 12 shows a flowchart of a video decoding method according to an embodiment of the present application, which can be executed by a device with a computing processing function, such as a terminal device or a server. Referring to FIG. 12, the video decoding method at least includes S1210 to S1240, which are described in detail as follows.

[0073] In S1210, a video code stream is decoded to obtain a candidate motion vector of a current block in an inter-frame template matching mode.

[0074] In some embodiments, a video includes a sequence of video image frames. The sequence of video image frames includes a series of images. Each image can be further divided into slices. Each slice can be further divided into a series of LCUs (or CTUs). Each LCU includes a number of CUs. Video image frames are encoded in units of blocks. In some new video coding standards, such as in the H.264 standard, there are macroblocks (MBs). A macroblock can be further divided into a number of blocks that can be used for predictive encoding. In the HEVC standard, a number of basic concepts, such as coding unit (CU), prediction unit (PU), and transform unit (TU), are used to functionally divide the blocks and a brand new tree-based structure is used to describe the division. For example, a CU can be divided into smaller CUs according to a quad-tree, and the smaller CUs can be further divided, forming a quad-tree structure. The current block, the reference block, and the matching block in the embodiments of the present application can be CUs, or smaller blocks than CUs, such as smaller blocks obtained by dividing a CU.

[0075] The candidate motion vector of the current block can be one or more. The candidate motion vector of the current block can be obtained from a video bitstream, or can be obtained from one or more motion vectors in the AMVP, Skip, or Direct mode in the inter prediction process as the candidate motion vector of the current block.

[0076] In S1220, according to the candidate motion vector, a search is performed in the search area in the reference frame to obtain the matching block of the current block.

[0077] In some embodiments, the process of searching in the search area to obtain the matching block of the current block can be determining the reference block of the current block in the reference frame and the search starting point in the search area according to the candidate motion vector, then searching for the best motion vector corresponding to the candidate motion vector in the search area based on the search starting point, and determining the matching block of the current block according to the best motion vector. The process of searching for the best motion vector corresponding to the candidate motion vector in the search area can be as shown in the above embodiments, coarse search is performed first, and then fine search is performed. After the best motion vector is obtained, the matching block of the current block can be determined according to the best motion vector.

[0078] In some embodiments, the search region is a region surrounding the reference block, and can include at least one of the following regions: a first number of rows of pixel regions above the reference block; a second number of rows of pixel regions below the reference block; a third number of columns of pixel regions left of the reference block; a fourth number of columns of pixel regions right of the reference block; a pixel region above-left of the reference block; a pixel region above-right of the reference block; a pixel region below-left of the reference block; a pixel region below-right of the reference block. The first number, the second number, the third number and the fourth number can be equal or not equal, and can be partially equal, for example, can be selected from 1, 2, 3, 4, 5, 6, etc.

[0079] FIG. 13 shows a schematic diagram of a search region according to an embodiment of the present application. As shown in FIG. 13, the search region can have various settings (ways A-P in FIG. 13 are only examples). The search region can also include the pixel regions of the top-left corner, the top-right corner, the bottom-left corner and the bottom-right corner in ways A to O shown in FIG. 13. As shown in FIG. 13, taking way M as an example, if the pixel regions of the top-left corner and the bottom-left corner are included, the search region can be as shown in way M' in FIG. 13.

[0080] In some embodiments, the pixel values in the search region can be from the pixels in the reference frame, i.e., directly read from the reference frame without using additional methods for filling.

[0081] In S1230, the pixel values in the interpolation expansion region used for the interpolation filtering processing of the matching block are determined according to the pixel values in the set region in the reference frame.

[0082] In some embodiments, the range of the interpolation expansion region can be determined according to at least one of the following information: the position of the matching block, the number of taps of the interpolation filter, the range of the search region.

[0083] In the embodiments of the present application, when determining the range of the interpolation expansion region, if the pixels needed for the interpolation filtering processing of the matching block are beyond the range of the search region, the search region can be further expanded to obtain the interpolation expansion region. If the pixels needed for the interpolation filtering processing of the matching block are within the range of the search region, the interpolation filtering processing can be implemented without expanding the search region.

[0084] In some embodiments, the interpolation extended region can be the range of a fifth number of pixel regions above the search region and a sixth number of pixel regions below the search region when the absolute difference between the top-left corner horizontal coordinate of the reference block and the matching block is less than or equal to a first threshold value and the absolute difference between the top-left corner vertical coordinate of the reference block and the matching block is greater than a second threshold value. The fifth number and the sixth number can be equal or not equal, such as can be selected from 1, 2, 3, 4, 5, 6, etc. The first threshold value can be the difference between half of the number of taps used by the interpolation filter in the horizontal direction and a set constant value. The second threshold value can be the difference between half of the number of taps used by the interpolation filter in the vertical direction and a set constant value. The set constant can be 1 or other values, etc. The number of taps used by the interpolation filter in the horizontal direction can be equal to or not equal to the number of taps used in the vertical direction.

[0085] For example, if the number of taps is 4, the fifth number can be 1 and the sixth number can be 2; if the number of taps is 6, the fifth number can be 2 and the sixth number can be 3; if the number of taps is 8, the fifth number can be 3 and the sixth number can be 4; if the number of taps is 12, the fifth number can be 5 and the sixth number can be 6.

[0086] In some embodiments, the interpolation extended region can be the range of a fifth number of pixel regions above the search region when the absolute difference between the top-left corner horizontal coordinate of the reference block and the matching block is less than or equal to a first threshold value, the absolute difference between the top-left corner vertical coordinate of the reference block and the matching block is greater than a second threshold value, and the difference between the top-left corner vertical coordinate of the reference block and the matching block is greater than 0. The fifth number can be selected from 1, 2, 3, 4, 5, 6, etc. The first threshold value can be the difference between half of the number of taps used by the interpolation filter in the horizontal direction and a set constant value. The second threshold value can be the difference between half of the number of taps used by the interpolation filter in the vertical direction and a set constant value. The set constant can be 1 or other values, etc. The number of taps used by the interpolation filter in the horizontal direction can be equal to or not equal to the number of taps used in the vertical direction.

[0087] For example, if the number of taps is 4, the fifth number can be 1; if the number of taps is 6, the fifth number can be 2; if the number of taps is 8, the fifth number can be 3; if the number of taps is 12, the fifth number can be 5.

[0088] In some embodiments, if the absolute difference between the top-left corner horizontal coordinate of the reference block and the matching block is less than or equal to a first threshold, the absolute difference between the top-left corner vertical coordinate of the reference block and the matching block is greater than a second threshold, and the difference between the top-left corner vertical coordinate of the reference block and the matching block is less than or equal to 0, the sixth number of rows of pixel regions below the search region are taken as the range of the interpolation expansion region. The sixth number can be selected from 1, 2, 3, 4, 5, 6, etc. The first threshold can be the difference between half of the number of taps used by the interpolation filter in the horizontal direction and a first constant value. The second threshold can be the difference between half of the number of taps used by the interpolation filter in the vertical direction and a second constant value. The first and second constant values can be 1 or other values, etc. The number of taps used by the interpolation filter in the horizontal direction can be equal to or different from the number of taps used in the vertical direction.

[0089] For example, if the number of taps is 4, the sixth number can be 2; if the number of taps is 6, the sixth number can be 3; if the number of taps is 8, the sixth number can be 4; if the number of taps is 12, the sixth number can be 6.

[0090] In some embodiments, the search region is expanded to obtain the interpolation expansion region can be that when the absolute difference between the top-left corner vertical coordinate of the reference block and the matching block is less than or equal to a third threshold, and the absolute difference between the top-left corner horizontal coordinate of the reference block and the matching block is greater than a fourth threshold, the seventh number of columns of pixel regions to the left of the search region and the eighth number of columns of pixel regions to the right of the search region are taken as the range of the interpolation expansion region. The seventh and eighth numbers can be equal or different, and can be selected from 1, 2, 3, 4, 5, 6, etc. The third threshold can be the difference between half of the number of taps used by the interpolation filter in the vertical direction and a third constant value. The fourth threshold can be the difference between half of the number of taps used by the interpolation filter in the horizontal direction and a fourth constant value. The third and fourth constant values can be 1 or other values, etc. The number of taps used by the interpolation filter in the horizontal direction can be equal to or different from the number of taps used in the vertical direction.

[0091] For example, if the number of taps is 4, the seventh number can be 1 and the eighth number can be 2; if the number of taps is 6, the seventh number can be 2 and the eighth number can be 3; if the number of taps is 8, the seventh number can be 3 and the eighth number can be 4; if the number of taps is 12, the seventh number can be 5 and the eighth number can be 6.

[0092] In some embodiments, if the absolute difference between the top-left corner vertical coordinate of the reference block and the top-left corner vertical coordinate of the matching block is less than or equal to a third threshold value, the absolute difference between the top-left corner horizontal coordinate of the reference block and the top-left corner horizontal coordinate of the matching block is greater than a fourth threshold value, and the difference between the top-left corner horizontal coordinate of the reference block and the top-left corner horizontal coordinate of the matching block is greater than 0, then the pixel region of the seventh number of columns to the left of the search area is taken as the range of the interpolation expansion region. The seventh number can be selected from 1, 2, 3, 4, 5, 6, etc. The third threshold value can be the difference between half of the number of taps used by the interpolation filter in the vertical direction and a third constant value. The fourth threshold value can be the difference between half of the number of taps used by the interpolation filter in the horizontal direction and a fourth constant value. The third and fourth constant values can be 1 or other values, etc. The number of taps used by the interpolation filter in the horizontal direction can be equal to or different from the number of taps used in the vertical direction.

[0093] For example, if the number of taps is 4, the seventh number can be 1; if the number of taps is 6, the seventh number can be 2; if the number of taps is 8, the seventh number can be 3; if the number of taps is 12, the seventh number can be 5.

[0094] In some embodiments, if the absolute difference between the top-left corner vertical coordinate of the reference block and the top-left corner vertical coordinate of the matching block is less than or equal to a third threshold value, the absolute difference between the top-left corner horizontal coordinate of the reference block and the top-left corner horizontal coordinate of the matching block is greater than a fourth threshold value, and the difference between the top-left corner horizontal coordinate of the reference block and the top-left corner horizontal coordinate of the matching block is less than or equal to 0, then the pixel region of the eighth number of columns to the right of the search area is taken as the range of the interpolation expansion region. The eighth number can be selected from 1, 2, 3, 4, 5, 6, etc. The third threshold value can be the difference between half of the number of taps used by the interpolation filter in the vertical direction and a third constant value. The fourth threshold value can be the difference between half of the number of taps used by the interpolation filter in the horizontal direction and a fourth constant value. The third and fourth constant values can be 1 or other values, etc. The number of taps used by the interpolation filter in the horizontal direction can be equal to or different from the number of taps used in the vertical direction.

[0095] For example, if the number of taps is 4, the eighth number can be 2; if the number of taps is 6, the eighth number can be 3; if the number of taps is 8, the eighth number can be 4; if the number of taps is 12, the eighth number can be 6.

[0096] In some embodiments, the range of the interpolation extended region can be the fifth number of rows of pixel regions above the search region, the sixth number of rows of pixel regions below the search region, the seventh number of columns of pixel regions left to the search region, and the eighth number of columns of pixel regions right to the search region, if the absolute difference between the horizontal coordinate of the top-left corner of the reference block and the horizontal coordinate of the top-left corner of the matching block is greater than a fifth threshold value, and the absolute difference between the vertical coordinate of the top-left corner of the reference block and the vertical coordinate of the top-left corner of the matching block is greater than a sixth threshold value. The fifth number, the sixth number, the seventh number and the eighth number can be equal, can not be equal, or can be partially equal, such as can be selected from 1, 2, 3, 4, 5, 6, etc. The fifth threshold value can be the difference between half of the number of taps used by the interpolation filter in the horizontal direction and a fifth constant value. The sixth threshold value can be the difference between half of the number of taps used by the interpolation filter in the vertical direction and a sixth constant value. The constant values can be 1 or other values, etc. The number of taps used by the interpolation filter in the horizontal direction can be equal to the number of taps used by the interpolation filter in the vertical direction, or can not be equal.

[0097] In some embodiments, the fifth number of rows of pixel regions above the search region can be the range of the interpolation extended region, if the absolute difference between the horizontal coordinate of the top-left corner of the reference block and the horizontal coordinate of the top-left corner of the matching block is greater than a fifth threshold value, the absolute difference between the vertical coordinate of the top-left corner of the reference block and the vertical coordinate of the top-left corner of the matching block is greater than a sixth threshold value, and the difference between the vertical coordinate of the top-left corner of the reference block and the vertical coordinate of the top-left corner of the matching block is greater than 0. The fifth number can be selected from 1, 2, 3, 4, 5, 6, etc. The fifth threshold value can be the difference between half of the number of taps used by the interpolation filter in the horizontal direction and a fifth constant value. The sixth threshold value can be the difference between half of the number of taps used by the interpolation filter in the vertical direction and a sixth constant value. The fifth and sixth constant values can be 1 or other values, etc. The number of taps used by the interpolation filter in the horizontal direction can be equal to the number of taps used by the interpolation filter in the vertical direction, or can not be equal.

[0098] In some embodiments, if the absolute difference between the top-left corner horizontal coordinate of the reference block and the matching block is greater than a fifth threshold value, the absolute difference between the top-left corner vertical coordinate of the reference block and the matching block is greater than a sixth threshold value, and the difference between the top-left corner vertical coordinate of the reference block and the matching block is less than or equal to 0, then the range of the interpolation expansion region is the pixel region of a sixth number of rows below the search region. The sixth number can be selected from 1, 2, 3, 4, 5, 6, etc. The fifth threshold value can be the difference between half of the number of taps used by the interpolation filter in the horizontal direction and a fifth constant value. The sixth threshold value can be the difference between half of the number of taps used by the interpolation filter in the vertical direction and a sixth constant value. The fifth and sixth constant values can be 1 or other values, etc. The number of taps used by the interpolation filter in the horizontal direction can be equal to or different from the number of taps used in the vertical direction.

[0099] In some embodiments, if the absolute difference between the top-left corner horizontal coordinate of the reference block and the matching block is greater than a fifth threshold value, the absolute difference between the top-left corner vertical coordinate of the reference block and the matching block is greater than a sixth threshold value, and the difference between the top-left corner horizontal coordinate of the reference block and the matching block is greater than 0, then the range of the interpolation expansion region is the pixel region of a seventh number of columns to the left of the search region. The seventh number can be selected from 1, 2, 3, 4, 5, 6, etc. The fifth threshold value can be the difference between half of the number of taps used by the interpolation filter in the horizontal direction and a fifth constant value. The sixth threshold value can be the difference between half of the number of taps used by the interpolation filter in the vertical direction and a sixth constant value. The fifth and sixth constant values can be 1 or other values, etc. The number of taps used by the interpolation filter in the horizontal direction can be equal to or different from the number of taps used in the vertical direction.

[0100] In some embodiments, if the absolute difference between the top-left corner horizontal coordinate of the reference block and the matching block is greater than a fifth threshold value, the absolute difference between the top-left corner vertical coordinate of the reference block and the matching block is greater than a sixth threshold value, and the difference between the top-left corner horizontal coordinate of the reference block and the matching block is less than or equal to 0, then the range of the interpolation expansion region is the pixel region of an eighth number of columns to the right of the search region. The eighth number can be selected from 1, 2, 3, 4, 5, 6, etc. The fifth threshold value can be the difference between half of the number of taps used by the interpolation filter in the horizontal direction and a fifth constant value. The sixth threshold value can be the difference between half of the number of taps used by the interpolation filter in the vertical direction and a sixth constant value. The fifth and sixth constant values can be 1 or other values, etc. The number of taps used by the interpolation filter in the horizontal direction can be equal to or different from the number of taps used in the vertical direction.

[0101] The top-left corner vertex in the above embodiments is only an example, and the right-top corner vertex, the left-bottom corner vertex, the right-bottom corner vertex, the block center point in the reference block and the matching block can also be used, or the coordinate point at any same position in the reference block and the matching block can also be used.

[0102] Based on the above embodiments, assuming that the coordinate of the current block (such as the coordinate of the top-left corner vertex of the current block) is (x, y), the width of the current block is w, the height of the current block is h, the initial MV and the best MV of the inter-frame template matching are and respectively. and Since the initial MV corresponds to the reference block and the best MV corresponds to the best matching block, and the positions of the reference block and the best matching block are different, the interpolation expansion region can be determined in the following manner:

[0103] When , the interpolation expansion region can be obtained by expanding I pixels upwards (namely, expanding I rows of pixels upwards) and expanding J pixels downwards based on the search region. Under the above condition, and , the interpolation expansion region can be obtained by expanding I pixels upwards based on the search region; and when , the interpolation expansion region can be obtained by expanding J pixels downwards based on the search region.

[0104] When , the interpolation expansion region can be obtained by expanding I pixels leftwards (namely, expanding I columns of pixels leftwards) and expanding J pixels rightwards based on the search region. Under the above condition, and , the interpolation expansion region can be obtained by expanding I pixels leftwards based on the search region; and when , the interpolation expansion region can be obtained by expanding J pixels rightwards based on the search region.

[0105] When , the interpolation expansion region can be obtained by expanding I1 pixels upwards and downwards (namely, expanding I1 rows of pixels upwards and downwards) and expanding I2 pixels leftwards and rightwards (namely, expanding I2 columns of pixels leftwards and rightwards) based on the search region. Under the above condition, and , the interpolation expansion region can be obtained by expanding I2 pixels leftwards based on the search region; under the above condition, and , the interpolation expansion region can be obtained by expanding J2 pixels rightwards based on the search region; under the above condition, and , the interpolation expansion region can be obtained by expanding I1 pixels upwards based on the search region; under the above condition, and , the interpolation expansion region can be obtained by expanding J1 pixels downwards based on the search region.

[0106] When , the interpolation expansion region does not exceed the boundary of the search region, that is, no pixel needs to be expanded.

[0107] In the above example, I, J, I1, J1, I2, J2 are all positive integers. T1 represents the number of taps of the interpolation filter in the horizontal direction. T2 represents the number of taps of the interpolation filter in the vertical direction.

[0108] In the embodiments of the present application, if the interpolation expansion region is determined according to the range of the search region, the range of the interpolation expansion region can be determined as follows: a pixel region of a ninth number of rows above the search region; a pixel region of a tenth number of rows below the search region; a pixel region of an eleventh number of columns left of the search region; a pixel region of a twelfth number of columns right of the search region; a pixel region above-left of the search region; a pixel region above-right of the search region; a pixel region below-left of the search region; a pixel region below-right of the search region.

[0109] As shown in FIG. 14A, the interpolation expansion region can have various settings. The settings in FIG. 14A are described by taking the search region surrounding the reference block as an example, and the settings in FIG. 14A are merely examples. As shown in FIG. 14A, the interpolation expansion region can be at least one of above, below, left and right of the search region. The interpolation expansion region can also include a pixel region of one or more of the top-left corner, top-right corner, bottom-left corner, and bottom-right corner in the modes A to O shown in FIG. 14A. As shown in FIG. 14A, taking mode M as an example, if the pixel region of the top-left corner and the bottom-left corner is included, the interpolation expansion region can be as shown in mode M' in FIG. 14A. As shown in mode O in FIG. 14A, if the pixel region of the top-left corner, the top-right corner, the bottom-left corner and the bottom-right corner is included, the interpolation expansion region can be as shown in mode P in FIG. 14A.

[0110] In one specific example, as shown in FIG. 14B, the search region surrounds the reference block, and the interpolation expansion region is a region expanded by 5 pixels above and left of the search region (i.e., 5 rows of pixels upward and 5 columns of pixels leftward), and expanded by 6 pixels below and right of the search region (i.e., 6 rows of pixels downward and 6 columns of pixels rightward).

[0111] The search region can also include a pixel region of the top-left corner, the top-right corner, the bottom-left corner, and the bottom-right corner in the modes A to O shown in FIG. 13. As shown in FIG. 13, taking mode M as an example, if the pixel region of the top-left corner and the bottom-left corner is included, the search region can be as shown in mode M' in FIG. 13.

[0112] In all embodiments of the present application, if the interpolation expansion region is determined in accordance with the number of taps of the interpolation filter, then when the number of taps of the interpolation filter is 4, a pixel region of 1 row above the search region, a pixel region of 2 rows below the search region, a pixel region of 1 column to the left of the search region, and a pixel region of 2 columns to the right of the search region can be taken as the range of the interpolation expansion region. The specific numerical values in this embodiment are merely examples.

[0113] In all embodiments of the present application, if the interpolation expansion region is determined in accordance with the number of taps of the interpolation filter, then when the number of taps of the interpolation filter is 6, a pixel region of 2 rows above the search region, a pixel region of 3 rows below the search region, a pixel region of 2 columns to the left of the search region, and a pixel region of 3 columns to the right of the search region can be taken as the range of the interpolation expansion region. The specific numerical values in this embodiment are merely examples.

[0114] In all embodiments of the present application, if the interpolation expansion region is determined in accordance with the number of taps of the interpolation filter, then when the number of taps of the interpolation filter is 8, a pixel region of 3 rows above the search region, a pixel region of 4 rows below the search region, a pixel region of 3 columns to the left of the search region, and a pixel region of 4 columns to the right of the search region can be taken as the range of the interpolation expansion region. The specific numerical values in this embodiment are merely examples.

[0115] In all embodiments of the present application, if the interpolation expansion region is determined in accordance with the number of taps of the interpolation filter, then when the number of taps of the interpolation filter is 12, a pixel region of 5 rows above the search region, a pixel region of 6 rows below the search region, a pixel region of 5 columns to the left of the search region, and a pixel region of 6 columns to the right of the search region can be taken as the range of the interpolation expansion region. The specific numerical values in this embodiment are merely examples.

[0116] In all embodiments of the present application, if the interpolation expansion region is determined in accordance with the number of taps of the interpolation filter, then when the number of taps of the interpolation filter is 12, a pixel region of 5 columns to the left of the search region, and a pixel region of 6 columns to the right of the search region can be taken as the range of the interpolation expansion region. The specific numerical values in this embodiment are merely examples.

[0117] In all embodiments of the present application, if the interpolation expansion region is determined in accordance with the number of taps of the interpolation filter, then when the number of taps of the interpolation filter is 12, a pixel region of 5 rows above the search region, and a pixel region of 6 rows below the search region can be taken as the range of the interpolation expansion region. The specific numerical values in this embodiment are merely examples.

[0118] In some example embodiments, if the coordinate position of the reference block exceeds the image boundary of the reference frame, the coordinate position of the reference block can be adjusted to be on the image boundary; wherein the image boundary of the reference frame can be the boundary of the reference frame image, or can also be the boundary after the reference frame image is extended outward by a set size region (such as a set row and / or a set column).

[0119] In some example embodiments, if the coordinate position of the matching block exceeds the image boundary of the reference frame, the coordinate position of the matching block can be adjusted to be on the image boundary. The image boundary of the reference frame can be the boundary of the reference frame image, or can also be the boundary after the reference frame image is extended outward by a set size region (such as a set row and / or a set column).

[0120] In some example embodiments, if the search region exceeds the image boundary of the reference frame, the boundary of the search region can be adjusted to be on the image boundary. The image boundary of the reference frame can be the boundary of the reference frame image, or can also be the boundary after the reference frame image is extended outward by a set size region (such as a set row and / or a set column).

[0121] Specifically, assuming that the coordinates of the current block (such as the coordinates of the top-left corner vertex of the current block) are (x, y), the width of the current block is w, the height of the current block is h, the initial MV and the best MV of the inter-frame template matching are and respectively, then the top-left coordinates, the top-right coordinates, the bottom-left coordinates, and the bottom-right coordinates of the reference block of the current block are and and the top-left coordinates, the top-right coordinates, the bottom-left coordinates, and the bottom-right coordinates of the best matching block corresponding to the best MV are and the top-left coordinates, the top-right coordinates, the bottom-left coordinates, and the bottom-right coordinates of the best matching block corresponding to the best MV are Therefore, these coordinate values cannot exceed the image boundary, and it can also be understood that the reference block and the best matching block cannot exceed the image boundary. The image boundary can be the boundary of the current coding image (current frame), or the boundary after the current coding image is extended outward by N1 pixel units, where N1 is a positive integer (such as the boundary after the current coding image is extended outward by a CTU length).

[0122] If the coordinate positions of the reference block and the best matching block do not exceed the image boundary, the template matching and pixel interpolation can be performed according to the positions of the reference block and the best matching block. Otherwise, the coordinates exceeding the image boundary are adjusted to be on the boundary of the current coding image. In addition, the coordinates of the best matching block can be on the boundary of the search region, and therefore the boundary of the search region cannot exceed the image boundary.

[0123] In some embodiments, when determining the pixel values in the interpolation extension region according to the pixel values in the set region in the reference frame, the set region in the reference frame can be set according to actual needs. For example, the set region can include at least one of the following regions: a first pixel position in the search region, a second pixel position in the reference block of the current block. The first pixel position can be a position of one pixel or a position of multiple pixels. The second pixel position can be a position of one pixel or a position of multiple pixels.

[0124] In some embodiments, when determining the pixel values in the interpolation extension region, the pixel values in the set region can be copied as the pixel values in the interpolation extension region, such as copying a plurality of pixel values to fill the set positions in the interpolation extension region. The interpolation extension region can include one or more sub-interpolation extension regions, and copying the pixel values in the set region as the pixel values in the interpolation extension region can include: determining the size and position of the sub-interpolation extension region; selecting the pixel values in the set region of the same size as the sub-interpolation extension region as the pixel values in the corresponding position of the sub-interpolation extension region.

[0125] As shown in FIG. 15, the pixel value at position 1501 in the search region can be copied, and the pixel value at position 1502 in the search region can be copied as the pixel value at the corresponding position in the interpolation extension region. In addition, the pixel value at the top-left corner of the interpolation extension region can be obtained by copying the pixel value at the specified position (such as the top-left corner pixel of the search region or the position adjacent to the top-left corner of the interpolation extension region in the interpolation extension region). For example, the interpolation extension region can include an upper interpolation extension region above the search region, a left interpolation extension region on the left side of the search region, and a top-left interpolation extension region on the top-left side of the search region. The row of pixel values P1, P2, P3 adjacent to the position 1501 in the search region of the upper interpolation extension region can be copied as the pixel values in the corresponding row in the upper interpolation extension region, and the column of pixel values P1, P4, P7 adjacent to the position 1502 in the search region of the left interpolation extension region can be copied as the pixel values in the corresponding column in the left interpolation extension region. In addition, the pixel value P1 at the top-left corner pixel position of the search region or the pixel position adjacent to the top-left interpolation extension region in other interpolation extension regions (such as the upper or left interpolation extension region) can be copied as the pixel value of the top-left interpolation extension region.

[0126] Alternatively, as shown in FIG. 16, not only the pixel values in the search area but also the pixel values in the reference block can be copied as the pixel values at the corresponding positions in the interpolation extension area. For example, the pixel value at position 1601 in the area composed of the search area and the reference block, and the pixel value at position 1602 can be copied as the pixel values at the corresponding positions in the interpolation extension area. The pixel value at the top-left corner of the interpolation extension area can be obtained by copying the pixel value at a specified position (e.g., the pixel value at a position in the search area). For example, the interpolation extension area can include an upper interpolation extension area above the search area, a left interpolation extension area to the left of the search area, and a top-left interpolation extension area above and to the left of the search area. The row of pixel values P4, P5, P6 at position 1601 in the area composed of the search area and the reference block, which is next to the upper interpolation extension area, can be copied as the pixel values of the corresponding row in the upper interpolation extension area, and the column of pixel values P2, P5, P8 at position 1602 in the area composed of the search area and the reference block, which is next to the left interpolation extension area, can be copied as the pixel values of the corresponding column in the left interpolation extension area. The pixel value at the position in the search area that is closest to the interpolation extension area at position 1602 can be copied as the pixel value of the top-left interpolation extension area.

[0127] In some embodiments, when determining the pixel values in the interpolation extension area, symmetry processing based on a symmetry axis can be performed on the pixel values in a specified area to obtain the pixel values in the interpolation extension area. The interpolation extension area can be divided into one or more sub-interpolation extension areas, including an upper interpolation extension area above the search area, a lower interpolation extension area below the search area, a left interpolation extension area to the left of the search area, and a right interpolation extension area to the right of the search area. The one or more sub-interpolation extension areas can be non-corner interpolation extension areas that are not at the corners of the search area. The symmetry processing based on a symmetry axis on the pixel values in the specified area to obtain the pixel values in the interpolation extension area can include, for example, determining the size and position of a sub-interpolation extension area, and selecting, based on a symmetry axis, the pixel values in a region in the specified area that is symmetrical to the sub-interpolation extension area and has the same size as the sub-interpolation extension area, as the pixel values at the corresponding positions of the sub-interpolation extension area. The symmetry axis can be, for example, a boundary between the search area and the interpolation extension area, or a boundary of the reference block that is closest to the sub-interpolation extension area.

[0128] As shown in FIG. 17, in the rectangular dashed box 1701, symmetry processing is performed to obtain pixel values at corresponding positions in the interpolation expansion region; in the rectangular dashed box 1702, symmetry processing is performed to obtain pixel values at corresponding positions in the interpolation expansion region. For example, in the rectangular dashed box 1701, the size (including 3 rows and 2 columns of pixels) and position (for example, the pixel position at the upper left corner of the sub-interpolation expansion region) of a sub-interpolation expansion region therein can be determined, and with the boundary 1705 between the sub-interpolation expansion region and the search region as the symmetry axis, pixel values P1, P2, P4, P5, P7, P8 in the same size region symmetric to the sub-interpolation expansion region in the set region formed by the search region and the reference block are selected as the pixel values at the corresponding positions of the sub-interpolation expansion region. In the rectangular dashed box 1702, the size (including 2 rows and 3 columns of pixels) and position (for example, the pixel position at the upper left corner of the sub-interpolation expansion region) of a sub-interpolation expansion region therein can be determined, and with the boundary 1706 between the sub-interpolation expansion region and the search region as the symmetry axis, pixel values P1, P2, P3, P4, P5, P6 in the same size region symmetric to the sub-interpolation expansion region in the set region formed by the search region and the reference block are selected as the pixel values at the corresponding positions of the sub-interpolation expansion region.

[0129] In some embodiments, when determining pixel values in the interpolation expansion region, symmetry processing based on a symmetry point can be performed on pixel values in the set region to obtain pixel values in the interpolation expansion region. The interpolation expansion region can include one or more sub-interpolation expansion regions at the upper left corner, the upper right corner, the lower left corner, the lower right corner, and the like of the search region. The symmetry processing based on a symmetry point to obtain pixel values in the interpolation expansion region can include determining the size and position of a sub-interpolation expansion region, and selecting, based on the symmetry point, pixel values in the same size region symmetric to the sub-interpolation expansion region in the set region as pixel values at corresponding positions of the sub-interpolation expansion region. The symmetry point can be, for example, a pixel point at a corner of the search region corresponding to the sub-interpolation expansion region, or a pixel point at a corner of the reference block corresponding to the sub-interpolation expansion region.

[0130] As shown in FIG. 17, the pixel values in the circular dashed box 1704 are obtained based on symmetry processing based on the symmetry point 1703. For example, in the circular dashed box 1704, the size (including 2 rows and 2 columns of pixels) and position (for example, the pixel position at the upper left corner of the sub-interpolation expansion region) of a sub-interpolation expansion region therein can be determined, and with the pixel point 1703 at the corner of the search region corresponding to the sub-interpolation expansion region as the symmetry point, pixel values P1, P2, P4, P5 in the same size region symmetric to the sub-interpolation expansion region in the set region formed by the search region and the reference block are selected as the pixel values at the corresponding positions of the sub-interpolation expansion region.

[0131] In some embodiments, when determining the pixel value in the interpolation expansion region, the pixel value in the setting region can be weighted to obtain the pixel value in the interpolation expansion region. As shown in FIG. 18, the pixel value P1' in the interpolation expansion region is (2*P4+P1+P7+2)>>2; the pixel value P2' in the interpolation expansion region is (2*P5+P2+P8+2)>>2; and the pixel value P3' in the interpolation expansion region is (2*P6+P3+P9+2)>>2.

[0132] In some embodiments, when determining the pixel value in the interpolation expansion region, an intra-frame prediction process can be performed based on the pixel value in the setting region to obtain the pixel value in the interpolation expansion region. For example, the pixel value at a corresponding position in the interpolation expansion region can be filled based on the calculation formula of the angle mode, the DC mode, or the Planar mode, etc.

[0133] The above-mentioned embodiments of determining the pixel value in the interpolation expansion region can be used in combination or individually.

[0134] In some embodiments, the pixel value of a pixel in the top-left corner region in the interpolation expansion region can be obtained by copying the pixel value of an upper pixel in the upper region and a left pixel in the left region in the interpolation expansion region, or by other ways such as symmetric processing of the upper pixel and the left pixel, or by weighted calculation of the pixel value of the upper pixel and the left pixel, or by intra prediction based on the pixel values of the upper pixel and the left pixel. The pixel value of a pixel in the top-right corner region in the interpolation expansion region can be obtained by copying the pixel value of the upper pixel and a right pixel in the right region in the interpolation expansion region, or by other ways such as symmetric processing of the upper pixel and the right pixel, or by weighted calculation of the pixel value of the upper pixel and the right pixel, or by intra prediction based on the pixel values of the upper pixel and the right pixel. The pixel value of a pixel in the bottom-left corner region in the interpolation expansion region can be obtained by copying the pixel value of a lower pixel in the lower region and the left pixel in the left region in the interpolation expansion region, or by other ways such as symmetric processing of the lower pixel and the left pixel, or by weighted calculation of the pixel value of the lower pixel and the left pixel, or by intra prediction based on the pixel values of the lower pixel and the left pixel. The pixel value of a pixel in the bottom-right corner region in the interpolation expansion region can be obtained by copying the pixel value of the lower pixel and the right pixel in the right region in the interpolation expansion region, or by other ways such as symmetric processing of the lower pixel and the right pixel, or by weighted calculation of the pixel value of the lower pixel and the right pixel, or by intra prediction based on the pixel values of the lower pixel and the right pixel. The symmetric axis of the symmetric processing is, for example, a boundary between the pixels. Or the symmetric processing is performed with a certain pixel in the interpolation expansion region as the symmetric point.

[0135] In S1240, the matching block is subjected to interpolation filtering based on the interpolation expansion region.

[0136] In some embodiments, after the matching block is subjected to interpolation filtering based on the interpolation expansion region, the best matching block of the current block can be obtained, and then the best matching block can be taken as the prediction block of the current block for further decoding.

[0137] In some embodiments, when the technical solution of the embodiments of the present application is applied, the decoding end can determine at least one of the following information according to the default manner negotiated with the encoding end: the range of the search area, the range of the interpolation expansion area, and the pixel value in the interpolation expansion area. That is, in this embodiment, the encoding end and the decoding end can be made to use the same kind of manner by default based on implicit application. For example, the encoding end and the decoding end both default to expand N3 pixels (N3 is a positive integer) from all around the reference block to obtain the search area, then expand 5 pixels to the left and up (i.e., expand 5 columns to the left and 5 rows to the up), and expand 6 pixels to the right and down (i.e., expand 6 columns to the right and 6 rows to the down) to obtain the interpolation expansion area, and fill the interpolation expansion area using the copy manner.

[0138] In some embodiments, when the technical solution of the embodiments of the present application is applied, at least one flag can be decoded from the video bitstream, and then at least one of the following information can be determined according to the value of the at least one flag: the range of the search area, the range of the interpolation expansion area, and the pixel value in the interpolation expansion area. For example, the encoding end can adaptively select whether to use one or more manners proposed in the embodiments of the present application by RDO, and indicate which specific manner to use through one or more of block-level, CTU-level, slice-level, and frame-level flags, so that the decoding end can directly parse the flag and obtain the corresponding processing manner. Specifically, for example, the encoding end can use 3 flags, the value of one flag is used to indicate the range of the search area (such as indicating how many pixels are expanded from all around the reference block to obtain the search area), the value of one flag is used to indicate the range of the interpolation expansion area, and the value of one flag is used to indicate how to determine the pixel value in the interpolation expansion area.

[0139] In some embodiments, the encoding end can also implicitly indicate which manner or manners to use by adjusting the quantization coefficient, so that the decoding end determines the implicitly derived flag by counting the quantization coefficient, and then determines the corresponding processing manner.

[0140] The schemes in the above embodiments of the present application can be used alone or in combination. The technical solution of the embodiments of the present application can be used in the search process and / or motion compensation process of template matching-based technologies such as intra-frame and inter-frame, and can be applied to products of video codecs.

[0141] FIG. 19 shows a flowchart of a video encoding method according to an embodiment of the present application, which can be executed by a device with computing processing function, such as a terminal device or a server. Referring to FIG. 19, the video encoding method at least includes S1910 to S1940, which are described in detail as follows:

[0142] In S1910, a candidate motion vector of a current block in an inter-frame template matching mode is determined.

[0143] In S1920, a search is performed in a search region in a reference frame according to the candidate motion vector to obtain a matching block of the current block.

[0144] In S1930, pixel values in an interpolation expansion region for interpolation filtering processing of the matching block are determined according to pixel values in a set region in the reference frame. The interpolation expansion region is a region in the reference frame expanded based on the search region.

[0145] In S1940, interpolation filtering processing is performed on the matching block based on the interpolation expansion region to encode based on a result of the interpolation filtering processing.

[0146] The processing procedure at the encoding end is similar to the processing procedure at the decoding end, and details are referable to the aforementioned processing procedure at the decoding end, which will not be repeated here.

[0147] The apparatus embodiment of the present application is introduced below, which can be used to execute the method described in the aforementioned embodiments of the present application. For details not disclosed in the apparatus embodiment of the present application, refer to the aforementioned method embodiments of the present application.

[0148] FIG. 20 shows a block diagram of a video decoding apparatus according to an embodiment of the present application, which can be arranged in a device with computing processing function, such as a terminal device or a server.

[0149] Referring to FIG. 20, the video decoding apparatus 2000 according to an embodiment of the present application includes a decoding unit 2002, a searching unit 2004, a determining unit 2006 and a processing unit 2008.

[0150] The decoding unit 2002 is configured to decode a video code stream to obtain a candidate motion vector of a current block in an inter-frame template matching mode; the searching unit 2004 is configured to perform a search in a search region in a reference frame according to the candidate motion vector to obtain a matching block of the current block; the determining unit 2006 is configured to determine pixel values in an interpolation expansion region for interpolation filtering processing of the matching block according to pixel values in a set region in the reference frame; and the processing unit 2008 is configured to perform interpolation filtering processing on the matching block based on the interpolation expansion region. The interpolation expansion region is a region in the reference frame expanded based on the search region.

[0151] In some embodiments of the present application, based on the foregoing scheme, the searching unit 2004 is configured to: determine a reference block of the current block according to the candidate motion vector in the reference frame, and a search starting point in the search region; search for an optimal motion vector corresponding to the candidate motion vector in the search region based on the search starting point, so as to determine a matching block of the current block according to the optimal motion vector.

[0152] In some embodiments of the present application, based on the foregoing scheme, the search region comprises at least one of the following regions:

[0153] a first number of rows of pixel regions located above the reference block;

[0154] a second number of rows of pixel regions located below the reference block;

[0155] a third number of columns of pixel regions located left of the reference block;

[0156] a fourth number of columns of pixel regions located right of the reference block;

[0157] a pixel region located top-left of the reference block;

[0158] a pixel region located top-right of the reference block;

[0159] a pixel region located bottom-left of the reference block;

[0160] a pixel region located bottom-right of the reference block.

[0161] In some embodiments of the present application, based on the foregoing scheme, the determining unit 2006 is further configured to determine the range of the interpolation expansion region according to at least one of the following information: the position of the matching block, the number of taps of an interpolation filter, and the range of the search region.

[0162] In some embodiments of the present application, based on the foregoing scheme, the determining unit 2006 is configured to expand the search region to obtain the interpolation expansion region, if pixels used for interpolation filtering processing on the matching block exceed the range of the search region.

[0163] In some embodiments of the present application, based on the foregoing scheme, the determining unit 2006 is configured to expand the search region to obtain the interpolation expansion region, including any one of the following manners:

[0164] if the absolute difference between the top-left corner horizontal coordinate of the reference block and the top-left corner horizontal coordinate of the matching block is less than or equal to a first threshold value, and the absolute difference between the top-left corner vertical coordinate of the reference block and the top-left corner vertical coordinate of the matching block is greater than a second threshold value, then a fifth number of rows of pixel regions above the search region and a sixth number of rows of pixel regions below the search region are taken as the range of the interpolation expansion region;

[0165] if the absolute difference between the top-left corner horizontal coordinate of the reference block and the top-left corner horizontal coordinate of the matching block is less than or equal to a first threshold value, the absolute difference between the top-left corner vertical coordinate of the reference block and the top-left corner vertical coordinate of the matching block is greater than a second threshold value, and the difference between the top-left corner vertical coordinate of the reference block and the top-left corner vertical coordinate of the matching block is greater than 0, then a fifth number of rows of pixel regions above the search region are taken as the range of the interpolation expansion region;

[0166] if the absolute difference between the top-left corner horizontal coordinate of the reference block and the top-left corner horizontal coordinate of the matching block is less than or equal to a first threshold value, the absolute difference between the top-left corner vertical coordinate of the reference block and the top-left corner vertical coordinate of the matching block is greater than a second threshold value, and the difference between the top-left corner vertical coordinate of the reference block and the top-left corner vertical coordinate of the matching block is less than or equal to 0, then a sixth number of rows of pixel regions below the search region are taken as the range of the interpolation expansion region;

[0167] wherein the first threshold value is the difference between half of the number of taps used by the interpolation filter in the horizontal direction and a first constant value; and the second threshold value is the difference between half of the number of taps used by the interpolation filter in the vertical direction and a second constant value.

[0168] In some embodiments of the present application, based on the foregoing scheme, the determining unit 2006 is configured to expand the search region to obtain the interpolation expansion region, including any one of the following manners:

[0169] if the absolute difference between the top-left corner vertical coordinate of the reference block and the top-left corner vertical coordinate of the matching block is less than or equal to a third threshold value, and the absolute difference between the top-left corner horizontal coordinate of the reference block and the top-left corner horizontal coordinate of the matching block is greater than a fourth threshold value, then a seventh number of columns of pixel regions to the left of the search region and an eighth number of columns of pixel regions to the right of the search region are taken as the range of the interpolation expansion region;

[0170] if the absolute difference between the top-left corner vertical coordinate of the reference block and the top-left corner vertical coordinate of the matching block is less than or equal to a third threshold value, the absolute difference between the top-left corner horizontal coordinate of the reference block and the top-left corner horizontal coordinate of the matching block is greater than a fourth threshold value, and the difference between the top-left corner horizontal coordinate of the reference block and the top-left corner horizontal coordinate of the matching block is greater than 0, then a seventh number of columns of pixel regions to the left of the search region are taken as the range of the interpolation expansion region;

[0171] if the absolute difference between the top-left corner vertical coordinate of the reference block and the top-left corner vertical coordinate of the matching block is less than or equal to a third threshold value, the absolute difference between the top-left corner horizontal coordinate of the reference block and the top-left corner horizontal coordinate of the matching block is greater than a fourth threshold value, and the difference between the top-left corner horizontal coordinate of the reference block and the top-left corner horizontal coordinate of the matching block is less than or equal to 0, then the pixel region of the eighth number of columns located to the right of the search region is taken as the range of the interpolation expansion region;

[0172] wherein the third threshold value is the difference between half of the number of taps used by the interpolation filter in the horizontal direction and a third constant value; and the fourth threshold value is the difference between half of the number of taps used by the interpolation filter in the vertical direction and a fourth constant value.

[0173] In some embodiments of the present application, based on the foregoing scheme, the determining unit 2006 is configured to expand the search region to obtain the interpolation expansion region, including any one of the following manners:

[0174] if the absolute difference between the top-left corner horizontal coordinate of the reference block and the top-left corner horizontal coordinate of the matching block is greater than a fifth threshold value, and the absolute difference between the top-left corner vertical coordinate of the reference block and the top-left corner vertical coordinate of the matching block is greater than a sixth threshold value, then the pixel region of the fifth number of rows located above the search region, the pixel region of the sixth number of rows located below the search region, the pixel region of the seventh number of columns located to the left of the search region, and the pixel region of the eighth number of columns located to the right of the search region are taken as the range of the interpolation expansion region;

[0175] if the absolute difference between the top-left corner horizontal coordinate of the reference block and the top-left corner horizontal coordinate of the matching block is greater than a fifth threshold value, the absolute difference between the top-left corner vertical coordinate of the reference block and the top-left corner vertical coordinate of the matching block is greater than a sixth threshold value, and the difference between the top-left corner vertical coordinate of the reference block and the top-left corner vertical coordinate of the matching block is greater than 0, then the pixel region of the fifth number of rows located above the search region is taken as the range of the interpolation expansion region;

[0176] if the absolute difference between the top-left corner horizontal coordinate of the reference block and the top-left corner horizontal coordinate of the matching block is greater than a fifth threshold value, the absolute difference between the top-left corner vertical coordinate of the reference block and the top-left corner vertical coordinate of the matching block is greater than a sixth threshold value, and the difference between the top-left corner vertical coordinate of the reference block and the top-left corner vertical coordinate of the matching block is less than or equal to 0, then the pixel region of the sixth number of rows located below the search region is taken as the range of the interpolation expansion region;

[0177] if the absolute difference between the top-left corner horizontal coordinate of the reference block and the top-left corner horizontal coordinate of the matching block is greater than a fifth threshold value, the absolute difference between the top-left corner vertical coordinate of the reference block and the top-left corner vertical coordinate of the matching block is greater than a sixth threshold value, and the difference between the top-left corner horizontal coordinate of the reference block and the top-left corner horizontal coordinate of the matching block is greater than 0, then a pixel region of a seventh number of columns located to the left of the search region is determined as the range of the interpolation expansion region;

[0178] if the absolute difference between the top-left corner horizontal coordinate of the reference block and the top-left corner horizontal coordinate of the matching block is greater than a fifth threshold value, the absolute difference between the top-left corner vertical coordinate of the reference block and the top-left corner vertical coordinate of the matching block is greater than a sixth threshold value, and the difference between the top-left corner horizontal coordinate of the reference block and the top-left corner horizontal coordinate of the matching block is less than or equal to 0, then a pixel region of an eighth number of columns located to the right of the search region is determined as the range of the interpolation expansion region; wherein the fifth threshold value is the difference between half of the number of taps used by the interpolation filter in the horizontal direction and a fifth constant value; and the sixth threshold value is the difference between half of the number of taps used by the interpolation filter in the vertical direction and a sixth constant value.

[0179] In some embodiments of the present application, based on the foregoing scheme, the determining unit 2006 is configured to determine the range of the interpolation expansion region as at least one of the following regions:

[0180] a pixel region of a ninth number of rows located above the search region;

[0181] a pixel region of a tenth number of rows located below the search region;

[0182] a pixel region of an eleventh number of columns located to the left of the search region;

[0183] a pixel region of a twelfth number of columns located to the right of the search region;

[0184] a pixel region located to the top-left of the search region;

[0185] a pixel region located to the top-right of the search region;

[0186] a pixel region located to the bottom-left of the search region;

[0187] a pixel region located to the bottom-right of the search region.

[0188] In some embodiments of the present application, based on the foregoing scheme, the determining unit 2006 is configured to determine the range of the interpolation expansion region according to at least one of the following manners:

[0189] If the tap number of the interpolation filter is 4, a pixel region of 1 row above the search region, a pixel region of 2 rows below the search region, a pixel region of 1 column left to the search region, and a pixel region of 2 columns right to the search region are taken as the range of the interpolation expansion region;

[0190] If the tap number of the interpolation filter is 6, a pixel region of 2 rows above the search region, a pixel region of 3 rows below the search region, a pixel region of 2 columns left to the search region, and a pixel region of 3 columns right to the search region are taken as the range of the interpolation expansion region;

[0191] If the tap number of the interpolation filter is 8, a pixel region of 3 rows above the search region, a pixel region of 4 rows below the search region, a pixel region of 3 columns left to the search region, and a pixel region of 4 columns right to the search region are taken as the range of the interpolation expansion region;

[0192] If the tap number of the interpolation filter is 12, a pixel region of 5 rows above the search region, a pixel region of 6 rows below the search region, a pixel region of 5 columns left to the search region, and a pixel region of 6 columns right to the search region are taken as the range of the interpolation expansion region;

[0193] If the tap number of the interpolation filter is 12, a pixel region of 5 columns left to the search region, and a pixel region of 6 columns right to the search region are taken as the range of the interpolation expansion region;

[0194] If the tap number of the interpolation filter is 12, a pixel region of 5 rows above the search region, and a pixel region of 6 rows below the search region are taken as the range of the interpolation expansion region.

[0195] In some embodiments of the present application, based on the foregoing scheme, the determining unit 2006 is further configured to: if the coordinate position of the reference block, the coordinate position of the matching block, or the search region exceeds the image boundary of the reference frame, adjust the coordinate position of the reference block, the coordinate position of the matching block, or the search region to be on the image boundary.

[0196] The image boundary of the reference frame is the boundary of the reference frame image, or the boundary of the reference frame image after the size region is expanded outward.

[0197] In some embodiments of the present application, based on the foregoing scheme, the set region comprises at least one of the following regions: a first pixel position in the search region, a second pixel position in the reference block of the current block;

[0198] The determining unit 2006 is configured to determine the pixel value in the interpolation expansion region according to at least one of the following manners:

[0199] copying the pixel value in the set region as the pixel value in the interpolation expansion region;

[0200] performing first symmetry processing on the pixel value in the set region based on a symmetry axis to obtain the pixel value in the interpolation expansion region;

[0201] performing second symmetry processing on the pixel value in the set region based on a symmetry point to obtain the pixel value in the interpolation expansion region;

[0202] performing weighted calculation on the pixel value in the set region to obtain the pixel value in the interpolation expansion region;

[0203] obtaining the pixel value in the interpolation expansion region by intra prediction based on the pixel value in the set region.

[0204] In some embodiments of the present application, based on the foregoing scheme, the determining unit 2006 is further configured to determine at least one of the following information according to a default manner negotiated with the encoding end: the range of the search region, the range of the interpolation expansion region, and the pixel value in the interpolation expansion region; or

[0205] decoding at least one flag bit from the video code stream, and determining at least one of the following information according to the value of the at least one flag bit: the range of the search region, the range of the interpolation expansion region, and the pixel value in the interpolation expansion region.

[0206] FIG. 21 shows a block diagram of a video encoding apparatus according to an embodiment of the present application, which can be arranged in a device with computing processing function, such as a terminal device or a server.

[0207] Referring to FIG. 21, the video encoding apparatus 2100 according to an embodiment of the present application comprises a determining unit 2102, a searching unit 2104, a determining unit 2106 and a processing unit 2108.

[0208] The determining unit 2102 is configured to determine a candidate motion vector of a current block using an inter-frame template matching mode; the searching unit 2104 is configured to search in a search region in a reference frame according to the candidate motion vector to obtain a matching block of the current block; the determining unit 2106 is configured to determine pixel values in an interpolation expansion region used for interpolation filtering according to pixel values in a set region in the reference frame; and the processing unit 2108 is configured to perform interpolation filtering on the matching block based on the interpolation expansion region.

[0209] FIG. 22 shows a structural schematic diagram of a computer system of an electronic device suitable for implementing the embodiments of the present application, which can be the video encoding apparatus or the video decoding apparatus in the foregoing embodiments.

[0210] The computer system 2200 of the electronic device shown in FIG. 22 is only an example and should not bring any limitation to the functions and use range of the embodiments of the present application.

[0211] As shown in FIG. 22, the computer system 2200 can include a central processing unit (CPU) 2201, which can perform various appropriate actions and processes according to programs stored in a read-only memory (ROM) 2202 or loaded from a storage portion 2208 into a random access memory (RAM) 2203, such as performing the methods described in the foregoing embodiments. In the RAM 2203, various programs and data required for system operation are also stored. The CPU 2201, the ROM 2202, and the RAM 2203 are connected to each other through a bus 2204. An input / output (I / O) interface 2205 is also connected to the bus 2204.

[0212] The following components can be connected to the I / O interface 2205: an input part 2206 including a keyboard, a mouse, etc.; an output part 2207 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), etc., and a speaker, etc.; a storage part 2208 including a hard disk, etc.; and a communication part 2209 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication part 2209 performs communication processing via a network such as the Internet. A drive 2210 is also connected to the I / O interface 2205 as necessary. A removable media 2211 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc. is attached to the drive 2210 as necessary, so that a computer program read therefrom is installed in the storage part 2208 as necessary.

[0213] In particular, the processes described above with reference to the flowcharts can be implemented as a computer software program according to embodiments of the present application. For example, embodiments of the present application include a computer program product comprising a computer program for performing the methods illustrated by the flowcharts carried on a computer readable medium. In such embodiments, the computer program can be downloaded and installed from a network via the communication part 2209, and / or installed from the removable media 2211. When the computer program is executed by the central processing unit (CPU) 2201, various functions defined in the system of the present application are performed.

[0214] Embodiments of the present application also provide a method for storing or transmitting a video bitstream, which is decoded according to the aforementioned video decoding method, or generated according to the aforementioned video encoding method.

[0215] The computer readable medium in the embodiments of the present application can be a computer readable signal medium or a computer readable storage medium or any combination thereof. The computer readable storage medium may, for example, be, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or apparatus, or any suitable combination thereof. More specific examples of the computer readable storage medium can include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In this application, the computer readable storage medium can be any tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus, or device. In this application, the computer readable signal medium can include a computer readable computer program product that transmits a program over a computer readable storage medium or a carrier wave. Such a computer readable signal medium can take many forms, including but not limited to, a wireless, wire line, or any suitable combination thereof. The computer readable medium can be any medium that can be accessed by a computer. The computer readable medium can be part of a memory, a computer readable storage medium, or a computer readable signal medium. The memory can include a cache, a buffer, a RAM, a ROM, an EEPROM, an E2PROM, a flash memory, or any suitable combination thereof. The computer readable storage medium can include a magnetic storage, an optical storage, a portable computer diskette, a hard disk, a solid state drive, or any suitable combination thereof. The computer readable signal medium can include a carrier wave transmitting a program over a computer readable storage medium or a computer readable storage medium.

[0216] The flowcharts and block diagrams in the drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present application. In this regard, each block in the flowcharts or block diagrams can represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions noted in the blocks can occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently or the blocks can sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowcharts, and combinations thereof, can be implemented by special purpose hardware-based systems that perform the specified functions or operations, or combinations of special purpose hardware and computer program products.

[0217] The units described in the embodiments of the present application can be implemented by software, or can be implemented by hardware, and the units described can also be arranged in a processor. In some cases, the names of the units do not constitute a limitation on the units themselves.

[0218] As another aspect, the present application also provides a computer readable medium, which can be included in the electronic device described in the above embodiments, or can exist independently without being assembled into the electronic device. The computer readable medium carries one or more computer programs, which, when executed by the electronic device, enable the electronic device to implement the method described in the above embodiments.

[0219] It should be noted that although several modules or units of the device for action execution are mentioned in the above detailed description, such division is not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided into several modules or units.

[0220] From the above description of the embodiments, those skilled in the art can easily understand that the example embodiments described herein can be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solutions according to the embodiments of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a U disk, a mobile hard disk, etc.) or a network, and includes several instructions to enable an electronic device to perform the method according to the embodiments of the present application.

[0221] For example, the electronic device can be a video decoding apparatus, which can perform the video decoding method shown in FIG. 12; for another example, the electronic device can be a video encoding apparatus, which can perform the video encoding method shown in FIG. 19.

[0222] Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the embodiments disclosed herein. The present application is intended to cover any variations, uses, or adaptations of the application following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice in the art to which the application pertains.

[0223] It is to be understood that the application is not limited to the precise construction already described above and shown in the drawings, and that various modifications and changes can be made by those skilled in the art without departing from the scope of the application. The scope of the application should only be limited by the claims appended hereto.

Claims

1. A method of video decoding, the method comprising: The video decoding method comprises: decoding a video bitstream to obtain a candidate motion vector of a current block in an inter-frame template matching mode; searching in a search region in a reference frame according to the candidate motion vector to obtain a matching block of the current block; determining pixel values in an interpolation expansion region used for interpolation filtering processing of the matching block according to pixel values in a set region in the reference frame; performing interpolation filtering processing on the matching block based on the interpolation expansion region.

2. The video decoding method of claim 1, wherein, The searching in a search region in a reference frame according to the candidate motion vector to obtain a matching block of the current block comprises: determining a reference block of the current block in the reference frame and a search starting point in the search region according to the candidate motion vector; searching for an optimal motion vector corresponding to the candidate motion vector in the search region based on the search starting point; determining the matching block of the current block according to the optimal motion vector.

3. The video decoding method of claim 2, wherein, The search region is a region surrounding the reference block, and comprises at least one of the following regions: a first number of rows of pixel regions above the reference block; a second number of rows of pixel regions below the reference block; a third number of columns of pixel regions left to the reference block; a fourth number of columns of pixel regions right to the reference block; a pixel region above-left to the reference block; a pixel region above-right to the reference block; a pixel region below-left to the reference block; a pixel region below-right to the reference block.

4. The method of Claim 1-3, wherein, The video decoding method further comprises: determining a range of the interpolation expansion region according to at least one of the following information: a position of the matching block, a tap number of an interpolation filter, a range of the search region.

5. The video decoding method of claim 4, wherein, The determining of the range of the interpolation expansion region comprises: if pixels used for the interpolation filtering processing on the matching block exceed the range of the search region, expanding the search region to obtain the interpolation expansion region.

6. The video decoding method of claim 5, wherein, The expanding of the search region to obtain the interpolation expansion region comprises any one of the following manners: if an absolute difference between a reference block of the current block and a horizontal coordinate of a top-left vertex of the matching block is less than or equal to a first threshold value, and an absolute difference between the reference block and a vertical coordinate of the top-left vertex of the matching block is greater than a second threshold value, a fifth number of rows of pixel regions above the search region and a sixth number of rows of pixel regions below the search region are taken as the range of the interpolation expansion region; or if the absolute difference between the reference block and the horizontal coordinate of the top-left vertex of the matching block is less than or equal to the first threshold value, the absolute difference between the reference block and the vertical coordinate of the top-left vertex of the matching block is greater than the second threshold value, and a difference between the reference block and the vertical coordinate of the top-left vertex of the matching block is greater than 0, the fifth number of rows of pixel regions above the search region are taken as the range of the interpolation expansion region; or if an absolute difference between the reference block and a top-left corner horizontal coordinate of the matching block is less than or equal to a first threshold, an absolute difference between the reference block and a top-left corner vertical coordinate of the matching block is greater than a second threshold, and a difference between the reference block and the top-left corner vertical coordinate of the matching block is less than or equal to 0, then a pixel region of a sixth number of rows below the search region is taken as a range of the interpolation expansion region; wherein the first threshold is a difference between a half of a number of taps used by the interpolation filter in a horizontal direction and a first constant value; and the second threshold is a difference between a half of a number of taps used by the interpolation filter in a vertical direction and a second constant value.

7. The video decoding method of claim 5 or 6, characterized by, The search region is expanded to obtain the interpolation expansion region, including any one of the following manners: if an absolute difference between the reference block and a top-left corner vertical coordinate of the matching block is less than or equal to a third threshold, and an absolute difference between the reference block and a top-left corner horizontal coordinate of the matching block is greater than a fourth threshold, then a pixel region of a seventh number of columns left of the search region and a pixel region of an eighth number of columns right of the search region are taken as a range of the interpolation expansion region; or if an absolute difference between the reference block and a top-left corner vertical coordinate of the matching block is less than or equal to a third threshold, an absolute difference between the reference block and a top-left corner horizontal coordinate of the matching block is greater than a fourth threshold, and a difference between the reference block and the top-left corner horizontal coordinate of the matching block is greater than 0, then a pixel region of a seventh number of columns left of the search region is taken as a range of the interpolation expansion region; or if an absolute difference between the reference block and a top-left corner vertical coordinate of the matching block is less than or equal to a third threshold, an absolute difference between the reference block and a top-left corner horizontal coordinate of the matching block is greater than a fourth threshold, and a difference between the reference block and the top-left corner horizontal coordinate of the matching block is less than or equal to 0, then a pixel region of an eighth number of columns right of the search region is taken as a range of the interpolation expansion region; wherein the third threshold is a difference between a half of a number of taps used by the interpolation filter in a horizontal direction and a third constant value; and the fourth threshold is a difference between a half of a number of taps used by the interpolation filter in a vertical direction and a fourth constant value.

8. The method of Claim 5-7, wherein, The search region is expanded to obtain the interpolation expansion region, including any one of the following manners: if an absolute difference between the reference block and a top-left corner horizontal coordinate of the matching block is greater than a fifth threshold, and an absolute difference between the reference block and a top-left corner vertical coordinate of the matching block is greater than a sixth threshold, then a pixel region of a fifth number of rows above the search region, a pixel region of a sixth number of rows below the search region, a pixel region of a seventh number of columns left of the search region, and a pixel region of an eighth number of columns right of the search region are taken as a range of the interpolation expansion region; or if the absolute difference between the top-left corner horizontal coordinate of the reference block and the top-left corner horizontal coordinate of the matching block is greater than a fifth threshold value, the absolute difference between the top-left corner vertical coordinate of the reference block and the top-left corner vertical coordinate of the matching block is greater than a sixth threshold value, and the difference between the top-left corner vertical coordinate of the reference block and the top-left corner vertical coordinate of the matching block is greater than 0, then a fifth number of rows of pixel regions located above the search region are taken as the range of the interpolation expansion region; or if the absolute difference between the top-left corner horizontal coordinate of the reference block and the top-left corner horizontal coordinate of the matching block is greater than a fifth threshold value, the absolute difference between the top-left corner vertical coordinate of the reference block and the top-left corner vertical coordinate of the matching block is greater than a sixth threshold value, and the difference between the top-left corner vertical coordinate of the reference block and the top-left corner vertical coordinate of the matching block is less than or equal to 0, then a sixth number of rows of pixel regions located below the search region are taken as the range of the interpolation expansion region; or if the absolute difference between the top-left corner horizontal coordinate of the reference block and the top-left corner horizontal coordinate of the matching block is greater than a fifth threshold value, the absolute difference between the top-left corner vertical coordinate of the reference block and the top-left corner vertical coordinate of the matching block is greater than a sixth threshold value, and the difference between the top-left corner horizontal coordinate of the reference block and the top-left corner horizontal coordinate of the matching block is greater than 0, then a seventh number of columns of pixel regions located to the left of the search region are taken as the range of the interpolation expansion region; if the absolute difference between the top-left corner horizontal coordinate of the reference block and the top-left corner horizontal coordinate of the matching block is greater than a fifth threshold value, the absolute difference between the top-left corner vertical coordinate of the reference block and the top-left corner vertical coordinate of the matching block is greater than a sixth threshold value, and the difference between the top-left corner horizontal coordinate of the reference block and the top-left corner horizontal coordinate of the matching block is less than or equal to 0, then an eighth number of columns of pixel regions located to the right of the search region are taken as the range of the interpolation expansion region; wherein the fifth threshold value is the difference between half of the number of taps used by the interpolation filter in the horizontal direction and a fifth constant value; and the sixth threshold value is the difference between half of the number of taps used by the interpolation filter in the vertical direction and a sixth constant value.

9. The method of video decoding according to any of claims 4-8, characterized in that, Determining the range of the interpolation expansion region comprises determining at least one of the following regions as the range of the interpolation expansion region: a ninth number of rows of pixel regions located above the search region; a tenth number of rows of pixel regions located below the search region; an eleventh number of columns of pixel regions located to the left of the search region; a twelfth number of columns of pixel regions located to the right of the search region; a pixel region located to the top left of the search region; a pixel region located to the top right of the search region; a pixel region located to the bottom left of the search region; a pixel region located to the bottom right of the search region.

10. The method of video decoding according to any of claims 4-9, characterized in that, Determining the range of the interpolation expansion region comprises at least one of the following: if the number of taps of the interpolation filter is 4, then 1 row of pixel regions located above the search region, 2 rows of pixel regions located below the search region, 1 column of pixel regions located to the left of the search region, and 2 columns of pixel regions located to the right of the search region are taken as the range of the interpolation expansion region; if the tap number of the interpolation filter is 6, a pixel region of 2 rows above the search region, a pixel region of 3 rows below the search region, a pixel region of 2 columns left to the search region, and a pixel region of 3 columns right to the search region are taken as the range of the interpolation expansion region; if the tap number of the interpolation filter is 8, a pixel region of 3 rows above the search region, a pixel region of 4 rows below the search region, a pixel region of 3 columns left to the search region, and a pixel region of 4 columns right to the search region are taken as the range of the interpolation expansion region; if the tap number of the interpolation filter is 12, a pixel region of 5 rows above the search region, a pixel region of 6 rows below the search region, a pixel region of 5 columns left to the search region, and a pixel region of 6 columns right to the search region are taken as the range of the interpolation expansion region; if the tap number of the interpolation filter is 12, a pixel region of 5 columns left to the search region, and a pixel region of 6 columns right to the search region are taken as the range of the interpolation expansion region; if the tap number of the interpolation filter is 12, a pixel region of 5 rows above the search region, and a pixel region of 6 rows below the search region are taken as the range of the interpolation expansion region.

11. The method of video decoding according to any of claims 2-10, characterized in that, The video decoding method further comprises: if the coordinate position of the reference block, the coordinate position of the matching block, or the search region exceeds the image boundary of the reference frame, the coordinate position of the reference block, the coordinate position of the matching block, or the search region is adjusted to be on the image boundary; wherein the image boundary of the reference frame is the boundary of the reference frame image, or is the boundary of the reference frame image after the size region is extended outward.

12. The method of video decoding according to any one of claims 1-11, characterized in that, The set region comprises at least one of the following regions: a first pixel position in the search region, a second pixel position in the reference block of the current block; According to the pixel value in the set region in the reference frame, the pixel value in the interpolation expansion region used for interpolation filtering processing is determined, comprising at least one of the following ways: copying the pixel value in the set region as the pixel value in the interpolation expansion region; performing first symmetry processing on the pixel value in the set region based on the symmetry axis to obtain the pixel value in the interpolation expansion region; performing second symmetry processing on the pixel value in the set region based on the symmetry point to obtain the pixel value in the interpolation expansion region; performing weighted calculation on the pixel value in the set region to obtain the pixel value in the interpolation expansion region; obtaining the pixel value in the interpolation expansion region by the way of intra prediction based on the pixel value in the set region.

13. The method of video decoding according to any one of claims 1-12, characterized in that, The video decoding method further comprises: determining at least one of the following information according to the default way negotiated with the encoding end: the range of the search region, the range of the interpolation expansion region, and the pixel value in the interpolation expansion region; or At least one flag is decoded from the video bitstream, and at least one of the following information is determined according to the value of the at least one flag: a range of the search region, a range of the interpolation extension region, and pixel values in the interpolation extension region.

14. A method of video encoding, the method comprising: The method comprises: determining a candidate motion vector of a current block using an inter-template matching mode; searching in a search region in a reference frame according to the candidate motion vector to obtain a matching block of the current block; determining pixel values in an interpolation extension region used for interpolation filtering processing of the matching block according to pixel values in a set region in the reference frame; performing interpolation filtering processing on the matching block based on the interpolation extension region to encode based on a result of the interpolation filtering processing.

15. An apparatus for video decoding, the apparatus comprising: The method comprises: a decoding unit configured to decode a video bitstream to obtain a candidate motion vector of a current block using an inter-template matching mode; a searching unit configured to search in a search region in a reference frame according to the candidate motion vector to obtain a matching block of the current block; a determining unit configured to determine pixel values in an interpolation extension region used for interpolation filtering processing of the matching block according to pixel values in a set region in the reference frame; a processing unit configured to perform interpolation filtering processing on the matching block based on the interpolation extension region.

16. A video encoding apparatus, comprising: The method comprises: a determining unit configured to determine a candidate motion vector of a current block using an inter-template matching mode; a searching unit configured to search in a search region in a reference frame according to the candidate motion vector to obtain a matching block of the current block; a determining unit configured to determine pixel values in an interpolation extension region used for interpolation filtering processing of the matching block according to pixel values in a set region in the reference frame; a processing unit configured to perform interpolation filtering processing on the matching block based on the interpolation extension region.

17. A computer readable medium having stored thereon a computer program, characterized in that The computer program is executed by a processor to implement the video decoding method in any one of claims 1 to 13, or to implement the video encoding method in claim 14.

18. An electronic device, comprising: The method comprises: one or more processors; a memory for storing one or more computer programs, which, when executed by the one or more processors, cause the electronic device to implement the video decoding method in any one of claims 1 to 13, or to implement the video encoding method in claim 14.

19. A computer program product, characterised in that, The computer program product comprises a computer program stored in a computer readable storage medium, and a processor of an electronic device reads and executes the computer program from the computer readable storage medium, so that the electronic device executes the video decoding method in any one of claims 1 to 13, or implements the video encoding method in claim 14.

20. A method of storing or transmitting a video bitstream, the method comprising: The video bitstream is decoded according to the video decoding method in any one of claims 1 to 13, or is generated according to the video encoding method in claim 14.

Citation Information

Patent Citations

  • Fast-motion searching method and fast-motion searching device applied to template matching

    CN101686393A

  • Improved decoder-side motion vector derivation

    CN111602399A

  • Video encoding and decoding method and device, computer equipment and storage medium

    CN112153390A

  • Video encoding and decoding method and device and computer readable storage medium

    CN112204977A

  • Method for saving bandwidth through sub-pixel motion estimation

    CN116320450A